Skip to content

Commit

Permalink
feat: use hoisted yarn install in binary build (#17285)
Browse files Browse the repository at this point in the history
  • Loading branch information
tgriesser committed Nov 20, 2021
1 parent fc6131c commit e4f5b10
Show file tree
Hide file tree
Showing 49 changed files with 1,122 additions and 1,184 deletions.
9 changes: 5 additions & 4 deletions __snapshots__/packages-spec.js
Expand Up @@ -15,18 +15,19 @@ exports['packages can copy files from package.json 1'] = {
"tmp": {
"packages": {
"coffee": {
"package.json": "{\"main\":\"src/main.js\", \"name\": \"foo\", \"files\": [\"lib\"]}",
"lib": {
"foo.js": "{}"
},
"src": {
"main.js": "console.log()"
},
"lib": {
"foo.js": "{}"
}
"package.json": "{\n \"main\": \"src/main.js\",\n \"name\": \"foo\",\n \"files\": [\n \"lib\"\n ]\n}\n"
}
}
}
}


exports['transformRequires can find and replace symlink requires 1'] = {
"[cwd]": {
"build": {
Expand Down
1 change: 1 addition & 0 deletions appveyor.yml
Expand Up @@ -2,6 +2,7 @@ branches:
only:
- master
- develop
- windows-code-signing
- 9.0-release
- /win*/

Expand Down
12 changes: 1 addition & 11 deletions circle.yml
Expand Up @@ -8,7 +8,6 @@ macBuildFilters: &macBuildFilters
branches:
only:
- develop
- 9.0-release

defaults: &defaults
parallelism: 1
Expand Down Expand Up @@ -42,7 +41,6 @@ onlyMainBranches: &onlyMainBranches
branches:
only:
- develop
- 9.0-release
requires:
- create-build-artifacts

Expand Down Expand Up @@ -1513,7 +1511,7 @@ jobs:
- run:
name: Check current branch to persist artifacts
command: |
if [[ "$CIRCLE_BRANCH" != "develop" && "$CIRCLE_BRANCH" != "9.0-release" ]]; then
if [[ "$CIRCLE_BRANCH" != "develop" && "$CIRCLE_BRANCH" != "tgriesser/build/root-yarn-install" ]]; then
echo "Not uploading artifacts or posting install comment for this branch."
circleci-agent step halt
fi
Expand Down Expand Up @@ -2155,7 +2153,6 @@ linux-workflow: &linux-workflow
branches:
only:
- develop
- 9.0-release
requires:
- build
- test-kitchensink:
Expand All @@ -2167,7 +2164,6 @@ linux-workflow: &linux-workflow
branches:
only:
- develop
- 9.0-release
requires:
- build
- create-build-artifacts:
Expand Down Expand Up @@ -2217,15 +2213,13 @@ linux-workflow: &linux-workflow
branches:
only:
- develop
- 9.0-release
requires:
- create-build-artifacts
- test-npm-module-and-verify-binary:
filters:
branches:
only:
- develop
- 9.0-release
requires:
- create-build-artifacts
- test-binary-against-staging:
Expand All @@ -2234,7 +2228,6 @@ linux-workflow: &linux-workflow
branches:
only:
- develop
- 9.0-release
requires:
- create-build-artifacts

Expand All @@ -2259,7 +2252,6 @@ linux-workflow: &linux-workflow
branches:
only:
- develop
- 9.0-release
requires:
- create-build-artifacts

Expand Down Expand Up @@ -2331,7 +2323,6 @@ mac-workflow: &mac-workflow
branches:
only:
- develop
- 9.0-release
requires:
- darwin-create-build-artifacts

Expand All @@ -2343,7 +2334,6 @@ mac-workflow: &mac-workflow
branches:
only:
- develop
- 9.0-release
requires:
- darwin-create-build-artifacts

Expand Down
6 changes: 5 additions & 1 deletion cli/lib/tasks/install.js
Expand Up @@ -38,6 +38,10 @@ const getNpmArgv = () => {
const getVersionSpecifier = (startDir = path.resolve(__dirname, '../..')) => {
const argv = getNpmArgv()

if ((process.env.npm_package_resolved || '').endsWith('cypress.tgz')) {
return process.env.npm_package_resolved
}

if (argv) {
const tgz = _.find(argv, (t) => t.endsWith('cypress.tgz'))

Expand Down Expand Up @@ -81,7 +85,7 @@ const getVersionSpecifier = (startDir = path.resolve(__dirname, '../..')) => {
})
}

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

// convert a prerelease NPM package .tgz URL to the corresponding binary .zip URL
const getBinaryUrlFromPrereleaseNpmUrl = (npmUrl) => {
Expand Down
3 changes: 2 additions & 1 deletion cli/package.json
Expand Up @@ -4,6 +4,7 @@
"private": true,
"main": "index.js",
"scripts": {
"clean": "node ./scripts/clean.js",
"prebuild": "yarn postinstall && node ./scripts/start-build.js",
"build": "node ./scripts/build.js",
"dtslint": "dtslint types",
Expand All @@ -27,7 +28,7 @@
"@types/sizzle": "^2.3.2",
"arch": "^2.2.0",
"blob-util": "^2.0.2",
"bluebird": "^3.7.2",
"bluebird": "3.7.2",
"cachedir": "^2.3.0",
"chalk": "^4.1.0",
"check-more-types": "^2.24.0",
Expand Down
8 changes: 8 additions & 0 deletions cli/scripts/clean.js
@@ -0,0 +1,8 @@
const shelljs = require('shelljs')
const { includeTypes } = require('./utils')

shelljs.rm('-rf', 'build')

includeTypes.map((m) => {
shelljs.rm('-rf', `types/${m}`)
})
4 changes: 3 additions & 1 deletion cli/scripts/post-install.js
Expand Up @@ -89,7 +89,9 @@ filesToUncomment.forEach((file) => {
const filePath = join(__dirname, '../types', file)
const str = fs.readFileSync(filePath).toString()

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

fs.writeFileSync(filePath, result)
})
11 changes: 11 additions & 0 deletions cli/test/lib/tasks/install_spec.js
Expand Up @@ -472,6 +472,9 @@ describe('/lib/tasks/install', function () {

expect(install._getBinaryUrlFromPrereleaseNpmUrl('https://cdn.cypress.io/beta/npm/5.1.1/circle-develop-3fdfc3b453eb38ad3c0b079531e4dde6668e3dd0-436710/cypress.tgz'))
.to.eq('https://cdn.cypress.io/beta/binary/5.1.1/linux-x64/circle-develop-3fdfc3b453eb38ad3c0b079531e4dde6668e3dd0-436710/cypress.zip')

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

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

it('resolves with cypress.tgz URL if specified in npm env npm_package_resolved', async function () {
restoreEnv = mockedEnv({
npm_package_resolved: 'https://foo.com/cypress.tgz',
})

expect(await install._getVersionSpecifier('/foo/bar/baz')).to.eq('https://foo.com/cypress.tgz')
})

it('resolves with versionSpecifier from parent pkg.json', async function () {
fs.readJSON.withArgs('/foo/bar/baz/package.json').resolves({
dependencies: {
Expand Down
14 changes: 1 addition & 13 deletions electron-builder.json
Expand Up @@ -9,19 +9,7 @@
"hardenedRuntime": true,
"entitlements": "./scripts/entitlements.mac.inherit.plist",
"entitlementsInherit": "./scripts/entitlements.mac.inherit.plist",
"type": "distribution",
"binaries": [
"./build/mac/Cypress.app/Contents/Resources/app/packages/server/node_modules/babel-plugin-add-module-exports/node_modules/fsevents/build/Release/.node",
"./build/mac/Cypress.app/Contents/Resources/app/packages/server/node_modules/babel-plugin-add-module-exports/node_modules/fsevents/build/Release/fse.node",
"./build/mac/Cypress.app/Contents/Resources/app/packages/server/node_modules/@ffmpeg-installer/darwin-x64/ffmpeg",
"./build/mac/Cypress.app/Contents/Resources/app/packages/server/node_modules/watchpack-chokidar2/node_modules/fsevents/build/Release/.node",
"./build/mac/Cypress.app/Contents/Resources/app/packages/server/node_modules/watchpack-chokidar2/node_modules/fsevents/build/Release/fse.node",
"./build/mac/Cypress.app/Contents/Resources/app/packages/server/node_modules/registry-js/build/Release/registry.node",
"./build/mac/Cypress.app/Contents/Resources/app/packages/server/node_modules/term-size/vendor/macos/term-size",
"./build/mac/Cypress.app/Contents/Resources/app/packages/server/node_modules/trash/lib/macos-trash",
"./build/mac/Cypress.app/Contents/Resources/app/packages/server/node_modules/fsevents/fsevents.node",
"./build/mac/Cypress.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Helpers/chrome_crashpad_handler"
]
"type": "distribution"
},
"linux": {
"target": "dir",
Expand Down
2 changes: 1 addition & 1 deletion npm/angular/package.json
Expand Up @@ -17,7 +17,7 @@
},
"dependencies": {
"@cypress/mount-utils": "0.0.0-development",
"debug": "4.3.2"
"debug": "^4.3.2"
},
"devDependencies": {
"@angular-devkit/build-angular": "0.1102.12",
Expand Down
2 changes: 1 addition & 1 deletion npm/create-cypress-tests/package.json
Expand Up @@ -17,7 +17,7 @@
"@babel/plugin-transform-typescript": "^7.2.0",
"@babel/template": "^7.5.4",
"@babel/types": "^7.5.0",
"bluebird": "^3.7.2",
"bluebird": "3.7.2",
"chalk": "4.1.0",
"cli-highlight": "2.1.10",
"commander": "6.1.0",
Expand Down
2 changes: 1 addition & 1 deletion npm/eslint-plugin-dev/package.json
Expand Up @@ -10,7 +10,7 @@
"test": "jest"
},
"dependencies": {
"bluebird": "^3.5.5",
"bluebird": "3.5.5",
"chalk": "^2.4.2",
"eslint-rule-composer": "^0.3.0",
"lodash": "^4.17.15",
Expand Down
4 changes: 2 additions & 2 deletions npm/react/package.json
Expand Up @@ -21,7 +21,7 @@
},
"dependencies": {
"@cypress/mount-utils": "0.0.0-development",
"debug": "4.3.2",
"debug": "^4.3.2",
"find-webpack": "2.2.1",
"find-yarn-workspace-root": "2.0.0"
},
Expand Down Expand Up @@ -66,7 +66,7 @@
"date-fns": "2.13.0",
"framer-motion": "2.6.13",
"i18next": "19.7.0",
"lodash": "4.17.15",
"lodash": "^4.17.15",
"mobx": "6.0.0",
"mobx-react-lite": "3.0.0",
"mocha-junit-reporter": "^2.0.0",
Expand Down
2 changes: 1 addition & 1 deletion npm/vue/package.json
Expand Up @@ -37,7 +37,7 @@
"babel-preset-typescript-vue3": "^2.0.14",
"css-loader": "3.4.2",
"cypress": "0.0.0-development",
"debug": "4.3.2",
"debug": "^4.3.2",
"eslint-plugin-vue": "^6.2.2",
"find-webpack": "2.1.0",
"mocha": "7.1.1",
Expand Down
2 changes: 1 addition & 1 deletion npm/webpack-dev-server/package.json
Expand Up @@ -11,7 +11,7 @@
"watch": "tsc -w"
},
"dependencies": {
"debug": "4.3.2",
"debug": "^4.3.2",
"semver": "^7.3.4",
"webpack-merge": "^5.4.0"
},
Expand Down
4 changes: 2 additions & 2 deletions npm/webpack-preprocessor/package.json
Expand Up @@ -20,8 +20,8 @@
"watch": "yarn build --watch"
},
"dependencies": {
"bluebird": "^3.7.1",
"debug": "4.3.2",
"bluebird": "3.7.1",
"debug": "^4.3.2",
"lodash": "^4.17.20"
},
"devDependencies": {
Expand Down
15 changes: 6 additions & 9 deletions package.json
Expand Up @@ -35,7 +35,7 @@
"effective:circle:config": "circleci config process circle.yml | sed /^#/d",
"ensure-deps": "./scripts/ensure-dependencies.sh",
"get-next-version": "node scripts/get-next-version.js",
"postinstall": "yarn-deduplicate --strategy=highest && patch-package && ./scripts/run-if-not-ci.sh yarn build",
"postinstall": "patch-package && ./scripts/run-if-not-ci.sh yarn-deduplicate --strategy=highest && ./scripts/run-if-not-ci.sh yarn build",
"jscodeshift": "jscodeshift -t ./node_modules/js-codemod/transforms/arrow-function-arguments.js",
"lint": "eslint --ext .js,.jsx,.ts,.tsx,.json .",
"lint-changed": "lint-changed",
Expand Down Expand Up @@ -88,7 +88,7 @@
"@types/execa": "0.9.0",
"@types/fs-extra": "^8.0.1",
"@types/glob": "7.1.1",
"@types/lodash": "4.14.168",
"@types/lodash": "^4.14.168",
"@types/markdown-it": "0.0.9",
"@types/mini-css-extract-plugin": "1.2.3",
"@types/mocha": "8.0.3",
Expand All @@ -115,10 +115,10 @@
"commander": "6.2.1",
"common-tags": "1.8.0",
"conventional-recommended-bump": "6.1.0",
"debug": "4.3.2",
"debug": "^4.3.2",
"del": "3.0.0",
"electron-builder": "22.9.1",
"electron-notarize": "1.0.0",
"electron-builder": "^22.13.1",
"electron-notarize": "^1.1.1",
"enzyme-adapter-react-16": "1.12.1",
"eslint": "7.22.0",
"eslint-plugin-cypress": "2.11.2",
Expand Down Expand Up @@ -154,15 +154,14 @@
"lerna": "3.20.2",
"lint-staged": "11.1.2",
"listr2": "3.8.3",
"lodash": "4.17.21",
"lodash": "^4.17.21",
"make-empty-github-commit": "cypress-io/make-empty-github-commit#4a592aedb776ba2f4cc88979055315a53eec42ee",
"minimist": "1.2.5",
"mocha": "3.5.3",
"mocha-banner": "1.1.2",
"mocha-junit-reporter": "2.0.0",
"mocha-multi-reporters": "1.1.7",
"mock-fs": "5.1.1",
"odiff-bin": "2.1.0",
"parse-github-repo-url": "1.4.1",
"patch-package": "6.4.7",
"plist": "3.0.1",
Expand Down Expand Up @@ -226,8 +225,6 @@
"system-tests"
],
"nohoist": [
"**/@ffmpeg-installer",
"**/@ffmpeg-installer/**",
"**/webpack-preprocessor/babel-loader",
"**/webpack-batteries-included-preprocessor/ts-loader",
"**/@vue/runtime-dom",
Expand Down
4 changes: 2 additions & 2 deletions packages/config/package.json
Expand Up @@ -14,8 +14,8 @@
"dependencies": {
"check-more-types": "2.24.0",
"common-tags": "1.8.0",
"debug": "4.3.2",
"lodash": "4.17.21"
"debug": "^4.3.2",
"lodash": "^4.17.21"
},
"devDependencies": {
"@packages/ts": "0.0.0-development",
Expand Down
2 changes: 1 addition & 1 deletion packages/desktop-gui/package.json
Expand Up @@ -37,7 +37,7 @@
"dayjs": "^1.9.3",
"gravatar": "1.8.0",
"human-interval": "1.0.0",
"lodash": "4.17.21",
"lodash": "^4.17.21",
"markdown-it": "11.0.0",
"mobx": "5.15.4",
"mobx-react": "6.1.8",
Expand Down

3 comments on commit e4f5b10

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on e4f5b10 Nov 20, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the linux x64 version of the Test Runner.

Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/9.1.0/circle-develop-e4f5b106d49d6ac0857c5fdac886f83b99558c88/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on e4f5b10 Nov 20, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AppVeyor has built the win32 x64 version of the Test Runner.

Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/9.1.0/appveyor-develop-e4f5b106d49d6ac0857c5fdac886f83b99558c88/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on e4f5b10 Nov 20, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the darwin x64 version of the Test Runner.

Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/9.1.0/circle-develop-e4f5b106d49d6ac0857c5fdac886f83b99558c88/cypress.tgz

Please sign in to comment.