mirror of
https://github.com/cypress-io/cypress.git
synced 2026-02-25 01:09:52 -06:00
build: properly use local npm packages for development and binary build (#14182)
This commit is contained in:
@@ -7,7 +7,7 @@ Application Data: /user/app/data/path
|
||||
Browser Profiles: /user/app/data/path/to/browsers
|
||||
Binary Caches: /user/path/to/binary/cache
|
||||
|
||||
Cypress Version: 0.0.0
|
||||
Cypress Version: 0.0.0-development
|
||||
System Platform: linux (Foo-OsVersion)
|
||||
System Memory: 1.2 GB free 400 MB
|
||||
|
||||
@@ -29,7 +29,7 @@ Application Data: /user/app/data/path
|
||||
Browser Profiles: /user/app/data/path/to/browsers
|
||||
Binary Caches: /user/path/to/binary/cache
|
||||
|
||||
Cypress Version: 0.0.0
|
||||
Cypress Version: 0.0.0-development
|
||||
System Platform: linux (Foo-OsVersion)
|
||||
System Memory: 1.2 GB free 400 MB
|
||||
|
||||
@@ -48,7 +48,7 @@ Application Data: /user/app/data/path
|
||||
Browser Profiles: /user/app/data/path/to/browsers
|
||||
Binary Caches: /user/path/to/binary/cache
|
||||
|
||||
Cypress Version: 0.0.0
|
||||
Cypress Version: 0.0.0-development
|
||||
System Platform: linux (Foo-OsVersion)
|
||||
System Memory: 1.2 GB free 400 MB
|
||||
|
||||
|
||||
@@ -33,5 +33,5 @@ Consider opening a new issue.
|
||||
----------
|
||||
|
||||
Platform: darwin (Foo-OsVersion)
|
||||
Cypress Version: 0.0.0
|
||||
Cypress Version: 0.0.0-development
|
||||
`
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "cypress",
|
||||
"version": "0.0.0",
|
||||
"version": "0.0.0-development",
|
||||
"private": true,
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
@@ -63,7 +63,7 @@
|
||||
"@babel/cli": "7.8.4",
|
||||
"@babel/preset-env": "7.9.5",
|
||||
"@cypress/sinon-chai": "2.9.1",
|
||||
"@packages/root": "*",
|
||||
"@packages/root": "0.0.0-development",
|
||||
"@types/bluebird": "3.5.29",
|
||||
"@types/chai": "4.2.7",
|
||||
"@types/chai-jquery": "1.1.40",
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
"dependencies": {
|
||||
"@babel/plugin-transform-modules-commonjs": "7.12.1",
|
||||
"@cypress/code-coverage": "3.8.6",
|
||||
"@cypress/webpack-preprocessor": "*",
|
||||
"@cypress/webpack-preprocessor": "0.0.0-development",
|
||||
"babel-plugin-istanbul": "6.0.0",
|
||||
"debug": "4.1.1",
|
||||
"find-up": "5.0.0",
|
||||
@@ -56,7 +56,7 @@
|
||||
"check-code-coverage": "1.9.2",
|
||||
"common-tags": "1.8.0",
|
||||
"css-loader": "2.1.1",
|
||||
"cypress": "*",
|
||||
"cypress": "0.0.0-development",
|
||||
"cypress-expect": "2.0.0",
|
||||
"cypress-image-snapshot": "3.1.1",
|
||||
"cypress-plugin-snapshots": "1.4.4",
|
||||
@@ -133,15 +133,15 @@
|
||||
"@babel/preset-env": {
|
||||
"optional": true
|
||||
},
|
||||
"@types/react": {
|
||||
"optional": true
|
||||
},
|
||||
"babel-loader": {
|
||||
"optional": true
|
||||
},
|
||||
"next": {
|
||||
"optional": true
|
||||
},
|
||||
"types/react": {
|
||||
"optional": true
|
||||
},
|
||||
"webpack": {
|
||||
"optional": true
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
"dependencies": {
|
||||
"@babel/plugin-transform-modules-commonjs": "7.10.4",
|
||||
"@cypress/code-coverage": "3.8.1",
|
||||
"@cypress/webpack-preprocessor": "*",
|
||||
"@cypress/webpack-preprocessor": "0.0.0-development",
|
||||
"@intlify/vue-i18n-loader": "1.0.0",
|
||||
"@vue/test-utils": "1.0.3",
|
||||
"babel-plugin-istanbul": "6.0.0",
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
"webpack": "^4.44.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@cypress/eslint-plugin-dev": "*",
|
||||
"@cypress/webpack-preprocessor": "*",
|
||||
"@cypress/eslint-plugin-dev": "0.0.0-development",
|
||||
"@cypress/webpack-preprocessor": "0.0.0-development",
|
||||
"@types/mocha": "^8.0.2",
|
||||
"@types/webpack": "^4.41.21",
|
||||
"@typescript-eslint/eslint-plugin": "^3.9.0",
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
"chai": "4.1.2",
|
||||
"chalk": "3.0.0",
|
||||
"chokidar-cli": "1.2.0",
|
||||
"cypress": "*",
|
||||
"cypress": "0.0.0-development",
|
||||
"dependency-check": "2.9.1",
|
||||
"deps-ok": "1.2.1",
|
||||
"eslint": "6.8.0",
|
||||
@@ -63,7 +63,6 @@
|
||||
"snap-shot-it": "7.9.2",
|
||||
"start-server-and-test": "1.10.11",
|
||||
"ts-node": "8.10.1",
|
||||
"typescript": "3.8.3",
|
||||
"webpack": "^4.18.1"
|
||||
},
|
||||
"peerDependencies": {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@packages/desktop-gui",
|
||||
"version": "0.0.0",
|
||||
"version": "0.0.0-development",
|
||||
"private": true,
|
||||
"main": "lib/gui.js",
|
||||
"scripts": {
|
||||
@@ -18,9 +18,9 @@
|
||||
"@cypress/icons": "0.7.0",
|
||||
"@cypress/json-schemas": "5.35.1",
|
||||
"@cypress/react-tooltip": "0.5.3",
|
||||
"@cypress/webpack-preprocessor": "*",
|
||||
"@cypress/webpack-preprocessor": "0.0.0-development",
|
||||
"@fortawesome/fontawesome-free": "5.11.2",
|
||||
"@packages/web-config": "*",
|
||||
"@packages/web-config": "0.0.0-development",
|
||||
"bluebird": "3.5.3",
|
||||
"bootstrap-sass": "3.4.1",
|
||||
"classnames": "2.2.6",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@packages/driver",
|
||||
"version": "0.0.0",
|
||||
"version": "0.0.0-development",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"clean-deps": "rm -rf node_modules",
|
||||
@@ -15,12 +15,12 @@
|
||||
"@cypress/bower-kendo-ui": "0.0.2",
|
||||
"@cypress/sinon-chai": "2.9.1",
|
||||
"@cypress/unique-selector": "0.4.2",
|
||||
"@cypress/webpack-preprocessor": "*",
|
||||
"@cypress/webpack-preprocessor": "0.0.0-development",
|
||||
"@cypress/what-is-circular": "1.0.1",
|
||||
"@packages/network": "*",
|
||||
"@packages/runner": "*",
|
||||
"@packages/server": "*",
|
||||
"@packages/ts": "*",
|
||||
"@packages/network": "0.0.0-development",
|
||||
"@packages/runner": "0.0.0-development",
|
||||
"@packages/server": "0.0.0-development",
|
||||
"@packages/ts": "0.0.0-development",
|
||||
"@types/chalk": "^2.2.0",
|
||||
"@types/common-tags": "^1.8.0",
|
||||
"@types/lodash": "^4.14.123",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@packages/electron",
|
||||
"version": "0.0.0",
|
||||
"version": "0.0.0-development",
|
||||
"private": true,
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@packages/example",
|
||||
"version": "0.0.0",
|
||||
"version": "0.0.0-development",
|
||||
"private": true,
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@packages/extension",
|
||||
"version": "0.0.0",
|
||||
"version": "0.0.0-development",
|
||||
"private": true,
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
@@ -21,7 +21,7 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@cypress/icons": "0.7.0",
|
||||
"@packages/socket": "*",
|
||||
"@packages/socket": "0.0.0-development",
|
||||
"browserify": "16.3.0",
|
||||
"chai": "3.5.0",
|
||||
"coffeescript": "1.12.7",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@packages/https-proxy",
|
||||
"version": "0.0.0",
|
||||
"version": "0.0.0-development",
|
||||
"private": true,
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
@@ -25,8 +25,8 @@
|
||||
"@cypress/debugging-proxy": "2.0.1",
|
||||
"@cypress/request": "2.88.5",
|
||||
"@cypress/request-promise": "4.2.6",
|
||||
"@packages/network": "*",
|
||||
"@packages/ts": "*",
|
||||
"@packages/network": "0.0.0-development",
|
||||
"@packages/ts": "0.0.0-development",
|
||||
"chai": "3.5.0",
|
||||
"cross-env": "6.0.3",
|
||||
"mocha": "3.5.3",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@packages/launcher",
|
||||
"version": "0.0.0",
|
||||
"version": "0.0.0-development",
|
||||
"private": true,
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
@@ -22,7 +22,7 @@
|
||||
"ramda": "0.24.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@packages/ts": "*",
|
||||
"@packages/ts": "0.0.0-development",
|
||||
"chai": "3.5.0",
|
||||
"chai-as-promised": "7.1.1",
|
||||
"cross-env": "6.0.3",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@packages/net-stubbing",
|
||||
"version": "0.0.0",
|
||||
"version": "0.0.0-development",
|
||||
"private": true,
|
||||
"main": "./lib/server",
|
||||
"scripts": {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@packages/network",
|
||||
"version": "0.0.0",
|
||||
"version": "0.0.0-development",
|
||||
"private": true,
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
@@ -24,9 +24,9 @@
|
||||
"@cypress/debugging-proxy": "2.0.1",
|
||||
"@cypress/request": "2.88.5",
|
||||
"@cypress/request-promise": "4.2.6",
|
||||
"@packages/https-proxy": "*",
|
||||
"@packages/socket": "*",
|
||||
"@packages/ts": "*",
|
||||
"@packages/https-proxy": "0.0.0-development",
|
||||
"@packages/socket": "0.0.0-development",
|
||||
"@packages/ts": "0.0.0-development",
|
||||
"@types/concat-stream": "1.6.0",
|
||||
"express": "4.17.1",
|
||||
"mocha": "6.2.2",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@packages/proxy",
|
||||
"version": "0.0.0",
|
||||
"version": "0.0.0-development",
|
||||
"private": true,
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@packages/reporter",
|
||||
"version": "0.0.0",
|
||||
"version": "0.0.0-development",
|
||||
"private": true,
|
||||
"main": "src/main.tsx",
|
||||
"scripts": {
|
||||
@@ -13,9 +13,9 @@
|
||||
"devDependencies": {
|
||||
"@cypress/react-tooltip": "0.5.3",
|
||||
"@fortawesome/fontawesome-free": "5.11.2",
|
||||
"@packages/driver": "*",
|
||||
"@packages/socket": "*",
|
||||
"@packages/web-config": "*",
|
||||
"@packages/driver": "0.0.0-development",
|
||||
"@packages/socket": "0.0.0-development",
|
||||
"@packages/web-config": "0.0.0-development",
|
||||
"@reach/dialog": "0.10.5",
|
||||
"@reach/visually-hidden": "0.10.4",
|
||||
"classnames": "2.2.6",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@packages/rewriter",
|
||||
"version": "0.0.0",
|
||||
"version": "0.0.0-development",
|
||||
"private": true,
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@packages/root",
|
||||
"version": "0.0.0",
|
||||
"version": "0.0.0-development",
|
||||
"description": "dummy package pointing at the root package",
|
||||
"main": "index.js"
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@packages/runner",
|
||||
"version": "0.0.0",
|
||||
"version": "0.0.0-development",
|
||||
"private": true,
|
||||
"main": "src/index.js",
|
||||
"scripts": {
|
||||
@@ -18,12 +18,12 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@cypress/react-tooltip": "0.5.3",
|
||||
"@cypress/webpack-preprocessor": "*",
|
||||
"@cypress/webpack-preprocessor": "0.0.0-development",
|
||||
"@fortawesome/fontawesome-free": "5.12.1",
|
||||
"@packages/driver": "*",
|
||||
"@packages/reporter": "*",
|
||||
"@packages/socket": "*",
|
||||
"@packages/web-config": "*",
|
||||
"@packages/driver": "0.0.0-development",
|
||||
"@packages/reporter": "0.0.0-development",
|
||||
"@packages/socket": "0.0.0-development",
|
||||
"@packages/web-config": "0.0.0-development",
|
||||
"ansi-to-html": "0.6.14",
|
||||
"babel-plugin-prismjs": "1.0.2",
|
||||
"bluebird": "3.5.3",
|
||||
|
||||
@@ -90,7 +90,7 @@ Error: Webpack Compilation Error
|
||||
./cypress/integration/typescript_syntax_error_spec.tsXX:XX
|
||||
Module parse failed: Unexpected token (4:19)
|
||||
File was processed with these loaders:
|
||||
* ../../node_modules/@cypress/webpack-batteries-included-preprocessor/node_modules/ts-loader/index.js
|
||||
* ../../../../npm/webpack-batteries-included-preprocessor/node_modules/ts-loader/index.js
|
||||
You may need an additional loader to handle the result of these loaders.
|
||||
| // The code below is ignored by eslint
|
||||
| // because it tests failing spec.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@packages/server",
|
||||
"version": "0.0.0",
|
||||
"version": "0.0.0-development",
|
||||
"private": true,
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
@@ -27,8 +27,8 @@
|
||||
"@cypress/mocha-teamcity-reporter": "1.0.0",
|
||||
"@cypress/request": "2.88.5",
|
||||
"@cypress/request-promise": "4.2.6",
|
||||
"@cypress/webpack-batteries-included-preprocessor": "*",
|
||||
"@cypress/webpack-preprocessor": "*",
|
||||
"@cypress/webpack-batteries-included-preprocessor": "0.0.0-development",
|
||||
"@cypress/webpack-preprocessor": "0.0.0-development",
|
||||
"@ffmpeg-installer/ffmpeg": "1.0.20",
|
||||
"ansi_up": "4.0.4",
|
||||
"black-hole-stream": "0.0.1",
|
||||
@@ -126,18 +126,18 @@
|
||||
"@cypress/json-schemas": "5.35.1",
|
||||
"@cypress/sinon-chai": "2.9.1",
|
||||
"@ffprobe-installer/ffprobe": "1.1.0",
|
||||
"@packages/desktop-gui": "*",
|
||||
"@packages/electron": "*",
|
||||
"@packages/example": "*",
|
||||
"@packages/extension": "*",
|
||||
"@packages/https-proxy": "*",
|
||||
"@packages/launcher": "*",
|
||||
"@packages/network": "*",
|
||||
"@packages/reporter": "*",
|
||||
"@packages/root": "*",
|
||||
"@packages/socket": "*",
|
||||
"@packages/static": "*",
|
||||
"@packages/ts": "*",
|
||||
"@packages/desktop-gui": "0.0.0-development",
|
||||
"@packages/electron": "0.0.0-development",
|
||||
"@packages/example": "0.0.0-development",
|
||||
"@packages/extension": "0.0.0-development",
|
||||
"@packages/https-proxy": "0.0.0-development",
|
||||
"@packages/launcher": "0.0.0-development",
|
||||
"@packages/network": "0.0.0-development",
|
||||
"@packages/reporter": "0.0.0-development",
|
||||
"@packages/root": "0.0.0-development",
|
||||
"@packages/socket": "0.0.0-development",
|
||||
"@packages/static": "0.0.0-development",
|
||||
"@packages/ts": "0.0.0-development",
|
||||
"@types/chai-as-promised": "7.1.2",
|
||||
"@types/chrome": "0.0.101",
|
||||
"awesome-typescript-loader": "5.2.1",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@packages/socket",
|
||||
"version": "0.0.0",
|
||||
"version": "0.0.0-development",
|
||||
"private": true,
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@packages/static",
|
||||
"version": "0.0.0",
|
||||
"version": "0.0.0-development",
|
||||
"private": true,
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@packages/ts",
|
||||
"version": "0.0.0",
|
||||
"version": "0.0.0-development",
|
||||
"private": true,
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@packages/ui-components",
|
||||
"version": "0.0.0",
|
||||
"version": "0.0.0-development",
|
||||
"private": true,
|
||||
"main": "src/index.tsx",
|
||||
"scripts": {
|
||||
@@ -19,7 +19,7 @@
|
||||
"@babel/plugin-proposal-decorators": "7.8.3",
|
||||
"@babel/preset-env": "7.9.0",
|
||||
"@babel/preset-react": "7.9.4",
|
||||
"@cypress/webpack-preprocessor": "*",
|
||||
"@cypress/webpack-preprocessor": "0.0.0-development",
|
||||
"@fortawesome/fontawesome-free": "5.12.1",
|
||||
"@reach/dialog": "0.10.5",
|
||||
"@reach/visually-hidden": "0.10.4",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@packages/web-config",
|
||||
"version": "0.0.0",
|
||||
"version": "0.0.0-development",
|
||||
"devDependencies": {
|
||||
"@babel/core": "7.9.0",
|
||||
"@babel/plugin-proposal-class-properties": "7.8.3",
|
||||
|
||||
@@ -12,7 +12,7 @@ module.exports = async function (params) {
|
||||
console.log(params.electronPlatformName)
|
||||
console.log('****************************')
|
||||
|
||||
const packages = await globby(['packages/*/node_modules'], {
|
||||
const packages = await globby('packages/*/node_modules', {
|
||||
cwd: params.packager.info._appDir,
|
||||
onlyFiles: false,
|
||||
})
|
||||
|
||||
@@ -130,13 +130,10 @@ const buildCypressApp = function (platform, version, options = {}) {
|
||||
return packages.copyAllToDist(distDir())
|
||||
}
|
||||
|
||||
const transformSymlinkRequires = function () {
|
||||
log('#transformSymlinkRequires')
|
||||
const replaceLocalNpmVersions = function () {
|
||||
log('#replaceLocalNpmVersions')
|
||||
|
||||
return transformRequires(distDir())
|
||||
.then((replaceCount) => {
|
||||
return la(replaceCount > 5, 'expected to replace more than 5 symlink requires, but only replaced', replaceCount)
|
||||
})
|
||||
return packages.replaceLocalNpmVersions(distDir())
|
||||
}
|
||||
|
||||
const npmInstallPackages = function () {
|
||||
@@ -147,6 +144,12 @@ const buildCypressApp = function (platform, version, options = {}) {
|
||||
return packages.npmInstallAll(pathToPackages)
|
||||
}
|
||||
|
||||
const cleanLocalNpmPackages = function () {
|
||||
log('#cleanLocalNpmPackages')
|
||||
|
||||
return fs.removeAsync(distDir('npm'))
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the package.json file that sits in the root of the output app
|
||||
*/
|
||||
@@ -211,6 +214,21 @@ require('./packages/server')\
|
||||
})
|
||||
}
|
||||
|
||||
const cleanJs = function () {
|
||||
log('#cleanJs')
|
||||
|
||||
return packages.runAllCleanJs()
|
||||
}
|
||||
|
||||
const transformSymlinkRequires = function () {
|
||||
log('#transformSymlinkRequires')
|
||||
|
||||
return transformRequires(distDir())
|
||||
.then((replaceCount) => {
|
||||
return la(replaceCount > 5, 'expected to replace more than 5 symlink requires, but only replaced', replaceCount)
|
||||
})
|
||||
}
|
||||
|
||||
// we also don't need ".bin" links inside Electron application
|
||||
// thus we can go through dist/packages/*/node_modules and remove all ".bin" folders
|
||||
const removeBinFolders = function () {
|
||||
@@ -251,12 +269,6 @@ require('./packages/server')\
|
||||
})
|
||||
}
|
||||
|
||||
const cleanJs = function () {
|
||||
log('#cleanJs')
|
||||
|
||||
return packages.runAllCleanJs()
|
||||
}
|
||||
|
||||
const getIconFilename = function (platform) {
|
||||
const filenames = {
|
||||
darwin: 'cypress.icns',
|
||||
@@ -270,6 +282,26 @@ require('./packages/server')\
|
||||
return iconFilename
|
||||
}
|
||||
|
||||
const removeDevElectronApp = function () {
|
||||
log('#removeDevElectronApp')
|
||||
// when we copy packages/electron, we get the "dist" folder with
|
||||
// empty Electron app, symlinked to our server folder
|
||||
// in production build, we do not need this link, and it
|
||||
// would not work anyway with code signing
|
||||
|
||||
// hint: you can see all symlinks in the build folder
|
||||
// using "find build/darwin/Cypress.app/ -type l -ls"
|
||||
console.log('platform', platform)
|
||||
const electronDistFolder = distDir('packages', 'electron', 'dist')
|
||||
|
||||
la(check.unemptyString(electronDistFolder),
|
||||
'empty electron dist folder for platform', platform)
|
||||
|
||||
console.log(`Removing unnecessary folder '${electronDistFolder}'`)
|
||||
|
||||
return fs.removeAsync(electronDistFolder) // .catch(_.noop) why are we ignoring an error here?!
|
||||
}
|
||||
|
||||
const electronPackAndSign = function () {
|
||||
log('#electronPackAndSign')
|
||||
|
||||
@@ -309,26 +341,6 @@ require('./packages/server')\
|
||||
return execa('electron-builder', args, opts)
|
||||
}
|
||||
|
||||
const removeDevElectronApp = function () {
|
||||
log('#removeDevElectronApp')
|
||||
// when we copy packages/electron, we get the "dist" folder with
|
||||
// empty Electron app, symlinked to our server folder
|
||||
// in production build, we do not need this link, and it
|
||||
// would not work anyway with code signing
|
||||
|
||||
// hint: you can see all symlinks in the build folder
|
||||
// using "find build/darwin/Cypress.app/ -type l -ls"
|
||||
console.log('platform', platform)
|
||||
const electronDistFolder = distDir('packages', 'electron', 'dist')
|
||||
|
||||
la(check.unemptyString(electronDistFolder),
|
||||
'empty electron dist folder for platform', platform)
|
||||
|
||||
console.log(`Removing unnecessary folder '${electronDistFolder}'`)
|
||||
|
||||
return fs.removeAsync(electronDistFolder) // .catch(_.noop) why are we ignoring an error here?!
|
||||
}
|
||||
|
||||
const lsDistFolder = function () {
|
||||
log('#lsDistFolder')
|
||||
const buildFolder = buildDir()
|
||||
@@ -441,7 +453,9 @@ require('./packages/server')\
|
||||
.then(cleanupPlatform)
|
||||
.then(buildPackages)
|
||||
.then(copyPackages)
|
||||
.then(replaceLocalNpmVersions)
|
||||
.then(npmInstallPackages)
|
||||
.then(cleanLocalNpmPackages)
|
||||
.then(createRootPackage)
|
||||
.then(removeTypeScript)
|
||||
.then(cleanJs)
|
||||
|
||||
@@ -9,7 +9,6 @@ const la = require('lazy-ass')
|
||||
const check = require('check-more-types')
|
||||
const execa = require('execa')
|
||||
const R = require('ramda')
|
||||
const os = require('os')
|
||||
const prettyMs = require('pretty-ms')
|
||||
const pluralize = require('pluralize')
|
||||
const debug = require('debug')('cypress:binary')
|
||||
@@ -56,19 +55,6 @@ const runAllBuild = _.partial(npx, ['lerna', 'run', 'build-prod', '--ignore', 'c
|
||||
// removes transpiled JS files in the original package folders
|
||||
const runAllCleanJs = _.partial(npx, ['lerna', 'run', 'clean-js', '--ignore', 'cli'])
|
||||
|
||||
// @returns string[] with names of packages, e.g. ['runner', 'driver', 'server']
|
||||
const getPackagesWithScript = (scriptName) => {
|
||||
return Promise.resolve(glob('./packages/*/package.json'))
|
||||
.map((pkgPath) => {
|
||||
return fs.readJsonAsync(pkgPath)
|
||||
.then((json) => {
|
||||
if (json.scripts != null ? json.scripts.build : undefined) {
|
||||
return path.basename(path.dirname(pkgPath))
|
||||
}
|
||||
})
|
||||
}).filter(Boolean)
|
||||
}
|
||||
|
||||
const copyAllToDist = function (distDir) {
|
||||
const copyRelativePathToDist = function (relative) {
|
||||
const dest = path.join(distDir, relative)
|
||||
@@ -126,7 +112,12 @@ const copyAllToDist = function (distDir) {
|
||||
|
||||
return fs.ensureDirAsync(distDir)
|
||||
.then(() => {
|
||||
return glob('./packages/*')
|
||||
const globs = ['./packages/*', './npm/*']
|
||||
const globOptions = {
|
||||
onlyFiles: false,
|
||||
}
|
||||
|
||||
return Promise.resolve(externalUtils.globby(globs, globOptions))
|
||||
.map(copyPackage, { concurrency: 1 })
|
||||
}).then(() => {
|
||||
console.log('Finished Copying %dms', new Date() - started)
|
||||
@@ -135,6 +126,61 @@ const copyAllToDist = function (distDir) {
|
||||
})
|
||||
}
|
||||
|
||||
// replaces local npm version 0.0.0-development
|
||||
// with the path to the package
|
||||
// we need to do this instead of just changing the symlink (like we do for require('@packages/...'))
|
||||
// so the packages actually get installed to node_modules and work with peer dependencies
|
||||
const replaceLocalNpmVersions = function (basePath) {
|
||||
const visited = []
|
||||
|
||||
const updateNpmPackage = function (pkg) {
|
||||
if (!visited.includes(pkg)) {
|
||||
visited.push(pkg)
|
||||
|
||||
return updatePackageJson(`./npm/${pkg}/package.json`)
|
||||
}
|
||||
|
||||
return Promise.resolve()
|
||||
}
|
||||
|
||||
const updatePackageJson = function (pattern) {
|
||||
return Promise.resolve(glob(pattern, { cwd: basePath }))
|
||||
.map((pkgPath) => {
|
||||
const pkgJsonPath = path.join(basePath, pkgPath)
|
||||
|
||||
return fs.readJsonAsync(pkgJsonPath)
|
||||
.then((json) => {
|
||||
const { dependencies } = json
|
||||
let shouldWriteFile = false
|
||||
|
||||
if (dependencies) {
|
||||
return Promise.all(_.map(dependencies, (version, pkg) => {
|
||||
const parsedPkg = /(@cypress\/)(.*)/g.exec(pkg)
|
||||
|
||||
if (parsedPkg && parsedPkg.length === 3 && version === '0.0.0-development') {
|
||||
const pkgName = parsedPkg[2]
|
||||
|
||||
json.dependencies[`@cypress/${pkgName}`] = `file:${path.join(basePath, 'npm', pkgName)}`
|
||||
shouldWriteFile = true
|
||||
|
||||
return updateNpmPackage(pkgName)
|
||||
}
|
||||
}))
|
||||
.then(() => {
|
||||
if (shouldWriteFile) {
|
||||
return fs.writeJsonAsync(pkgJsonPath, json, { spaces: 2 })
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
return Promise.resolve()
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
return updatePackageJson('./packages/*/package.json')
|
||||
}
|
||||
|
||||
const forceNpmInstall = function (packagePath, packageToInstall) {
|
||||
console.log('Force installing %s', packageToInstall)
|
||||
console.log('in %s', packagePath)
|
||||
@@ -217,60 +263,6 @@ const npmInstallAll = function (pathToPackages) {
|
||||
})
|
||||
}
|
||||
|
||||
const removePackageJson = function (filename) {
|
||||
if (filename.endsWith('/package.json')) {
|
||||
return path.dirname(filename)
|
||||
}
|
||||
|
||||
return filename
|
||||
}
|
||||
|
||||
const ensureFoundSomething = function (files) {
|
||||
if (files.length === 0) {
|
||||
throw new Error('Could not find any files')
|
||||
}
|
||||
|
||||
return files
|
||||
}
|
||||
|
||||
const symlinkType = function () {
|
||||
if (os.platform() === 'win32') {
|
||||
return 'junction'
|
||||
}
|
||||
|
||||
return 'dir'
|
||||
}
|
||||
|
||||
const symlinkAll = function (pathToDistPackages, pathTo) {
|
||||
console.log('symlink these packages', pathToDistPackages)
|
||||
la(check.unemptyString(pathToDistPackages),
|
||||
'missing paths to dist packages', pathToDistPackages)
|
||||
|
||||
const symlink = function (pkg) {
|
||||
// console.log(pkg, dist)
|
||||
// strip off the initial './'
|
||||
// ./packages/foo -> node_modules/@packages/foo
|
||||
pkg = removePackageJson(pkg)
|
||||
const dest = pathTo('node_modules', '@packages', path.basename(pkg))
|
||||
const relativeDest = path.relative(`${dest}/..`, pkg)
|
||||
|
||||
const type = symlinkType()
|
||||
|
||||
console.log(relativeDest, 'link ->', dest, 'type', type)
|
||||
|
||||
return fs.ensureSymlinkAsync(relativeDest, dest, symlinkType)
|
||||
.catch((err) => {
|
||||
if (!err.message.includes('EEXIST')) {
|
||||
throw err
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
return glob(pathToDistPackages)
|
||||
.then(ensureFoundSomething)
|
||||
.map(symlink)
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
runAllBuild,
|
||||
|
||||
@@ -278,13 +270,11 @@ module.exports = {
|
||||
|
||||
npmInstallAll,
|
||||
|
||||
symlinkAll,
|
||||
|
||||
runAllCleanJs,
|
||||
|
||||
forceNpmInstall,
|
||||
|
||||
getPackagesWithScript,
|
||||
replaceLocalNpmVersions,
|
||||
}
|
||||
|
||||
if (!module.parent) {
|
||||
|
||||
@@ -114,7 +114,7 @@ const injectVersions = (packagesToRelease, versions, packages) => {
|
||||
|
||||
if (packageJson.dependencies) {
|
||||
for (const dependency in packageJson.dependencies) {
|
||||
if (packageJson.dependencies[dependency] === '*') {
|
||||
if (packageJson.dependencies[dependency] === '0.0.0-development' || packageJson.dependencies[dependency] === '*') {
|
||||
const version = versions[dependency].nextVersion || versions[dependency].currentVersion
|
||||
|
||||
if (!version) {
|
||||
|
||||
@@ -41,7 +41,13 @@ describe('packages', () => {
|
||||
},
|
||||
})
|
||||
|
||||
sinon.stub(externalUtils, 'globby')
|
||||
const globbyStub = sinon.stub(externalUtils, 'globby')
|
||||
|
||||
globbyStub
|
||||
.withArgs(['./packages/*', './npm/*'])
|
||||
.resolves(['./packages/coffee'])
|
||||
|
||||
globbyStub
|
||||
.withArgs(['package.json', 'lib', 'src/main.js'])
|
||||
.resolves([
|
||||
'package.json',
|
||||
@@ -59,38 +65,6 @@ describe('packages', () => {
|
||||
|
||||
snapshot(files)
|
||||
})
|
||||
|
||||
it('can find packages with script', async () => {
|
||||
mockfs(
|
||||
{
|
||||
'packages': {
|
||||
'foo': {
|
||||
'package.json': JSON.stringify({
|
||||
scripts: {
|
||||
build: 'somefoo',
|
||||
},
|
||||
}),
|
||||
},
|
||||
'bar': {
|
||||
'package.json': JSON.stringify({
|
||||
scripts: {
|
||||
start: 'somefoo',
|
||||
},
|
||||
}),
|
||||
},
|
||||
'baz': {
|
||||
'package.json': JSON.stringify({
|
||||
main: 'somefoo',
|
||||
}),
|
||||
},
|
||||
},
|
||||
},
|
||||
)
|
||||
|
||||
const res = await packages.getPackagesWithScript('build')
|
||||
|
||||
expect(res).deep.eq(['foo'])
|
||||
})
|
||||
})
|
||||
|
||||
describe('transformRequires', () => {
|
||||
@@ -120,6 +94,18 @@ describe('transformRequires', () => {
|
||||
},
|
||||
})
|
||||
|
||||
sinon.stub(externalUtils, 'globby')
|
||||
.withArgs([
|
||||
'build/linux/Cypress/resources/app/packages/**/*.js',
|
||||
'build/linux/Cypress/resources/app/npm/**/*.js',
|
||||
])
|
||||
.resolves([
|
||||
'build/linux/Cypress/resources/app/packages/foo/src/main.js',
|
||||
'build/linux/Cypress/resources/app/packages/foo/lib/foo.js',
|
||||
'build/linux/Cypress/resources/app/packages/bar/src/main.js',
|
||||
'build/linux/Cypress/resources/app/packages/bar/lib/foo.js',
|
||||
])
|
||||
|
||||
// should return number of transformed requires
|
||||
await expect(transformRequires(buildRoot)).to.eventually.eq(2)
|
||||
|
||||
@@ -160,6 +146,18 @@ describe('transformRequires', () => {
|
||||
},
|
||||
})
|
||||
|
||||
sinon.stub(externalUtils, 'globby')
|
||||
.withArgs([
|
||||
'build/linux/Cypress/resources/app/packages/**/*.js',
|
||||
'build/linux/Cypress/resources/app/npm/**/*.js',
|
||||
])
|
||||
.resolves([
|
||||
'build/linux/Cypress/resources/app/packages/foo/src/main.js',
|
||||
'build/linux/Cypress/resources/app/packages/foo/lib/foo.js',
|
||||
'build/linux/Cypress/resources/app/packages/bar/src/main.js',
|
||||
'build/linux/Cypress/resources/app/packages/bar/lib/foo.js',
|
||||
])
|
||||
|
||||
await transformRequires(buildRoot)
|
||||
|
||||
snapshot(getFs())
|
||||
|
||||
90
yarn.lock
90
yarn.lock
@@ -1962,17 +1962,6 @@
|
||||
debug "3.1.0"
|
||||
lazy-ass "1.6.0"
|
||||
|
||||
"@cypress/eslint-plugin-dev@*":
|
||||
version "5.0.2"
|
||||
resolved "https://registry.yarnpkg.com/@cypress/eslint-plugin-dev/-/eslint-plugin-dev-5.0.2.tgz#b7b59a836d55afd59f15b6410e37d4c624f5adad"
|
||||
integrity sha512-VlmFYfCo8HnrKRBUOmkzOvtTvCNALNAei4fF5+TdUgmofU13nUxDccmB/SArhExMgSuAikHGQGPDFC2+NKJ0ew==
|
||||
dependencies:
|
||||
bluebird "^3.5.5"
|
||||
chalk "^2.4.2"
|
||||
eslint-rule-composer "^0.3.0"
|
||||
lodash "^4.17.15"
|
||||
shelljs "^0.8.3"
|
||||
|
||||
"@cypress/get-windows-proxy@1.6.1":
|
||||
version "1.6.1"
|
||||
resolved "https://registry.yarnpkg.com/@cypress/get-windows-proxy/-/get-windows-proxy-1.6.1.tgz#61a29d0271b38deaafc24b22a661bab684b6743f"
|
||||
@@ -2129,36 +2118,6 @@
|
||||
dependencies:
|
||||
css.escape "^1.5.1"
|
||||
|
||||
"@cypress/webpack-batteries-included-preprocessor@*":
|
||||
version "2.1.3"
|
||||
resolved "https://registry.yarnpkg.com/@cypress/webpack-batteries-included-preprocessor/-/webpack-batteries-included-preprocessor-2.1.3.tgz#da6a21e7634f78b0939e97581cd6b95d200bc743"
|
||||
integrity sha512-fTktM5ZY4oL53sJWgehehOmkIV7/6l8nZm83gd4M6s/psw7V/rrr7W4mfZvDPECAadO0Ov0nnOPvlBhO9IYpLg==
|
||||
dependencies:
|
||||
"@babel/core" "^7.11.1"
|
||||
"@babel/plugin-proposal-class-properties" "^7.10.4"
|
||||
"@babel/plugin-proposal-object-rest-spread" "^7.11.0"
|
||||
"@babel/plugin-transform-runtime" "^7.11.0"
|
||||
"@babel/preset-env" "^7.11.0"
|
||||
"@babel/preset-react" "^7.10.4"
|
||||
"@babel/runtime" "^7.11.2"
|
||||
babel-loader "^8.1.0"
|
||||
babel-plugin-add-module-exports "^1.0.2"
|
||||
coffee-loader "^0.9.0"
|
||||
coffeescript "^1.12.7"
|
||||
ts-loader "^8.0.2"
|
||||
tsconfig-package "npm:tsconfig@^7.0.0"
|
||||
tsconfig-paths-webpack-plugin "^3.3.0"
|
||||
webpack "^4.44.1"
|
||||
|
||||
"@cypress/webpack-preprocessor@*":
|
||||
version "5.4.5"
|
||||
resolved "https://registry.yarnpkg.com/@cypress/webpack-preprocessor/-/webpack-preprocessor-5.4.5.tgz#a3e5f7172c2a11348da3afa8821d1a4cd0bfcfcd"
|
||||
integrity sha512-KH9B//f5DanvnO4RxyEq9RRGqeFqbzsk/wvINWhJAZcyCSZ9iD/J5E1picHt7UZxw9iXw3hzJWcuKNxdR4nk5w==
|
||||
dependencies:
|
||||
bluebird "^3.7.1"
|
||||
debug "^4.1.1"
|
||||
lodash "^4.17.20"
|
||||
|
||||
"@cypress/webpack-preprocessor@5.4.2":
|
||||
version "5.4.2"
|
||||
resolved "https://registry.yarnpkg.com/@cypress/webpack-preprocessor/-/webpack-preprocessor-5.4.2.tgz#d40fed6375b09dd16b266a045f4577e9c7a0299a"
|
||||
@@ -12255,6 +12214,50 @@ cypress-react-unit-test@4.11.2:
|
||||
mime-types "2.1.26"
|
||||
unfetch "4.1.0"
|
||||
|
||||
cypress@*:
|
||||
version "6.1.0"
|
||||
resolved "https://registry.yarnpkg.com/cypress/-/cypress-6.1.0.tgz#af2596cb110aa98eaf75fef3d8ab379ca0ff2413"
|
||||
integrity sha512-uQnSxRcZ6hkf9R5cr8KpRBTzN88QZwLIImbf5DWa5RIxH6o5Gpff58EcjiYhAR8/8p9SGv7O6SRygq4H+k0Qpw==
|
||||
dependencies:
|
||||
"@cypress/listr-verbose-renderer" "^0.4.1"
|
||||
"@cypress/request" "^2.88.5"
|
||||
"@cypress/xvfb" "^1.2.4"
|
||||
"@types/sinonjs__fake-timers" "^6.0.1"
|
||||
"@types/sizzle" "^2.3.2"
|
||||
arch "^2.1.2"
|
||||
blob-util "2.0.2"
|
||||
bluebird "^3.7.2"
|
||||
cachedir "^2.3.0"
|
||||
chalk "^4.1.0"
|
||||
check-more-types "^2.24.0"
|
||||
cli-table3 "~0.6.0"
|
||||
commander "^5.1.0"
|
||||
common-tags "^1.8.0"
|
||||
debug "^4.1.1"
|
||||
eventemitter2 "^6.4.2"
|
||||
execa "^4.0.2"
|
||||
executable "^4.1.1"
|
||||
extract-zip "^1.7.0"
|
||||
fs-extra "^9.0.1"
|
||||
getos "^3.2.1"
|
||||
is-ci "^2.0.0"
|
||||
is-installed-globally "^0.3.2"
|
||||
lazy-ass "^1.6.0"
|
||||
listr "^0.14.3"
|
||||
lodash "^4.17.19"
|
||||
log-symbols "^4.0.0"
|
||||
minimist "^1.2.5"
|
||||
moment "^2.27.0"
|
||||
ospath "^1.2.2"
|
||||
pretty-bytes "^5.4.1"
|
||||
ramda "~0.26.1"
|
||||
request-progress "^3.0.0"
|
||||
supports-color "^7.2.0"
|
||||
tmp "~0.2.1"
|
||||
untildify "^4.0.0"
|
||||
url "^0.11.0"
|
||||
yauzl "^2.10.0"
|
||||
|
||||
d3-array@^1.2.0:
|
||||
version "1.2.4"
|
||||
resolved "https://registry.yarnpkg.com/d3-array/-/d3-array-1.2.4.tgz#635ce4d5eea759f6f605863dbcfc30edc737f71f"
|
||||
@@ -32250,11 +32253,6 @@ typescript@3.7.4:
|
||||
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.7.4.tgz#1743a5ec5fef6a1fa9f3e4708e33c81c73876c19"
|
||||
integrity sha512-A25xv5XCtarLwXpcDNZzCGvW2D1S3/bACratYBx2sax8PefsFhlYmkQicKHvpYflFS8if4zne5zT5kpJ7pzuvw==
|
||||
|
||||
typescript@3.8.3:
|
||||
version "3.8.3"
|
||||
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.8.3.tgz#409eb8544ea0335711205869ec458ab109ee1061"
|
||||
integrity sha512-MYlEfn5VrLNsgudQTVJeNaQFUAI7DkhnOjdpAp4T+ku1TfQClewlbSuTVHiA+8skNBgaf02TL/kLOvig4y3G8w==
|
||||
|
||||
typescript@3.9.6, typescript@^3.0.3, typescript@^3.8.3:
|
||||
version "3.9.6"
|
||||
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.9.6.tgz#8f3e0198a34c3ae17091b35571d3afd31999365a"
|
||||
|
||||
Reference in New Issue
Block a user