Merge pull request #424 from napi-rs/fix-windows
fix(cli): mkdir -p is not valid command in powershell
This commit is contained in:
commit
260ff1decd
2 changed files with 5 additions and 5 deletions
|
@ -1,3 +1,4 @@
|
||||||
|
import { mkdirSync } from 'fs'
|
||||||
import { join } from 'path'
|
import { join } from 'path'
|
||||||
|
|
||||||
import chalk from 'chalk'
|
import chalk from 'chalk'
|
||||||
|
@ -7,7 +8,6 @@ import { pick } from 'lodash'
|
||||||
import { getNapiConfig } from './consts'
|
import { getNapiConfig } from './consts'
|
||||||
import { debugFactory } from './debug'
|
import { debugFactory } from './debug'
|
||||||
import { PlatformDetail } from './parse-triple'
|
import { PlatformDetail } from './parse-triple'
|
||||||
import { spawn } from './spawn'
|
|
||||||
import { writeFileAsync } from './utils'
|
import { writeFileAsync } from './utils'
|
||||||
|
|
||||||
const debug = debugFactory('create-npm-dir')
|
const debug = debugFactory('create-npm-dir')
|
||||||
|
@ -38,7 +38,9 @@ export class CreateNpmDirCommand extends Command {
|
||||||
'npm',
|
'npm',
|
||||||
`${platformDetail.platformArchABI}`,
|
`${platformDetail.platformArchABI}`,
|
||||||
)
|
)
|
||||||
await spawn(`mkdir -p ${targetDir}`)
|
mkdirSync(targetDir, {
|
||||||
|
recursive: true,
|
||||||
|
})
|
||||||
const binaryFileName = `${binaryName}.${platformDetail.platformArchABI}.node`
|
const binaryFileName = `${binaryName}.${platformDetail.platformArchABI}.node`
|
||||||
const targetPackageJson = join(targetDir, 'package.json')
|
const targetPackageJson = join(targetDir, 'package.json')
|
||||||
debug(`Write file [${chalk.yellowBright(targetPackageJson)}]`)
|
debug(`Write file [${chalk.yellowBright(targetPackageJson)}]`)
|
||||||
|
|
|
@ -8,7 +8,6 @@ import inquirer, { prompt } from 'inquirer'
|
||||||
import { CreateNpmDirCommand } from '../create-npm-dir'
|
import { CreateNpmDirCommand } from '../create-npm-dir'
|
||||||
import { debugFactory } from '../debug'
|
import { debugFactory } from '../debug'
|
||||||
import { DefaultPlatforms } from '../parse-triple'
|
import { DefaultPlatforms } from '../parse-triple'
|
||||||
import { spawn } from '../spawn'
|
|
||||||
|
|
||||||
import { createCargoContent } from './cargo'
|
import { createCargoContent } from './cargo'
|
||||||
import { createCargoConfig } from './cargo-config'
|
import { createCargoConfig } from './cargo-config'
|
||||||
|
@ -113,10 +112,9 @@ export class NewProjectCommand extends Command {
|
||||||
this.enableGithubActions = answer[ENABLE_GITHUB_ACTIONS_PROMOTE_NAME]
|
this.enableGithubActions = answer[ENABLE_GITHUB_ACTIONS_PROMOTE_NAME]
|
||||||
}
|
}
|
||||||
|
|
||||||
const command = `mkdir -p ${this.dirname}`
|
|
||||||
debug(`Running command: ${chalk.green('[${command}]')}`)
|
debug(`Running command: ${chalk.green('[${command}]')}`)
|
||||||
if (!this.dryRun) {
|
if (!this.dryRun) {
|
||||||
await spawn(command)
|
mkdirSync(join(process.cwd(), this.dirname!))
|
||||||
mkdirSync(join(process.cwd(), this.dirname!, 'src'))
|
mkdirSync(join(process.cwd(), this.dirname!, 'src'))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue