@bigcommerce/stencil-cli 3.8.5 → 3.10.0

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,23 @@
1
+ ### Draft
2
+
3
+ ### 3.10.0 (2022-02-08)
4
+
5
+ - fix(storefront): bctheme-1000 handle regular css in stencil ([845](https://github.com/bigcommerce/stencil-cli/pull/845))
6
+ - chore: bump paper to 3.0.0 ([868](https://github.com/bigcommerce/stencil-cli/pull/868))
7
+
8
+ ### 3.9.2 (2022-01-31)
9
+
10
+ - chore: bump paper to latest ([863](https://github.com/bigcommerce/stencil-cli/pull/863))
11
+
12
+ ### 3.9.1 (2022-01-25)
13
+
14
+ - fix: strf-9612 Fix stencil pull when there is 1 channel ([859](https://github.com/bigcommerce/stencil-cli/pull/859))
15
+
16
+ ### 3.9.0 (2022-01-21)
17
+
18
+ - fix: return channel id as an iterable when a store only has a single storefront ([849](https://github.com/bigcommerce/stencil-cli/pull/849))
19
+ - feat: warn npm users if npm is above 7 version ([846](https://github.com/bigcommerce/stencil-cli/pull/846))
20
+
1
21
  ### 3.8.5 (2022-01-18)
2
22
 
3
23
  - fix(storefront): strf-9594 loosed frontmatter refex ([841](https://github.com/bigcommerce/stencil-cli/pull/841))
@@ -110,7 +110,12 @@ class Bundle {
110
110
  bundle: true,
111
111
  };
112
112
  return (callback) => {
113
- const basePath = path.join(this.themePath, 'assets', compiler);
113
+ let basePath;
114
+ if (compiler === 'css') {
115
+ basePath = path.join(this.themePath, 'assets/dist', compiler);
116
+ } else {
117
+ basePath = path.join(this.themePath, 'assets', compiler);
118
+ }
114
119
 
115
120
  console.log('%s Parsing Started...', compiler.toUpperCase());
116
121
  fs.readdir(basePath, (err, files) => {
@@ -395,7 +400,12 @@ class Bundle {
395
400
  case 'css':
396
401
  // Create the parsed tree files
397
402
  for (const [filename, data] of Object.entries(result)) {
398
- archiveJsonFile(data, `parsed/scss/${filename}.json`);
403
+ const ext =
404
+ this.configuration.css_compiler === 'css'
405
+ ? this.configuration.css_compiler
406
+ : 'scss';
407
+
408
+ archiveJsonFile(data, `parsed/${ext}/${filename}.json`);
399
409
  }
400
410
  break;
401
411
 
@@ -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,13 +351,13 @@ 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
- return channels[0].channel_id;
360
+ return [channels[0].channel_id];
360
361
  }
361
362
 
362
363
  const questions = [
@@ -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.8.5",
3
+ "version": "3.10.0",
4
4
  "lockfileVersion": 1,
5
5
  "requires": true,
6
6
  "dependencies": {
@@ -537,9 +537,9 @@
537
537
  }
538
538
  },
539
539
  "@bigcommerce/stencil-paper": {
540
- "version": "3.0.0-rc.52",
541
- "resolved": "https://registry.npmjs.org/@bigcommerce/stencil-paper/-/stencil-paper-3.0.0-rc.52.tgz",
542
- "integrity": "sha512-hANH4m0dh9YJuXIlirXj2F9HeWv8k2kJXH1lZkDWx7Ukl0Mn+caibBFprb4Ds+maAc9mHjg9ECUZ5WFT2wBSgA==",
540
+ "version": "3.0.0",
541
+ "resolved": "https://registry.npmjs.org/@bigcommerce/stencil-paper/-/stencil-paper-3.0.0.tgz",
542
+ "integrity": "sha512-+8Zyln2L7yvoFabDzgXgSE+7it01Q5UZml+pq70qrx9GtsX+leIhdY01RoziDnES1I12qIx+bPUX+vM7oD1NZg==",
543
543
  "requires": {
544
544
  "@bigcommerce/stencil-paper-handlebars": "4.5.1",
545
545
  "accept-language-parser": "~1.4.1",
@@ -2873,6 +2873,16 @@
2873
2873
  "is-string": "^1.0.5"
2874
2874
  }
2875
2875
  },
2876
+ "array-sort": {
2877
+ "version": "0.1.4",
2878
+ "resolved": "https://registry.npmjs.org/array-sort/-/array-sort-0.1.4.tgz",
2879
+ "integrity": "sha512-BNcM+RXxndPxiZ2rd76k6nyQLRZr2/B/sdi8pQ+Joafr5AH279L40dfokSUTp8O+AaqYjXWhblBWa2st2nc4fQ==",
2880
+ "requires": {
2881
+ "default-compare": "^1.0.0",
2882
+ "get-value": "^2.0.6",
2883
+ "kind-of": "^5.0.2"
2884
+ }
2885
+ },
2876
2886
  "array-union": {
2877
2887
  "version": "2.1.0",
2878
2888
  "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz",
@@ -7640,23 +7650,6 @@
7640
7650
  "arr-flatten": "^1.0.1"
7641
7651
  }
7642
7652
  },
7643
- "array-sort": {
7644
- "version": "0.1.4",
7645
- "resolved": "https://registry.npmjs.org/array-sort/-/array-sort-0.1.4.tgz",
7646
- "integrity": "sha512-BNcM+RXxndPxiZ2rd76k6nyQLRZr2/B/sdi8pQ+Joafr5AH279L40dfokSUTp8O+AaqYjXWhblBWa2st2nc4fQ==",
7647
- "requires": {
7648
- "default-compare": "^1.0.0",
7649
- "get-value": "^2.0.6",
7650
- "kind-of": "^5.0.2"
7651
- },
7652
- "dependencies": {
7653
- "kind-of": {
7654
- "version": "5.1.0",
7655
- "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz",
7656
- "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw=="
7657
- }
7658
- }
7659
- },
7660
7653
  "array-unique": {
7661
7654
  "version": "0.2.1",
7662
7655
  "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.2.1.tgz",
@@ -15443,9 +15436,9 @@
15443
15436
  "integrity": "sha512-6Gurc1n//gjp9eQNXjD9O3M/sMwVtN5S8Lv9bvOYBfKfDNiIIhqiyi01vMBO45u4zkDE420w/e0se7Vs+sIg+g=="
15444
15437
  },
15445
15438
  "uglify-js": {
15446
- "version": "3.14.4",
15447
- "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.14.4.tgz",
15448
- "integrity": "sha512-AbiSR44J0GoCeV81+oxcy/jDOElO2Bx3d0MfQCUShq7JRXaM4KtQopZsq2vFv8bCq2yMaGrw1FgygUd03RyRDA==",
15439
+ "version": "3.15.1",
15440
+ "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.15.1.tgz",
15441
+ "integrity": "sha512-FAGKF12fWdkpvNJZENacOH0e/83eG6JyVQyanIJaBXCN1J11TUQv1T1/z8S+Z0CG0ZPk1nPcreF/c7lrTd0TEQ==",
15449
15442
  "optional": true
15450
15443
  },
15451
15444
  "uglify-to-browserify": {
package/package.json CHANGED
@@ -1,10 +1,11 @@
1
1
  {
2
2
  "name": "@bigcommerce/stencil-cli",
3
- "version": "3.8.5",
3
+ "version": "3.10.0",
4
4
  "description": "CLI tool to run BigCommerce Stores locally for theme development.",
5
5
  "main": "index.js",
6
6
  "engines": {
7
- "node": "^10.17 || ^12"
7
+ "node": "^10.17 || ^12",
8
+ "npm": ">=v6.11.3 <7.0.0"
8
9
  },
9
10
  "scripts": {
10
11
  "lint": "eslint . && prettier --check . --ignore-unknown",
@@ -44,7 +45,7 @@
44
45
  "package-lock.json"
45
46
  ],
46
47
  "dependencies": {
47
- "@bigcommerce/stencil-paper": "^3.0.0-rc.52",
48
+ "@bigcommerce/stencil-paper": "3.0.0",
48
49
  "@bigcommerce/stencil-styles": "2.1.1",
49
50
  "@hapi/boom": "^8.0.1",
50
51
  "@hapi/glue": "^6.2.0",
@@ -60,21 +60,21 @@ internals.cssHandler = async (request, h) => {
60
60
  request.app.themeConfig.setVariation(variationIndex);
61
61
 
62
62
  // Get the theme configuration
63
+ const configuration = await request.app.themeConfig.getConfig();
63
64
  const fileName = internals.getOriginalFileName(request.params.fileName);
64
65
  const fileParts = path.parse(fileName);
65
- const pathToFile = path.join(fileParts.dir, `${fileParts.name}.scss`);
66
- const basePath = path.join(internals.getThemeAssetsPath(), 'scss');
66
+ const ext = configuration.css_compiler === 'css' ? configuration.css_compiler : 'scss';
67
+ const pathToFile = path.join(fileParts.dir, `${fileParts.name}.${ext}`);
68
+ const basePath = path.join(internals.getThemeAssetsPath(), `${ext}`);
67
69
 
68
70
  let files;
69
71
  try {
70
- files = await promisify(cssAssembler.assemble)(pathToFile, basePath, 'scss', {});
72
+ files = await promisify(cssAssembler.assemble)(pathToFile, basePath, `${ext}`, {});
71
73
  } catch (err) {
72
74
  console.error(err);
73
75
  throw Boom.badData(err);
74
76
  }
75
77
 
76
- const configuration = await request.app.themeConfig.getConfig();
77
-
78
78
  const params = {
79
79
  data: files[pathToFile],
80
80
  files,