Skip to content

Commit 6aa110a

Browse files
Merge pull request #1152 from pattern-lab/better-spawn
fix(cli): ensure specified directory exists prior to scaffold
2 parents fc90750 + cc3b696 commit 6aa110a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

packages/cli/bin/scaffold.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use strict';
22
const path = require('path');
33
const execa = require('execa');
4-
const fs = require('fs');
4+
const fs = require('fs-extra');
55
const wrapAsync = require('./utils').wrapAsync;
66
const mkdirsAsync = require('./utils').mkdirsAsync;
77

@@ -18,6 +18,7 @@ const scaffold = (projectDir, sourceDir, publicDir, exportDir) =>
1818
wrapAsync(function*() {
1919
const projectPath = path.join(process.cwd(), projectDir);
2020
if (!fs.existsSync(path.join(projectPath, 'package.json'))) {
21+
fs.ensureDirSync(projectPath);
2122
execa.sync('npm', ['init', '-y'], {
2223
cwd: projectPath,
2324
});

0 commit comments

Comments
 (0)