Skip to content

Commit

Permalink
ci: add size-limit support
Browse files Browse the repository at this point in the history
  • Loading branch information
JounQin committed Jul 14, 2022
1 parent ac860be commit 7599d89
Show file tree
Hide file tree
Showing 9 changed files with 2,516 additions and 7,845 deletions.
4 changes: 2 additions & 2 deletions .eslintignore
@@ -1,6 +1,6 @@
dist
lib
CHANGELOG.md
/pnpm-*.yml
/pnpm-lock.yml
!/.*.cjs
!/.changeset/*.json
!/.changeset
34 changes: 0 additions & 34 deletions .github/workflows/pkg-size.yml

This file was deleted.

32 changes: 32 additions & 0 deletions .github/workflows/size-limit.yml
@@ -0,0 +1,32 @@
name: Size Limit

on:
pull_request:
branches:
- master

jobs:
size-limit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
version: latest

- name: Setup Node.js ${{ matrix.node }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
cache: pnpm

- name: Install Dependencies
run: pnpm i

- uses: andresz1/size-limit-action@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
skip_step: install
script: pnpm size-limit --json
2 changes: 0 additions & 2 deletions .npmrc
@@ -1,6 +1,4 @@
enable-pre-post-scripts=true
; https://github.com/pkg-size/action/pull/45
; package-lock=false
public-hoist-pattern[]=@1stg/*
public-hoist-pattern[]=@pkgr/*
public-hoist-pattern[]=@commitlint/*
Expand Down
2 changes: 1 addition & 1 deletion .prettierignore
@@ -1,6 +1,6 @@
.npmrc
.type-coverage
dist
lib
node_modules
CHANGELOG.md
/pnpm-lock.yaml
15 changes: 15 additions & 0 deletions .size-limit.cjs
@@ -0,0 +1,15 @@
const { dependencies } = require('./package.json')

/** @see https://github.com/ai/size-limit/issues/291 */
const external = Object.keys(dependencies)

module.exports = [
{
path: './lib/index.js',
ignore: external,
},
{
path: './lib/worker.mjs',
ignore: external,
},
]
17 changes: 12 additions & 5 deletions package.json
Expand Up @@ -41,7 +41,7 @@
},
"funding": "https://opencollective.com/unts",
"license": "ISC",
"packageManager": "pnpm@7.5.0",
"packageManager": "pnpm@7.5.1",
"engines": {
"node": "^12.20.0 || ^14.18.0 || >=16.0.0"
},
Expand Down Expand Up @@ -103,25 +103,32 @@
"synckit": "^0.7.2"
},
"devDependencies": {
"@1stg/lib-config": "^8.0.0",
"@1stg/lib-config": "^9.0.0",
"@changesets/changelog-github": "^0.4.5",
"@changesets/cli": "^2.23.1",
"@changesets/cli": "^2.23.2",
"@mozilla/glean": "^1.0.0",
"@size-limit/preset-small-lib": "^7.0.8",
"@types/debug": "^4.1.7",
"@types/enhanced-resolve": "^3.0.7",
"@types/is-core-module": "^2.2.0",
"@types/is-glob": "^4.0.2",
"@types/node": "^18.0.3",
"@types/node": "^18.0.4",
"@types/unist": "^2.0.6",
"dummy.js": "link:dummy.js",
"eslint-import-resolver-typescript": "link:.",
"react": "^18.2.0",
"type-coverage": "^2.21.2",
"size-limit": "^7.0.8",
"type-coverage": "^2.22.0",
"typescript": "^4.7.4"
},
"resolutions": {
"prettier": "^2.7.1"
},
"pnpm": {
"patchedDependencies": {
"@size-limit/esbuild@7.0.8": "patches/@size-limit__esbuild@7.0.8.patch"
}
},
"typeCoverage": {
"atLeast": 100,
"cache": true,
Expand Down
15 changes: 15 additions & 0 deletions patches/@size-limit__esbuild@7.0.8.patch
@@ -0,0 +1,15 @@
diff --git a/get-config.js b/get-config.js
index caf78653fda1c3464ffb12ff10e19cd82fce644a..ddd3f4a229791a633668bd66d7fb3a63217b5e70 100644
--- a/get-config.js
+++ b/get-config.js
@@ -16,7 +16,9 @@ module.exports = async function getConfig(limitConfig, check, output) {
bundle: true,
minifyWhitespace: true,
minifyIdentifiers: true,
- minifySyntax: true
+ minifySyntax: true,
+
+ platform: 'node'
}

return config

0 comments on commit 7599d89

Please sign in to comment.