Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: don't compile right after generating a project #142

Merged
merged 2 commits into from
Mar 29, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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'});

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If someone has a postinstall script, I don't think that will get invoked either. However, I expect this use case is probably not too common and, if needed, someone can always run npm install manually if needed.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, most of the cases gts init is run from an empty directory. Even though someone had a postinstall script, they would know what they are doing and be able to figure things out.

}

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