mirror of
https://github.com/cypress-io/cypress.git
synced 2026-05-03 13:30:26 -05:00
Fix patch-package (#6583)
* fix patch-package - don't hoist dependencies that are patched, this way we can be assured the path is always correct - put all patches in root postinstall so postinstall-postinstall is guaranteed to work * wip * Revert "fix patch-package" This reverts commit5583f21478. * use per package patches * don't ignor engines or silence * try: make sinon patch devonly * fix socketspec * run full ci on this branch * bump xcode tools to bump mac node version * also run appveyor * Revert "run full ci on this branch" This reverts commitc3e52d09ec. * Revert "also run appveyor" This reverts commitbfe7b0499a.
This commit is contained in:
+3
-2
@@ -59,7 +59,8 @@ executors:
|
||||
# https://circleci.com/docs/2.0/testing-ios/#supported-xcode-versions
|
||||
mac:
|
||||
macos:
|
||||
xcode: "10.1.0"
|
||||
## Node 12.10.0 (yarn 1.17.3)
|
||||
xcode: "11.0.0"
|
||||
environment:
|
||||
PLATFORM: mac
|
||||
|
||||
@@ -235,7 +236,7 @@ jobs:
|
||||
- run: ls $(yarn global bin)/../lib/node_modules
|
||||
|
||||
# try several times, because flaky NPM installs ...
|
||||
- run: yarn --ignore-engines || yarn --ignore-engines
|
||||
- run: yarn || yarn
|
||||
- run:
|
||||
name: Top level packages
|
||||
command: yarn list --depth=0 || true
|
||||
|
||||
@@ -218,9 +218,6 @@
|
||||
"packages": [
|
||||
"cli",
|
||||
"packages/*"
|
||||
],
|
||||
"nohoist": [
|
||||
"@packages/driver/*"
|
||||
]
|
||||
},
|
||||
"lint-staged": {
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
"clean-deps": "rm -rf node_modules",
|
||||
"cypress:open": "node ../../scripts/cypress open --project ./test",
|
||||
"cypress:run": "node ../../scripts/cypress run --project ./test",
|
||||
"postinstall": "npx patch-package",
|
||||
"postinstall": "patch-package",
|
||||
"start": "$(yarn bin coffee) test/support/server.coffee"
|
||||
},
|
||||
"devDependencies": {
|
||||
@@ -66,6 +66,12 @@
|
||||
"zone.js": "0.9.0"
|
||||
},
|
||||
"files": [
|
||||
"lib"
|
||||
]
|
||||
"lib",
|
||||
"patches"
|
||||
],
|
||||
"workspaces": {
|
||||
"nohoist": [
|
||||
"*"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
const fs = require('fs')
|
||||
const server = require('socket.io')
|
||||
const path = require('path')
|
||||
const pkg = require('socket.io-client/package.json')
|
||||
const { version } = require('socket.io-client/package.json')
|
||||
const { client, circularParser } = require('./browser')
|
||||
const resolvePkg = require('resolve-pkg')
|
||||
|
||||
const clientSource = require.resolve('socket.io-client/dist/socket.io.js')
|
||||
|
||||
module.exports = {
|
||||
server,
|
||||
@@ -13,17 +13,11 @@ module.exports = {
|
||||
circularParser,
|
||||
|
||||
getPathToClientSource () {
|
||||
const clientSource = resolvePkg('socket.io-client/dist/socket.io.js', { cwd: path.join(__dirname, '..', '..', '..') })
|
||||
|
||||
if (fs.existsSync(clientSource)) {
|
||||
return clientSource
|
||||
}
|
||||
|
||||
return require.resolve('socket.io-client/dist/socket.io.js')
|
||||
return clientSource
|
||||
},
|
||||
|
||||
getClientVersion () {
|
||||
return pkg.version
|
||||
return version
|
||||
},
|
||||
|
||||
getClientSource () {
|
||||
|
||||
@@ -5,23 +5,30 @@
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"clean-deps": "rm -rf node_modules",
|
||||
"postinstall": "patch-package",
|
||||
"test": "yarn test-unit",
|
||||
"test-debug": "yarn test-unit --inspect-brk=5566",
|
||||
"test-unit": "cross-env NODE_ENV=test mocha --reporter mocha-multi-reporters --reporter-options configFile=../../mocha-reporter-config.json",
|
||||
"test-watch": "cross-env NODE_ENV=test mocha --watch"
|
||||
},
|
||||
"dependencies": {
|
||||
"resolve-pkg": "2.0.0",
|
||||
"socket.io": "2.3.0",
|
||||
"socket.io-circular-parser": "cypress-io/socket.io-circular-parser#4d3076af68ea8192c2e53f9d185eaa166359b4c5",
|
||||
"socket.io-circular-parser": "cypress-io/socket.io-circular-parser#unpatched-has-binary-2",
|
||||
"socket.io-client": "2.3.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"chai": "3.5.0",
|
||||
"cross-env": "6.0.3",
|
||||
"mocha": "3.5.3"
|
||||
"mocha": "3.5.3",
|
||||
"resolve-pkg": "2.0.0"
|
||||
},
|
||||
"files": [
|
||||
"lib"
|
||||
]
|
||||
"lib",
|
||||
"patches"
|
||||
],
|
||||
"workspaces": {
|
||||
"nohoist": [
|
||||
"**"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ describe('Socket', function () {
|
||||
|
||||
context('.getPathToClientSource', function () {
|
||||
it('returns path to socket.io.js', function () {
|
||||
const clientPath = path.join(resolvePkg('socket.io-client', { cwd: path.join(__dirname, '..', '..', '..') }), 'dist', 'socket.io.js')
|
||||
const clientPath = path.join(resolvePkg('socket.io-client'), 'dist', 'socket.io.js')
|
||||
|
||||
expect(lib.getPathToClientSource()).to.eq(clientPath)
|
||||
})
|
||||
@@ -36,7 +36,7 @@ describe('Socket', function () {
|
||||
|
||||
context('.getClientSource', function () {
|
||||
it('returns client source as a string', function (done) {
|
||||
const clientPath = path.join(resolvePkg('socket.io-client', { cwd: path.join(__dirname, '..', '..', '..') }), 'dist', 'socket.io.js')
|
||||
const clientPath = path.join(resolvePkg('socket.io-client'), 'dist', 'socket.io.js')
|
||||
|
||||
fs.readFile(clientPath, 'utf8', function (err, str) {
|
||||
if (err) done(err)
|
||||
|
||||
@@ -121,20 +121,6 @@ buildCypressApp = (platform, version, options = {}) ->
|
||||
|
||||
packages.copyAllToDist(distDir())
|
||||
|
||||
copyPatches = ->
|
||||
log("#copyPatches")
|
||||
|
||||
patchesPath = path.join(__dirname, '..', '..', 'patches')
|
||||
destPatchesPath = path.join(distDir(), 'patches')
|
||||
|
||||
fs.mkdirSync(destPatchesPath)
|
||||
fs.readdirSync(patchesPath)
|
||||
.map((patchFileName) -> [
|
||||
path.join(patchesPath, patchFileName),
|
||||
path.join(destPatchesPath, patchFileName)
|
||||
])
|
||||
.forEach(([src, dest]) -> fs.copyFileSync(src, dest))
|
||||
|
||||
transformSymlinkRequires = ->
|
||||
log("#transformSymlinkRequires")
|
||||
|
||||
@@ -355,7 +341,6 @@ buildCypressApp = (platform, version, options = {}) ->
|
||||
.then(cleanupPlatform)
|
||||
.then(buildPackages)
|
||||
.then(copyPackages)
|
||||
.then(copyPatches)
|
||||
.then(npmInstallPackages)
|
||||
.then(createRootPackage)
|
||||
.then(convertCoffeeToJs)
|
||||
|
||||
@@ -106,7 +106,7 @@ forceNpmInstall = (packagePath, packageToInstall) ->
|
||||
console.log("Force installing %s", packageToInstall)
|
||||
console.log("in %s", packagePath)
|
||||
la(check.unemptyString(packageToInstall), "missing package to install")
|
||||
yarn(["install", "--force", "--ignore-engines", packageToInstall], packagePath)
|
||||
yarn(["install", "--force", packageToInstall], packagePath)
|
||||
|
||||
removeDevDependencies = (packageFolder) ->
|
||||
packagePath = pathToPackageJson(packageFolder)
|
||||
@@ -141,7 +141,7 @@ npmInstallAll = (pathToPackages) ->
|
||||
|
||||
# force installing only PRODUCTION dependencies
|
||||
# https://docs.npmjs.com/cli/install
|
||||
npmInstall = _.partial(yarn, ["install", "--production", "--silent", "--ignore-engines"])
|
||||
npmInstall = _.partial(yarn, ["install", "--production"])
|
||||
|
||||
npmInstall(pkg, {NODE_ENV: "production"})
|
||||
.catch {code: "EMFILE"}, ->
|
||||
|
||||
@@ -13490,12 +13490,6 @@ has-ansi@^2.0.0:
|
||||
dependencies:
|
||||
ansi-regex "^2.0.0"
|
||||
|
||||
has-binary2@cypress-io/has-binary#8580a33df21e8b36a43f57872a82c60829636a92:
|
||||
version "1.0.2"
|
||||
resolved "https://codeload.github.com/cypress-io/has-binary/tar.gz/8580a33df21e8b36a43f57872a82c60829636a92"
|
||||
dependencies:
|
||||
isarray "2.0.1"
|
||||
|
||||
has-binary2@~1.0.2:
|
||||
version "1.0.3"
|
||||
resolved "https://registry.yarnpkg.com/has-binary2/-/has-binary2-1.0.3.tgz#7776ac627f3ea77250cfc332dab7ddf5e4f5d11d"
|
||||
@@ -22603,14 +22597,14 @@ socket.io-adapter@~1.1.0:
|
||||
resolved "https://registry.yarnpkg.com/socket.io-adapter/-/socket.io-adapter-1.1.1.tgz#2a805e8a14d6372124dd9159ad4502f8cb07f06b"
|
||||
integrity sha1-KoBeihTWNyEk3ZFZrUUC+MsH8Gs=
|
||||
|
||||
socket.io-circular-parser@cypress-io/socket.io-circular-parser#4d3076af68ea8192c2e53f9d185eaa166359b4c5:
|
||||
socket.io-circular-parser@cypress-io/socket.io-circular-parser#unpatched-has-binary-2:
|
||||
version "3.1.2-patch1"
|
||||
resolved "https://codeload.github.com/cypress-io/socket.io-circular-parser/tar.gz/4d3076af68ea8192c2e53f9d185eaa166359b4c5"
|
||||
resolved "https://codeload.github.com/cypress-io/socket.io-circular-parser/tar.gz/e274585ec04d1840fd1211dd3061d6dba2160475"
|
||||
dependencies:
|
||||
circular-json "0.5.9"
|
||||
component-emitter "1.2.1"
|
||||
debug "~4.1.0"
|
||||
has-binary2 cypress-io/has-binary#8580a33df21e8b36a43f57872a82c60829636a92
|
||||
has-binary2 "~1.0.2"
|
||||
|
||||
socket.io-client@2.3.0:
|
||||
version "2.3.0"
|
||||
|
||||
Reference in New Issue
Block a user