diff --git a/cli/src/create-npm-dir.ts b/cli/src/create-npm-dir.ts index 3d352aeb..28cbfe44 100644 --- a/cli/src/create-npm-dir.ts +++ b/cli/src/create-npm-dir.ts @@ -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)}]`) diff --git a/cli/src/new/index.ts b/cli/src/new/index.ts index 618d9f23..ac179125 100644 --- a/cli/src/new/index.ts +++ b/cli/src/new/index.ts @@ -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')) }