mirror of
https://github.com/cypress-io/cypress.git
synced 2026-05-05 14:30:32 -05:00
chore: optimize task execution (#27848)
* Revert "chore: simplify build script (#27547)" This reverts commit0a86ec686e. * Revert "chore: upgrade lerna to 6, cache build step (#26913)" This reverts commit9e60aeba8f. * [run ci] * chore: upgrade lerna to 6, cache build step (#26913) * chore: update build-npm-modules script * chore: update build-npm-modules script * chore: update build-npm-modules script * chore: update build-npm-modules script * chore: update lerna to 6 * [run ci] * try caching build step * we can't clean without building after * add dependencies on scripts for npm packages * update commands * add config for data-context build step * fix output configurations for npm packages, add gitignores * revert changes to config and data-context build steps * fix outputs * run with cache * fix outputs for cli * actually fix outputs * test with cache --------- Co-authored-by: astone123 <adams@cypress.io> * chore: simplify build script (#27547) * chore: simplify build script * update CI workflows * fix workflows * empty commit because Percy weirdness * chore: add driver, reporter, config as implicit dependencies for runner package (#27559) * run all workflows on branch * chore: parallelize test-binary-against-recipes CI step (#27570) * chore: fix some easy circular dependencies in dep graph (#27612) * chore: remove gulp tasks from postinstall (#27616) * empty commit * chore: minor improvements to node_modules_install (#27647) * chore: fix cypress:open and dev scripts * run with cache [run ci] * exclude mochaawesome assets from .yarnclean [run ci] * bump cache again [run ci] * run cached [run ci] * chore: do not cache cli build step [run ci] * update workflow command and docs for build-cli [run ci] * fix commands that use scope [run ci] * use different branch for publish repo [run ci] * percy weirdness? [run ci] * fix postbuild cli script [run ci] * try to remove typescript from production binary [run ci] * fix circular dependency [run ci] * try removing ts from node_modules [run ci] * remove typescript resolution [run ci] * remove redundant target scripts * update to lerna scoped commands * remove unneeded yarn in lerna command * try to fix Electron install in Windows workflow --------- Co-authored-by: Jordan <jordan@jpdesigning.com> Co-authored-by: Dave Kasper <dave.m.kasper@gmail.com>
This commit is contained in:
+23
-22
@@ -31,6 +31,7 @@ mainBuildFilters: &mainBuildFilters
|
||||
# use the following branch as well to ensure that v8 snapshot cache updates are fully tested
|
||||
- 'publish-binary'
|
||||
- 'chore/update_electron25_and_node18'
|
||||
- 'lerna-optimize-tasks'
|
||||
|
||||
# usually we don't build Mac app - it takes a long time
|
||||
# but sometimes we want to really confirm we are doing the right thing
|
||||
@@ -41,7 +42,8 @@ macWorkflowFilters: &darwin-workflow-filters
|
||||
- equal: [ develop, << pipeline.git.branch >> ]
|
||||
# use the following branch as well to ensure that v8 snapshot cache updates are fully tested
|
||||
- equal: [ 'update-v8-snapshot-cache-on-develop', << pipeline.git.branch >> ]
|
||||
- equal: [ 'chore/update_electron25_and_node18', << pipeline.git.branch >> ]
|
||||
- equal: [ 'chore/update_webpack_deps_to_latest_webpack4_compat', << pipeline.git.branch >> ]
|
||||
- equal: [ 'lerna-optimize-tasks', << pipeline.git.branch >> ]
|
||||
- matches:
|
||||
pattern: /^release\/\d+\.\d+\.\d+$/
|
||||
value: << pipeline.git.branch >>
|
||||
@@ -51,9 +53,10 @@ linuxArm64WorkflowFilters: &linux-arm64-workflow-filters
|
||||
or:
|
||||
- equal: [ develop, << pipeline.git.branch >> ]
|
||||
# use the following branch as well to ensure that v8 snapshot cache updates are fully tested
|
||||
- equal: [ 'jordanpowell88/update-angular-tsconfig-path', << pipeline.git.branch >> ]
|
||||
- equal: [ 'publish-binary', << pipeline.git.branch >> ]
|
||||
- equal: [ 'chore/update_electron25_and_node18', << pipeline.git.branch >> ]
|
||||
- equal: [ 'update-v8-snapshot-cache-on-develop', << pipeline.git.branch >> ]
|
||||
- equal: [ 'chore/update_webpack_deps_to_latest_webpack4_compat', << pipeline.git.branch >> ]
|
||||
- equal: [ 'chore/bump_loaders_and_optimize_webpack', << pipeline.git.branch >> ]
|
||||
- equal: [ 'lerna-optimize-tasks', << pipeline.git.branch >> ]
|
||||
- matches:
|
||||
pattern: /^release\/\d+\.\d+\.\d+$/
|
||||
value: << pipeline.git.branch >>
|
||||
@@ -76,7 +79,8 @@ windowsWorkflowFilters: &windows-workflow-filters
|
||||
- equal: [ develop, << pipeline.git.branch >> ]
|
||||
# use the following branch as well to ensure that v8 snapshot cache updates are fully tested
|
||||
- equal: [ 'update-v8-snapshot-cache-on-develop', << pipeline.git.branch >> ]
|
||||
- equal: [ 'chore/update_electron25_and_node18', << pipeline.git.branch >> ]
|
||||
- equal: [ 'chore/update_webpack_deps_to_latest_webpack4_compat', << pipeline.git.branch >> ]
|
||||
- equal: [ 'lerna-optimize-tasks', << pipeline.git.branch >> ]
|
||||
- matches:
|
||||
pattern: /^release\/\d+\.\d+\.\d+$/
|
||||
value: << pipeline.git.branch >>
|
||||
@@ -146,7 +150,7 @@ commands:
|
||||
name: Set environment variable to determine whether or not to persist artifacts
|
||||
command: |
|
||||
echo "Setting SHOULD_PERSIST_ARTIFACTS variable"
|
||||
echo 'if ! [[ "$CIRCLE_BRANCH" != "develop" && "$CIRCLE_BRANCH" != "release/"* && "$CIRCLE_BRANCH" != "publish-binary" && "$CIRCLE_BRANCH" != "update-v8-snapshot-cache-on-develop" && "$CIRCLE_BRANCH" != "chore/update_electron25_and_node18" ]]; then
|
||||
echo 'if ! [[ "$CIRCLE_BRANCH" != "develop" && "$CIRCLE_BRANCH" != "release/"* && "$CIRCLE_BRANCH" != "publish-binary" && "$CIRCLE_BRANCH" != "lerna-optimize-tasks" ]]; then
|
||||
export SHOULD_PERSIST_ARTIFACTS=true
|
||||
fi' >> "$BASH_ENV"
|
||||
# You must run `setup_should_persist_artifacts` command and be using bash before running this command
|
||||
@@ -223,10 +227,9 @@ commands:
|
||||
description: Save entire folder as artifact for other jobs to run without reinstalling
|
||||
steps:
|
||||
- run:
|
||||
name: Build all codegen
|
||||
name: Sync Cloud Validations
|
||||
command: |
|
||||
source ./scripts/ensure-node.sh
|
||||
yarn gulp buildProd
|
||||
yarn gulp syncCloudValidations
|
||||
- run:
|
||||
name: Build packages
|
||||
@@ -1175,11 +1178,7 @@ commands:
|
||||
name: Build NPM package
|
||||
command: |
|
||||
source ./scripts/ensure-node.sh
|
||||
yarn build --scope cypress
|
||||
- run:
|
||||
name: Copy Re-exported NPM Packages
|
||||
command: node ./scripts/post-build.js
|
||||
working_directory: cli
|
||||
yarn lerna run build-cli
|
||||
- run:
|
||||
command: ls -la types
|
||||
working_directory: cli/build
|
||||
@@ -1514,6 +1513,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 build --concurrency 4
|
||||
# run unit tests from each individual package
|
||||
- run: yarn test
|
||||
# run type checking for each individual package
|
||||
@@ -1897,7 +1897,7 @@ jobs:
|
||||
- restore_cached_workspace
|
||||
- run:
|
||||
name: Build
|
||||
command: yarn workspace @cypress/webpack-preprocessor build
|
||||
command: yarn lerna run build --scope @cypress/webpack-preprocessor
|
||||
- run:
|
||||
name: Run tests
|
||||
command: yarn workspace @cypress/webpack-preprocessor test
|
||||
@@ -1955,7 +1955,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:
|
||||
@@ -1964,7 +1964,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
|
||||
@@ -1981,7 +1981,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
|
||||
@@ -1998,7 +1998,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:
|
||||
@@ -2020,7 +2020,7 @@ jobs:
|
||||
resource_class: small
|
||||
steps:
|
||||
- restore_cached_workspace
|
||||
- run: yarn workspace create-cypress-tests build
|
||||
- run: yarn lerna run build --scope create-cypress-tests
|
||||
|
||||
npm-eslint-plugin-dev:
|
||||
<<: *defaults
|
||||
@@ -2037,8 +2037,7 @@ jobs:
|
||||
- run:
|
||||
name: Build + Install
|
||||
command: |
|
||||
yarn workspace @cypress/schematic build
|
||||
working_directory: npm/cypress-schematic
|
||||
yarn lerna run build --scope @cypress/schematic
|
||||
- run:
|
||||
name: Run unit tests
|
||||
command: |
|
||||
@@ -2380,10 +2379,12 @@ jobs:
|
||||
|
||||
test-binary-against-recipes:
|
||||
<<: *defaults
|
||||
parallelism: 4
|
||||
steps:
|
||||
- test-binary-against-repo:
|
||||
repo: cypress-example-recipes
|
||||
command: npm run test:ci
|
||||
# Split the specs up across 4 different machines to run in parallel
|
||||
command: npm run test:ci -- --chunk $CIRCLE_NODE_INDEX --total-chunks $CIRCLE_NODE_TOTAL
|
||||
browser: electron
|
||||
|
||||
# This is a special job. It allows you to test the current
|
||||
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
# test directories
|
||||
__tests__
|
||||
test
|
||||
tests
|
||||
powered-test
|
||||
|
||||
# asset directories
|
||||
docs
|
||||
doc
|
||||
# yaml package has a `doc` folder that we need
|
||||
!yaml/**/doc/*
|
||||
website
|
||||
images
|
||||
assets
|
||||
!mochawesome-report-generator/dist/assets
|
||||
|
||||
# examples
|
||||
example
|
||||
!@packages/example
|
||||
examples
|
||||
|
||||
# code coverage directories
|
||||
coverage
|
||||
.nyc_output
|
||||
|
||||
# build scripts
|
||||
Makefile
|
||||
Gulpfile.js
|
||||
Gruntfile.js
|
||||
|
||||
# configs
|
||||
appveyor.yml
|
||||
circle.yml
|
||||
codeship-services.yml
|
||||
codeship-steps.yml
|
||||
wercker.yml
|
||||
.tern-project
|
||||
.gitattributes
|
||||
.editorconfig
|
||||
.*ignore
|
||||
.eslintrc
|
||||
.jshintrc
|
||||
.flowconfig
|
||||
.documentup.json
|
||||
.yarn-metadata.json
|
||||
.travis.yml
|
||||
|
||||
# misc
|
||||
*.md
|
||||
+17
-1
@@ -6,7 +6,7 @@
|
||||
"scripts": {
|
||||
"clean": "node ./scripts/clean.js",
|
||||
"prebuild": "yarn postinstall && node ./scripts/start-build.js",
|
||||
"build": "node ./scripts/build.js",
|
||||
"build-cli": "node ./scripts/build.js && node ./scripts/post-build.js",
|
||||
"dtslint": "dtslint types",
|
||||
"postinstall": "patch-package && node ./scripts/post-install.js",
|
||||
"size": "t=\"cypress-v0.0.0.tgz\"; yarn pack --filename \"${t}\"; wc -c \"${t}\"; tar tvf \"${t}\"; rm \"${t}\";",
|
||||
@@ -176,5 +176,21 @@
|
||||
"nohoist": [
|
||||
"@types/*"
|
||||
]
|
||||
},
|
||||
"nx": {
|
||||
"targets": {
|
||||
"build-cli": {
|
||||
"dependsOn": [
|
||||
"prebuild"
|
||||
],
|
||||
"outputs": [
|
||||
"{projectRoot}/types",
|
||||
"{projectRoot}/build"
|
||||
]
|
||||
}
|
||||
},
|
||||
"implicitDependencies": [
|
||||
"@cypress/*"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ This guide has instructions for building both.
|
||||
Building a new npm package is two commands:
|
||||
|
||||
1. Increment the version in the root `package.json`
|
||||
2. `yarn build --scope cypress`
|
||||
2. `yarn lerna run build-cli`
|
||||
|
||||
The steps above:
|
||||
|
||||
|
||||
@@ -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, ."
|
||||
},
|
||||
@@ -59,6 +58,15 @@
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"nx": {
|
||||
"targets": {
|
||||
"build": {
|
||||
"outputs": [
|
||||
"{workspaceRoot}/cli/angular"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"standard": {
|
||||
"globals": [
|
||||
"Cypress",
|
||||
|
||||
@@ -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'",
|
||||
@@ -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",
|
||||
"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": "18.17.5",
|
||||
"@types/ora": "^3.2.0",
|
||||
|
||||
@@ -54,5 +54,16 @@
|
||||
"ng-add": {
|
||||
"save": "devDependencies"
|
||||
},
|
||||
"nx": {
|
||||
"targets": {
|
||||
"build": {
|
||||
"outputs": [
|
||||
"{projectRoot}/src/**/*.js",
|
||||
"{projectRoot}/src/**/*.d.ts",
|
||||
"{projectRoot}/src/**/*.js.map"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"schematics": "./src/schematics/collection.json"
|
||||
}
|
||||
|
||||
@@ -41,5 +41,10 @@
|
||||
],
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"nx": {
|
||||
"implicitDependencies": [
|
||||
"!cypress"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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, ."
|
||||
@@ -33,5 +32,15 @@
|
||||
"bugs": "https://github.com/cypress-io/cypress/issues/new?template=1-bug-report.md",
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"nx": {
|
||||
"targets": {
|
||||
"build": {
|
||||
"outputs": [
|
||||
"{workspaceRoot}/cli/mount-utils",
|
||||
"{projectRoot}/dist"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,6 +88,19 @@
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"nx": {
|
||||
"targets": {
|
||||
"build": {
|
||||
"dependsOn": [
|
||||
"!@cypress/react18:build"
|
||||
],
|
||||
"outputs": [
|
||||
"{workspaceRoot}/cli/react",
|
||||
"{projectRoot}/dist"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"standard": {
|
||||
"globals": [
|
||||
"Cypress",
|
||||
|
||||
@@ -57,5 +57,15 @@
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"nx": {
|
||||
"targets": {
|
||||
"build": {
|
||||
"outputs": [
|
||||
"{workspaceRoot}/cli/react18",
|
||||
"{projectRoot}/dist"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+13
-1
@@ -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"
|
||||
},
|
||||
@@ -40,5 +39,18 @@
|
||||
"module": "dist/cypress-svelte.esm-bundler.js",
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"nx": {
|
||||
"targets": {
|
||||
"build": {
|
||||
"outputs": [
|
||||
"{workspaceRoot}/cli/svelte",
|
||||
"{projectRoot}/dist"
|
||||
]
|
||||
}
|
||||
},
|
||||
"implicitDependencies": [
|
||||
"!cypress"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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",
|
||||
@@ -46,5 +45,14 @@
|
||||
"module": "dist/index.js",
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"nx": {
|
||||
"targets": {
|
||||
"build": {
|
||||
"outputs": [
|
||||
"{projectRoot}/dist"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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",
|
||||
@@ -42,5 +41,14 @@
|
||||
"module": "dist/index.js",
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"nx": {
|
||||
"targets": {
|
||||
"build": {
|
||||
"outputs": [
|
||||
"{projectRoot}/dist"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+13
-1
@@ -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",
|
||||
@@ -80,5 +79,18 @@
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"nx": {
|
||||
"targets": {
|
||||
"build": {
|
||||
"dependsOn": [
|
||||
"!@cypress/react18:build"
|
||||
],
|
||||
"outputs": [
|
||||
"{workspaceRoot}/cli/vue",
|
||||
"{projectRoot}/dist"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+13
-1
@@ -7,7 +7,6 @@
|
||||
"check-ts": "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 .",
|
||||
@@ -49,5 +48,18 @@
|
||||
"module": "dist/cypress-vue2.esm-bundler.js",
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"nx": {
|
||||
"targets": {
|
||||
"build": {
|
||||
"outputs": [
|
||||
"{workspaceRoot}/cli/vue2",
|
||||
"{projectRoot}/dist"
|
||||
]
|
||||
}
|
||||
},
|
||||
"implicitDependencies": [
|
||||
"!cypress"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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",
|
||||
@@ -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"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
"main": "dist",
|
||||
"scripts": {
|
||||
"build": "rimraf dist && tsc || echo 'built, with errors'",
|
||||
"build-prod": "yarn build",
|
||||
"deps": "deps-ok && dependency-check --no-dev .",
|
||||
"secure": "nsp check",
|
||||
"semantic-release": "semantic-release",
|
||||
@@ -72,5 +71,17 @@
|
||||
"cypress-plugin",
|
||||
"cypress-preprocessor",
|
||||
"webpack"
|
||||
]
|
||||
],
|
||||
"nx": {
|
||||
"targets": {
|
||||
"build": {
|
||||
"dependsOn": [
|
||||
"!@cypress/react18:build"
|
||||
],
|
||||
"outputs": [
|
||||
"{projectRoot}/dist"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,8 @@
|
||||
"options": {
|
||||
"cacheableOperations": [
|
||||
"lint",
|
||||
"check-ts"
|
||||
"check-ts",
|
||||
"build"
|
||||
],
|
||||
"accessToken": "ZmNlNjA0YzAtNTM1NS00MDIwLWFlMWItNWYxYzNiMjQ4N2VkfHJlYWQtb25seQ=="
|
||||
}
|
||||
@@ -36,7 +37,9 @@
|
||||
}
|
||||
},
|
||||
"namedInputs": {
|
||||
"sharedGlobals": [],
|
||||
"sharedGlobals": [
|
||||
"{workspaceRoot}/scripts"
|
||||
],
|
||||
"default": [
|
||||
"{projectRoot}/**/*",
|
||||
"sharedGlobals"
|
||||
|
||||
+6
-7
@@ -14,14 +14,13 @@
|
||||
"binary-zip": "node ./scripts/binary.js zip",
|
||||
"binary-package": "cross-env NODE_OPTIONS=--max_old_space_size=8192 node ./scripts/binary.js package",
|
||||
"check-binary-on-cdn": "node ./scripts/binary.js checkIfBinaryExistsOnCdn",
|
||||
"build": "yarn build-npm-modules && lerna run build --stream --no-bail --ignore create-cypress-tests --ignore cypress --ignore \"'@packages/{runner}'\" --ignore \"'@cypress/{angular,react,react18,vue,vue2,mount-utils,svelte}'\" && node ./cli/scripts/post-build.js && lerna run build --stream --scope create-cypress-tests",
|
||||
"build-npm-modules": "lerna run build --scope cypress --scope @cypress/mount-utils --scope @cypress/react && lerna run build --scope \"'@cypress/{angular,react18,vue,vue2,svelte}'\"",
|
||||
"build-prod": "lerna run build-prod-ui --stream && lerna run build-prod --stream --ignore create-cypress-tests && node ./cli/scripts/post-build.js && lerna run build-prod --stream --scope create-cypress-tests --scope",
|
||||
"build": "lerna run build --stream && lerna run build-cli --stream",
|
||||
"build-prod": "lerna run build-prod --stream --ignore create-cypress-tests && node ./cli/scripts/post-build.js && lerna run build-prod --stream --scope create-cypress-tests --scope",
|
||||
"build-v8-snapshot-dev": "node --max-old-space-size=8192 tooling/v8-snapshot/scripts/setup-v8-snapshot-in-cypress.js --env=dev",
|
||||
"build-v8-snapshot-prod": "node --max-old-space-size=8192 tooling/v8-snapshot/scripts/setup-v8-snapshot-in-cypress.js",
|
||||
"check-node-version": "node scripts/check-node-version.js",
|
||||
"check-terminal": "node scripts/check-terminal.js",
|
||||
"clean": "lerna run clean --parallel --no-bail || echo 'ok, errors while cleaning'",
|
||||
"clean": "lerna run clean --no-bail || echo 'ok, errors while cleaning'",
|
||||
"check-ts": "yarn lerna run check-ts",
|
||||
"clean-deps": "find . -depth -name node_modules -type d -exec rimraf {} \\;",
|
||||
"clean-untracked-files": "git clean -d -f",
|
||||
@@ -174,10 +173,10 @@
|
||||
"http-server": "0.12.3",
|
||||
"human-interval": "1.0.0",
|
||||
"husky": "7.0.2",
|
||||
"inquirer": "3.3.0",
|
||||
"inquirer": "8.2.4",
|
||||
"inquirer-confirm": "2.0.3",
|
||||
"lazy-ass": "1.6.0",
|
||||
"lerna": "5.4.3",
|
||||
"lerna": "6.6.2",
|
||||
"lint-staged": "11.1.2",
|
||||
"listr2": "3.8.3",
|
||||
"lodash": "^4.17.21",
|
||||
@@ -209,7 +208,7 @@
|
||||
"through2": "^4.0.2",
|
||||
"tree-kill": "1.2.2",
|
||||
"ts-node": "^10.9.1",
|
||||
"typescript": "^4.7.4",
|
||||
"typescript": "4.7.4",
|
||||
"yarn-deduplicate": "3.1.0"
|
||||
},
|
||||
"engines": {
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"check-ts": "vue-tsc --noEmit",
|
||||
"build-prod-ui": "cross-env NODE_ENV=production vite build",
|
||||
"build": "vite build",
|
||||
"clean": "rimraf dist && echo 'cleaned'",
|
||||
"clean-deps": "rimraf node_modules",
|
||||
"test": "echo 'ok'",
|
||||
@@ -79,5 +79,11 @@
|
||||
},
|
||||
"files": [
|
||||
"dist"
|
||||
]
|
||||
],
|
||||
"nx": {
|
||||
"implicitDependencies": [
|
||||
"@packages/data-context",
|
||||
"@packages/graphql"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
src/**/*.js
|
||||
@@ -9,7 +9,7 @@ import {
|
||||
testingTypeBreakingOptions,
|
||||
} from './options'
|
||||
|
||||
import type { TestingType } from '@packages/types'
|
||||
import type { BreakingErrResult, TestingType } from '@packages/types'
|
||||
import type { BreakingOption, BreakingOptionErrorKey, OverrideLevel } from './options'
|
||||
import type { ErrResult } from './validation'
|
||||
|
||||
@@ -60,14 +60,6 @@ export type InvalidTestOverrideResult = {
|
||||
supportedOverrideLevel: string
|
||||
}
|
||||
|
||||
export type BreakingErrResult = {
|
||||
name: string
|
||||
newName?: string
|
||||
value?: any
|
||||
configFile: string
|
||||
testingType?: TestingType
|
||||
}
|
||||
|
||||
type ErrorHandler = (
|
||||
key: BreakingOptionErrorKey,
|
||||
options: BreakingErrResult
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
"main": "index.js",
|
||||
"browser": "src/index.ts",
|
||||
"scripts": {
|
||||
"build": "node ./scripts/build.js",
|
||||
"build-prod": "tsc || echo 'built, with errors'",
|
||||
"check-ts": "tsc --noEmit && yarn -s tslint",
|
||||
"clean-deps": "rimraf node_modules",
|
||||
@@ -87,5 +88,17 @@
|
||||
"files": [
|
||||
"src"
|
||||
],
|
||||
"types": "src/index.ts"
|
||||
"types": "src/index.ts",
|
||||
"nx": {
|
||||
"targets": {
|
||||
"build": {
|
||||
"outputs": [
|
||||
"{projectRoot}/src/gen/urql-introspection.gen.ts"
|
||||
]
|
||||
}
|
||||
},
|
||||
"implicitDependencies": [
|
||||
"@packages/graphql"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
const fs = require('fs-extra')
|
||||
const { buildSchema, introspectionFromSchema } = require('graphql')
|
||||
const path = require('path')
|
||||
const { minifyIntrospectionQuery } = require('@urql/introspection')
|
||||
|
||||
const graphQlPackageRoot = path.join(__dirname, '..', '..', 'graphql')
|
||||
const dataContextRoot = path.join(__dirname, '..')
|
||||
|
||||
async function generateDataContextSchema () {
|
||||
const schemaContents = await fs.promises.readFile(path.join(graphQlPackageRoot, 'schemas/schema.graphql'), 'utf8')
|
||||
const schema = buildSchema(schemaContents, { assumeValid: true })
|
||||
|
||||
const URQL_INTROSPECTION_PATH = path.join(dataContextRoot, 'src/gen/urql-introspection.gen.ts')
|
||||
|
||||
await fs.ensureDir(path.dirname(URQL_INTROSPECTION_PATH))
|
||||
|
||||
await fs.promises.writeFile(
|
||||
URQL_INTROSPECTION_PATH,
|
||||
`/* eslint-disable */\nexport const urqlSchema = ${JSON.stringify(minifyIntrospectionQuery(introspectionFromSchema(schema)), null, 2)} as const`,
|
||||
)
|
||||
}
|
||||
|
||||
generateDataContextSchema()
|
||||
@@ -5,7 +5,6 @@
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"build": "node ./bin/cypress-electron --install",
|
||||
"build-prod": "yarn build",
|
||||
"clean-deps": "rimraf node_modules",
|
||||
"postinstall": "echo '@packages/electron needs: yarn build'",
|
||||
"start": "./bin/cypress-electron",
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
"strip-ansi": "6.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@packages/config": "0.0.0-development",
|
||||
"@packages/ts": "0.0.0-development",
|
||||
"@packages/types": "0.0.0-development",
|
||||
"@types/chai": "4.2.15",
|
||||
|
||||
@@ -4,8 +4,7 @@ import chalk from 'chalk'
|
||||
import _ from 'lodash'
|
||||
import path from 'path'
|
||||
import stripAnsi from 'strip-ansi'
|
||||
import type { TestingType } from '@packages/types'
|
||||
import type { BreakingErrResult } from '@packages/config'
|
||||
import type { BreakingErrResult, TestingType } from '@packages/types'
|
||||
import { humanTime, logError, parseResolvedPattern, pluralize } from './errorUtils'
|
||||
import { errPartial, errTemplate, fmt, theme, PartialErr } from './errTemplate'
|
||||
import { stackWithoutMessage } from './stackUtils'
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
"test-e2e": "cypress run",
|
||||
"test-unit": "echo 'no unit tests'",
|
||||
"build": "node ./bin/build.js && gulp build",
|
||||
"build-prod": "yarn build",
|
||||
"predeploy": "yarn build",
|
||||
"deploy": "gh-pages -d build -b gh-pages"
|
||||
},
|
||||
@@ -28,5 +27,16 @@
|
||||
"cypress",
|
||||
"lib"
|
||||
],
|
||||
"types": "index.d.ts"
|
||||
"types": "index.d.ts",
|
||||
"nx": {
|
||||
"targets": {
|
||||
"build": {
|
||||
"outputs": [
|
||||
"{projectRoot}/cypress",
|
||||
"{projectRoot}/app",
|
||||
"{projectRoot}/build"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"build": "gulp build",
|
||||
"build-prod": "yarn build",
|
||||
"clean": "gulp clean",
|
||||
"clean-deps": "rimraf node_modules",
|
||||
"postinstall": "echo '@packages/extension needs: yarn build'",
|
||||
|
||||
@@ -142,7 +142,7 @@ Our GraphQL frontend client is [urql](https://formidable.com/open-source/urql/)
|
||||
By convention, we use a prop named `gql` to represent the source of data, so it is common to see things like `props.gql.currentProject`.
|
||||
|
||||
### Use of GraphQL by shared components is limited to `src/gql-components`
|
||||
In the long run, files in the `src/components` directory are intended as the foundation of a design system. As such they may be used in many contexts other than the Cypress App and Launchpad. There are some components that are only intended to be shared between App and Launchpad and make use of GraphQL queries and mutations. These will only work correctly if placed within `src/gql-components` directory, because only that directory is specified in [graphql-codegen.yml](graphql-codegen.yml). This is intended to maintain the separation between genuinely reusable components driven by props and events, and gql-driven components that are tightly bound to the implementation of App and Launchpad.
|
||||
In the long run, files in the `src/components` directory are intended as the foundation of a design system. As such they may be used in many contexts other than the Cypress App and Launchpad. There are some components that are only intended to be shared between App and Launchpad and make use of GraphQL queries and mutations. These will only work correctly if placed within `src/gql-components` directory, because only that directory is specified in [graphql-codegen.yml](../graphql/graphql-codegen.yml). This is intended to maintain the separation between genuinely reusable components driven by props and events, and gql-driven components that are tightly bound to the implementation of App and Launchpad.
|
||||
|
||||
## Generating Fixtures
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
"version": "0.0.0-development",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"build": "node ./script/build.js",
|
||||
"check-ts": "vue-tsc --noEmit",
|
||||
"clean-deps": "rimraf node_modules",
|
||||
"clean": "rimraf dist ./node_modules/.vite src/*.js src/**/*.js && echo 'cleaned'",
|
||||
@@ -87,5 +88,21 @@
|
||||
"@toycode/markdown-it-class",
|
||||
"patch-package"
|
||||
]
|
||||
},
|
||||
"nx": {
|
||||
"targets": {
|
||||
"build": {
|
||||
"dependsOn": [
|
||||
"generate-shiki-theme"
|
||||
],
|
||||
"outputs": [
|
||||
"{projectRoot}/src/generated/schema-for-tests.gen.json"
|
||||
]
|
||||
}
|
||||
},
|
||||
"implicitDependencies": [
|
||||
"@packages/data-context",
|
||||
"@packages/graphql"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
const fs = require('fs-extra')
|
||||
const { buildSchema, extendSchema, parse, introspectionFromSchema, isObjectType } = require('graphql')
|
||||
const path = require('path')
|
||||
|
||||
const graphQlPackageRoot = path.join(__dirname, '..', '..', 'graphql')
|
||||
const frontendSharedRoot = path.join(__dirname, '..')
|
||||
|
||||
/**
|
||||
* Adds two fields to the GraphQL types specific to testing
|
||||
*
|
||||
* @param schema
|
||||
* @returns
|
||||
*/
|
||||
function generateTestExtensions (schema) {
|
||||
const objects = []
|
||||
const typesMap = schema.getTypeMap()
|
||||
|
||||
for (const [typeName, type] of Object.entries(typesMap)) {
|
||||
if (!typeName.startsWith('__') && isObjectType(type)) {
|
||||
if (isObjectType(type)) {
|
||||
objects.push(typeName)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return `
|
||||
union TestUnion = ${objects.join(' | ')}
|
||||
|
||||
extend type Query {
|
||||
testFragmentMember: TestUnion!
|
||||
testFragmentMemberList(count: Int = 2): [TestUnion!]!
|
||||
}
|
||||
`
|
||||
}
|
||||
|
||||
async function generateFrontendSchema () {
|
||||
const schemaContents = await fs.promises.readFile(path.join(graphQlPackageRoot, 'schemas/schema.graphql'), 'utf8')
|
||||
const schema = buildSchema(schemaContents, { assumeValid: true })
|
||||
const testExtensions = generateTestExtensions(schema)
|
||||
const extendedSchema = extendSchema(schema, parse(testExtensions))
|
||||
|
||||
await fs.ensureDir(path.join(frontendSharedRoot, 'src/generated'))
|
||||
await fs.writeFile(path.join(frontendSharedRoot, 'src/generated/schema-for-tests.gen.json'), JSON.stringify(introspectionFromSchema(extendedSchema), null, 2))
|
||||
}
|
||||
|
||||
generateFrontendSchema()
|
||||
@@ -8,7 +8,7 @@ documentFilters: &documentFilters
|
||||
avoidOptionals: true
|
||||
|
||||
vueOperations: &vueOperations
|
||||
schema: './packages/graphql/schemas/schema.graphql'
|
||||
schema: './schemas/schema.graphql'
|
||||
config:
|
||||
<<: *documentFilters
|
||||
plugins:
|
||||
@@ -22,7 +22,7 @@ vueOperations: &vueOperations
|
||||
flattenGeneratedTypes: true
|
||||
|
||||
vueTesting: &vueTesting
|
||||
schema: './packages/graphql/schemas/schema.graphql'
|
||||
schema: './schemas/schema.graphql'
|
||||
config:
|
||||
<<: *documentFilters
|
||||
plugins:
|
||||
@@ -48,28 +48,28 @@ generates:
|
||||
# Generates types for us to infer the correct "source types" when we mock out on the frontend
|
||||
# This ensures we have proper type checking when we're using cy.mountFragment in component tests
|
||||
###
|
||||
'./packages/frontend-shared/cypress/support/generated/test-graphql-types.gen.ts':
|
||||
schema: 'packages/graphql/schemas/schema.graphql'
|
||||
'../frontend-shared/cypress/support/generated/test-graphql-types.gen.ts':
|
||||
schema: 'schemas/schema.graphql'
|
||||
plugins:
|
||||
- add:
|
||||
content: '/* eslint-disable */'
|
||||
- 'typescript':
|
||||
nonOptionalTypename: true
|
||||
- 'packages/frontend-shared/script/codegen-type-map.js'
|
||||
- '../frontend-shared/script/codegen-type-map.js'
|
||||
|
||||
'./packages/graphql/src/gen/test-cloud-graphql-types.gen.ts':
|
||||
schema: 'packages/graphql/schemas/cloud.graphql'
|
||||
'./src/gen/test-cloud-graphql-types.gen.ts':
|
||||
schema: 'schemas/cloud.graphql'
|
||||
plugins:
|
||||
- add:
|
||||
content: '/* eslint-disable */'
|
||||
- 'typescript':
|
||||
nonOptionalTypename: true
|
||||
- 'packages/frontend-shared/script/codegen-type-map.js'
|
||||
- '../frontend-shared/script/codegen-type-map.js'
|
||||
|
||||
'./packages/graphql/src/gen/cloud-source-types.gen.ts':
|
||||
'./src/gen/cloud-source-types.gen.ts':
|
||||
config:
|
||||
useTypeImports: true
|
||||
schema: 'packages/graphql/schemas/cloud.graphql'
|
||||
schema: 'schemas/cloud.graphql'
|
||||
plugins:
|
||||
- add:
|
||||
content: '/* eslint-disable */'
|
||||
@@ -79,10 +79,10 @@ generates:
|
||||
###
|
||||
# Generates types for us to infer the correct keys for graphcache
|
||||
###
|
||||
'./packages/data-context/src/gen/graphcache-config.gen.ts':
|
||||
'../data-context/src/gen/graphcache-config.gen.ts':
|
||||
config:
|
||||
useTypeImports: true
|
||||
schema: 'packages/graphql/schemas/schema.graphql'
|
||||
schema: 'schemas/schema.graphql'
|
||||
plugins:
|
||||
- add:
|
||||
content: '/* eslint-disable */'
|
||||
@@ -93,39 +93,39 @@ generates:
|
||||
# All of the GraphQL Query/Mutation documents we import for use in the .{vue,ts,tsx,js,jsx}
|
||||
# files for useQuery / useMutation, as well as types associated with the fragments
|
||||
###
|
||||
'./packages/launchpad/src/generated/graphql.ts':
|
||||
'../launchpad/src/generated/graphql.ts':
|
||||
documents:
|
||||
- './packages/launchpad/src/**/*.{vue,ts,tsx,js,jsx}'
|
||||
- './packages/frontend-shared/src/**/*.{vue,ts,tsx,js,jsx}'
|
||||
- '../launchpad/src/**/*.{vue,ts,tsx,js,jsx}'
|
||||
- '../frontend-shared/src/**/*.{vue,ts,tsx,js,jsx}'
|
||||
<<: *vueOperations
|
||||
|
||||
'./packages/app/src/generated/graphql.ts':
|
||||
'../app/src/generated/graphql.ts':
|
||||
documents:
|
||||
- './packages/app/src/**/*.{vue,ts,tsx,js,jsx}'
|
||||
- './packages/frontend-shared/src/**/*.{vue,ts,tsx,js,jsx}'
|
||||
- '../app/src/**/*.{vue,ts,tsx,js,jsx}'
|
||||
- '../frontend-shared/src/**/*.{vue,ts,tsx,js,jsx}'
|
||||
<<: *vueOperations
|
||||
|
||||
'./packages/frontend-shared/src/generated/graphql.ts':
|
||||
documents: './packages/frontend-shared/src/{gql-components,graphql,composables}/**/*.{vue,ts,tsx,js,jsx}'
|
||||
'../frontend-shared/src/generated/graphql.ts':
|
||||
documents: '../frontend-shared/src/{gql-components,graphql,composables}/**/*.{vue,ts,tsx,js,jsx}'
|
||||
<<: *vueOperations
|
||||
###
|
||||
# All GraphQL documents imported into the .spec.tsx files for component testing.
|
||||
# Similar to generated/graphql.ts, except it doesn't include the flattening for the document nodes,
|
||||
# so we can actually use the document in cy.mountFragment
|
||||
###
|
||||
'./packages/launchpad/src/generated/graphql-test.ts':
|
||||
'../launchpad/src/generated/graphql-test.ts':
|
||||
documents:
|
||||
- './packages/launchpad/src/**/*.{vue,ts,tsx,js,jsx}'
|
||||
- './packages/frontend-shared/src/**/*.{vue,ts,tsx,js,jsx}'
|
||||
- '../launchpad/src/**/*.{vue,ts,tsx,js,jsx}'
|
||||
- '../frontend-shared/src/**/*.{vue,ts,tsx,js,jsx}'
|
||||
<<: *vueTesting
|
||||
|
||||
'./packages/app/src/generated/graphql-test.ts':
|
||||
'../app/src/generated/graphql-test.ts':
|
||||
documents:
|
||||
- './packages/app/src/**/*.{vue,ts,tsx,js,jsx}'
|
||||
- './packages/frontend-shared/src/gql-components/**/*.{vue,ts,tsx,js,jsx}'
|
||||
- '../app/src/**/*.{vue,ts,tsx,js,jsx}'
|
||||
- '../frontend-shared/src/gql-components/**/*.{vue,ts,tsx,js,jsx}'
|
||||
<<: *vueTesting
|
||||
|
||||
'./packages/frontend-shared/src/generated/graphql-test.ts':
|
||||
'../frontend-shared/src/generated/graphql-test.ts':
|
||||
documents:
|
||||
- './packages/frontend-shared/src/gql-components/**/*.{vue,ts,tsx,js,jsx}'
|
||||
- '../frontend-shared/src/gql-components/**/*.{vue,ts,tsx,js,jsx}'
|
||||
<<: *vueTesting
|
||||
@@ -5,6 +5,8 @@
|
||||
"main": "index.js",
|
||||
"browser": "src/index.ts",
|
||||
"scripts": {
|
||||
"nexus-build": "ts-node ./scripts/nexus-build.ts",
|
||||
"build": "graphql-codegen --config graphql-codegen.yml",
|
||||
"build-prod": "tsc || echo 'built, with errors'",
|
||||
"check-ts": "tsc --noEmit && yarn -s tslint",
|
||||
"clean-deps": "rimraf node_modules",
|
||||
@@ -47,5 +49,32 @@
|
||||
"src",
|
||||
"schemas"
|
||||
],
|
||||
"types": "src/index.ts"
|
||||
"types": "src/index.ts",
|
||||
"nx": {
|
||||
"targets": {
|
||||
"nexus-build": {
|
||||
"outputs": [
|
||||
"{projectRoot}/src/gen/nxs.gen.ts",
|
||||
"{projectRoot}/schemas/schema.graphql"
|
||||
]
|
||||
},
|
||||
"build": {
|
||||
"dependsOn": [
|
||||
"nexus-build"
|
||||
],
|
||||
"outputs": [
|
||||
"{workspaceRoot}/packages/frontend-shared/cypress/support/generated/test-graphql-types.gen.ts",
|
||||
"{projectRoot}/src/gen/test-cloud-graphql-types.gen.ts",
|
||||
"{projectRoot}/src/gen/cloud-source-types.gen.ts",
|
||||
"{workspaceRoot}/packages/data-context/src/gen/graphcache-config.gen.ts",
|
||||
"{workspaceRoot}/packages/launchpad/src/generated/graphql.ts",
|
||||
"{workspaceRoot}/packages/app/src/generated/graphql.ts",
|
||||
"{workspaceRoot}/packages/frontend-shared/src/generated/graphql.ts",
|
||||
"{workspaceRoot}/packages/launchpad/src/generated/graphql-test.ts",
|
||||
"{workspaceRoot}/packages/app/src/generated/graphql-test.ts",
|
||||
"{workspaceRoot}/packages/frontend-shared/src/generated/graphql-test.ts"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
import { nexusCodegen } from '../src/utils/nexusTypegenUtils'
|
||||
|
||||
nexusCodegen()
|
||||
@@ -2,3 +2,4 @@
|
||||
// created by autobarrel, do not modify directly
|
||||
|
||||
export * from './graphqlTypeUtils'
|
||||
export * from './nexusTypegenUtils'
|
||||
|
||||
@@ -0,0 +1,130 @@
|
||||
/* eslint-disable no-console */
|
||||
/* eslint-disable no-restricted-syntax */
|
||||
import { spawn, execSync } from 'child_process'
|
||||
import chalk from 'chalk'
|
||||
import pDefer from 'p-defer'
|
||||
import chokidar from 'chokidar'
|
||||
import _ from 'lodash'
|
||||
import path from 'path'
|
||||
import fs from 'fs-extra'
|
||||
|
||||
const graphQlPackageRoot = path.join(__dirname, '..', '..')
|
||||
|
||||
interface NexusTypegenCfg {
|
||||
cwd: string
|
||||
/**
|
||||
* Path to the file we need to execute to generate the schema
|
||||
*/
|
||||
filePath: string
|
||||
outputPath?: string
|
||||
}
|
||||
|
||||
function prefixTypegen (s: string) {
|
||||
return `${chalk.cyan('nexusTypegen')}: ${s}`
|
||||
}
|
||||
|
||||
async function windowsTouch (filename: string, time: Date) {
|
||||
// `fs.utimesSync` is used here to prevent existing file contents from being overwritten.
|
||||
// It also updates the last modification timestamp of the file, which is consistent with what POSIX touch does.
|
||||
try {
|
||||
fs.utimesSync(filename, time, time)
|
||||
} catch (e) {
|
||||
fs.closeSync(fs.openSync(filename, 'w'))
|
||||
}
|
||||
}
|
||||
|
||||
export async function nexusTypegen (cfg: NexusTypegenCfg) {
|
||||
const dfd = pDefer()
|
||||
|
||||
if (cfg.outputPath) {
|
||||
await fs.ensureDir(path.join(graphQlPackageRoot, 'src/gen'))
|
||||
|
||||
const pkgGraphql = path.join(graphQlPackageRoot, 'src/gen/cloud-source-types.gen.ts')
|
||||
|
||||
// on windows there is no `touch` equivalent command
|
||||
if (process.platform === 'win32') {
|
||||
const time = new Date()
|
||||
|
||||
await windowsTouch(pkgGraphql, time)
|
||||
await windowsTouch(cfg.outputPath, time)
|
||||
} else {
|
||||
execSync(`touch ${pkgGraphql}`)
|
||||
execSync(`touch ${cfg.outputPath}`)
|
||||
}
|
||||
}
|
||||
|
||||
const nodeCmd = `node${process.platform === 'win32' ? '.cmd' : ''}`
|
||||
const out = spawn(nodeCmd, ['-r', '@packages/ts/register', cfg.filePath], {
|
||||
cwd: cfg.cwd,
|
||||
env: {
|
||||
...process.env,
|
||||
CYPRESS_INTERNAL_NEXUS_CODEGEN: 'true',
|
||||
TS_NODE_CACHE: 'false',
|
||||
},
|
||||
})
|
||||
|
||||
out.stderr.on('data', (data) => {
|
||||
process.stdout.write(prefixTypegen(chalk.red(String(data))))
|
||||
dfd.resolve({})
|
||||
})
|
||||
|
||||
out.stdout.on('data', (data) => {
|
||||
const outString = String(data)
|
||||
.split('\n')
|
||||
.map((s) => prefixTypegen(chalk.magentaBright(s)))
|
||||
.join('\n')
|
||||
|
||||
process.stdout.write('\n')
|
||||
process.stdout.write(outString)
|
||||
process.stdout.write('\n')
|
||||
dfd.resolve({})
|
||||
})
|
||||
|
||||
out.on('error', dfd.reject)
|
||||
|
||||
return dfd.promise
|
||||
}
|
||||
|
||||
let debounced: Record<string, Function> = {}
|
||||
|
||||
const nexusTypegenDebounced = (cfg: NexusTypegenCfg) => {
|
||||
debounced[cfg.filePath] =
|
||||
debounced[cfg.filePath] ?? _.debounce(nexusTypegen, 500)
|
||||
|
||||
// @ts-expect-error
|
||||
debounced[cfg.filePath](cfg)
|
||||
}
|
||||
|
||||
interface NexusTypegenWatchCfg extends NexusTypegenCfg {
|
||||
watchPaths: string[]
|
||||
}
|
||||
|
||||
export async function watchNexusTypegen (cfg: NexusTypegenWatchCfg) {
|
||||
const dfd = pDefer()
|
||||
|
||||
const watcher = chokidar.watch(cfg.watchPaths, {
|
||||
cwd: cfg.cwd,
|
||||
ignored: /\.gen\.ts/,
|
||||
ignoreInitial: true,
|
||||
})
|
||||
|
||||
watcher.on('all', (evt, path) => {
|
||||
console.log(prefixTypegen(`${evt} ${path}`))
|
||||
nexusTypegenDebounced(cfg)
|
||||
})
|
||||
|
||||
watcher.on('ready', () => {
|
||||
console.log(prefixTypegen(`Codegen Watcher Ready for ${cfg.filePath}`))
|
||||
nexusTypegen(cfg).then(dfd.resolve, dfd.reject)
|
||||
})
|
||||
|
||||
return dfd.promise
|
||||
}
|
||||
|
||||
export async function nexusCodegen () {
|
||||
return nexusTypegen({
|
||||
cwd: graphQlPackageRoot,
|
||||
filePath: path.join(graphQlPackageRoot, 'src/schema.ts'),
|
||||
outputPath: path.join(graphQlPackageRoot, 'src/gen/nxs.gen.ts'),
|
||||
})
|
||||
}
|
||||
@@ -39,5 +39,10 @@
|
||||
"index.js",
|
||||
"lib"
|
||||
],
|
||||
"types": "index.ts"
|
||||
"types": "index.ts",
|
||||
"nx": {
|
||||
"implicitDependencies": [
|
||||
"@packages/graphql"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"check-ts": "vue-tsc --noEmit",
|
||||
"build-prod-ui": "cross-env NODE_ENV=production vite build",
|
||||
"build": "vite build",
|
||||
"clean": "rimraf dist && rimraf dist-e2e && echo 'cleaned'",
|
||||
"clean-deps": "rimraf node_modules",
|
||||
"test": "yarn cypress:run:ct && yarn types",
|
||||
@@ -74,5 +74,10 @@
|
||||
},
|
||||
"files": [
|
||||
"dist"
|
||||
]
|
||||
],
|
||||
"nx": {
|
||||
"implicitDependencies": [
|
||||
"@packages/graphql"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
"main": "dist/require.js",
|
||||
"scripts": {
|
||||
"build": "tsc",
|
||||
"build-prod": "yarn build",
|
||||
"check-ts": "tsc --noEmit && yarn -s tslint",
|
||||
"clean-deps": "rimraf node_modules",
|
||||
"clean": "rimraf dist",
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
lib/**/*.js
|
||||
@@ -0,0 +1 @@
|
||||
lib/**/*.js
|
||||
@@ -0,0 +1 @@
|
||||
src/**/*.js
|
||||
@@ -0,0 +1 @@
|
||||
lib/**/*.js
|
||||
@@ -7,7 +7,6 @@
|
||||
"browser": "src/browser.ts",
|
||||
"scripts": {
|
||||
"build": "tsc",
|
||||
"build-prod": "yarn build",
|
||||
"check-ts": "tsc --noEmit && yarn -s tslint",
|
||||
"clean": "rimraf dist",
|
||||
"test": "yarn test-unit",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/// <reference path="../../../cli/types/cypress.d.ts" />
|
||||
|
||||
import type { AllModeOptions } from '.'
|
||||
import type { AllModeOptions, TestingType } from '.'
|
||||
|
||||
export const RESOLVED_FROM = ['default', 'config', 'plugin', 'envFile', 'env', 'cli', 'runtime'] as const
|
||||
|
||||
@@ -61,3 +61,11 @@ export type BannersState = {
|
||||
export type MajorVersionWelcomeDismissed = {
|
||||
[key: string]: number
|
||||
}
|
||||
|
||||
export type BreakingErrResult = {
|
||||
name: string
|
||||
newName?: string
|
||||
value?: any
|
||||
configFile: string
|
||||
testingType?: TestingType
|
||||
}
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
"main": "dist/snapshot-require.js",
|
||||
"scripts": {
|
||||
"build": "tsc",
|
||||
"build-prod": "yarn build",
|
||||
"check-ts": "tsc --noEmit && yarn -s tslint",
|
||||
"clean-deps": "rimraf node_modules",
|
||||
"clean": "rimraf dist",
|
||||
|
||||
@@ -100,7 +100,12 @@ export async function buildCypressApp (options: BuildCypressAppOpts) {
|
||||
if (!keepBuild) {
|
||||
log('#buildPackages')
|
||||
|
||||
await execa('yarn', ['lerna', 'run', 'build-prod', '--ignore', 'cli', '--concurrency', '4'], {
|
||||
await execa('yarn', ['lerna', 'run', 'build', '--concurrency', '4'], {
|
||||
stdio: 'inherit',
|
||||
cwd: CY_ROOT_DIR,
|
||||
})
|
||||
|
||||
await execa('yarn', ['lerna', 'run', 'build-prod', '--concurrency', '4'], {
|
||||
stdio: 'inherit',
|
||||
cwd: CY_ROOT_DIR,
|
||||
})
|
||||
|
||||
@@ -10,6 +10,7 @@ const { getNextVersionForBinary } = require('../get-next-version')
|
||||
const { nextVersion } = await getNextVersionForBinary()
|
||||
|
||||
const body = JSON.stringify({
|
||||
branch: 'lerna-optimize-tasks',
|
||||
parameters: {
|
||||
temp_dir: os.tmpdir(),
|
||||
sha: process.env.CIRCLE_SHA1,
|
||||
|
||||
@@ -11,10 +11,9 @@ import gulp from 'gulp'
|
||||
import { autobarrelWatcher } from './tasks/gulpAutobarrel'
|
||||
import { startCypressWatch, openCypressLaunchpad, openCypressApp, runCypressLaunchpad, wrapRunWithExit, runCypressApp, killExistingCypress } from './tasks/gulpCypress'
|
||||
import { graphqlCodegen, graphqlCodegenWatch, nexusCodegen, nexusCodegenWatch, generateFrontendSchema, syncRemoteGraphQL } from './tasks/gulpGraphql'
|
||||
import { viteApp, viteCleanApp, viteCleanLaunchpad, viteLaunchpad, viteBuildApp, viteBuildAndWatchApp, viteBuildLaunchpad, viteBuildAndWatchLaunchpad, generateShikiTheme, viteClean } from './tasks/gulpVite'
|
||||
import { viteApp, viteCleanApp, viteCleanLaunchpad, viteLaunchpad, viteBuildApp, viteBuildAndWatchApp, viteBuildLaunchpad, viteBuildAndWatchLaunchpad, viteClean } from './tasks/gulpVite'
|
||||
import { makePathMap } from './utils/makePathMap'
|
||||
import { makePackage } from './tasks/gulpMakePackage'
|
||||
import { exitAfterAll } from './tasks/gulpRegistry'
|
||||
import { execSync } from 'child_process'
|
||||
import { webpackReporter, webpackRunner } from './tasks/gulpWebpack'
|
||||
import { e2eTestScaffold, e2eTestScaffoldWatch } from './tasks/gulpE2ETestScaffold'
|
||||
@@ -116,30 +115,6 @@ gulp.task('open', startCypressWatch)
|
||||
* Tasks that aren't watched. Usually composed together with other tasks.
|
||||
*------------------------------------------------------------------------**/
|
||||
|
||||
gulp.task('buildProd',
|
||||
gulp.series(
|
||||
viteClean,
|
||||
e2eTestScaffold,
|
||||
|
||||
nexusCodegen,
|
||||
graphqlCodegen,
|
||||
generateShikiTheme,
|
||||
|
||||
// Build the frontend(s) for production.
|
||||
gulp.parallel(
|
||||
viteBuildApp,
|
||||
viteBuildLaunchpad,
|
||||
),
|
||||
))
|
||||
|
||||
gulp.task(
|
||||
'postinstall',
|
||||
gulp.series(
|
||||
'buildProd',
|
||||
exitAfterAll,
|
||||
),
|
||||
)
|
||||
|
||||
gulp.task('watchForE2E', gulp.series(
|
||||
'codegen',
|
||||
gulp.series(
|
||||
@@ -170,9 +145,6 @@ gulp.task('watchForE2E', gulp.series(
|
||||
*------------------------------------------------------------------------**/
|
||||
|
||||
gulp.task('cyRunLaunchpadE2E', gulp.series(
|
||||
// 1. Build the Cypress App itself
|
||||
'buildProd',
|
||||
|
||||
// Ensure we have no existing cypress processes running
|
||||
killExistingCypress,
|
||||
|
||||
@@ -183,9 +155,6 @@ gulp.task('cyRunLaunchpadE2E', gulp.series(
|
||||
))
|
||||
|
||||
gulp.task('cyRunAppE2E', gulp.series(
|
||||
// 1. Build the Cypress App itself
|
||||
'buildProd',
|
||||
|
||||
killExistingCypress,
|
||||
|
||||
// 5. Start the REAL Cypress App, which will execute the integration specs.
|
||||
|
||||
@@ -36,14 +36,14 @@ export async function nexusCodegenWatch () {
|
||||
|
||||
export async function graphqlCodegen () {
|
||||
return spawned('gql-codegen', 'yarn graphql-codegen --config graphql-codegen.yml', {
|
||||
cwd: monorepoPaths.root,
|
||||
cwd: monorepoPaths.pkgGraphql,
|
||||
waitForExit: true,
|
||||
})
|
||||
}
|
||||
|
||||
export async function graphqlCodegenWatch () {
|
||||
const spawned = universalSpawn('graphql-codegen', ['--watch', '--config', 'graphql-codegen.yml'], {
|
||||
cwd: monorepoPaths.root,
|
||||
cwd: monorepoPaths.pkgGraphql,
|
||||
})
|
||||
const dfd = pDefer()
|
||||
let hasResolved = false
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
{
|
||||
"name": "internal-scripts",
|
||||
"version": "0.0.0-development",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"lint": "eslint --ext .js,.ts,.json, ."
|
||||
|
||||
@@ -3,8 +3,8 @@ const { execSync } = require('child_process')
|
||||
const executionEnv = process.env.CI ? 'ci' : 'local'
|
||||
|
||||
const postInstallCommands = {
|
||||
local: 'patch-package && yarn-deduplicate --strategy=highest && yarn clean && gulp postinstall && yarn workspace @packages/server rebuild-better-sqlite3 && yarn build && yarn build-v8-snapshot-dev',
|
||||
ci: 'patch-package && yarn clean && gulp postinstall && yarn workspace @packages/server rebuild-better-sqlite3',
|
||||
local: 'patch-package && yarn-deduplicate --strategy=highest && lerna run rebuild-better-sqlite3 --scope @packages/server && yarn build && yarn build-v8-snapshot-dev',
|
||||
ci: 'patch-package && lerna run rebuild-better-sqlite3 --scope @packages/server',
|
||||
}
|
||||
|
||||
execSync(postInstallCommands[executionEnv], {
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
"main": "lib/fixtures.ts",
|
||||
"browser": "lib/fixtureDirs.ts",
|
||||
"scripts": {
|
||||
"build": "node ./scripts/scaffold.js",
|
||||
"lint": "eslint . --ext .js,.ts,.jsx,.tsx",
|
||||
"type-check": "tsc --project .",
|
||||
"clean-deps": "find . -depth -name node_modules -type d -exec rimraf {} \\;",
|
||||
@@ -92,5 +93,17 @@
|
||||
"types": "lib/fixtures.ts",
|
||||
"license": "ISC",
|
||||
"author": "",
|
||||
"keywords": []
|
||||
"keywords": [],
|
||||
"nx": {
|
||||
"targets": {
|
||||
"build": {
|
||||
"outputs": [
|
||||
"{projectRoot}/lib/fixtureDirs.ts"
|
||||
],
|
||||
"dependsOn": [
|
||||
"!@packages/data-context:build"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,117 @@
|
||||
const chokidar = require('chokidar')
|
||||
const path = require('path')
|
||||
const fs = require('fs-extra')
|
||||
const _ = require('lodash')
|
||||
const minimist = require('minimist')
|
||||
|
||||
const toolingRoot = path.join(__dirname, '..')
|
||||
|
||||
const PROJECT_FIXTURE_DIRECTORY = 'projects'
|
||||
|
||||
const DIR_PATH = path.join(toolingRoot, PROJECT_FIXTURE_DIRECTORY)
|
||||
const OUTPUT_PATH = path.join(toolingRoot, 'lib/fixtureDirs.ts')
|
||||
|
||||
async function e2eTestScaffold () {
|
||||
return _e2eTestScaffold(true)
|
||||
}
|
||||
|
||||
async function _e2eTestScaffold (cleanupEmpty = true) {
|
||||
const possibleDirectories = await fs.readdir(DIR_PATH)
|
||||
const dirs = await Promise.all(possibleDirectories.map(async (dir) => {
|
||||
const fullPath = path.join(DIR_PATH, dir)
|
||||
const stat = await fs.stat(fullPath)
|
||||
|
||||
if (stat.isDirectory()) {
|
||||
if (await hasVisibleFileRecursive(fullPath)) {
|
||||
return fullPath
|
||||
}
|
||||
|
||||
if (cleanupEmpty) {
|
||||
await fs.remove(fullPath)
|
||||
}
|
||||
|
||||
return null
|
||||
}
|
||||
}))
|
||||
const allDirs = dirs.filter((dir) => dir)
|
||||
|
||||
await fs.writeFile(
|
||||
OUTPUT_PATH,
|
||||
`/* eslint-disable */
|
||||
// Auto-generated by ${path.basename(__filename)} (run yarn gulp e2eTestScaffold)
|
||||
export const fixtureDirs = [
|
||||
${allDirs
|
||||
.map((dir) => ` '${path.basename(dir)}'`).join(',\n')}
|
||||
] as const
|
||||
|
||||
export type ProjectFixtureDir = typeof fixtureDirs[number]
|
||||
`,
|
||||
)
|
||||
|
||||
return allDirs
|
||||
}
|
||||
|
||||
async function e2eTestScaffoldWatch () {
|
||||
const fixtureWatcher = chokidar.watch(PROJECT_FIXTURE_DIRECTORY, {
|
||||
cwd: toolingRoot,
|
||||
// ignoreInitial: true,
|
||||
depth: 0,
|
||||
})
|
||||
|
||||
fixtureWatcher.on('unlinkDir', () => {
|
||||
e2eTestScaffold()
|
||||
})
|
||||
|
||||
fixtureWatcher.on('addDir', _.debounce(() => {
|
||||
_e2eTestScaffold(false)
|
||||
}))
|
||||
|
||||
await e2eTestScaffold()
|
||||
}
|
||||
|
||||
/**
|
||||
* From the basePath, checks for a valid file within that directory. Used to ignore empty
|
||||
* system tests directories left over from switching branches
|
||||
*/
|
||||
async function hasVisibleFileRecursive (basePath) {
|
||||
if (basePath.endsWith('node_modules')) {
|
||||
return false
|
||||
}
|
||||
|
||||
const files = await fs.readdir(basePath)
|
||||
|
||||
const toCheck = await Promise.all(files.filter((f) => !f.startsWith('.')).map(async (f) => {
|
||||
try {
|
||||
return {
|
||||
file: f,
|
||||
stat: await fs.stat(path.join(basePath, f)),
|
||||
}
|
||||
} catch {
|
||||
return null
|
||||
}
|
||||
}))
|
||||
|
||||
if (toCheck.some((f) => f?.stat.isFile())) {
|
||||
return true
|
||||
}
|
||||
|
||||
const directories = toCheck.filter((f) => f?.stat.isDirectory())
|
||||
|
||||
if (directories.length) {
|
||||
for (const dir of directories) {
|
||||
if (dir?.file && await hasVisibleFileRecursive(path.join(basePath, dir?.file))) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
const options = minimist(process.argv)
|
||||
|
||||
if (options.watch) {
|
||||
e2eTestScaffoldWatch()
|
||||
} else {
|
||||
e2eTestScaffold()
|
||||
}
|
||||
@@ -53,5 +53,10 @@
|
||||
"@cypress/snapbuild-linux-ppc64le": "1.0.2",
|
||||
"@cypress/snapbuild-windows-32": "1.0.2",
|
||||
"@cypress/snapbuild-windows-64": "1.0.2"
|
||||
},
|
||||
"nx": {
|
||||
"implicitDependencies": [
|
||||
"@packages/graphql"
|
||||
]
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user