Skip to content

Commit 2604750

Browse files
authored
feat: Add source maps option to bundle and push process (#1245)
1 parent 3a8b0ef commit 2604750

4 files changed

Lines changed: 9 additions & 3 deletions

File tree

bin/stencil-bundle.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ program
1313
'-d, --dest [dest]',
1414
'Where to save the zip file. It defaults to the current directory you are in when bundling',
1515
)
16+
.option('-S, --source-maps', 'Include source-maps in the bundle. This is useful for debugging')
1617
.option(
1718
'-n, --name [filename]',
1819
'What do you want to call the zip file. It defaults to stencil-bundle.zip',

bin/stencil-push.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ program
99
.version(PACKAGE_INFO.version)
1010
.option('-f, --file [filename]', 'specify the filename of the bundle to upload')
1111
.option('-s, --save [filename]', 'specify the filename to save the bundle as')
12+
.option('-S, --source-maps', 'Include source-maps in the bundle. This is useful for debugging')
1213
.option('-a, --activate [variationname]', 'specify the variation of the theme to activate')
1314
.option('-d, --delete', 'delete oldest private theme if upload limit reached')
1415
.option(
@@ -25,6 +26,7 @@ const options = {
2526
saveBundleName: cliOptions.save,
2627
deleteOldest: cliOptions.delete,
2728
allChannels: cliOptions.all_channels,
29+
sourceMaps: cliOptions.source_maps,
2830
};
2931
stencilPush(options, (err, result) => {
3032
if (err) {

lib/stencil-bundle.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ const MAX_SIZE_BUNDLE = MEGABYTE * 50;
1818
const PATHS_TO_ZIP = [
1919
{
2020
pattern: 'assets/**/*',
21-
ignore: ['assets/cdn/**', 'assets/**/*.js.map'],
21+
ignore: ['assets/cdn/**'],
2222
},
2323
{ pattern: 'CHANGELOG.md' },
2424
{ pattern: 'config.json' },
@@ -387,6 +387,9 @@ class Bundle {
387387
*/
388388
_bundleThemeFiles(archive, themePath) {
389389
for (const { pattern, ignore } of PATHS_TO_ZIP) {
390+
if (pattern === 'assets/**/*' && !this.options.sourceMaps) {
391+
ignore.push('assets/**/*.js.map');
392+
}
390393
archive.glob(pattern, { ignore, cwd: themePath });
391394
}
392395
}

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)