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 chalk from 'chalk'
|
||||
|
@ -7,7 +8,6 @@ import { pick } from 'lodash'
|
|||
import { getNapiConfig } from './consts'
|
||||
import { debugFactory } from './debug'
|
||||
import { PlatformDetail } from './parse-triple'
|
||||
import { spawn } from './spawn'
|
||||
import { writeFileAsync } from './utils'
|
||||
|
||||
const debug = debugFactory('create-npm-dir')
|
||||
|
@ -38,7 +38,9 @@ export class CreateNpmDirCommand extends Command {
|
|||
'npm',
|
||||
`${platformDetail.platformArchABI}`,
|
||||
)
|
||||
await spawn(`mkdir -p ${targetDir}`)
|
||||
mkdirSync(targetDir, {
|
||||
recursive: true,
|
||||
})
|
||||
const binaryFileName = `${binaryName}.${platformDetail.platformArchABI}.node`
|
||||
const targetPackageJson = join(targetDir, 'package.json')
|
||||
debug(`Write file [${chalk.yellowBright(targetPackageJson)}]`)
|
||||
|
|
|
@ -8,7 +8,6 @@ import inquirer, { prompt } from 'inquirer'
|
|||
import { CreateNpmDirCommand } from '../create-npm-dir'
|
||||
import { debugFactory } from '../debug'
|
||||
import { DefaultPlatforms } from '../parse-triple'
|
||||
import { spawn } from '../spawn'
|
||||
|
||||
import { createCargoContent } from './cargo'
|
||||
import { createCargoConfig } from './cargo-config'
|
||||
|
@ -113,10 +112,9 @@ export class NewProjectCommand extends Command {
|
|||
this.enableGithubActions = answer[ENABLE_GITHUB_ACTIONS_PROMOTE_NAME]
|
||||
}
|
||||
|
||||
const command = `mkdir -p ${this.dirname}`
|
||||
debug(`Running command: ${chalk.green('[${command}]')}`)
|
||||
if (!this.dryRun) {
|
||||
await spawn(command)
|
||||
mkdirSync(join(process.cwd(), this.dirname!))
|
||||
mkdirSync(join(process.cwd(), this.dirname!, 'src'))
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue