Skip to content

Commit

Permalink
fix: STRF-11741 Provide stencil init options to set up package manage…
Browse files Browse the repository at this point in the history
…r and skip packages install (#1190)
  • Loading branch information
jairo-bc authored Apr 10, 2024
1 parent 20e5fcb commit 2fb7b7d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
6 changes: 5 additions & 1 deletion bin/stencil-init.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ program
.option('-u, --url [url]', 'Store URL')
.option('-t, --token [token]', 'Access Token')
.option('-p, --port [port]', 'Port')
.option('-h, --apiHost [host]', 'API Host');
.option('-h, --apiHost [host]', 'API Host')
.option('-pm, --packageManager [pm]', 'Package manager')
.option('-skip, --skipInstall', 'Skip packages installation');

const cliOptions = prepareCommand(program);

Expand All @@ -21,5 +23,7 @@ new StencilInit()
accessToken: cliOptions.token,
port: cliOptions.port,
apiHost: cliOptions.apiHost,
packageManager: cliOptions.packageManager,
skipInstall: cliOptions.skipInstall,
})
.catch(printCliResultErrorAndExit);
8 changes: 6 additions & 2 deletions lib/stencil-init.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class StencilInit {
const answers = await this.askQuestions(questions);
const updatedStencilConfig = this.applyAnswers(oldStencilConfig, answers, cliOptions);
await this._stencilConfigManager.save(updatedStencilConfig);
await this.installDependencies(THEME_PATH, answers.packageManager);
await this.installDependencies(THEME_PATH, answers.packageManager, cliOptions);

this._logger.log(
'You are now ready to go! To start developing, run $ ' + 'stencil start'.cyan,
Expand Down Expand Up @@ -195,9 +195,13 @@ class StencilInit {
*
* @param {string} projectDir
* @param {object} packageManager
* @param {object} cliOptions
* @returns
*/
installDependencies(projectDir, packageManager) {
installDependencies(projectDir, packageManager, cliOptions) {
if (cliOptions.skipInstall) {
return Promise.resolve();
}
return this._spinner(
this._nypm.installDependencies({
cwd: projectDir,
Expand Down

0 comments on commit 2fb7b7d

Please sign in to comment.