Skip to content

Commit

Permalink
fix(cli): set current working directory before scaffolded npm init
Browse files Browse the repository at this point in the history
  • Loading branch information
bmuenzenmeyer committed Apr 24, 2020
1 parent a2062dd commit 6d2186d
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions packages/cli/bin/scaffold.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,11 @@ const mkdirsAsync = require('./utils').mkdirsAsync;
*/
const scaffold = (projectDir, sourceDir, publicDir, exportDir) =>
wrapAsync(function*() {
if (!fs.existsSync(path.resolve(projectDir, 'package.json'))) {
execa.sync('npm', ['init', '-y']);
const projectPath = path.join(process.cwd(), projectDir);
if (!fs.existsSync(path.join(projectPath, 'package.json'))) {
execa.sync('npm', ['init', '-y'], {
cwd: projectPath,
});
}
/**
* Create mandatory files structure
Expand Down

0 comments on commit 6d2186d

Please sign in to comment.