From 025681d43609e5af2367eb01f98e9310ff53f03d Mon Sep 17 00:00:00 2001 From: bc-0dp Date: Thu, 12 Dec 2024 11:48:15 +0100 Subject: [PATCH 1/5] feat: add option to include source maps in the bundle - Introduced an option to enable source maps during the build process. - Helps with debugging by providing a mapping between the minified code and the original source. --- bin/stencil-bundle.js | 4 ++++ lib/stencil-bundle.js | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/bin/stencil-bundle.js b/bin/stencil-bundle.js index 4c2ce6db..fdb759a4 100755 --- a/bin/stencil-bundle.js +++ b/bin/stencil-bundle.js @@ -13,6 +13,10 @@ program '-d, --dest [dest]', 'Where to save the zip file. It defaults to the current directory you are in when bundling', ) + .option( + '-S, --source-maps', + 'Include source-maps in the bundle. This is useful for debugging', + ) .option( '-n, --name [filename]', 'What do you want to call the zip file. It defaults to stencil-bundle.zip', diff --git a/lib/stencil-bundle.js b/lib/stencil-bundle.js index aad2f68f..a8f6d398 100644 --- a/lib/stencil-bundle.js +++ b/lib/stencil-bundle.js @@ -18,7 +18,7 @@ const MAX_SIZE_BUNDLE = MEGABYTE * 50; const PATHS_TO_ZIP = [ { pattern: 'assets/**/*', - ignore: ['assets/cdn/**', 'assets/**/*.js.map'], + ignore: ['assets/cdn/**'], }, { pattern: 'CHANGELOG.md' }, { pattern: 'config.json' }, @@ -387,6 +387,9 @@ class Bundle { */ _bundleThemeFiles(archive, themePath) { for (const { pattern, ignore } of PATHS_TO_ZIP) { + if (pattern === "assets/**/*" && !this.options.sourceMaps) { + ignore.push("assets/**/*.js.map"); + } archive.glob(pattern, { ignore, cwd: themePath }); } } From 81e24c60659236795b436951cd2ecddef45ac578 Mon Sep 17 00:00:00 2001 From: bc-0dp Date: Thu, 12 Dec 2024 11:53:42 +0100 Subject: [PATCH 2/5] feat: add option to include source maps in the bundle - Introduced the source maps options to stencil-push process. --- bin/stencil-push.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/bin/stencil-push.js b/bin/stencil-push.js index 1cef84ed..095dbb0e 100755 --- a/bin/stencil-push.js +++ b/bin/stencil-push.js @@ -9,6 +9,10 @@ program .version(PACKAGE_INFO.version) .option('-f, --file [filename]', 'specify the filename of the bundle to upload') .option('-s, --save [filename]', 'specify the filename to save the bundle as') + .option( + '-S, --source-maps', + 'Include source-maps in the bundle. This is useful for debugging', + ) .option('-a, --activate [variationname]', 'specify the variation of the theme to activate') .option('-d, --delete', 'delete oldest private theme if upload limit reached') .option( @@ -25,6 +29,7 @@ const options = { saveBundleName: cliOptions.save, deleteOldest: cliOptions.delete, allChannels: cliOptions.all_channels, + sourceMaps: cliOptions.source_maps, }; stencilPush(options, (err, result) => { if (err) { From 74f19276c480f6797d9db01c7f82fce942f32c85 Mon Sep 17 00:00:00 2001 From: bc-0dp Date: Thu, 12 Dec 2024 11:56:02 +0100 Subject: [PATCH 3/5] fix: correct options formatting in configuration - Resolved inconsistencies in the formatting of options. - Ensured proper alignment and indentation for readability. --- bin/stencil-push.js | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/bin/stencil-push.js b/bin/stencil-push.js index 095dbb0e..e1e76f09 100755 --- a/bin/stencil-push.js +++ b/bin/stencil-push.js @@ -7,19 +7,34 @@ import { prepareCommand, printCliResultErrorAndExit } from '../lib/cliCommon.js' program .version(PACKAGE_INFO.version) - .option('-f, --file [filename]', 'specify the filename of the bundle to upload') - .option('-s, --save [filename]', 'specify the filename to save the bundle as') + .option( + '-f, --file [filename]', + 'specify the filename of the bundle to upload' + ) + .option( + '-s, --save [filename]', + 'specify the filename to save the bundle as' + ) .option( '-S, --source-maps', 'Include source-maps in the bundle. This is useful for debugging', ) - .option('-a, --activate [variationname]', 'specify the variation of the theme to activate') - .option('-d, --delete', 'delete oldest private theme if upload limit reached') + .option( + '-a, --activate [variationname]', + 'specify the variation of the theme to activate' + ) + .option( + '-d, --delete', + 'delete oldest private theme if upload limit reached' + ) .option( '-c, --channel_ids ', 'specify the channel IDs of the storefront to push the theme to', ) - .option('-allc, --all_channels', 'push a theme to all available channels'); + .option( + '-allc, --all_channels', + 'push a theme to all available channels' + ); const cliOptions = prepareCommand(program); const options = { apiHost: cliOptions.host, From 8126053fd44d63180812fe1d544cc0262eb46e28 Mon Sep 17 00:00:00 2001 From: bc-0dp Date: Thu, 12 Dec 2024 12:26:20 +0100 Subject: [PATCH 4/5] fix: remove trailing spaces --- bin/stencil-bundle.js | 2 +- bin/stencil-push.js | 2 +- lib/stencil-bundle.js | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/bin/stencil-bundle.js b/bin/stencil-bundle.js index fdb759a4..30298659 100755 --- a/bin/stencil-bundle.js +++ b/bin/stencil-bundle.js @@ -16,7 +16,7 @@ program .option( '-S, --source-maps', 'Include source-maps in the bundle. This is useful for debugging', - ) + ) .option( '-n, --name [filename]', 'What do you want to call the zip file. It defaults to stencil-bundle.zip', diff --git a/bin/stencil-push.js b/bin/stencil-push.js index e1e76f09..544a41ca 100755 --- a/bin/stencil-push.js +++ b/bin/stencil-push.js @@ -18,7 +18,7 @@ program .option( '-S, --source-maps', 'Include source-maps in the bundle. This is useful for debugging', - ) + ) .option( '-a, --activate [variationname]', 'specify the variation of the theme to activate' diff --git a/lib/stencil-bundle.js b/lib/stencil-bundle.js index a8f6d398..e8e9b8fb 100644 --- a/lib/stencil-bundle.js +++ b/lib/stencil-bundle.js @@ -387,9 +387,9 @@ class Bundle { */ _bundleThemeFiles(archive, themePath) { for (const { pattern, ignore } of PATHS_TO_ZIP) { - if (pattern === "assets/**/*" && !this.options.sourceMaps) { - ignore.push("assets/**/*.js.map"); - } + if (pattern === 'assets/**/*' && !this.options.sourceMaps) { + ignore.push('assets/**/*.js.map'); + } archive.glob(pattern, { ignore, cwd: themePath }); } } From 7a42b361b4b4123ce5636f0c2382095e753068f4 Mon Sep 17 00:00:00 2001 From: bc-0dp Date: Thu, 12 Dec 2024 12:43:13 +0100 Subject: [PATCH 5/5] fix: satifiy prettier --- bin/stencil-bundle.js | 5 +---- bin/stencil-push.js | 30 ++++++------------------------ package-lock.json | 4 ++-- 3 files changed, 9 insertions(+), 30 deletions(-) diff --git a/bin/stencil-bundle.js b/bin/stencil-bundle.js index 30298659..4f9bf090 100755 --- a/bin/stencil-bundle.js +++ b/bin/stencil-bundle.js @@ -13,10 +13,7 @@ program '-d, --dest [dest]', 'Where to save the zip file. It defaults to the current directory you are in when bundling', ) - .option( - '-S, --source-maps', - 'Include source-maps in the bundle. This is useful for debugging', - ) + .option('-S, --source-maps', 'Include source-maps in the bundle. This is useful for debugging') .option( '-n, --name [filename]', 'What do you want to call the zip file. It defaults to stencil-bundle.zip', diff --git a/bin/stencil-push.js b/bin/stencil-push.js index 544a41ca..87445630 100755 --- a/bin/stencil-push.js +++ b/bin/stencil-push.js @@ -7,34 +7,16 @@ import { prepareCommand, printCliResultErrorAndExit } from '../lib/cliCommon.js' program .version(PACKAGE_INFO.version) - .option( - '-f, --file [filename]', - 'specify the filename of the bundle to upload' - ) - .option( - '-s, --save [filename]', - 'specify the filename to save the bundle as' - ) - .option( - '-S, --source-maps', - 'Include source-maps in the bundle. This is useful for debugging', - ) - .option( - '-a, --activate [variationname]', - 'specify the variation of the theme to activate' - ) - .option( - '-d, --delete', - 'delete oldest private theme if upload limit reached' - ) + .option('-f, --file [filename]', 'specify the filename of the bundle to upload') + .option('-s, --save [filename]', 'specify the filename to save the bundle as') + .option('-S, --source-maps', 'Include source-maps in the bundle. This is useful for debugging') + .option('-a, --activate [variationname]', 'specify the variation of the theme to activate') + .option('-d, --delete', 'delete oldest private theme if upload limit reached') .option( '-c, --channel_ids ', 'specify the channel IDs of the storefront to push the theme to', ) - .option( - '-allc, --all_channels', - 'push a theme to all available channels' - ); + .option('-allc, --all_channels', 'push a theme to all available channels'); const cliOptions = prepareCommand(program); const options = { apiHost: cliOptions.host, diff --git a/package-lock.json b/package-lock.json index 140751b0..d000b119 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@bigcommerce/stencil-cli", - "version": "8.2.0", + "version": "8.3.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@bigcommerce/stencil-cli", - "version": "8.2.0", + "version": "8.3.0", "license": "BSD-4-Clause", "dependencies": { "@bigcommerce/stencil-paper": "5.0.0",