Skip to content

Commit e4f5b10

Browse files
authored
feat: use hoisted yarn install in binary build (#17285)
1 parent fc6131c commit e4f5b10

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+1122
-1184
lines changed

__snapshots__/packages-spec.js

+5-4
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,19 @@ exports['packages can copy files from package.json 1'] = {
1515
"tmp": {
1616
"packages": {
1717
"coffee": {
18-
"package.json": "{\"main\":\"src/main.js\", \"name\": \"foo\", \"files\": [\"lib\"]}",
18+
"lib": {
19+
"foo.js": "{}"
20+
},
1921
"src": {
2022
"main.js": "console.log()"
2123
},
22-
"lib": {
23-
"foo.js": "{}"
24-
}
24+
"package.json": "{\n \"main\": \"src/main.js\",\n \"name\": \"foo\",\n \"files\": [\n \"lib\"\n ]\n}\n"
2525
}
2626
}
2727
}
2828
}
2929

30+
3031
exports['transformRequires can find and replace symlink requires 1'] = {
3132
"[cwd]": {
3233
"build": {

appveyor.yml

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ branches:
22
only:
33
- master
44
- develop
5+
- windows-code-signing
56
- 9.0-release
67
- /win*/
78

circle.yml

+1-11
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ macBuildFilters: &macBuildFilters
88
branches:
99
only:
1010
- develop
11-
- 9.0-release
1211

1312
defaults: &defaults
1413
parallelism: 1
@@ -42,7 +41,6 @@ onlyMainBranches: &onlyMainBranches
4241
branches:
4342
only:
4443
- develop
45-
- 9.0-release
4644
requires:
4745
- create-build-artifacts
4846

@@ -1513,7 +1511,7 @@ jobs:
15131511
- run:
15141512
name: Check current branch to persist artifacts
15151513
command: |
1516-
if [[ "$CIRCLE_BRANCH" != "develop" && "$CIRCLE_BRANCH" != "9.0-release" ]]; then
1514+
if [[ "$CIRCLE_BRANCH" != "develop" && "$CIRCLE_BRANCH" != "tgriesser/build/root-yarn-install" ]]; then
15171515
echo "Not uploading artifacts or posting install comment for this branch."
15181516
circleci-agent step halt
15191517
fi
@@ -2155,7 +2153,6 @@ linux-workflow: &linux-workflow
21552153
branches:
21562154
only:
21572155
- develop
2158-
- 9.0-release
21592156
requires:
21602157
- build
21612158
- test-kitchensink:
@@ -2167,7 +2164,6 @@ linux-workflow: &linux-workflow
21672164
branches:
21682165
only:
21692166
- develop
2170-
- 9.0-release
21712167
requires:
21722168
- build
21732169
- create-build-artifacts:
@@ -2217,15 +2213,13 @@ linux-workflow: &linux-workflow
22172213
branches:
22182214
only:
22192215
- develop
2220-
- 9.0-release
22212216
requires:
22222217
- create-build-artifacts
22232218
- test-npm-module-and-verify-binary:
22242219
filters:
22252220
branches:
22262221
only:
22272222
- develop
2228-
- 9.0-release
22292223
requires:
22302224
- create-build-artifacts
22312225
- test-binary-against-staging:
@@ -2234,7 +2228,6 @@ linux-workflow: &linux-workflow
22342228
branches:
22352229
only:
22362230
- develop
2237-
- 9.0-release
22382231
requires:
22392232
- create-build-artifacts
22402233

@@ -2259,7 +2252,6 @@ linux-workflow: &linux-workflow
22592252
branches:
22602253
only:
22612254
- develop
2262-
- 9.0-release
22632255
requires:
22642256
- create-build-artifacts
22652257

@@ -2331,7 +2323,6 @@ mac-workflow: &mac-workflow
23312323
branches:
23322324
only:
23332325
- develop
2334-
- 9.0-release
23352326
requires:
23362327
- darwin-create-build-artifacts
23372328

@@ -2343,7 +2334,6 @@ mac-workflow: &mac-workflow
23432334
branches:
23442335
only:
23452336
- develop
2346-
- 9.0-release
23472337
requires:
23482338
- darwin-create-build-artifacts
23492339

cli/lib/tasks/install.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ const getNpmArgv = () => {
3838
const getVersionSpecifier = (startDir = path.resolve(__dirname, '../..')) => {
3939
const argv = getNpmArgv()
4040

41+
if ((process.env.npm_package_resolved || '').endsWith('cypress.tgz')) {
42+
return process.env.npm_package_resolved
43+
}
44+
4145
if (argv) {
4246
const tgz = _.find(argv, (t) => t.endsWith('cypress.tgz'))
4347

@@ -81,7 +85,7 @@ const getVersionSpecifier = (startDir = path.resolve(__dirname, '../..')) => {
8185
})
8286
}
8387

84-
const betaNpmUrlRe = /^\/beta\/npm\/(?<version>[0-9.]+)\/(?<artifactSlug>[^/]+)\/cypress\.tgz$/
88+
const betaNpmUrlRe = /^\/beta\/npm\/(?<version>[0-9.]+)\/(?<artifactSlug>.+?)\/cypress\.tgz$/
8589

8690
// convert a prerelease NPM package .tgz URL to the corresponding binary .zip URL
8791
const getBinaryUrlFromPrereleaseNpmUrl = (npmUrl) => {

cli/package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"private": true,
55
"main": "index.js",
66
"scripts": {
7+
"clean": "node ./scripts/clean.js",
78
"prebuild": "yarn postinstall && node ./scripts/start-build.js",
89
"build": "node ./scripts/build.js",
910
"dtslint": "dtslint types",
@@ -27,7 +28,7 @@
2728
"@types/sizzle": "^2.3.2",
2829
"arch": "^2.2.0",
2930
"blob-util": "^2.0.2",
30-
"bluebird": "^3.7.2",
31+
"bluebird": "3.7.2",
3132
"cachedir": "^2.3.0",
3233
"chalk": "^4.1.0",
3334
"check-more-types": "^2.24.0",

cli/scripts/clean.js

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
const shelljs = require('shelljs')
2+
const { includeTypes } = require('./utils')
3+
4+
shelljs.rm('-rf', 'build')
5+
6+
includeTypes.map((m) => {
7+
shelljs.rm('-rf', `types/${m}`)
8+
})

cli/scripts/post-install.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,9 @@ filesToUncomment.forEach((file) => {
8989
const filePath = join(__dirname, '../types', file)
9090
const str = fs.readFileSync(filePath).toString()
9191

92-
const result = str.split('\n').map((line) => line.substring(3)).join('\n')
92+
const result = str.split('\n').map((line) => {
93+
return line.startsWith('// ') ? line.substring(3) : line
94+
}).join('\n')
9395

9496
fs.writeFileSync(filePath, result)
9597
})

cli/test/lib/tasks/install_spec.js

+11
Original file line numberDiff line numberDiff line change
@@ -472,6 +472,9 @@ describe('/lib/tasks/install', function () {
472472

473473
expect(install._getBinaryUrlFromPrereleaseNpmUrl('https://cdn.cypress.io/beta/npm/5.1.1/circle-develop-3fdfc3b453eb38ad3c0b079531e4dde6668e3dd0-436710/cypress.tgz'))
474474
.to.eq('https://cdn.cypress.io/beta/binary/5.1.1/linux-x64/circle-develop-3fdfc3b453eb38ad3c0b079531e4dde6668e3dd0-436710/cypress.zip')
475+
476+
expect(install._getBinaryUrlFromPrereleaseNpmUrl('https://cdn.cypress.io/beta/npm/5.1.1/circle-develop/some/branch-3fdfc3b453eb38ad3c0b079531e4dde6668e3dd0-436710/cypress.tgz'))
477+
.to.eq('https://cdn.cypress.io/beta/binary/5.1.1/linux-x64/circle-develop/some/branch-3fdfc3b453eb38ad3c0b079531e4dde6668e3dd0-436710/cypress.zip')
475478
})
476479

477480
it('returns nothing for an invalid url', function () {
@@ -502,6 +505,14 @@ describe('/lib/tasks/install', function () {
502505
expect(await install._getVersionSpecifier('/foo/bar/baz')).to.eq('https://foo.com/cypress.tgz')
503506
})
504507

508+
it('resolves with cypress.tgz URL if specified in npm env npm_package_resolved', async function () {
509+
restoreEnv = mockedEnv({
510+
npm_package_resolved: 'https://foo.com/cypress.tgz',
511+
})
512+
513+
expect(await install._getVersionSpecifier('/foo/bar/baz')).to.eq('https://foo.com/cypress.tgz')
514+
})
515+
505516
it('resolves with versionSpecifier from parent pkg.json', async function () {
506517
fs.readJSON.withArgs('/foo/bar/baz/package.json').resolves({
507518
dependencies: {

electron-builder.json

+1-13
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,7 @@
99
"hardenedRuntime": true,
1010
"entitlements": "./scripts/entitlements.mac.inherit.plist",
1111
"entitlementsInherit": "./scripts/entitlements.mac.inherit.plist",
12-
"type": "distribution",
13-
"binaries": [
14-
"./build/mac/Cypress.app/Contents/Resources/app/packages/server/node_modules/babel-plugin-add-module-exports/node_modules/fsevents/build/Release/.node",
15-
"./build/mac/Cypress.app/Contents/Resources/app/packages/server/node_modules/babel-plugin-add-module-exports/node_modules/fsevents/build/Release/fse.node",
16-
"./build/mac/Cypress.app/Contents/Resources/app/packages/server/node_modules/@ffmpeg-installer/darwin-x64/ffmpeg",
17-
"./build/mac/Cypress.app/Contents/Resources/app/packages/server/node_modules/watchpack-chokidar2/node_modules/fsevents/build/Release/.node",
18-
"./build/mac/Cypress.app/Contents/Resources/app/packages/server/node_modules/watchpack-chokidar2/node_modules/fsevents/build/Release/fse.node",
19-
"./build/mac/Cypress.app/Contents/Resources/app/packages/server/node_modules/registry-js/build/Release/registry.node",
20-
"./build/mac/Cypress.app/Contents/Resources/app/packages/server/node_modules/term-size/vendor/macos/term-size",
21-
"./build/mac/Cypress.app/Contents/Resources/app/packages/server/node_modules/trash/lib/macos-trash",
22-
"./build/mac/Cypress.app/Contents/Resources/app/packages/server/node_modules/fsevents/fsevents.node",
23-
"./build/mac/Cypress.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Helpers/chrome_crashpad_handler"
24-
]
12+
"type": "distribution"
2513
},
2614
"linux": {
2715
"target": "dir",

npm/angular/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
},
1818
"dependencies": {
1919
"@cypress/mount-utils": "0.0.0-development",
20-
"debug": "4.3.2"
20+
"debug": "^4.3.2"
2121
},
2222
"devDependencies": {
2323
"@angular-devkit/build-angular": "0.1102.12",

npm/create-cypress-tests/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"@babel/plugin-transform-typescript": "^7.2.0",
1818
"@babel/template": "^7.5.4",
1919
"@babel/types": "^7.5.0",
20-
"bluebird": "^3.7.2",
20+
"bluebird": "3.7.2",
2121
"chalk": "4.1.0",
2222
"cli-highlight": "2.1.10",
2323
"commander": "6.1.0",

npm/eslint-plugin-dev/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"test": "jest"
1111
},
1212
"dependencies": {
13-
"bluebird": "^3.5.5",
13+
"bluebird": "3.5.5",
1414
"chalk": "^2.4.2",
1515
"eslint-rule-composer": "^0.3.0",
1616
"lodash": "^4.17.15",

npm/react/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
},
2222
"dependencies": {
2323
"@cypress/mount-utils": "0.0.0-development",
24-
"debug": "4.3.2",
24+
"debug": "^4.3.2",
2525
"find-webpack": "2.2.1",
2626
"find-yarn-workspace-root": "2.0.0"
2727
},
@@ -66,7 +66,7 @@
6666
"date-fns": "2.13.0",
6767
"framer-motion": "2.6.13",
6868
"i18next": "19.7.0",
69-
"lodash": "4.17.15",
69+
"lodash": "^4.17.15",
7070
"mobx": "6.0.0",
7171
"mobx-react-lite": "3.0.0",
7272
"mocha-junit-reporter": "^2.0.0",

npm/vue/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
"babel-preset-typescript-vue3": "^2.0.14",
3838
"css-loader": "3.4.2",
3939
"cypress": "0.0.0-development",
40-
"debug": "4.3.2",
40+
"debug": "^4.3.2",
4141
"eslint-plugin-vue": "^6.2.2",
4242
"find-webpack": "2.1.0",
4343
"mocha": "7.1.1",

npm/webpack-dev-server/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"watch": "tsc -w"
1212
},
1313
"dependencies": {
14-
"debug": "4.3.2",
14+
"debug": "^4.3.2",
1515
"semver": "^7.3.4",
1616
"webpack-merge": "^5.4.0"
1717
},

npm/webpack-preprocessor/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
"watch": "yarn build --watch"
2121
},
2222
"dependencies": {
23-
"bluebird": "^3.7.1",
24-
"debug": "4.3.2",
23+
"bluebird": "3.7.1",
24+
"debug": "^4.3.2",
2525
"lodash": "^4.17.20"
2626
},
2727
"devDependencies": {

package.json

+6-9
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
"effective:circle:config": "circleci config process circle.yml | sed /^#/d",
3636
"ensure-deps": "./scripts/ensure-dependencies.sh",
3737
"get-next-version": "node scripts/get-next-version.js",
38-
"postinstall": "yarn-deduplicate --strategy=highest && patch-package && ./scripts/run-if-not-ci.sh yarn build",
38+
"postinstall": "patch-package && ./scripts/run-if-not-ci.sh yarn-deduplicate --strategy=highest && ./scripts/run-if-not-ci.sh yarn build",
3939
"jscodeshift": "jscodeshift -t ./node_modules/js-codemod/transforms/arrow-function-arguments.js",
4040
"lint": "eslint --ext .js,.jsx,.ts,.tsx,.json .",
4141
"lint-changed": "lint-changed",
@@ -88,7 +88,7 @@
8888
"@types/execa": "0.9.0",
8989
"@types/fs-extra": "^8.0.1",
9090
"@types/glob": "7.1.1",
91-
"@types/lodash": "4.14.168",
91+
"@types/lodash": "^4.14.168",
9292
"@types/markdown-it": "0.0.9",
9393
"@types/mini-css-extract-plugin": "1.2.3",
9494
"@types/mocha": "8.0.3",
@@ -115,10 +115,10 @@
115115
"commander": "6.2.1",
116116
"common-tags": "1.8.0",
117117
"conventional-recommended-bump": "6.1.0",
118-
"debug": "4.3.2",
118+
"debug": "^4.3.2",
119119
"del": "3.0.0",
120-
"electron-builder": "22.9.1",
121-
"electron-notarize": "1.0.0",
120+
"electron-builder": "^22.13.1",
121+
"electron-notarize": "^1.1.1",
122122
"enzyme-adapter-react-16": "1.12.1",
123123
"eslint": "7.22.0",
124124
"eslint-plugin-cypress": "2.11.2",
@@ -154,15 +154,14 @@
154154
"lerna": "3.20.2",
155155
"lint-staged": "11.1.2",
156156
"listr2": "3.8.3",
157-
"lodash": "4.17.21",
157+
"lodash": "^4.17.21",
158158
"make-empty-github-commit": "cypress-io/make-empty-github-commit#4a592aedb776ba2f4cc88979055315a53eec42ee",
159159
"minimist": "1.2.5",
160160
"mocha": "3.5.3",
161161
"mocha-banner": "1.1.2",
162162
"mocha-junit-reporter": "2.0.0",
163163
"mocha-multi-reporters": "1.1.7",
164164
"mock-fs": "5.1.1",
165-
"odiff-bin": "2.1.0",
166165
"parse-github-repo-url": "1.4.1",
167166
"patch-package": "6.4.7",
168167
"plist": "3.0.1",
@@ -226,8 +225,6 @@
226225
"system-tests"
227226
],
228227
"nohoist": [
229-
"**/@ffmpeg-installer",
230-
"**/@ffmpeg-installer/**",
231228
"**/webpack-preprocessor/babel-loader",
232229
"**/webpack-batteries-included-preprocessor/ts-loader",
233230
"**/@vue/runtime-dom",

packages/config/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
"dependencies": {
1515
"check-more-types": "2.24.0",
1616
"common-tags": "1.8.0",
17-
"debug": "4.3.2",
18-
"lodash": "4.17.21"
17+
"debug": "^4.3.2",
18+
"lodash": "^4.17.21"
1919
},
2020
"devDependencies": {
2121
"@packages/ts": "0.0.0-development",

packages/desktop-gui/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
"dayjs": "^1.9.3",
3838
"gravatar": "1.8.0",
3939
"human-interval": "1.0.0",
40-
"lodash": "4.17.21",
40+
"lodash": "^4.17.21",
4141
"markdown-it": "11.0.0",
4242
"mobx": "5.15.4",
4343
"mobx-react": "6.1.8",

0 commit comments

Comments
 (0)