Skip to content

Commit

Permalink
chore(labs): add bundle size script
Browse files Browse the repository at this point in the history
  • Loading branch information
johnsoncodehk committed Sep 5, 2023
1 parent daf0fb8 commit 31bc546
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/labs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@
"watch": "npm run build -- --watch",
"prepack": "npm run build -- --minify",
"pack": "npm run prepack && vsce package",
"release": "npm run prepack && vsce publish"
"release": "npm run prepack && vsce publish",
"size": "npm run prepack -- --metafile && esbuild-visualizer --metadata ./meta.json && open ./stats.html"
},
"devDependencies": {
"@types/vscode": "1.67.0",
Expand Down
13 changes: 13 additions & 0 deletions packages/labs/scripts/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,18 @@ require('esbuild').build({
},
keepStructure: true,
}),
{
name: 'meta',
setup(build) {
build.onEnd((result) => {
if (result.metafile && result.errors.length === 0) {
require('fs').writeFileSync(
require('path').resolve(__dirname, '../meta.json'),
JSON.stringify(result.metafile),
);
}
});
},
},
],
}).catch(() => process.exit(1))

0 comments on commit 31bc546

Please sign in to comment.