mirror of
https://github.com/cypress-io/cypress.git
synced 2026-04-24 07:59:12 -05:00
fix: patch-package is not applied in dist'ed build (#19239)
This commit is contained in:
+3
-1
@@ -37,6 +37,7 @@ macWorkflowFilters: &mac-workflow-filters
|
||||
when:
|
||||
or:
|
||||
- equal: [ develop, << pipeline.git.branch >> ]
|
||||
- equal: [ tgriesser/fix/patch-resolutions, << pipeline.git.branch >> ]
|
||||
- equal: [ renovate/cypress-request-2.x, << pipeline.git.branch >> ]
|
||||
- matches:
|
||||
pattern: "-release$"
|
||||
@@ -47,6 +48,7 @@ windowsWorkflowFilters: &windows-workflow-filters
|
||||
or:
|
||||
- equal: [ master, << pipeline.git.branch >> ]
|
||||
- equal: [ develop, << pipeline.git.branch >> ]
|
||||
- equal: [ tgriesser/fix/patch-resolutions, << pipeline.git.branch >> ]
|
||||
- matches:
|
||||
pattern: "-release$"
|
||||
value: << pipeline.git.branch >>
|
||||
@@ -1586,7 +1588,7 @@ jobs:
|
||||
- run:
|
||||
name: Check current branch to persist artifacts
|
||||
command: |
|
||||
if [[ "$CIRCLE_BRANCH" != "develop" ]]; then
|
||||
if [[ "$CIRCLE_BRANCH" != "develop" && "$CIRCLE_BRANCH" != "tgriesser/fix/patch-resolutions" ]]; then
|
||||
echo "Not uploading artifacts or posting install comment for this branch."
|
||||
circleci-agent step halt
|
||||
fi
|
||||
|
||||
@@ -113,6 +113,7 @@
|
||||
"trash": "5.2.0",
|
||||
"tree-kill": "1.2.2",
|
||||
"ts-node": "8.5.4",
|
||||
"tsconfig-paths": "3.10.1",
|
||||
"tslib": "2.3.0",
|
||||
"underscore.string": "3.3.5",
|
||||
"url-parse": "1.5.2",
|
||||
@@ -184,7 +185,6 @@
|
||||
"supertest-session": "4.0.0",
|
||||
"through2": "2.0.5",
|
||||
"ts-loader": "7.0.4",
|
||||
"tsconfig-paths": "3.10.1",
|
||||
"webpack": "4.43.0",
|
||||
"ws": "5.2.3",
|
||||
"xvfb": "cypress-io/node-xvfb#22e3783c31d81ebe64d8c0df491ea00cdc74726a",
|
||||
|
||||
@@ -14,6 +14,8 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"circular-json": "0.5.9",
|
||||
"engine.io": "5.0.0",
|
||||
"engine.io-parser": "4.0.2",
|
||||
"socket.io": "4.0.1",
|
||||
"socket.io-client": "4.0.1"
|
||||
},
|
||||
@@ -30,6 +32,8 @@
|
||||
],
|
||||
"workspaces": {
|
||||
"nohoist": [
|
||||
"engine.io",
|
||||
"engine.io-parser",
|
||||
"socket.io",
|
||||
"socket.io/socket.io-parser",
|
||||
"socket.io-client",
|
||||
|
||||
+12
-4
@@ -68,15 +68,23 @@ export async function buildCypressApp (options: BuildCypressAppOpts) {
|
||||
// Copy Packages: We want to copy the package.json, files, and output
|
||||
log('#copyAllToDist')
|
||||
await packages.copyAllToDist(DIST_DIR)
|
||||
fs.copySync(path.join(CY_ROOT_DIR, 'patches'), path.join(DIST_DIR, 'patches'))
|
||||
|
||||
const jsonRoot = fs.readJSONSync(path.join(CY_ROOT_DIR, 'package.json'))
|
||||
|
||||
fs.writeJsonSync(meta.distDir('package.json'), _.omit(jsonRoot, [
|
||||
'scripts',
|
||||
const packageJsonContents = _.omit(jsonRoot, [
|
||||
'devDependencies',
|
||||
'lint-staged',
|
||||
'engines',
|
||||
]), { spaces: 2 })
|
||||
'scripts',
|
||||
])
|
||||
|
||||
fs.writeJsonSync(meta.distDir('package.json'), {
|
||||
...packageJsonContents,
|
||||
scripts: {
|
||||
postinstall: 'patch-package',
|
||||
},
|
||||
}, { spaces: 2 })
|
||||
|
||||
// Copy the yarn.lock file so we have a consistent install
|
||||
fs.copySync(path.join(CY_ROOT_DIR, 'yarn.lock'), meta.distDir('yarn.lock'))
|
||||
@@ -153,7 +161,7 @@ require('./packages/server')\
|
||||
log(`#testVersion ${meta.distDir()}`)
|
||||
await testVersion(meta.distDir(), version)
|
||||
|
||||
// testBuiltStaticAssets
|
||||
log('#testStaticAssets')
|
||||
await testStaticAssets(meta.distDir())
|
||||
|
||||
log('#removeCyAndBinFolders')
|
||||
|
||||
@@ -104,7 +104,6 @@ export async function copyAllToDist (distDir: string) {
|
||||
try {
|
||||
// Strip out dev-dependencies & scripts for everything in /packages so we can yarn install in there
|
||||
await fs.writeJson(path.join(distDir, pkg, 'package.json'), _.omit(json, [
|
||||
'scripts',
|
||||
'devDependencies',
|
||||
'lint-staged',
|
||||
'engines',
|
||||
|
||||
@@ -62,6 +62,34 @@ const testStaticAssets = async (buildResourcePath) => {
|
||||
'react.production.min.js',
|
||||
],
|
||||
}),
|
||||
testPackageStaticAssets({
|
||||
assetGlob: `${buildResourcePath}/packages/socket/node_modules/socket.io-parser/dist/binary.js`,
|
||||
badStrings: [
|
||||
'pack.data = _deconstructPacket(packetData, buffers);',
|
||||
],
|
||||
goodStrings: [
|
||||
'pack.data = _deconstructPacket(packetData, buffers, [], new WeakMap());',
|
||||
],
|
||||
}),
|
||||
testPackageStaticAssets({
|
||||
assetGlob: `${buildResourcePath}/packages/socket/node_modules/engine.io-parser/lib/encodePacket.browser.js`,
|
||||
badStrings: [
|
||||
'return callback(data instanceof ArrayBuffer ? data : data.buffer);',
|
||||
],
|
||||
goodStrings: [
|
||||
'This extra check is made because the "instanceof ArrayBuffer" check does not work',
|
||||
'return callback((data instanceof ArrayBuffer || isArrayBuffer(data)) ? data : data.buffer);',
|
||||
],
|
||||
}),
|
||||
testPackageStaticAssets({
|
||||
assetGlob: `${buildResourcePath}/node_modules/winston/lib/winston/common.js`,
|
||||
badStrings: [
|
||||
`if (target.padLevels) {`,
|
||||
],
|
||||
goodStrings: [
|
||||
`if (target.hasOwnProperty('padLevels') && target.padLevels) {`,
|
||||
],
|
||||
}),
|
||||
])
|
||||
}
|
||||
|
||||
|
||||
@@ -17601,6 +17601,13 @@ engine.io-client@~5.0.0:
|
||||
ws "~7.4.2"
|
||||
yeast "0.1.2"
|
||||
|
||||
engine.io-parser@4.0.2, engine.io-parser@~4.0.0, engine.io-parser@~4.0.1:
|
||||
version "4.0.2"
|
||||
resolved "https://registry.yarnpkg.com/engine.io-parser/-/engine.io-parser-4.0.2.tgz#e41d0b3fb66f7bf4a3671d2038a154024edb501e"
|
||||
integrity sha512-sHfEQv6nmtJrq6TKuIz5kyEKH/qSdK56H/A+7DnAuUPWosnIZAS2NHNcPLmyjtY3cGS/MqJdZbUjW97JU72iYg==
|
||||
dependencies:
|
||||
base64-arraybuffer "0.1.4"
|
||||
|
||||
engine.io-parser@~2.2.0:
|
||||
version "2.2.1"
|
||||
resolved "https://registry.yarnpkg.com/engine.io-parser/-/engine.io-parser-2.2.1.tgz#57ce5611d9370ee94f99641b589f94c97e4f5da7"
|
||||
@@ -17612,12 +17619,18 @@ engine.io-parser@~2.2.0:
|
||||
blob "0.0.5"
|
||||
has-binary2 "~1.0.2"
|
||||
|
||||
engine.io-parser@~4.0.0, engine.io-parser@~4.0.1:
|
||||
version "4.0.2"
|
||||
resolved "https://registry.yarnpkg.com/engine.io-parser/-/engine.io-parser-4.0.2.tgz#e41d0b3fb66f7bf4a3671d2038a154024edb501e"
|
||||
integrity sha512-sHfEQv6nmtJrq6TKuIz5kyEKH/qSdK56H/A+7DnAuUPWosnIZAS2NHNcPLmyjtY3cGS/MqJdZbUjW97JU72iYg==
|
||||
engine.io@5.0.0, engine.io@~5.0.0:
|
||||
version "5.0.0"
|
||||
resolved "https://registry.npmjs.org/engine.io/-/engine.io-5.0.0.tgz#470dc94a8a4907fa4d2cd1fa6611426afcee61bf"
|
||||
integrity sha512-BATIdDV3H1SrE9/u2BAotvsmjJg0t1P4+vGedImSs1lkFAtQdvk4Ev1y4LDiPF7BPWgXWEG+NDY+nLvW3UrMWw==
|
||||
dependencies:
|
||||
base64-arraybuffer "0.1.4"
|
||||
accepts "~1.3.4"
|
||||
base64id "2.0.0"
|
||||
cookie "~0.4.1"
|
||||
cors "~2.8.5"
|
||||
debug "~4.3.1"
|
||||
engine.io-parser "~4.0.0"
|
||||
ws "~7.4.2"
|
||||
|
||||
engine.io@~3.5.0:
|
||||
version "3.5.0"
|
||||
@@ -17631,19 +17644,6 @@ engine.io@~3.5.0:
|
||||
engine.io-parser "~2.2.0"
|
||||
ws "~7.4.2"
|
||||
|
||||
engine.io@~5.0.0:
|
||||
version "5.0.0"
|
||||
resolved "https://registry.npmjs.org/engine.io/-/engine.io-5.0.0.tgz#470dc94a8a4907fa4d2cd1fa6611426afcee61bf"
|
||||
integrity sha512-BATIdDV3H1SrE9/u2BAotvsmjJg0t1P4+vGedImSs1lkFAtQdvk4Ev1y4LDiPF7BPWgXWEG+NDY+nLvW3UrMWw==
|
||||
dependencies:
|
||||
accepts "~1.3.4"
|
||||
base64id "2.0.0"
|
||||
cookie "~0.4.1"
|
||||
cors "~2.8.5"
|
||||
debug "~4.3.1"
|
||||
engine.io-parser "~4.0.0"
|
||||
ws "~7.4.2"
|
||||
|
||||
enhanced-resolve@4.1.0:
|
||||
version "4.1.0"
|
||||
resolved "https://registry.yarnpkg.com/enhanced-resolve/-/enhanced-resolve-4.1.0.tgz#41c7e0bfdfe74ac1ffe1e57ad6a5c6c9f3742a7f"
|
||||
|
||||
Reference in New Issue
Block a user