mirror of
https://github.com/cypress-io/cypress.git
synced 2026-01-05 14:09:46 -06:00
Merge branch 'develop' into release/14.0.0
This commit is contained in:
@@ -1554,7 +1554,7 @@ jobs:
|
||||
name: Run v8 integration tests
|
||||
command: |
|
||||
source ./scripts/ensure-node.sh
|
||||
yarn test-integration --scope "'@tooling/{packherd,v8-snapshot,electron-mksnapshot}'"
|
||||
yarn test-integration --scope=@tooling/{packherd,v8-snapshot,electron-mksnapshot}
|
||||
- verify-mocha-results:
|
||||
expectedResultCount: 3
|
||||
- when:
|
||||
@@ -1566,7 +1566,7 @@ jobs:
|
||||
name: Run v8 integration tests
|
||||
command: |
|
||||
source ./scripts/ensure-node.sh
|
||||
yarn test-integration --scope "'@tooling/packherd'"
|
||||
yarn test-integration --scope=@tooling/packherd
|
||||
- verify-mocha-results:
|
||||
expectedResultCount: 1
|
||||
- store_test_results:
|
||||
@@ -1690,7 +1690,7 @@ jobs:
|
||||
parallelism: 1
|
||||
steps:
|
||||
- restore_cached_workspace
|
||||
- run: yarn test-unit --scope @packages/server
|
||||
- run: yarn test-unit --scope=@packages/server
|
||||
- verify-mocha-results:
|
||||
expectedResultCount: 1
|
||||
- store_test_results:
|
||||
@@ -1736,7 +1736,7 @@ jobs:
|
||||
parallelism: 1
|
||||
steps:
|
||||
- restore_cached_workspace
|
||||
- run: yarn test-integration --scope @packages/server
|
||||
- run: yarn test-integration --scope=@packages/server
|
||||
- verify-mocha-results:
|
||||
expectedResultCount: 1
|
||||
- store_test_results:
|
||||
@@ -2084,7 +2084,7 @@ jobs:
|
||||
- restore_cached_workspace
|
||||
- run:
|
||||
name: Build
|
||||
command: yarn lerna run build --scope @cypress/webpack-preprocessor
|
||||
command: yarn lerna run build --scope=@cypress/webpack-preprocessor
|
||||
- run:
|
||||
name: Run tests
|
||||
command: yarn workspace @cypress/webpack-preprocessor test
|
||||
@@ -2129,7 +2129,7 @@ jobs:
|
||||
- restore_cached_workspace
|
||||
- run:
|
||||
name: Build
|
||||
command: yarn lerna run build --scope @cypress/vue
|
||||
command: yarn lerna run build --scope=@cypress/vue
|
||||
- store_test_results:
|
||||
path: npm/vue/test_results
|
||||
- store_artifacts:
|
||||
@@ -2142,7 +2142,7 @@ jobs:
|
||||
- restore_cached_workspace
|
||||
- run:
|
||||
name: Build
|
||||
command: yarn lerna run build --scope @cypress/angular
|
||||
command: yarn lerna run build --scope=@cypress/angular
|
||||
- store-npm-logs
|
||||
|
||||
npm-angular-signals:
|
||||
@@ -2151,7 +2151,7 @@ jobs:
|
||||
- restore_cached_workspace
|
||||
- run:
|
||||
name: Build
|
||||
command: yarn lerna run build --scope @cypress/angular-signals
|
||||
command: yarn lerna run build --scope=@cypress/angular-signals
|
||||
- store-npm-logs
|
||||
|
||||
npm-puppeteer-unit-tests:
|
||||
@@ -2160,7 +2160,7 @@ jobs:
|
||||
- restore_cached_workspace
|
||||
- run:
|
||||
name: Build
|
||||
command: yarn lerna run build --scope @cypress/puppeteer
|
||||
command: yarn lerna run build --scope=@cypress/puppeteer
|
||||
- run:
|
||||
name: Run tests
|
||||
command: yarn test
|
||||
@@ -2192,7 +2192,7 @@ jobs:
|
||||
- restore_cached_workspace
|
||||
- run:
|
||||
name: Build
|
||||
command: yarn lerna run build --scope @cypress/react
|
||||
command: yarn lerna run build --scope=@cypress/react
|
||||
- run:
|
||||
name: Run tests
|
||||
command: yarn test
|
||||
@@ -2209,7 +2209,7 @@ jobs:
|
||||
- restore_cached_workspace
|
||||
- run:
|
||||
name: Build
|
||||
command: yarn lerna run build --scope @cypress/vite-plugin-cypress-esm
|
||||
command: yarn lerna run build --scope=@cypress/vite-plugin-cypress-esm
|
||||
- run:
|
||||
name: Run tests
|
||||
command: yarn test
|
||||
@@ -2226,7 +2226,7 @@ jobs:
|
||||
- restore_cached_workspace
|
||||
- run:
|
||||
name: Build
|
||||
command: yarn lerna run build --scope @cypress/mount-utils
|
||||
command: yarn lerna run build --scope=@cypress/mount-utils
|
||||
- store-npm-logs
|
||||
|
||||
npm-grep:
|
||||
@@ -2258,7 +2258,7 @@ jobs:
|
||||
- run:
|
||||
name: Build + Install
|
||||
command: |
|
||||
yarn lerna run build --scope @cypress/schematic
|
||||
yarn lerna run build --scope=@cypress/schematic
|
||||
- run:
|
||||
name: Run unit tests
|
||||
command: |
|
||||
|
||||
3
.gitignore
vendored
3
.gitignore
vendored
@@ -398,3 +398,6 @@ tooling/v8-snapshot/cache/prod-win32
|
||||
|
||||
# Cloud API validations
|
||||
system-tests/lib/validations
|
||||
|
||||
.nx/cache
|
||||
.nx/workspace-data
|
||||
@@ -1 +1,4 @@
|
||||
**/*
|
||||
|
||||
/.nx/cache
|
||||
/.nx/workspace-data
|
||||
@@ -8,7 +8,6 @@
|
||||
"system-tests",
|
||||
"scripts"
|
||||
],
|
||||
"useWorkspaces": true,
|
||||
"useNx": true,
|
||||
"version": "0.0.0"
|
||||
"version": "0.0.0",
|
||||
"$schema": "node_modules/lerna/schemas/lerna-schema.json"
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
"@types/node": "^18.17.5",
|
||||
"chai": "4.2.0",
|
||||
"mocha": "3.5.3",
|
||||
"typescript": "^5.4.5"
|
||||
"typescript": "~5.4.5"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@angular/cli": ">=14",
|
||||
|
||||
@@ -52,5 +52,6 @@
|
||||
"cypress",
|
||||
"eslint",
|
||||
"eslintplugin"
|
||||
]
|
||||
],
|
||||
"nx": {}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
"devDependencies": {
|
||||
"cypress-each": "^1.11.0",
|
||||
"cypress-expect": "^2.5.3",
|
||||
"typescript": "^5.4.5"
|
||||
"typescript": "~5.4.5"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"cypress": ">=10"
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
"rollup": "3.7.3",
|
||||
"rollup-plugin-dts": "5.0.0",
|
||||
"rollup-plugin-typescript2": "^0.29.0",
|
||||
"typescript": "^5.4.5"
|
||||
"typescript": "~5.4.5"
|
||||
},
|
||||
"files": [
|
||||
"dist"
|
||||
|
||||
@@ -50,5 +50,6 @@
|
||||
"bugs": "https://github.com/cypress-io/cypress/issues/new?assignees=&labels=npm%3A%20%40cypress%2Fpuppeteer&template=1-bug-report.md&title=",
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
}
|
||||
},
|
||||
"nx": {}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
"react-dom": "^16",
|
||||
"rollup": "3.7.3",
|
||||
"rollup-plugin-typescript2": "^0.29.0",
|
||||
"typescript": "^5.4.5"
|
||||
"typescript": "~5.4.5"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@types/react": "^18",
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
"devDependencies": {
|
||||
"@cypress/mount-utils": "0.0.0-development",
|
||||
"svelte": "^3.49.0",
|
||||
"typescript": "^5.4.5"
|
||||
"typescript": "~5.4.5"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"cypress": ">=10.6.0",
|
||||
|
||||
@@ -58,7 +58,7 @@
|
||||
"mock-require": "3.0.3",
|
||||
"react": "^16.13.1",
|
||||
"sinon": "18.0.0",
|
||||
"typescript": "^5.4.5"
|
||||
"typescript": "~5.4.5"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@cypress/webpack-preprocessor": "^5.4.4"
|
||||
@@ -82,5 +82,6 @@
|
||||
],
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
}
|
||||
},
|
||||
"nx": {}
|
||||
}
|
||||
|
||||
@@ -84,4 +84,4 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
25
nx.json
25
nx.json
@@ -1,34 +1,24 @@
|
||||
{
|
||||
"tasksRunnerOptions": {
|
||||
"default": {
|
||||
"runner": "nx-cloud",
|
||||
"options": {
|
||||
"cacheableOperations": [
|
||||
"lint",
|
||||
"check-ts",
|
||||
"build"
|
||||
],
|
||||
"accessToken": "ZmNlNjA0YzAtNTM1NS00MDIwLWFlMWItNWYxYzNiMjQ4N2VkfHJlYWQtb25seQ=="
|
||||
}
|
||||
}
|
||||
},
|
||||
"targetDefaults": {
|
||||
"lint": {
|
||||
"inputs": [
|
||||
"default",
|
||||
"{workspaceRoot}/.eslintrc.js"
|
||||
]
|
||||
],
|
||||
"cache": true
|
||||
},
|
||||
"check-ts": {
|
||||
"inputs": [
|
||||
"default",
|
||||
"sharedGlobals"
|
||||
]
|
||||
],
|
||||
"cache": true
|
||||
},
|
||||
"build": {
|
||||
"dependsOn": [
|
||||
"^build"
|
||||
]
|
||||
],
|
||||
"cache": true
|
||||
},
|
||||
"build-prod": {
|
||||
"dependsOn": [
|
||||
@@ -54,5 +44,6 @@
|
||||
"!{projectRoot/cypress.config.{ts,js}",
|
||||
"!{projectRoot/**/*.cy.ts"
|
||||
]
|
||||
}
|
||||
},
|
||||
"nxCloudAccessToken": "ZmNlNjA0YzAtNTM1NS00MDIwLWFlMWItNWYxYzNiMjQ4N2VkfHJlYWQtb25seQ=="
|
||||
}
|
||||
|
||||
19
package.json
19
package.json
@@ -54,19 +54,19 @@
|
||||
"stop-only": "npx stop-only --skip .cy,.publish,.projects,node_modules,dist,dist-test,fixtures,lib,bower_components,src,__snapshots__ --exclude cypress-tests.ts,*only.cy.js",
|
||||
"stop-only-all": "yarn stop-only --folder packages",
|
||||
"pretest": "yarn ensure-deps",
|
||||
"test": "yarn lerna exec yarn test --scope cypress --scope \"'@packages/{config,data-context,electron,errors,extension,https-proxy,launcher,net-stubbing,network,packherd-require,proxy,rewriter,scaffold-config,socket,v8-snapshot-require,telemetry}'\" --scope \"'@tooling/{electron-mksnapshot,v8-snapshot}'\"",
|
||||
"test-debug": "lerna exec yarn test-debug --ignore \"'@packages/{driver,root,static,web-config}'\"",
|
||||
"test-integration": "lerna exec yarn test-integration --ignore \"'@packages/{driver,root,static,web-config}'\"",
|
||||
"test": "yarn lerna exec yarn test --scope=cypress --scope=@packages/{config,data-context,electron,errors,extension,https-proxy,launcher,net-stubbing,network,packherd-require,proxy,rewriter,scaffold-config,socket,v8-snapshot-require,telemetry} --scope=@tooling/{electron-mksnapshot,v8-snapshot}",
|
||||
"test-debug": "lerna exec yarn test-debug --ignore=@packages/{driver,root,static,web-config}",
|
||||
"test-integration": "lerna exec yarn test-integration --ignore=@packages/{driver,root,static,web-config}",
|
||||
"test-mocha": "mocha --reporter spec scripts/spec.js",
|
||||
"test-npm-package-release-script": "npx lerna exec --scope \"@cypress/*\" -- npx --no-install semantic-release --dry-run",
|
||||
"test-npm-package-release-script": "npx lerna exec --scope=@cypress/* -- npx --no-install semantic-release --dry-run",
|
||||
"test-scripts": "mocha -r packages/ts/register --reporter spec 'scripts/unit/**/*spec.js'",
|
||||
"test-scripts-watch": "yarn test-scripts --watch --watch-extensions 'ts,js'",
|
||||
"test-system": "yarn workspace @tooling/system-tests test",
|
||||
"pretest-unit": "yarn ensure-deps",
|
||||
"test-unit": "lerna exec yarn test-unit --ignore \"'{@packages/{driver,root,static,web-config,net-stubbing,rewriter},@cypress/{webpack-dev-server,eslint-plugin-dev}}'\"",
|
||||
"test-unit": "lerna exec yarn test-unit --ignore={@packages/{driver,root,static,web-config,net-stubbing,rewriter},@cypress/{webpack-dev-server,eslint-plugin-dev}}",
|
||||
"pretest-watch": "yarn ensure-deps",
|
||||
"test-watch": "lerna exec yarn test-watch --ignore \"'@packages/{driver,root,static,web-config}'\"",
|
||||
"type-check": "yarn lerna exec yarn type-check --scope @tooling/system-tests && node scripts/type_check",
|
||||
"test-watch": "lerna exec yarn test-watch --ignore=@packages/{driver,root,static,web-config}",
|
||||
"type-check": "yarn lerna exec yarn type-check --scope=@tooling/system-tests && node scripts/type_check",
|
||||
"verify:mocha:results": "node ./scripts/verify-mocha-results",
|
||||
"watch": "yarn gulp watch"
|
||||
},
|
||||
@@ -90,7 +90,7 @@
|
||||
"@graphql-tools/delegate": "8.2.1",
|
||||
"@graphql-tools/utils": "8.2.3",
|
||||
"@graphql-tools/wrap": "8.1.1",
|
||||
"@nrwl/nx-cloud": "19.0.0",
|
||||
"@npmcli/arborist": "8.0.0",
|
||||
"@octokit/auth-app": "6.0.3",
|
||||
"@octokit/core": "5.0.2",
|
||||
"@percy/cli": "1.27.4",
|
||||
@@ -170,7 +170,7 @@
|
||||
"inquirer": "8.2.4",
|
||||
"inquirer-confirm": "2.0.3",
|
||||
"lazy-ass": "1.6.0",
|
||||
"lerna": "6.6.2",
|
||||
"lerna": "8.1.8",
|
||||
"lint-staged": "11.1.2",
|
||||
"listr2": "3.8.3",
|
||||
"lodash": "^4.17.21",
|
||||
@@ -180,6 +180,7 @@
|
||||
"mocha-junit-reporter": "2.2.0",
|
||||
"mocha-multi-reporters": "1.1.7",
|
||||
"mock-fs": "5.2.0",
|
||||
"npm-packlist": "9.0.0",
|
||||
"p-defer": "^3.0.0",
|
||||
"patch-package": "6.4.7",
|
||||
"playwright-webkit": "1.24.2",
|
||||
|
||||
@@ -44,5 +44,6 @@
|
||||
"files": [
|
||||
"src"
|
||||
],
|
||||
"types": "src/index.ts"
|
||||
"types": "src/index.ts",
|
||||
"nx": {}
|
||||
}
|
||||
|
||||
@@ -91,5 +91,6 @@
|
||||
"nohoist": [
|
||||
"*"
|
||||
]
|
||||
}
|
||||
},
|
||||
"nx": {}
|
||||
}
|
||||
|
||||
@@ -34,5 +34,6 @@
|
||||
],
|
||||
"bin": {
|
||||
"cypress-electron": "./bin/cypress-electron"
|
||||
}
|
||||
},
|
||||
"nx": {}
|
||||
}
|
||||
|
||||
@@ -43,5 +43,6 @@
|
||||
"src",
|
||||
"dist"
|
||||
],
|
||||
"types": "src/index.ts"
|
||||
"types": "src/index.ts",
|
||||
"nx": {}
|
||||
}
|
||||
|
||||
@@ -41,5 +41,6 @@
|
||||
"dist",
|
||||
"lib",
|
||||
"theme"
|
||||
]
|
||||
],
|
||||
"nx": {}
|
||||
}
|
||||
|
||||
@@ -39,5 +39,6 @@
|
||||
},
|
||||
"files": [
|
||||
"lib"
|
||||
]
|
||||
],
|
||||
"nx": {}
|
||||
}
|
||||
|
||||
@@ -24,5 +24,6 @@
|
||||
"index.js",
|
||||
"index.d.ts"
|
||||
],
|
||||
"license": "MIT"
|
||||
"license": "MIT",
|
||||
"nx": {}
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
"mock-fs": "5.2.0",
|
||||
"sinon": "^10.0.0",
|
||||
"sinon-chai": "3.4.0",
|
||||
"typescript": "^5.4.5"
|
||||
"typescript": "~5.4.5"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
|
||||
@@ -25,5 +25,6 @@
|
||||
},
|
||||
"files": [
|
||||
"lib"
|
||||
]
|
||||
],
|
||||
"nx": {}
|
||||
}
|
||||
|
||||
@@ -37,10 +37,11 @@
|
||||
"mocha": "6.2.2",
|
||||
"sinon": "7.3.1",
|
||||
"sinon-chai": "3.3.0",
|
||||
"typescript": "^5.4.5"
|
||||
"typescript": "~5.4.5"
|
||||
},
|
||||
"files": [
|
||||
"lib"
|
||||
],
|
||||
"types": "./lib/index.ts"
|
||||
"types": "./lib/index.ts",
|
||||
"nx": {}
|
||||
}
|
||||
|
||||
@@ -28,5 +28,6 @@
|
||||
"dist",
|
||||
"src/require.ts"
|
||||
],
|
||||
"types": "src/require.ts"
|
||||
"types": "src/require.ts",
|
||||
"nx": {}
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
"devtools-protocol": "0.0.1346313",
|
||||
"express": "4.19.2",
|
||||
"supertest": "6.0.1",
|
||||
"typescript": "^5.4.5"
|
||||
"typescript": "~5.4.5"
|
||||
},
|
||||
"files": [
|
||||
"lib"
|
||||
@@ -49,5 +49,6 @@
|
||||
"nohoist": [
|
||||
"devtools-protocol"
|
||||
]
|
||||
}
|
||||
},
|
||||
"nx": {}
|
||||
}
|
||||
|
||||
@@ -37,5 +37,6 @@
|
||||
"webpack": "^5.88.2",
|
||||
"webpack-cli": "^5.1.4"
|
||||
},
|
||||
"files": []
|
||||
"files": [],
|
||||
"nx": {}
|
||||
}
|
||||
|
||||
@@ -19,5 +19,6 @@
|
||||
"files": [
|
||||
"lib"
|
||||
],
|
||||
"types": "./lib/index.ts"
|
||||
"types": "./lib/index.ts",
|
||||
"nx": {}
|
||||
}
|
||||
|
||||
@@ -42,5 +42,6 @@
|
||||
"@types/parse5-html-rewriting-stream",
|
||||
"@types/parse5-html-rewriting-stream/**"
|
||||
]
|
||||
}
|
||||
},
|
||||
"nx": {}
|
||||
}
|
||||
|
||||
@@ -2,5 +2,6 @@
|
||||
"name": "@packages/root",
|
||||
"version": "0.0.0-development",
|
||||
"description": "dummy package pointing at the root package",
|
||||
"main": "index.js"
|
||||
"main": "index.js",
|
||||
"nx": {}
|
||||
}
|
||||
|
||||
@@ -30,5 +30,6 @@
|
||||
"files": [
|
||||
"src"
|
||||
],
|
||||
"types": "src/index.ts"
|
||||
"types": "src/index.ts",
|
||||
"nx": {}
|
||||
}
|
||||
|
||||
@@ -226,5 +226,6 @@
|
||||
"optionalDependencies": {
|
||||
"fsevents": "^2",
|
||||
"registry-js": "1.15.0"
|
||||
}
|
||||
},
|
||||
"nx": {}
|
||||
}
|
||||
|
||||
@@ -48,5 +48,6 @@
|
||||
"socket.io-client",
|
||||
"socket.io-client/socket.io-parser"
|
||||
]
|
||||
}
|
||||
},
|
||||
"nx": {}
|
||||
}
|
||||
|
||||
@@ -33,5 +33,6 @@
|
||||
"dist",
|
||||
"src"
|
||||
],
|
||||
"types": "src/node.ts"
|
||||
"types": "src/node.ts",
|
||||
"nx": {}
|
||||
}
|
||||
|
||||
@@ -22,5 +22,6 @@
|
||||
"files": [
|
||||
"register.js",
|
||||
"registerDir.js"
|
||||
]
|
||||
],
|
||||
"nx": {}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
"devDependencies": {
|
||||
"@types/node": "18.17.5",
|
||||
"devtools-protocol": "0.0.1346313",
|
||||
"typescript": "^5.4.5"
|
||||
"typescript": "~5.4.5"
|
||||
},
|
||||
"files": [
|
||||
"src/*"
|
||||
@@ -24,5 +24,6 @@
|
||||
"nohoist": [
|
||||
"devtools-protocol"
|
||||
]
|
||||
}
|
||||
},
|
||||
"nx": {}
|
||||
}
|
||||
|
||||
@@ -26,5 +26,6 @@
|
||||
"dist",
|
||||
"src/snapshot-require.ts"
|
||||
],
|
||||
"types": "src/snapshot-require.ts"
|
||||
"types": "src/snapshot-require.ts",
|
||||
"nx": {}
|
||||
}
|
||||
|
||||
@@ -44,5 +44,6 @@
|
||||
"webpack": "^5.88.2",
|
||||
"webpack-cli": "^5.1.4",
|
||||
"webpack-livereload-plugin": "3.0.2"
|
||||
}
|
||||
},
|
||||
"nx": {}
|
||||
}
|
||||
|
||||
@@ -4,5 +4,6 @@
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"lint": "eslint --ext .js,.ts,.json, ."
|
||||
}
|
||||
},
|
||||
"nx": {}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
* with this version of the binary
|
||||
*/
|
||||
const path = require('path')
|
||||
const Arborist = require('@npmcli/arborist')
|
||||
const packlist = require('npm-packlist')
|
||||
const fs = require('fs-extra')
|
||||
|
||||
@@ -16,66 +17,70 @@ const currentPackageDir = process.cwd()
|
||||
// 1. We'll run npm's own "packlist" against the npm package to be published (@cypress/react, etc)
|
||||
// to make sure we don't miss any files when we copy them over to the CLI package
|
||||
// The files that will be returned here are the ones from @cypress/react's package.json['files'] key.
|
||||
packlist({ path: currentPackageDir })
|
||||
.then((files) => {
|
||||
// 2. Move all of the files that would be published under @cypress/react
|
||||
// to be copied under cli/react (drop the @cypress namespace)
|
||||
const cliPath = path.join(__dirname, '..', 'cli')
|
||||
const arborist = new Arborist({ path: currentPackageDir })
|
||||
|
||||
// Typically, these packages are independently published as @cypress/package-name
|
||||
// e.g. @cypress/vue => import whatever from 'cypress/vue'
|
||||
// The files will wind up at cypress/cli/vue/*
|
||||
const currentPackageConfig = require(path.join(process.cwd(), 'package.json'))
|
||||
const exportName = currentPackageConfig.name.replace('@cypress/', '')
|
||||
const outDir = path.join(cliPath, exportName)
|
||||
arborist.loadActual().then((tree) => {
|
||||
packlist(tree)
|
||||
.then((files) => {
|
||||
// 2. Move all of the files that would be published under @cypress/react
|
||||
// to be copied under cli/react (drop the @cypress namespace)
|
||||
const cliPath = path.join(__dirname, '..', 'cli')
|
||||
|
||||
// Remove output directory to clean up old files before building
|
||||
fs.removeSync(outDir)
|
||||
// Typically, these packages are independently published as @cypress/package-name
|
||||
// e.g. @cypress/vue => import whatever from 'cypress/vue'
|
||||
// The files will wind up at cypress/cli/vue/*
|
||||
const currentPackageConfig = require(path.join(process.cwd(), 'package.json'))
|
||||
const exportName = currentPackageConfig.name.replace('@cypress/', '')
|
||||
const outDir = path.join(cliPath, exportName)
|
||||
|
||||
// 3. For each file, mkdir if not exists, and then copy the dist'd assets over
|
||||
// to write to the `cliPackageConfig` at the end
|
||||
files.forEach((f) => {
|
||||
// mkdir if not exists
|
||||
const { dir } = path.parse(f)
|
||||
// Remove output directory to clean up old files before building
|
||||
fs.removeSync(outDir)
|
||||
|
||||
if (dir) {
|
||||
fs.mkdirSync(path.join(outDir, dir), { recursive: true })
|
||||
// 3. For each file, mkdir if not exists, and then copy the dist'd assets over
|
||||
// to write to the `cliPackageConfig` at the end
|
||||
files.forEach((f) => {
|
||||
// mkdir if not exists
|
||||
const { dir } = path.parse(f)
|
||||
|
||||
if (dir) {
|
||||
fs.mkdirSync(path.join(outDir, dir), { recursive: true })
|
||||
}
|
||||
|
||||
fs.cpSync(path.join(currentPackageDir, f), path.join(outDir, f))
|
||||
})
|
||||
|
||||
// After everything is copied, let's update the Cypress cli package.json['exports'] map.
|
||||
const isModule = currentPackageConfig.type === 'module'
|
||||
const types = currentPackageConfig.types
|
||||
|
||||
const cliPackageConfig = require(path.join(cliPath, 'package.json'))
|
||||
|
||||
const subPackageExports = cliPackageConfig.exports[`./${exportName}`] = {}
|
||||
const esmEntry = isModule ? currentPackageConfig.main : currentPackageConfig.module
|
||||
|
||||
if (types) {
|
||||
// ./react/dist/cypress-react-cjs.js, etc
|
||||
subPackageExports.types = `./${exportName}/${types}`
|
||||
}
|
||||
|
||||
fs.cpSync(path.join(currentPackageDir, f), path.join(outDir, f))
|
||||
if (esmEntry) {
|
||||
// ./react/dist/cypress-react-esm.js, etc
|
||||
subPackageExports.import = `./${exportName}/${esmEntry}`
|
||||
}
|
||||
|
||||
if (!isModule) {
|
||||
// ./react/dist/cypress-react-cjs.js, etc
|
||||
subPackageExports.require = `./${exportName}/${currentPackageConfig.main}`
|
||||
}
|
||||
|
||||
if (!cliPackageConfig.files.includes(exportName)) {
|
||||
cliPackageConfig.files.push(exportName)
|
||||
}
|
||||
|
||||
const output = `${JSON.stringify(cliPackageConfig, null, 2) }\n`
|
||||
|
||||
console.log('Writing to CLI package.json for', exportName)
|
||||
|
||||
fs.writeFileSync(path.join(cliPath, 'package.json'), output, 'utf-8')
|
||||
})
|
||||
|
||||
// After everything is copied, let's update the Cypress cli package.json['exports'] map.
|
||||
const isModule = currentPackageConfig.type === 'module'
|
||||
const types = currentPackageConfig.types
|
||||
|
||||
const cliPackageConfig = require(path.join(cliPath, 'package.json'))
|
||||
|
||||
const subPackageExports = cliPackageConfig.exports[`./${exportName}`] = {}
|
||||
const esmEntry = isModule ? currentPackageConfig.main : currentPackageConfig.module
|
||||
|
||||
if (types) {
|
||||
// ./react/dist/cypress-react-cjs.js, etc
|
||||
subPackageExports.types = `./${exportName}/${types}`
|
||||
}
|
||||
|
||||
if (esmEntry) {
|
||||
// ./react/dist/cypress-react-esm.js, etc
|
||||
subPackageExports.import = `./${exportName}/${esmEntry}`
|
||||
}
|
||||
|
||||
if (!isModule) {
|
||||
// ./react/dist/cypress-react-cjs.js, etc
|
||||
subPackageExports.require = `./${exportName}/${currentPackageConfig.main}`
|
||||
}
|
||||
|
||||
if (!cliPackageConfig.files.includes(exportName)) {
|
||||
cliPackageConfig.files.push(exportName)
|
||||
}
|
||||
|
||||
const output = `${JSON.stringify(cliPackageConfig, null, 2) }\n`
|
||||
|
||||
console.log('Writing to CLI package.json for', exportName)
|
||||
|
||||
fs.writeFileSync(path.join(cliPath, 'package.json'), output, 'utf-8')
|
||||
})
|
||||
|
||||
@@ -29,5 +29,6 @@
|
||||
},
|
||||
"files": [
|
||||
"dist"
|
||||
]
|
||||
],
|
||||
"nx": {}
|
||||
}
|
||||
|
||||
@@ -25,5 +25,6 @@
|
||||
"dist",
|
||||
"src/packherd.ts"
|
||||
],
|
||||
"types": "src/packherd.ts"
|
||||
"types": "src/packherd.ts",
|
||||
"nx": {}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user