Skip to content

Commit

Permalink
internal: More parallelism for build types (#3325)
Browse files Browse the repository at this point in the history
  • Loading branch information
ntucker authored Dec 22, 2024
1 parent 226f5b4 commit 16003eb
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 58 deletions.
71 changes: 35 additions & 36 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
- checkout:
depth: 1
- run:
name: examples use local packages
name: Add examples/* to yarn workspace
command: |
npm pkg set 'workspaces[]'='examples/*'
- restore_cache:
Expand All @@ -46,7 +46,7 @@ jobs:
- .yarn/install-state.gz
key: v13-dependencies-{{ checksum "yarn.lock" }}-{{ checksum "examples/github-app/package.json" }}-{{ checksum "examples/todo-app/package.json" }}
- run: yarn run ci:build:types
- run: yarn run ci:build
- run: yarn run ci:build-test-lib
- persist_to_workspace:
root: ~/
paths:
Expand All @@ -69,7 +69,7 @@ jobs:

lint:
executor: node
resource_class: medium+
resource_class: medium
steps:
- attach_workspace:
at: ~/
Expand Down Expand Up @@ -127,6 +127,7 @@ jobs:
parameters:
node-version:
type: string
executor: node
docker:
- image: cimg/node:<< parameters.node-version >>
steps:
Expand All @@ -140,16 +141,20 @@ jobs:
command: |
ANANSI_JEST_TYPECHECK=false npm test --ci --maxWorkers=2 --selectProjects Node
non-app-examples:
setup-esmodule-types:
executor: node
resource_class: small
resource_class: large
steps:
- attach_workspace:
at: ~/
- run:
command: |
cd examples/normalizr-relationships
yarn run start
name: Build Legacy Types
command: yarn run ci:build:legacy-types
- persist_to_workspace:
root: ~/
paths:
# explicitly list so we can ignore some directories that are not needed
- project/packages/*/ts*

esmodule-types:
parameters:
Expand All @@ -162,51 +167,43 @@ jobs:
- run:
name: Install TypeScript Version
command: |
if [ "<< parameters.typescript-version >>" != "latest" ]; then
yarn up typescript@~<< parameters.typescript-version >>
fi
yarn up typescript@~<< parameters.typescript-version >>
if [[ "<< parameters.typescript-version >>" == "4.0" || \
"<< parameters.typescript-version >>" == "4.1" || \
"<< parameters.typescript-version >>" == "4.3" ]]; then
sed -i '/"@types\/react":/d' package.json
sed -i '/"@types\/react-dom":/d' package.json
yarn up @types/react@ts<< parameters.typescript-version >>
fi
- run:
name: Run Typecheck
command: |
if [ "<< parameters.typescript-version >>" == "latest" ] || [ "<< parameters.typescript-version >>" == "5.3" ] || [ "<< parameters.typescript-version >>" == "4.8" ]; then
if [ "<< parameters.typescript-version >>" == "5.3" ] || [ "<< parameters.typescript-version >>" == "4.8" ]; then
yarn run tsc --project examples/todo-app/tsconfig.json
yarn run tsc --project examples/github-app/tsconfig.json
fi
yarn run tsc --project examples/todo-app/tsconfig.typetest.json
yarn run tsc --project examples/github-app/tsconfig.typetest.json
if [ "<< parameters.typescript-version >>" != "4.0" ]; then
yarn run tsc --project examples/todo-app/tsconfig.typetest41.json
fi
yarn run tsc --project examples/todo-app/tsconfig.typetest.json
yarn run tsc --project examples/github-app/tsconfig.typetest.json
esmodule-loosenulltypes:
esmodule-types-latest:
executor: node
steps:
- attach_workspace:
at: ~/
- run:
name: Run Typecheck
command: |
yarn run tsc --project examples/todo-app/tsconfig.json
yarn run tsc --project examples/github-app/tsconfig.json
yarn run tsc --project examples/todo-app/tsconfig.typetest.json
yarn run tsc --project examples/github-app/tsconfig.typetest.json
yarn run tsc --project examples/todo-app/tsconfig.typetest41.json
yarn run tsc --project examples/todo-app/tsconfig.json --strictNullChecks false
yarn run tsc --project examples/github-app/tsconfig.json --strictNullChecks false
yarn run tsc --project examples/todo-app/tsconfig.typetest.json --strictNullChecks false
yarn run tsc --project examples/github-app/tsconfig.typetest.json --strictNullChecks false
yarn run tsc --project examples/todo-app/tsconfig.typetest41.json --strictNullChecks false
esmodule-exactOptionalPropertyTypes:
executor: node
steps:
- attach_workspace:
at: ~/
- run:
name: Run Typecheck
command: |
yarn run tsc --project examples/todo-app/tsconfig.typetest.json --exactOptionalPropertyTypes true
yarn run tsc --project examples/github-app/tsconfig.typetest.json --exactOptionalPropertyTypes true
yarn run tsc --project examples/todo-app/tsconfig.typetest41.json --exactOptionalPropertyTypes true
Expand All @@ -216,10 +213,15 @@ jobs:
steps:
- attach_workspace:
at: ~/
- run: yarn run ci:build:esmodule
- run:
command: |
cd examples/todo-app
npm run build:browser -- --env readable
- run:
command: |
cd examples/normalizr-relationships
yarn run start
workflows:
version: 2
Expand All @@ -244,10 +246,13 @@ workflows:
- typecheck:
requires:
- setup
- non-app-examples:
- validate-esmodule-browser-build:
requires:
- setup
- validate-esmodule-browser-build:
- esmodule-types-latest:
requires:
- setup
- setup-esmodule-types:
requires:
- setup
- esmodule-types:
Expand All @@ -258,12 +263,6 @@ workflows:
# 4.1 is min version for rest package working well
# 4.3
# 4.7 (but its broken so we do 4.8) lets you apply a generic type to a function type to see its return value
typescript-version: ["4.0", "4.1", "4.3", "4.8", "5.3", "latest"]
typescript-version: ["4.0", "4.1", "4.3", "4.8", "5.3"]
requires:
- setup
- esmodule-loosenulltypes:
requires:
- setup
- esmodule-exactOptionalPropertyTypes:
requires:
- setup
- setup-esmodule-types
1 change: 0 additions & 1 deletion examples/github-app/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
"esModuleInterop": true,
"experimentalDecorators": true,
"emitDecoratorMetadata": true,

"types": ["@anansi/webpack-config/types","./src/types/remark-remove-comments"],
"paths": {
"@/*": ["./src/*"],
Expand Down
1 change: 1 addition & 0 deletions examples/github-app/tsconfig.typetest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"extends": "./tsconfig",
"compilerOptions": {
"skipLibCheck": true,
"skipDefaultLibCheck": true
},
"include": ["typetest.ts"],
}
14 changes: 3 additions & 11 deletions examples/normalizr-relationships/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,11 @@
"devDependencies": {
"@babel/core": "7.26.0",
"@babel/node": "7.26.0",
"@types/babel__core": "^7",
"mockdate": "^3.0.5",
"rollup": "2.79.2",
"rollup-plugin-babel": "^4.4.0",
"rollup-plugin-commonjs": "^10.1.0",
"rollup-plugin-filesize": "^9.1.2",
"rollup-plugin-json": "^4.0.0",
"rollup-plugin-node-resolve": "^5.2.0",
"rollup-plugin-replace": "^2.2.0",
"rollup-plugin-terser": "^7.0.2"
"@types/babel__core": "^7"
},
"dependencies": {
"@data-client/endpoint": "workspace:^",
"@data-client/normalizr": "workspace:^"
"@data-client/normalizr": "workspace:^",
"mockdate": "^3.0.5"
}
}
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@
"build:bundle": "yarn workspaces foreach -Wptiv --no-private run build:bundle",
"build:clean": "yarn workspaces foreach -Wpti --no-private run build:clean",
"build:types": "yarn build:copy:ambient && tsc --build && yarn workspaces foreach -Wpti --no-private run build:legacy-types",
"ci:build:types": "yarn build:copy:ambient && tsc --build && yarn workspaces foreach -WptivR --from @data-client/react --from @data-client/rest --from @data-client/graphql run build:legacy-types",
"ci:build": "yarn workspaces foreach -WptivR --from @data-client/react --from @data-client/rest --from @data-client/graphql --from @data-client/test run build:lib && yarn workspace @data-client/test run build:bundle && yarn workspace @data-client/normalizr run build:js:node && yarn workspace @data-client/endpoint run build:js:node",
"ci:build:types": "yarn build:copy:ambient && tsc --build",
"ci:build:legacy-types": "yarn workspaces foreach -WptivR -j 10 --from @data-client/react --from @data-client/rest --from @data-client/graphql run build:legacy-types",
"ci:build-test-lib": "yarn workspace @data-client/test run build:lib && yarn workspace @data-client/test run build:bundle",
"ci:build:esmodule": "yarn workspaces foreach -WptivR --from @data-client/react --from @data-client/rest --from @data-client/graphql run build:lib && yarn workspace @data-client/normalizr run build:js:node && yarn workspace @data-client/endpoint run build:js:node",
"build:copy:ambient": "mkdirp ./packages/endpoint/lib && copyfiles --flat ./packages/endpoint/src/schema.d.ts ./packages/endpoint/lib/ && copyfiles --flat ./packages/endpoint/src/endpoint.d.ts ./packages/endpoint/lib/ && mkdirp ./packages/rest/lib && copyfiles --flat ./packages/rest/src/RestEndpoint.d.ts ./packages/rest/lib && copyfiles --flat ./packages/rest/src/next/RestEndpoint.d.ts ./packages/rest/lib/next && mkdirp ./packages/react/lib && copyfiles --flat ./packages/react/src/server/redux/redux.d.ts ./packages/react/lib/server/redux",
"copy:websitetypes": "./scripts/copywebsitetypes.sh",
"test": "NODE_ENV=test NODE_OPTIONS=--experimental-vm-modules jest",
Expand Down
8 changes: 0 additions & 8 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -21795,14 +21795,6 @@ __metadata:
"@data-client/normalizr": "workspace:^"
"@types/babel__core": "npm:^7"
mockdate: "npm:^3.0.5"
rollup: "npm:2.79.2"
rollup-plugin-babel: "npm:^4.4.0"
rollup-plugin-commonjs: "npm:^10.1.0"
rollup-plugin-filesize: "npm:^9.1.2"
rollup-plugin-json: "npm:^4.0.0"
rollup-plugin-node-resolve: "npm:^5.2.0"
rollup-plugin-replace: "npm:^2.2.0"
rollup-plugin-terser: "npm:^7.0.2"
languageName: unknown
linkType: soft

Expand Down

0 comments on commit 16003eb

Please sign in to comment.