@bigcommerce/stencil-cli 3.9.0 → 3.9.1

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/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ### 3.9.1 (2022-01-25)
2
+
3
+ - fix: strf-9612 Fix stencil pull when there is 1 channel ([859](https://github.com/bigcommerce/stencil-cli/pull/859))
4
+
1
5
  ### 3.9.0 (2022-01-21)
2
6
 
3
7
  - fix: return channel id as an iterable when a store only has a single storefront ([849](https://github.com/bigcommerce/stencil-cli/pull/849))
@@ -18,7 +18,7 @@ function stencilPush(options = {}, callback) {
18
18
  utils.pollForJobCompletion((data) => ({ themeId: data.theme_id })),
19
19
  utils.promptUserWhetherToApplyTheme,
20
20
  utils.getChannels,
21
- utils.promptUserForChannel,
21
+ utils.promptUserForChannels,
22
22
  utils.getVariations,
23
23
  utils.promptUserForVariation,
24
24
  utils.requestToApplyVariationWithRetrys(),
@@ -274,6 +274,7 @@ utils.promptUserWhetherToApplyTheme = async (options) => {
274
274
  utils.getChannels = async (options) => {
275
275
  const {
276
276
  config: { accessToken },
277
+ channelId,
277
278
  channelIds,
278
279
  storeHash,
279
280
  applyTheme,
@@ -281,7 +282,7 @@ utils.getChannels = async (options) => {
281
282
 
282
283
  const apiHost = options.apiHost || options.config.apiHost;
283
284
 
284
- if (!applyTheme || channelIds) {
285
+ if (!applyTheme || channelIds || channelId) {
285
286
  return options;
286
287
  }
287
288
 
@@ -338,7 +339,7 @@ utils.getVariations = async (options) => {
338
339
  return { ...options, variations };
339
340
  };
340
341
 
341
- utils.promptUserForChannel = async (options) => {
342
+ utils.promptUserForChannels = async (options) => {
342
343
  const { applyTheme, channelIds, channels, allChannels } = options;
343
344
 
344
345
  if (!applyTheme || channelIds) {
@@ -350,11 +351,11 @@ utils.promptUserForChannel = async (options) => {
350
351
  return { ...options, channelIds: allIds };
351
352
  }
352
353
 
353
- const selectedChannelIds = await utils.promptUserToSelectChannel(channels);
354
+ const selectedChannelIds = await utils.promptUserToSelectChannels(channels);
354
355
  return { ...options, channelIds: selectedChannelIds };
355
356
  };
356
357
 
357
- utils.promptUserToSelectChannel = async (channels) => {
358
+ utils.promptUserToSelectChannels = async (channels) => {
358
359
  if (channels.length < 2) {
359
360
  return [channels[0].channel_id];
360
361
  }
@@ -375,6 +376,38 @@ utils.promptUserToSelectChannel = async (channels) => {
375
376
  return answer.channelIds;
376
377
  };
377
378
 
379
+ utils.promptUserForChannel = async (options) => {
380
+ const { applyTheme, channelId, channels } = options;
381
+
382
+ if (!applyTheme || channelId) {
383
+ return options;
384
+ }
385
+
386
+ const selectedChannelId = await utils.promptUserToSelectChannel(channels);
387
+ return { ...options, channelId: selectedChannelId };
388
+ };
389
+
390
+ utils.promptUserToSelectChannel = async (channels) => {
391
+ if (channels.length < 2) {
392
+ return channels[0].channel_id;
393
+ }
394
+
395
+ const questions = [
396
+ {
397
+ type: 'list',
398
+ name: 'channelId',
399
+ message: 'Which channel would you like to use?',
400
+ choices: channels.map((channel) => ({
401
+ name: channel.url,
402
+ value: channel.channel_id,
403
+ })),
404
+ },
405
+ ];
406
+
407
+ const answer = await Inquirer.prompt(questions);
408
+ return answer.channelId;
409
+ };
410
+
378
411
  utils.promptUserForVariation = async (options) => {
379
412
  if (!options.applyTheme || options.variationId) {
380
413
  return options;
package/package-lock.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bigcommerce/stencil-cli",
3
- "version": "3.9.0",
3
+ "version": "3.9.1",
4
4
  "lockfileVersion": 1,
5
5
  "requires": true,
6
6
  "dependencies": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bigcommerce/stencil-cli",
3
- "version": "3.9.0",
3
+ "version": "3.9.1",
4
4
  "description": "CLI tool to run BigCommerce Stores locally for theme development.",
5
5
  "main": "index.js",
6
6
  "engines": {