Skip to content

Commit 557f56b

Browse files
authored
Use esbuild to bundle and minify dependencies (#1542)
1 parent c7632e3 commit 557f56b

20 files changed

+2196
-2743
lines changed

.changeset/773bfb924a7b906ffc5f99aa82351993e7753fb4.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

.changeset/ab8e5b7d2e0363d9cd02984f42c77e05221b074a.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

.changeset/esbuild.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"ggt": patch
3+
---
4+
5+
Use esbuild to bundle code and packages

.cspell/project-words.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ nothrow
2929
notificationcenter
3030
notifysend
3131
oclif
32+
outdir
3233
packagejson
3334
pagedown
3435
pageup
@@ -41,7 +42,6 @@ sorhus
4142
sourcemaps
4243
sprintln
4344
sprintlns
44-
swcrc
4545
typecheck
4646
unmock
4747
unstub

.envrc

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@ export GGT_CONFIG_DIR="$WORKSPACE_ROOT/tmp/config"
99
export GGT_CACHE_DIR="$WORKSPACE_ROOT/tmp/cache"
1010
export GGT_DATA_DIR="$WORKSPACE_ROOT/tmp/data"
1111

12-
export SWCRC=true
13-
export SWC_NODE_PROJECT="$WORKSPACE_ROOT/tsconfig.json"
14-
1512
NODE_EXTRA_CA_CERTS=$(mkcert -CAROOT)/rootCA.pem
1613
export NODE_EXTRA_CA_CERTS
1714

.eslintrc.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"$schema": "https://json.schemastore.org/eslintrc",
3-
"ignorePatterns": ["node_modules", "lib", "tmp", "__fixtures__", "__generated__", ".direnv", "bin/run.js"],
3+
"ignorePatterns": ["node_modules", "dist", "tmp", "__fixtures__", "__generated__", ".direnv", "bin/run.js"],
44
"parser": "@typescript-eslint/parser",
55
"parserOptions": {
66
"project": true
@@ -86,8 +86,7 @@
8686
}
8787
]
8888
}
89-
],
90-
"import/no-extraneous-dependencies": ["warn", { "devDependencies": false }]
89+
]
9190
}
9291
},
9392
{

.github/workflows/cd.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ jobs:
5757
with:
5858
environment: production
5959
version: ${{ fromJson(steps.changesets.outputs.publishedPackages)[0].version }}
60-
sourcemaps: ./lib
60+
sourcemaps: ./dist
6161
env:
6262
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
6363
SENTRY_ORG: gadget

.github/workflows/ci.yml

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ jobs:
4242
run: |
4343
npm run build
4444
npm install --omit=dev # remove dev dependencies to mimic a user installing the package
45-
lib/main.js
45+
dist/main.js
4646
4747
test:
4848
strategy:
@@ -65,25 +65,6 @@ jobs:
6565
- name: Run tests
6666
run: npm run test
6767

68-
bundle-size:
69-
runs-on: ubuntu-latest
70-
steps:
71-
- name: Checkout repository
72-
uses: actions/checkout@v4
73-
74-
- name: Setup Node.js
75-
uses: actions/setup-node@v4
76-
with:
77-
node-version: 18
78-
cache: npm
79-
80-
- name: Install dependencies
81-
run: npm ci
82-
83-
- name: Show bundle size
84-
run: |
85-
./scripts/show-bundle-size.ts
86-
8768
dependabot:
8869
needs: [lint, build, test]
8970
if: github.event_name == 'pull_request' && startsWith(github.head_ref, 'dependabot/npm_and_yarn/')

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
.log
44
.nyc_output
55
.vscode
6+
dist
67
lib
78
node_modules
89
tmp

.prettierignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
__fixtures__
22
__generated__
3-
lib
3+
dist
44
tmp/*
55
!tmp/apps
66
npm-shrinkwrap.json

.swcrc

Lines changed: 0 additions & 14 deletions
This file was deleted.

cspell.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
"__fixtures__",
88
"__generated__",
99
"__snapshots__",
10+
"dist",
1011
"flake.lock",
1112
"flake.nix",
12-
"lib",
1313
"node_modules",
1414
"npm-shrinkwrap.json",
1515
"tmp"

flake.nix

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@
2222
yarn = pkgs.yarn.override { nodejs = flake.packages.nodejs; };
2323

2424
ggt = pkgs.writeShellScriptBin "ggt" ''
25-
GGT_ENV=production node --loader @swc-node/register/esm --no-warnings "$WORKSPACE_ROOT"/src/main.ts "$@"
25+
GGT_ENV=production "$WORKSPACE_ROOT"/dist/main.js "$@"
2626
'';
2727

2828
dggt = pkgs.writeShellScriptBin "dggt" ''
29-
GGT_ENV=development node --loader @swc-node/register/esm --no-warnings "$WORKSPACE_ROOT"/src/main.ts "$@"
29+
GGT_ENV=development "$WORKSPACE_ROOT"/dist/main.js
3030
'';
3131
};
3232

0 commit comments

Comments
 (0)