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

Dog fooding #7

Merged
merged 2 commits into from
May 2, 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
9 changes: 9 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ on:
paths-ignore:
- '*.md'

permissions:
contents: read # for checkout repository
actions: read # for fetching base branch bundle stats
pull-requests: write # for comments

jobs:
build:
runs-on: ubuntu-latest
Expand All @@ -34,6 +39,10 @@ jobs:
else
echo 'clean'
fi
- name: Analyze esbuild bundle size
uses: exoego/esbuild-bundle-analyzer@main
with:
metafiles: "tmp/meta.json"
- uses: actions/upload-artifact@v4
with:
name: dist
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
node_modules
out
.analyzer
tmp/meta.json

# Allow-list
!__tests__/__fixtures__/examples-with-base/**/.analyzer/base/bundle/bundle_analysis.json
6 changes: 4 additions & 2 deletions esbuild.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as esbuild from 'esbuild'
import { readFileSync } from 'node:fs'
import { readFileSync, writeFileSync } from 'node:fs'

// https://github.com/evanw/esbuild/issues/1685#issuecomment-944916409
const excludeNodeModulesFromSourceMap = {
Expand All @@ -18,7 +18,7 @@ const excludeNodeModulesFromSourceMap = {
},
};

await esbuild.build({
const result = await esbuild.build({
entryPoints: [`./src/index.ts`],
outfile: `dist/index.mjs`,
format: 'esm',
Expand All @@ -30,3 +30,5 @@ await esbuild.build({
bundle: true,
plugins: [excludeNodeModulesFromSourceMap]
})

writeFileSync(`tmp/meta.json`, JSON.stringify(result.metafile, null, 2));
Empty file added tmp/.gitkeep
Empty file.