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

chore: upgrade lerna to 6, cache build step #26913

Merged
merged 19 commits into from
Aug 10, 2023
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
15 changes: 8 additions & 7 deletions .circleci/workflows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1527,6 +1527,7 @@ jobs:
- run: yarn test-scripts
# make sure packages with TypeScript can be transpiled to JS
- run: yarn lerna run build-prod --stream --concurrency 4
- run: yarn lerna run build --stream --concurrency 4
# run unit tests from each individual package
- run: yarn test
# run type checking for each individual package
Expand Down Expand Up @@ -1913,7 +1914,7 @@ jobs:
- restore_cached_workspace
- run:
name: Build
command: yarn workspace @cypress/webpack-preprocessor build
command: yarn lerna run build --scope @cypress/webpack-preprocessor
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In order for these jobs to leverage caching we need to change them from yarn workspace commands to yarn lerna run commands

- run:
name: Run tests
command: yarn workspace @cypress/webpack-preprocessor test
Expand Down Expand Up @@ -1958,7 +1959,7 @@ jobs:
- restore_cached_workspace
- run:
name: Build
command: yarn workspace @cypress/vue build
command: yarn lerna run build --scope @cypress/vue
- run:
name: Type Check
command: yarn typecheck
Expand All @@ -1975,7 +1976,7 @@ jobs:
- restore_cached_workspace
- run:
name: Build
command: yarn workspace @cypress/angular build
command: yarn lerna run build --scope @cypress/angular
- store-npm-logs

npm-react:
Expand All @@ -1984,7 +1985,7 @@ jobs:
- restore_cached_workspace
- run:
name: Build
command: yarn workspace @cypress/react build
command: yarn lerna run build --scope @cypress/react
- run:
name: Run tests
command: yarn test
Expand All @@ -2001,7 +2002,7 @@ jobs:
- restore_cached_workspace
- run:
name: Build
command: yarn workspace @cypress/vite-plugin-cypress-esm build
command: yarn lerna run build --scope @cypress/vite-plugin-cypress-esm
- run:
name: Run tests
command: yarn test
Expand All @@ -2018,7 +2019,7 @@ jobs:
- restore_cached_workspace
- run:
name: Build
command: yarn workspace @cypress/mount-utils build
command: yarn lerna run build --scope @cypress/mount-utils
- store-npm-logs

