Skip to content

Commit

Permalink
fix: don't compile right after generating a project (#142)
Browse files Browse the repository at this point in the history
Compilation would fail because there's no source files.
  • Loading branch information
jinwoo committed Mar 29, 2018
1 parent 30f461f commit 32c412b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion src/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,9 @@ export async function init(options: Options): Promise<boolean> {

// Run `npm install` after initial setup so `npm run check` works right away.
if (!options.dryRun) {
cp.spawnSync('npm', ['install'], {stdio: 'inherit'});
// --ignore-scripts so that compilation doesn't happen because there's no
// source files yet.
cp.spawnSync('npm', ['install', '--ignore-scripts'], {stdio: 'inherit'});
}

return true;
Expand Down
5 changes: 5 additions & 0 deletions test/test-kitchen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,11 @@ test.serial('init', async t => {
execOpts);
}
fs.accessSync(`${stagingPath}/kitchen/tsconfig.json`);

// Compilation shouldn't have happened. Hence no `build` directory.
const dirContents = fs.readdirSync(`${stagingPath}/kitchen`);
t.is(dirContents.indexOf('build'), -1);

t.pass();
});

Expand Down

0 comments on commit 32c412b

Please sign in to comment.