Skip to content

Commit

Permalink
Add size-limit (#10871)
Browse files Browse the repository at this point in the history
* add size-limit
* comment out `useSuspenseQuery_experimental` for main branch
  • Loading branch information
phryneas authored May 15, 2023
1 parent 64f4930 commit 2ebccfc
Show file tree
Hide file tree
Showing 5 changed files with 1,077 additions and 24 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/size-limit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: "size"
on:
pull_request:
branches:
- main
- release-*
jobs:
size:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Setup Node.js 18.x
uses: actions/setup-node@v3
with:
node-version: 18.x
- name: Install dependencies (with cache)
uses: bahmutov/npm-install@v1
- name: Run size-limit
uses: andresz1/size-limit-action@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,5 @@ junit.xml

# Ignore generated test report output
reports

esbuild-why-*.html
47 changes: 47 additions & 0 deletions .size-limit.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
const checks = [
{
path: "dist/apollo-client.min.cjs",
limit: "36.64kb"
},
{
path: "dist/main.cjs",
import: "{ ApolloClient, InMemoryCache, HttpLink }"
},
{
path: "dist/index.js",
import: "{ ApolloClient, InMemoryCache, HttpLink }",
limit: "34.99kb"
},
...[
"ApolloProvider",
"useQuery",
"useLazyQuery",
"useMutation",
"useSubscription",
//"useSuspenseQuery_experimental",
"useFragment_experimental"
].map((name) => ({ path: "dist/react/index.js", import: `{ ${name} }` })),
].map((config) => ({
...config,
name: config.name || config.import ? `import ${config.import} from "${config.path}"` : config.path,
ignore: [
...(config.ignore || []),
"react",
"react-dom",
"@graphql-typed-document-node/core",
"@wry/context",
"@wry/equality",
"@wry/trie",
"graphql-tag",
"hoist-non-react-statics",
"optimism",
"prop-types",
"response-iterator",
"symbol-observable",
"ts-invariant",
"tslib",
"zen-observable-ts"
],
}));

module.exports = checks;
Loading

0 comments on commit 2ebccfc

Please sign in to comment.