Skip to content

Commit e4f5b10

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

File tree

49 files changed

+1122
-1184
lines changed

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

Lines changed: 5 additions & 4 deletions
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

Lines changed: 1 addition & 0 deletions
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

Lines changed: 1 addition & 11 deletions
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

Lines changed: 5 additions & 1 deletion
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

Lines changed: 2 additions & 1 deletion
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

Lines changed: 8 additions & 0 deletions
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

Lines changed: 3 additions & 1 deletion
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

Lines changed: 11 additions & 0 deletions
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

Lines changed: 1 addition & 13 deletions
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

Lines changed: 1 addition & 1 deletion
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",

0 commit comments

Comments
 (0)