Skip to content

Commit

Permalink
feat: Add source maps option to bundle and push process (#1245)
Browse files Browse the repository at this point in the history
  • Loading branch information
bc-0dp authored Dec 13, 2024
1 parent 3a8b0ef commit 2604750
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
1 change: 1 addition & 0 deletions bin/stencil-bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +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(
'-n, --name [filename]',
'What do you want to call the zip file. It defaults to stencil-bundle.zip',
Expand Down
2 changes: 2 additions & 0 deletions bin/stencil-push.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ 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(
Expand All @@ -25,6 +26,7 @@ const options = {
saveBundleName: cliOptions.save,
deleteOldest: cliOptions.delete,
allChannels: cliOptions.all_channels,
sourceMaps: cliOptions.source_maps,
};
stencilPush(options, (err, result) => {
if (err) {
Expand Down
5 changes: 4 additions & 1 deletion lib/stencil-bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -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' },
Expand Down Expand Up @@ -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 });
}
}
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 2604750

Please sign in to comment.