Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add source maps option to bundle and push process #1245

Merged
merged 5 commits into from
Dec 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.

Loading