Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add size-limit workflow #241

Merged
merged 5 commits into from
Mar 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/relative-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: RelativeCI

on:
workflow_run:
workflows: ["Run tests"]
workflows: ["Integration Tests (latest)"]
types:
- completed

Expand Down
23 changes: 23 additions & 0 deletions .github/workflows/size-limit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: "Run `size-limit`"
on:
pull_request:
branches:
- main
permissions:
pull-requests: write
jobs:
size:
runs-on: ubuntu-latest
env:
CI_JOB_NUMBER: 1
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "20.x"
cache: "yarn"
- run: yarn install --immutable
- uses: andresz1/size-limit-action@v1
with:
build_script: build:libs
github_token: ${{ secrets.GITHUB_TOKEN }}
101 changes: 101 additions & 0 deletions .size-limit.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
/** @type {import('size-limit').SizeLimitConfig} */
const checks = [
{
name: "{ ApolloNextAppProvider, NextSSRApolloClient, NextSSRInMemoryCache } from '@apollo/experimental-nextjs-app-support/ssr' (Browser ESM)",
path: "packages/experimental-nextjs-app-support/dist/ssr/index.browser.js",
import:
"{ ApolloNextAppProvider, NextSSRApolloClient, NextSSRInMemoryCache }",
},
{
name: "{ WrapApolloProvider, ApolloClient, InMemoryCache } from '@apollo/client-react-streaming' (Browser ESM)",
path: "packages/client-react-streaming/dist/index.browser.js",
import: "{ WrapApolloProvider, ApolloClient, InMemoryCache }",
},
{
name: "{ buildManualDataTransport } from '@apollo/client-react-streaming/manual-transport' (Browser ESM)",
path: "packages/client-react-streaming/dist/manual-transport.browser.cjs",
import: "{ buildManualDataTransport }",
},
{
name: "@apollo/client-react-streaming (Browser ESM)",
path: "packages/client-react-streaming/dist/index.browser.js",
},
{
name: "@apollo/client-react-streaming (SSR ESM)",
path: "packages/client-react-streaming/dist/index.ssr.js",
},
{
name: "@apollo/client-react-streaming (RSC ESM)",
path: "packages/client-react-streaming/dist/index.rsc.js",
},
{
name: "@apollo/client-react-streaming/manual-transport (Browser ESM)",
path: "packages/client-react-streaming/dist/manual-transport.browser.cjs",
},
{
name: "@apollo/client-react-streaming/manual-transport (SSR ESM)",
path: "packages/client-react-streaming/dist/manual-transport.ssr.cjs",
},
{
name: "@apollo/experimental-nextjs-app-support/ssr (Browser ESM)",
path: "packages/experimental-nextjs-app-support/dist/ssr/index.browser.js",
},
{
name: "@apollo/experimental-nextjs-app-support/ssr (SSR ESM)",
path: "packages/experimental-nextjs-app-support/dist/ssr/index.ssr.js",
},
{
name: "@apollo/experimental-nextjs-app-support/ssr (RSC ESM)",
path: "packages/experimental-nextjs-app-support/dist/ssr/index.rsc.js",
},
{
name: "@apollo/experimental-nextjs-app-support/rsc (RSC ESM)",
path: "packages/experimental-nextjs-app-support/dist/rsc/index.js",
},
];

module.exports = checks.map(
(check) =>
/** @type {import('size-limit').SizeLimitConfig} */ ({
...check,
import: check.import || "*",
modifyWebpackConfig(config) {
config.resolve = {
...config.resolve,
modules: ["node_modules"],
conditionNames: [
"import",
check.name.includes("Browser")
? "browser"
: check.name.includes("RSC")
? "react-server"
: check.name.includes("SSR")
? "node"
: "default",
],
};
return config;
},
ignore: [
...(check.ignore || []),
"rehackt",
"react",
"react-dom",
"@apollo/client",
"@graphql-typed-document-node/core",
"@wry/caches",
"@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",
],
})
);
9 changes: 8 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,18 @@
"scripts": {
"verify-package-json": "node ./scripts/verify-package-json.mjs",
"verify-package-shape": "node ./scripts/verify-package-shape.mjs",
"matrix": "node ./scripts/test-matrix.js"
"matrix": "node ./scripts/test-matrix.js",
"build:libs": "yarn workspaces foreach --all --include \"@apollo/*\" run build"
},
"resolutions": {
"react@18.2.0": "18.3.0-canary-60a927d04-20240113",
"react-dom@18.2.0": "18.3.0-canary-60a927d04-20240113",
"superjson": "1.13.3"
},
"devDependencies": {
"@size-limit/file": "^11.1.0",
"@size-limit/webpack": "^11.1.0",
"@size-limit/webpack-why": "^11.1.0",
"size-limit": "^11.1.0"
}
}
Loading
Loading