fix(cli): temporary dts path may not be writable

This commit is contained in:
Stéphan Kochen 2022-03-02 13:40:24 +01:00
parent 7626452cbf
commit e69f0230c2

View file

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