-
-
Notifications
You must be signed in to change notification settings - Fork 761
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* chore(dev-deps): size-limit and es-checks * chore(size-limit): initial setup * ci: initial github ci workflow * fix: lint * chore(es-check): add exclusions, check for browser es2017 * chore(size-limit): fix node imports in webpack mode * chore(scripts): bundle analyzer command
- Loading branch information
1 parent
54f929b
commit 0c93b0e
Showing
3 changed files
with
101 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
types: | ||
- opened | ||
- synchronize | ||
- reopened | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
node-version: [14.x, 16.x] | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
cache: 'npm' | ||
|
||
- name: 📥 Install | ||
run: npm install | ||
|
||
- name: ESLint checks | ||
run: npm run lint | ||
|
||
- name: Unit tests | ||
run: npm test | ||
|
||
- name: E2E tests | ||
run: npm run test:e2e | ||
|
||
- name: Build next-i18next | ||
run: npm run build | ||
|
||
- name: Check dist for ecmascript compliance | ||
run: npm run check-dist | ||
|
||
- name: Check size limits | ||
run: npm run check-size | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// @ts-check | ||
|
||
const fullEsmMaxSize = "23KB"; | ||
const fullCjsMaxSize = "46KB"; | ||
|
||
const modifyWebpackConfig = config => { | ||
config.resolve = {}; | ||
config.resolve.fallback = { "path": false, "fs": false }; | ||
} | ||
|
||
/** | ||
* Will ensure esm tree-shakeability and total size are within expectations. | ||
* | ||
* @link https://github.com/ai/size-limit/ | ||
* @type {{name: string, path: string[], limit: string, import?: string, webpack?: boolean, modifyWebpackConfig: any}[]} | ||
*/ | ||
module.exports = [ | ||
// ################################################### | ||
// ESM full bundle | ||
// ################################################### | ||
{ | ||
name: "ESM (import everything *)", | ||
path: ["dist/esm/index.js"], | ||
import: "*", | ||
limit: fullEsmMaxSize, | ||
modifyWebpackConfig, | ||
}, | ||
// ################################################### | ||
// Commonjs full bundle | ||
// ################################################### | ||
{ | ||
name: "CJS (require everything *)", | ||
path: ["dist/commonjs/index.js"], | ||
import: "*", | ||
webpack: true, | ||
limit: fullCjsMaxSize, | ||
modifyWebpackConfig, | ||
} | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters