Skip to content

Commit

Permalink
Merge pull request #7 from exoego/dog-fooding
Browse files Browse the repository at this point in the history
Dog fooding
  • Loading branch information
exoego committed May 2, 2024
2 parents d74eb82 + e60f145 commit 612d3b5
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 2 deletions.
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.

0 comments on commit 612d3b5

Please sign in to comment.