Skip to content

Commit

Permalink
fix build
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanthemanuel committed Dec 1, 2022
1 parent 35c8b6f commit 401fbdc
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 12 deletions.
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -4,7 +4,7 @@
"description": "Cypress is a next generation front end testing tool built for the modern web",
"private": true,
"scripts": {
"binary-build": "cross-env DEBUG=cypress:*snap*info NODE_OPTIONS=--max_old_space_size=16384 node ./scripts/binary.js build",
"binary-build": "cross-env NODE_OPTIONS=--max_old_space_size=8192 node ./scripts/binary.js build",
"binary-deploy": "node ./scripts/binary.js deploy",
"binary-deploy-linux": "./scripts/build-linux-binary.sh",
"binary-ensure": "node ./scripts/binary.js ensure",
Expand Down
7 changes: 1 addition & 6 deletions scripts/after-pack-hook.js
Expand Up @@ -67,11 +67,6 @@ module.exports = async function (params) {
)

await cleanup(outputFolder)

try {
await setupV8Snapshots({ cypressAppPath: params.appOutDir, integrityCheckSource: getIntegrityCheckSource(outputFolder) })
} catch (error) {
console.log(error)
}
await setupV8Snapshots({ cypressAppPath: params.appOutDir, integrityCheckSource: getIntegrityCheckSource(outputFolder) })
}
}
8 changes: 5 additions & 3 deletions scripts/binary/binary-integrity-check-source.js
Expand Up @@ -60,8 +60,10 @@ function validateFs (fs) {
}
}

function validatePath (path) {
if (toString.call(path.join) !== `PATH_JOIN_TO_STRING`) {
function validatePath (path, crypto) {
const pathJoinHash = crypto.createHmac('md5', 'HMAC_SECRET').update(toString.call(path.join)).digest('hex')

if (pathJoinHash !== 'PATH_JOIN_HASH') {
throw new Error(`Integrity check failed for path.join.toString()`)
}
}
Expand Down Expand Up @@ -91,8 +93,8 @@ function integrityCheck (options) {
validateToString()
validateElectron(electron)
validateFs(fs)
validatePath(path)
validateCrypto(crypto)
validatePath(path, crypto)

const appPath = electron.app.getAppPath()

Expand Down
3 changes: 2 additions & 1 deletion scripts/binary/binary-sources.js
Expand Up @@ -21,13 +21,14 @@ const getIntegrityCheckSource = (baseDirectory) => {
const mainIndexHash = crypto.createHmac('md5', secret).update(fs.readFileSync(path.join(baseDirectory, './index.js'), 'utf8')).digest('hex')
const bytenodeHash = crypto.createHmac('md5', secret).update(fs.readFileSync(path.join(baseDirectory, './node_modules/bytenode/lib/index.js'), 'utf8')).digest('hex')
const indexJscHash = crypto.createHmac('md5', secret).update(fs.readFileSync(path.join(baseDirectory, './packages/server/index.jsc'), 'utf8')).digest('hex')
const pathJoinHash = crypto.createHmac('md5', secret).update(path.join.toString()).digest('hex')

return fileSource.split('\n').join(`\n `)
.replaceAll('MAIN_INDEX_HASH', mainIndexHash)
.replaceAll('BYTENODE_HASH', bytenodeHash)
.replaceAll('INDEX_JSC_HASH', indexJscHash)
.replaceAll('HMAC_SECRET', secret)
.replaceAll('PATH_JOIN_TO_STRING', escapeString(path.join.toString()))
.replaceAll('PATH_JOIN_HASH', pathJoinHash)
.replaceAll('CRYPTO_CREATE_HMAC_TO_STRING', escapeString(crypto.createHmac.toString()))
.replaceAll('CRYPTO_HMAC_UPDATE_TO_STRING', escapeString(crypto.Hmac.prototype.update.toString()))
.replaceAll('CRYPTO_HMAC_DIGEST_TO_STRING', escapeString(crypto.Hmac.prototype.digest.toString()))
Expand Down
1 change: 0 additions & 1 deletion scripts/binary/build.ts
Expand Up @@ -260,7 +260,6 @@ require('./packages/server/index.js')
},
})
} catch (e) {
console.log(e)
if (!skipSigning) {
throw e
}
Expand Down

3 comments on commit 401fbdc

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 401fbdc Dec 1, 2022

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 arm64 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/11.3.0/linux-arm64/ryanm/fix/v8-improvements-401fbdcf50cee95de7915af6eaa850c38fcf4ac1/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 401fbdc Dec 1, 2022

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/11.3.0/linux-x64/ryanm/fix/v8-improvements-401fbdcf50cee95de7915af6eaa850c38fcf4ac1/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 401fbdc Dec 1, 2022

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 arm64 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/11.3.0/darwin-arm64/ryanm/fix/v8-improvements-401fbdcf50cee95de7915af6eaa850c38fcf4ac1/cypress.tgz

Please sign in to comment.