bigcommerce / stencil-cli

BigCommerce Stencil emulator for local theme development
https://developer.bigcommerce.com/stencil-docs
BSD 4-Clause "Original" or "Old" License
103 stars 140 forks source link

No unattended way to specify the new packageManager parameter #1189

Closed chmelev closed 3 months ago

chmelev commented 3 months ago

Expected behavior

The stencil-cli init should be able to execute without user input in automation scenarios

Actual behavior

The stencil-cli init gets stuck waiting for the "What is your favorite Package Manager?" input since the PR has been approved: https://github.com/bigcommerce/stencil-cli/pull/1183. There's no command line parameter to provide a value for this input for automation.

Steps to reproduce behavior

Run stencil-cli init with all the known command line parameters specified (-u, -t, -p, -h). The execution still stops waiting for user input.

Environment

Stencil-cli version stencil --version: 7.5.0

Node version node -v: 18.19.0

NPM version npm -v: 10.2.3

OS: ALL

StevenThelinLBB commented 3 months ago

Seconding this. Had to downgrade to 7.4.2 for this to work again.

Frame 1

jp06 commented 3 months ago

Not sure if the merit of one less command to run is worth the trouble of adding this and forcing to change everyone's automated deployment. Is this an actual popular request? I guess for now we'll just lock to the previous version npm i -g @bigcommerce/stencil-cli@7.4.2 and wait if it sticks.

ericdebelak commented 3 months ago

I know this isn't documented yet, but I ran into this issue and found the flags in the source code:

program
    .version(PACKAGE_INFO.version)
    .option('-u, --url [url]', 'Store URL')
    .option('-t, --token [token]', 'Access Token')
    .option('-p, --port [port]', 'Port')
    .option('-h, --apiHost [host]', 'API Host')
    .option('-pm, --packageManager [pm]', 'Package manager')
    .option('-skip, --skipInstall', 'Skip packages installation');

https://github.com/bigcommerce/stencil-cli/blob/2fb7b7d45425970a72a92c94431f0cc4a5c37f70/bin/stencil-init.js#L15-L16

I just had to add -pm npm -skip to the end of my init command.

chmelev commented 3 months ago

I know this isn't documented yet, but I ran into this issue and found the flags in the source code:

program
    .version(PACKAGE_INFO.version)
    .option('-u, --url [url]', 'Store URL')
    .option('-t, --token [token]', 'Access Token')
    .option('-p, --port [port]', 'Port')
    .option('-h, --apiHost [host]', 'API Host')
    .option('-pm, --packageManager [pm]', 'Package manager')
    .option('-skip, --skipInstall', 'Skip packages installation');

https://github.com/bigcommerce/stencil-cli/blob/2fb7b7d45425970a72a92c94431f0cc4a5c37f70/bin/stencil-init.js#L15-L16

I just had to add -pm npm -skip to the end of my init command.

Yes, the version published a few hours ago fixes it.

jairo-bc commented 3 months ago

Resolved in https://github.com/bigcommerce/stencil-cli/releases/tag/7.5.2

harnerdesigns commented 2 months ago

Just throwing a +1 to the concept of "who thought this was a good idea??"

NPM is for installing packages, the stencil CLI is for running Stencil themes. Keep things separate.