Merge pull request #1084 from stephank/fix/yarn-dts

fix(cli): temporary dts path may not be writable
This commit is contained in:
LongYinan 2022-03-03 21:28:12 +08:00 committed by GitHub
commit 1bee150a7a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,5 +1,6 @@
import { execSync } from 'child_process'
import { existsSync, mkdirSync } from 'fs'
import { tmpdir } from 'os'
import { join, parse, sep } from 'path'
import { Instance } from 'chalk'
@ -200,7 +201,7 @@ export class BuildCommand extends Command {
.filter((flag) => Boolean(flag))
.join(' ')
const cargoCommand = `cargo build ${externalFlags}`
const intermediateTypeFile = join(__dirname, `type_def.${Date.now()}.tmp`)
const intermediateTypeFile = join(tmpdir(), `type_def.${Date.now()}.tmp`)
debug(`Run ${chalk.green(cargoCommand)}`)
const additionalEnv = {}
if (