Skip to content

Commit

Permalink
Merge pull request #23145 from storybookjs/norbert/ensure-dependencie…
Browse files Browse the repository at this point in the history
…s-installed-before-init

CLI: Fix installing user's project before init
  • Loading branch information
shilman committed Jun 20, 2023
2 parents 684d72f + b331e6b commit 5b30336
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 4 additions & 0 deletions code/lib/cli/src/initiate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,10 @@ async function doInitiate(options: CommandOptions, pkg: PackageJson): Promise<vo
}
}

if (!options.skipInstall) {
await packageManager.installDependencies();
}

const installResult = await installStorybook(projectType as ProjectType, packageManager, options);

if (!options.skipInstall) {
Expand Down
5 changes: 3 additions & 2 deletions code/lib/cli/src/js-package-manager/JsPackageManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,18 +82,19 @@ export abstract class JsPackageManager {
public async installDependencies() {
let done = commandLog('Preparing to install dependencies');
done();
logger.log();

logger.log();
logger.log();

done = commandLog('Installing dependencies');

try {
await this.runInstall();
done();
} catch (e) {
done('An error occurred while installing dependencies.');
throw new HandledError(e);
}
done();
}

packageJsonPath(): string {
Expand Down

0 comments on commit 5b30336

Please sign in to comment.