@bigcommerce/stencil-cli 7.5.0 → 7.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/stencil-init.js +5 -1
- package/lib/stencil-init.js +6 -2
- package/lib/theme-api-client.js +20 -11
- package/package.json +1 -1
package/bin/stencil-init.js
CHANGED
|
@@ -11,7 +11,9 @@ program
|
|
|
11
11
|
.option('-u, --url [url]', 'Store URL')
|
|
12
12
|
.option('-t, --token [token]', 'Access Token')
|
|
13
13
|
.option('-p, --port [port]', 'Port')
|
|
14
|
-
.option('-h, --apiHost [host]', 'API Host')
|
|
14
|
+
.option('-h, --apiHost [host]', 'API Host')
|
|
15
|
+
.option('-pm, --packageManager [pm]', 'Package manager')
|
|
16
|
+
.option('-skip, --skipInstall', 'Skip packages installation');
|
|
15
17
|
|
|
16
18
|
const cliOptions = prepareCommand(program);
|
|
17
19
|
|
|
@@ -21,5 +23,7 @@ new StencilInit()
|
|
|
21
23
|
accessToken: cliOptions.token,
|
|
22
24
|
port: cliOptions.port,
|
|
23
25
|
apiHost: cliOptions.apiHost,
|
|
26
|
+
packageManager: cliOptions.packageManager,
|
|
27
|
+
skipInstall: cliOptions.skipInstall,
|
|
24
28
|
})
|
|
25
29
|
.catch(printCliResultErrorAndExit);
|
package/lib/stencil-init.js
CHANGED
|
@@ -47,7 +47,7 @@ class StencilInit {
|
|
|
47
47
|
const answers = await this.askQuestions(questions);
|
|
48
48
|
const updatedStencilConfig = this.applyAnswers(oldStencilConfig, answers, cliOptions);
|
|
49
49
|
await this._stencilConfigManager.save(updatedStencilConfig);
|
|
50
|
-
await this.installDependencies(THEME_PATH, answers.packageManager);
|
|
50
|
+
await this.installDependencies(THEME_PATH, answers.packageManager, cliOptions);
|
|
51
51
|
|
|
52
52
|
this._logger.log(
|
|
53
53
|
'You are now ready to go! To start developing, run $ ' + 'stencil start'.cyan,
|
|
@@ -195,9 +195,13 @@ class StencilInit {
|
|
|
195
195
|
*
|
|
196
196
|
* @param {string} projectDir
|
|
197
197
|
* @param {object} packageManager
|
|
198
|
+
* @param {object} cliOptions
|
|
198
199
|
* @returns
|
|
199
200
|
*/
|
|
200
|
-
installDependencies(projectDir, packageManager) {
|
|
201
|
+
installDependencies(projectDir, packageManager, cliOptions) {
|
|
202
|
+
if (cliOptions.skipInstall) {
|
|
203
|
+
return Promise.resolve();
|
|
204
|
+
}
|
|
201
205
|
return this._spinner(
|
|
202
206
|
this._nypm.installDependencies({
|
|
203
207
|
cwd: projectDir,
|
package/lib/theme-api-client.js
CHANGED
|
@@ -212,19 +212,28 @@ async function getStoreChannels({ accessToken, apiHost, storeHash }) {
|
|
|
212
212
|
url: `${apiHost}/stores/${storeHash}/v3/sites`,
|
|
213
213
|
accessToken,
|
|
214
214
|
});
|
|
215
|
-
const channelsResponse = await networkUtils
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
215
|
+
const channelsResponse = await networkUtils
|
|
216
|
+
.sendApiRequest({
|
|
217
|
+
url: `${apiHost}/stores/${storeHash}/v3/channels?type:in=storefront`,
|
|
218
|
+
accessToken,
|
|
219
|
+
})
|
|
220
|
+
.catch((error) => {
|
|
221
|
+
if (error.response.status === 403) {
|
|
222
|
+
console.log(
|
|
223
|
+
'WARNING: Version 7.4.2+ of stencil-cli added a request to the Channels resource which requires a permission missing on your current stencil cli auth token. Please generate a new auth token at your convenience which includes the "read-only channels" permission to clear up this warning. You can read more about correcting this issue here: https://github.com/bigcommerce/stencil-cli/issues/1185',
|
|
224
|
+
);
|
|
225
|
+
}
|
|
226
|
+
});
|
|
219
227
|
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
228
|
+
if (channelsResponse) {
|
|
229
|
+
return sitesResponse.data.data.filter(
|
|
230
|
+
(site) =>
|
|
231
|
+
channelsResponse.data.data.filter((channel) => channel.id === site.channel_id)
|
|
232
|
+
.length > 0,
|
|
233
|
+
);
|
|
234
|
+
}
|
|
223
235
|
|
|
224
|
-
return sitesResponse.data.data
|
|
225
|
-
(site) =>
|
|
226
|
-
storefrontChannels.filter((channel) => channel.id === site.channel_id).length > 0,
|
|
227
|
-
);
|
|
236
|
+
return sitesResponse.data.data;
|
|
228
237
|
} catch (err) {
|
|
229
238
|
throw new Error(`Could not fetch a list of the store channels: ${err.message}`);
|
|
230
239
|
}
|