feat(cli): use CARGO_TARGET_DIR if set (#1251)

* feat: use `CARGO_TARGET_DIR` if set

* use `||` instead of `??`

* use `CARGO_BUILD_TARGET_DIR` also if set

* disable eslint prefer-nullish-coalescing
This commit is contained in:
Amr Bashir 2022-07-31 16:41:32 +02:00 committed by GitHub
parent cb6fffd73f
commit 9be7ae2bf9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -409,7 +409,12 @@ export class BuildCommand extends Command {
}
}
const targetRootDir = await findUp(cwd)
const targetRootDir =
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
process.env.CARGO_TARGET_DIR ||
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
process.env.CARGO_BUILD_TARGET_DIR ||
(await findUp(cwd))
if (!targetRootDir) {
throw new TypeError('No target dir found')