mirror of
https://github.com/cypress-io/cypress.git
synced 2026-05-24 09:29:35 -05:00
Merge branch 'release/13.0.0' of https://github.com/cypress-io/cypress into chore/merge_develop_into_release_13
This commit is contained in:
@@ -6,7 +6,7 @@ const path = require('path')
|
||||
const { setupV8Snapshots } = require('@tooling/v8-snapshot')
|
||||
const { flipFuses, FuseVersion, FuseV1Options } = require('@electron/fuses')
|
||||
const { buildEntryPointAndCleanup } = require('./binary/binary-cleanup')
|
||||
const { getIntegrityCheckSource, getBinaryEntryPointSource, getEncryptionFileSource, getCloudApiFileSource, validateEncryptionFile } = require('./binary/binary-sources')
|
||||
const { getIntegrityCheckSource, getBinaryEntryPointSource, getEncryptionFileSource, getCloudEnvironmentFileSource, validateEncryptionFile, getProtocolFileSource, validateCloudEnvironmentFile, validateProtocolFile } = require('./binary/binary-sources')
|
||||
|
||||
const CY_ROOT_DIR = path.join(__dirname, '..')
|
||||
|
||||
@@ -61,18 +61,26 @@ module.exports = async function (params) {
|
||||
const binaryEntryPointSource = await getBinaryEntryPointSource()
|
||||
const encryptionFilePath = path.join(CY_ROOT_DIR, 'packages/server/lib/cloud/encryption.ts')
|
||||
const encryptionFileSource = await getEncryptionFileSource(encryptionFilePath)
|
||||
const cloudApiFilePath = path.join(CY_ROOT_DIR, 'packages/server/lib/cloud/environment.ts')
|
||||
const cloudApiFileSource = await getCloudApiFileSource(cloudApiFilePath)
|
||||
const cloudEnvironmentFilePath = path.join(CY_ROOT_DIR, 'packages/server/lib/cloud/environment.ts')
|
||||
const cloudEnvironmentFileSource = await getCloudEnvironmentFileSource(cloudEnvironmentFilePath)
|
||||
const cloudApiFilePath = path.join(CY_ROOT_DIR, 'packages/server/lib/cloud/api.ts')
|
||||
const cloudApiFileSource = await getProtocolFileSource(cloudApiFilePath)
|
||||
const cloudProtocolFilePath = path.join(CY_ROOT_DIR, 'packages/server/lib/cloud/protocol.ts')
|
||||
const cloudProtocolFileSource = await getProtocolFileSource(cloudProtocolFilePath)
|
||||
|
||||
await Promise.all([
|
||||
fs.writeFile(encryptionFilePath, encryptionFileSource),
|
||||
fs.writeFile(cloudEnvironmentFilePath, cloudEnvironmentFileSource),
|
||||
fs.writeFile(cloudApiFilePath, cloudApiFileSource),
|
||||
fs.writeFile(cloudProtocolFilePath, cloudProtocolFileSource),
|
||||
fs.writeFile(path.join(outputFolder, 'index.js'), binaryEntryPointSource),
|
||||
])
|
||||
|
||||
await Promise.all([
|
||||
validateEncryptionFile(encryptionFilePath),
|
||||
validateEncryptionFile(cloudApiFilePath),
|
||||
validateCloudEnvironmentFile(cloudEnvironmentFilePath),
|
||||
validateProtocolFile(cloudApiFilePath),
|
||||
validateProtocolFile(cloudProtocolFilePath),
|
||||
])
|
||||
|
||||
await flipFuses(
|
||||
|
||||
@@ -58,7 +58,7 @@ const validateEncryptionFile = async (encryptionFilePath) => {
|
||||
}
|
||||
}
|
||||
|
||||
const getCloudApiFileSource = async (cloudApiFilePath) => {
|
||||
const getCloudEnvironmentFileSource = async (cloudApiFilePath) => {
|
||||
const fileContents = await fs.readFile(cloudApiFilePath, 'utf8')
|
||||
|
||||
if (!fileContents.includes('process.env.CYPRESS_ENV_DEPENDENCIES')) {
|
||||
@@ -72,7 +72,7 @@ const getCloudApiFileSource = async (cloudApiFilePath) => {
|
||||
return fileContents
|
||||
}
|
||||
|
||||
const validateCloudApiFile = async (cloudApiFilePath) => {
|
||||
const validateCloudEnvironmentFile = async (cloudApiFilePath) => {
|
||||
if (process.env.CYPRESS_ENV_DEPENDENCIES) {
|
||||
const afterReplaceCloudApi = await fs.readFile(cloudApiFilePath, 'utf8')
|
||||
|
||||
@@ -82,11 +82,31 @@ const validateCloudApiFile = async (cloudApiFilePath) => {
|
||||
}
|
||||
}
|
||||
|
||||
const getProtocolFileSource = async (protocolFilePath) => {
|
||||
const fileContents = await fs.readFile(protocolFilePath, 'utf8')
|
||||
|
||||
if (!fileContents.includes('process.env.CYPRESS_LOCAL_PROTOCOL_PATH')) {
|
||||
throw new Error(`Expected to find CYPRESS_LOCAL_PROTOCOL_PATH in protocol file`)
|
||||
}
|
||||
|
||||
return fileContents.replaceAll('process.env.CYPRESS_LOCAL_PROTOCOL_PATH', 'undefined')
|
||||
}
|
||||
|
||||
const validateProtocolFile = async (protocolFilePath) => {
|
||||
const afterReplaceProtocol = await fs.readFile(protocolFilePath, 'utf8')
|
||||
|
||||
if (afterReplaceProtocol.includes('process.env.CYPRESS_LOCAL_PROTOCOL_PATH')) {
|
||||
throw new Error(`Expected process.env.CYPRESS_LOCAL_PROTOCOL_PATH to be stripped from protocol file`)
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
getBinaryEntryPointSource,
|
||||
getIntegrityCheckSource,
|
||||
getEncryptionFileSource,
|
||||
getCloudApiFileSource,
|
||||
validateCloudApiFile,
|
||||
validateEncryptionFile,
|
||||
getCloudEnvironmentFileSource,
|
||||
validateCloudEnvironmentFile,
|
||||
getProtocolFileSource,
|
||||
validateProtocolFile,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user