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: STRF-11741 Provide stencil init options to set up package manager and skip packages install #1190

Merged
merged 1 commit into from
Apr 10, 2024
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: 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
Loading