npm-grep:
Expand Down Expand Up @@ -2057,7 +2058,7 @@ jobs:
- run:
name: Build + Install
command: |
yarn workspace @cypress/schematic build
yarn lerna run build --scope @cypress/schematic
working_directory: npm/cypress-schematic
- run:
name: Run unit tests
Expand Down
10 changes: 10 additions & 0 deletions cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -176,5 +176,15 @@
"nohoist": [
"@types/*"
]
},
"nx": {
"targets": {
"build": {
"outputs": [
"{projectRoot}/types",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have to specify these outputs because we generate /types in CI. By default, Nx looks in the following directories so deviations from those standards need to be specified.

"{projectRoot}/build"
]
}
}
}
}
13 changes: 12 additions & 1 deletion npm/angular/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
"prebuild": "rimraf dist",
"build": "rollup -c rollup.config.mjs",
"postbuild": "node ../../scripts/sync-exported-npm-with-cli.js",
"build-prod": "yarn build",
"check-ts": "tsc --noEmit",
"lint": "eslint --ext .js,.ts,.json, ."
},
Expand Down Expand Up @@ -59,6 +58,18 @@
"publishConfig": {
"access": "public"
},
"nx": {
"targets": {
"build": {
"inputs": [
"{workspaceRoot}/scripts"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We specify /scripts because we still rely upon many node scripts for handling building (amongst other things). Any changes to a script should invalidate this lib. Eventually we can become more targeted and stricter in the future but we want to be more conservative to start off

],
"outputs": [
"{workspaceRoot}/cli/angular"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because we copy these assets to the /cli directory we need to specify them here.

]
}
}
},
"standard": {
"globals": [
"Cypress",
Expand Down
6 changes: 3 additions & 3 deletions npm/create-cypress-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
"main": "dist/src/main.js",
"scripts": {
"build": "yarn prepare-example && tsc -p ./tsconfig.json && node scripts/example copy-to ./dist/initial-template && yarn prepare-copy-templates",
"build-prod": "yarn build",
"prepare-example": "node scripts/example copy-to ./initial-template",
"prepare-copy-templates": "node scripts/copy-templates copy-to ./dist/src",
"test": "cross-env TS_NODE_PROJECT=./tsconfig.test.json mocha --config .mocharc.json './src/**/*.test.ts'",
Expand All @@ -23,14 +22,15 @@
"commander": "6.2.1",
"find-up": "5.0.0",
"fs-extra": "^9.1.0",
"inquirer": "7.3.3",
"glob": "^7.1.6",
"inquirer": "8.2.4",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a required change as Lerna 6 depends upon [email protected]+

"ora": "^5.1.0",
"recast": "0.20.4",
"semver": "7.3.7"
},
"devDependencies": {
"@types/babel__core": "^7.1.2",
"@types/inquirer": "7.3.1",
"@types/inquirer": "8.2.4",
"@types/mock-fs": "4.10.0",
"@types/node": "16.18.39",
"@types/ora": "^3.2.0",
Expand Down
11 changes: 11 additions & 0 deletions npm/cypress-schematic/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,16 @@
"ng-add": {
"save": "devDependencies"
},
"nx": {
"targets": {
"build": {
"outputs": [
"{projectRoot}/src/**/*.js",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have to specify these like this because we currently do not place build assets in an outDir and get placed next to the ts files

"{projectRoot}/src/**/*.d.ts",
"{projectRoot}/src/**/*.js.map"
]
}
}
},
"schematics": "./src/schematics/collection.json"
}
14 changes: 13 additions & 1 deletion npm/mount-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
"scripts": {
"build": "tsc || echo 'built, with type errors'",
"postbuild": "node ../../scripts/sync-exported-npm-with-cli.js",
"build-prod": "yarn build",
"check-ts": "tsc --noEmit",
"watch": "tsc -w",
"lint": "eslint --ext .js,.ts,.json, ."
Expand All @@ -33,5 +32,18 @@
"bugs": "https://github.com/cypress-io/cypress/issues/new?template=1-bug-report.md",
"publishConfig": {
"access": "public"
},
"nx": {
"targets": {
"build": {
"inputs": [
"{workspaceRoot}/scripts"
],
"outputs": [
"{workspaceRoot}/cli/mount-utils",
"{projectRoot}/dist"
]
}
}
}
}
14 changes: 13 additions & 1 deletion npm/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
"scripts": {
"build": "rimraf dist && rollup -c rollup.config.mjs",
"postbuild": "node ../../scripts/sync-exported-npm-with-cli.js",
"build-prod": "yarn build",
"cy:open": "node ../../scripts/cypress.js open --component",
"cy:open:debug": "node --inspect-brk ../../scripts/start.js --component-testing --run-project ${PWD}",
"cy:run": "node ../../scripts/cypress.js run --component",
Expand Down Expand Up @@ -88,6 +87,19 @@
"publishConfig": {
"access": "public"
},
"nx": {
"targets": {
"build": {
"inputs": [
"{workspaceRoot}/scripts"
],
"outputs": [
"{workspaceRoot}/cli/react",
"{projectRoot}/dist"
]
}
}
},
"standard": {
"globals": [
"Cypress",
Expand Down
14 changes: 13 additions & 1 deletion npm/react18/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
"scripts": {
"build": "rimraf dist && rollup -c rollup.config.mjs",
"postbuild": "node ../../scripts/sync-exported-npm-with-cli.js",
"build-prod": "yarn build",
"watch": "yarn build --watch --watch.exclude ./dist/**/*",
"lint": "eslint --ext .js,.jsx,.ts,.tsx,.json, ."
},
Expand Down Expand Up @@ -57,5 +56,18 @@
},
"publishConfig": {
"access": "public"
},
"nx": {
"targets": {
"build": {
"inputs": [
"{workspaceRoot}/scripts"
],
"outputs": [
"{workspaceRoot}/cli/react18",
"{projectRoot}/dist"
]
}
}
}
}
14 changes: 13 additions & 1 deletion npm/svelte/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
"prebuild": "rimraf dist",
"build": "rollup -c rollup.config.mjs",
"postbuild": "node ../../scripts/sync-exported-npm-with-cli.js",
"build-prod": "yarn build",
"lint": "eslint --ext .js,.jsx,.ts,.tsx,.json, .",
"check-ts": "tsc --noEmit"
},
Expand Down Expand Up @@ -40,5 +39,18 @@
"module": "dist/cypress-svelte.esm-bundler.js",
"publishConfig": {
"access": "public"
},
"nx": {
"targets": {
"build": {
"inputs": [
"{workspaceRoot}/scripts"
],
"outputs": [
"{workspaceRoot}/cli/svelte",
"{projectRoot}/dist"
]
}
}
}
}
10 changes: 9 additions & 1 deletion npm/vite-dev-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
"main": "index.js",
"scripts": {
"build": "tsc || echo 'built, with type errors'",
"build-prod": "tsc || echo 'built, with type errors'",
"check-ts": "tsc --noEmit",
"cypress:run": "yarn cypress:run-cypress-in-cypress node ../../scripts/cypress run --project . --browser chrome",
"cypress:run-cypress-in-cypress": "cross-env CYPRESS_INTERNAL_E2E_TESTING_SELF_PARENT_PROJECT=1 HTTP_PROXY_TARGET_FOR_ORIGIN_REQUESTS=http://localhost:4455 CYPRESS_REMOTE_DEBUGGING_PORT=6666 TZ=America/New_York",
Expand Down Expand Up @@ -46,5 +45,14 @@
"module": "dist/index.js",
"publishConfig": {
"access": "public"
},
"nx": {
"targets": {
"build": {
"outputs": [
"{projectRoot}/dist"
]
}
}
}
}
10 changes: 9 additions & 1 deletion npm/vite-plugin-cypress-esm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
"main": "index.js",
"scripts": {
"build": "tsc || echo 'built, with type errors'",
"build-prod": "tsc || echo 'built, with type errors'",
"check-ts": "tsc --noEmit",
"cypress:open": "node ../../scripts/cypress open --project . --component",
"cypress:run": "node ../../scripts/cypress run --project . --component",
Expand Down Expand Up @@ -42,5 +41,14 @@
"module": "dist/index.js",
"publishConfig": {
"access": "public"
},
"nx": {
"targets": {
"build": {
"outputs": [
"{projectRoot}/dist"
]
}
}
}
}
14 changes: 13 additions & 1 deletion npm/vue/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"description": "Browser-based Component Testing for Vue.js with Cypress.io ✌️🌲",
"main": "dist/cypress-vue.cjs.js",
"scripts": {
"build-prod": "yarn build",
"cy:open": "node ../../scripts/cypress.js open --component --project ${PWD}",
"cy:run": "node ../../scripts/cypress.js run --component --project ${PWD}",
"build": "rimraf dist && rollup -c rollup.config.mjs",
Expand Down Expand Up @@ -81,5 +80,18 @@
},
"publishConfig": {
"access": "public"
},
"nx": {
"targets": {
"build": {
"inputs": [
"{workspaceRoot}/scripts"
],
"outputs": [
"{workspaceRoot}/cli/vue",
"{projectRoot}/dist"
]
}
}
}
}
14 changes: 13 additions & 1 deletion npm/vue2/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
"typecheck": "tsc --noEmit",
"build": "rimraf dist && yarn rollup -c rollup.config.mjs",
"postbuild": "node ../../scripts/sync-exported-npm-with-cli.js",
"build-prod": "yarn build",
"test": "echo \"Tests for @cypress/vue2 are run from system-tests\"",
"watch": "yarn build --watch --watch.exclude ./dist/**/*",
"lint": "eslint --ext .js,.jsx,.ts,.tsx,.json,.vue .",
Expand Down Expand Up @@ -49,5 +48,18 @@
"module": "dist/cypress-vue2.esm-bundler.js",
"publishConfig": {
"access": "public"
},
"nx": {
"targets": {
"build": {
"inputs": [
"{workspaceRoot}/scripts"
],
"outputs": [
"{workspaceRoot}/cli/vue2",
"{projectRoot}/dist"
]
}
}
}
}
10 changes: 9 additions & 1 deletion npm/webpack-dev-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
"scripts": {
"prebuild": "rimraf dist",
"build": "tsc || echo 'built, with type errors'",
"build-prod": "yarn build",
"check-ts": "tsc --noEmit",
"dev": "tsc --watch",
"clean": "rimraf dist",
Expand Down Expand Up @@ -57,5 +56,14 @@
"bugs": "https://github.com/cypress-io/cypress/issues/new?template=1-bug-report.md",
"publishConfig": {
"access": "public"
},
"nx": {
"targets": {
"build": {
"outputs": [
"{projectRoot}/dist"
]
}
}
}
}
Loading