Skip to content

Commit 16fffb1

Browse files
authored
feat: rewrite for bundle size and add "convert to best" (#209)
1 parent 7f4dce1 commit 16fffb1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+9016
-9567
lines changed

.eslintrc.js

-8
This file was deleted.

.gitattributes

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/.yarn/** linguist-vendored

.github/workflows/ci.yml

+50-15
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ jobs:
1111
steps:
1212
- name: Checkout git repository
1313
uses: actions/checkout@v2
14+
- name: Setup Node.js
15+
uses: actions/setup-node@v2
16+
with:
17+
node-version: '16'
1418
- name: Get Yarn cache
1519
id: yarn-cache
1620
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
@@ -30,16 +34,18 @@ jobs:
3034
with:
3135
name: dist
3236
path: dist
33-
- name: Check ECMAScript compatibility
34-
run: yarn run compat
35-
lint:
36-
name: Lint source
37+
unit-test:
38+
name: Unit tests
3739

3840
runs-on: ubuntu-latest
3941

4042
steps:
4143
- name: Checkout git repository
4244
uses: actions/checkout@v2
45+
- name: Setup Node.js
46+
uses: actions/setup-node@v2
47+
with:
48+
node-version: '16'
4349
- name: Get Yarn cache
4450
id: yarn-cache
4551
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
@@ -52,16 +58,24 @@ jobs:
5258
${{ runner.os }}-yarn-
5359
- name: Install dependencies with Yarn
5460
run: yarn install --immutable
55-
- name: Lint
56-
run: yarn run lint
57-
unit-test:
58-
name: Unit tests
61+
- name: Run tests
62+
run: yarn test
63+
- name: Upload coverage
64+
uses: codecov/codecov-action@v1
65+
with:
66+
fail_ci_if_error: true
67+
legacy-test:
68+
name: Legacy Node.js tests
5969

6070
runs-on: ubuntu-latest
6171

6272
steps:
6373
- name: Checkout git repository
6474
uses: actions/checkout@v2
75+
- name: Setup Node.js
76+
uses: actions/setup-node@v2
77+
with:
78+
node-version: '16'
6579
- name: Get Yarn cache
6680
id: yarn-cache
6781
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
@@ -74,12 +88,19 @@ jobs:
7488
${{ runner.os }}-yarn-
7589
- name: Install dependencies with Yarn
7690
run: yarn install --immutable
77-
- name: Run tests
78-
run: yarn test --ci --coverage --maxWorkers=2
79-
- name: Upload coverage
80-
uses: codecov/codecov-action@v1
81-
with:
82-
fail_ci_if_error: true
91+
- name: Build
92+
run: yarn run build
93+
- name: Download Node.js v0.9.1
94+
run: |
95+
wget https://nodejs.org/dist/v0.9.1/node-v0.9.1-linux-x64.tar.gz
96+
tar xf node-v0.9.1-linux-x64.tar.gz
97+
mkdir -p $HOME/.local/bin
98+
cp ./node-v0.9.1-linux-x64/bin/node $HOME/.local/bin/node-0.9.1
99+
echo "$HOME/.local/bin" >> $GITHUB_PATH
100+
- name: Run tests on modern Node.js
101+
run: node ./src/test/legacy.js
102+
- name: Run tests on Node.js v0.9.1
103+
run: node-0.9.1 ./src/test/legacy.js
83104
size:
84105
name: Calculate bundle size
85106

@@ -91,6 +112,10 @@ jobs:
91112
steps:
92113
- name: Checkout git repository
93114
uses: actions/checkout@v2
115+
- name: Setup Node.js
116+
uses: actions/setup-node@v2
117+
with:
118+
node-version: '16'
94119
- name: Get Yarn cache
95120
id: yarn-cache
96121
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
@@ -115,6 +140,10 @@ jobs:
115140
steps:
116141
- name: Checkout git repository
117142
uses: actions/checkout@v2
143+
- name: Setup Node.js
144+
uses: actions/setup-node@v2
145+
with:
146+
node-version: '16'
118147
- name: Get Yarn cache
119148
id: yarn-cache
120149
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
@@ -134,11 +163,17 @@ jobs:
134163

135164
runs-on: ubuntu-latest
136165

137-
needs: [lint, unit-test, style, size]
166+
if: ${{ github.ref == 'refs/heads/master' }}
167+
168+
needs: [unit-test, legacy-test, style, size]
138169

139170
steps:
140171
- name: Checkout git repository
141172
uses: actions/checkout@v2
173+
- name: Setup Node.js
174+
uses: actions/setup-node@v2
175+
with:
176+
node-version: '16'
142177
- name: Get Yarn cache
143178
id: yarn-cache
144179
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"

.gitignore

+26-3
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
# Icon must end with two \r
2626
Icon
2727

28+
2829
# Thumbnails
2930
._*
3031

@@ -52,6 +53,7 @@ npm-debug.log*
5253
yarn-debug.log*
5354
yarn-error.log*
5455
lerna-debug.log*
56+
.pnpm-debug.log*
5557

5658
# Diagnostic reports (https://nodejs.org/api/report.html)
5759
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
@@ -88,8 +90,8 @@ build/Release
8890
node_modules/
8991
jspm_packages/
9092

91-
# TypeScript v1 declaration files
92-
typings/
93+
# Snowpack dependency directory (https://snowpack.dev/)
94+
web_modules/
9395

9496
# TypeScript cache
9597
*.tsbuildinfo
@@ -118,12 +120,15 @@ typings/
118120
# dotenv environment variables file
119121
.env
120122
.env.test
123+
.env.production
121124

122125
# parcel-bundler cache (https://parceljs.org/)
123126
.cache
127+
.parcel-cache
124128

125129
# Next.js build output
126130
.next
131+
out
127132

128133
# Nuxt.js build / generate output
129134
.nuxt
@@ -153,6 +158,13 @@ dist
153158
# Stores VSCode versions used for testing VSCode extensions
154159
.vscode-test
155160

161+
# yarn v2
162+
.yarn/cache
163+
.yarn/unplugged
164+
.yarn/build-state.yml
165+
.yarn/install-state.gz
166+
.pnp.*
167+
156168
### VisualStudioCode ###
157169
.vscode/*
158170
!.vscode/settings.json
@@ -161,9 +173,13 @@ dist
161173
!.vscode/extensions.json
162174
*.code-workspace
163175

176+
# Local History for Visual Studio Code
177+
.history/
178+
164179
### VisualStudioCode Patch ###
165180
# Ignore all local history of files
166181
.history
182+
.ionide
167183

168184
### Windows ###
169185
# Windows thumbnail cache files
@@ -195,11 +211,18 @@ $RECYCLE.BIN/
195211

196212
# Yarn
197213
.yarn/*
214+
!.yarn/patches
198215
!.yarn/releases
199216
!.yarn/plugins
200217
!.yarn/sdks
201218
!.yarn/versions
202219
.pnp.*
203220

204-
# Generated docs
221+
# Rollup
222+
.rollup.cache
223+
224+
# TypeScript compiler
225+
tsc_output
226+
227+
# TypeDoc
205228
docs_out

.npmignore

-1
This file was deleted.

.prettierignore

+27-3
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
# Icon must end with two \r
2626
Icon
2727

28+
2829
# Thumbnails
2930
._*
3031

@@ -52,6 +53,7 @@ npm-debug.log*
5253
yarn-debug.log*
5354
yarn-error.log*
5455
lerna-debug.log*
56+
.pnpm-debug.log*
5557

5658
# Diagnostic reports (https://nodejs.org/api/report.html)
5759
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
@@ -88,8 +90,8 @@ build/Release
8890
node_modules/
8991
jspm_packages/
9092

91-
# TypeScript v1 declaration files
92-
typings/
93+
# Snowpack dependency directory (https://snowpack.dev/)
94+
web_modules/
9395

9496
# TypeScript cache
9597
*.tsbuildinfo
@@ -118,12 +120,15 @@ typings/
118120
# dotenv environment variables file
119121
.env
120122
.env.test
123+
.env.production
121124

122125
# parcel-bundler cache (https://parceljs.org/)
123126
.cache
127+
.parcel-cache
124128

125129
# Next.js build output
126130
.next
131+
out
127132

128133
# Nuxt.js build / generate output
129134
.nuxt
@@ -153,6 +158,13 @@ dist
153158
# Stores VSCode versions used for testing VSCode extensions
154159
.vscode-test
155160

161+
# yarn v2
162+
.yarn/cache
163+
.yarn/unplugged
164+
.yarn/build-state.yml
165+
.yarn/install-state.gz
166+
.pnp.*
167+
156168
### VisualStudioCode ###
157169
.vscode/*
158170
!.vscode/settings.json
@@ -161,9 +173,13 @@ dist
161173
!.vscode/extensions.json
162174
*.code-workspace
163175

176+
# Local History for Visual Studio Code
177+
.history/
178+
164179
### VisualStudioCode Patch ###
165180
# Ignore all local history of files
166181
.history
182+
.ionide
167183

168184
### Windows ###
169185
# Windows thumbnail cache files
@@ -197,5 +213,13 @@ $RECYCLE.BIN/
197213
.yarn/*
198214
.pnp.*
199215

200-
# Generated docs
216+
# Rollup
217+
.rollup.cache
218+
219+
# TypeScript compiler
220+
tsc_output
221+
222+
src/generated
223+
224+
# TypeDoc
201225
docs_out

.yarnrc.yml

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
1-
nodeLinker: node-modules
2-
31
yarnPath: .yarn/releases/yarn-2.4.2.cjs
2+
nodeLinker: node-modules

0 commit comments

Comments
 (0)