Skip to content

Commit

Permalink
fix: copy yarn.lock to packages for deterministic builds (#17218)
Browse files Browse the repository at this point in the history
  • Loading branch information
tgriesser committed Jul 6, 2021
1 parent 7fbc617 commit 16516b7
Showing 1 changed file with 4 additions and 15 deletions.
19 changes: 4 additions & 15 deletions scripts/binary/util/packages.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ fs = Promise.promisifyAll(fs)
glob = Promise.promisify(glob)

const DEFAULT_PATHS = 'package.json'.split(' ')
const rootYarnLock = fs.readFileSync(path.join(__dirname, '../../../yarn.lock'), 'utf8')

const pathToPackageJson = function (packageFolder) {
la(check.unemptyString(packageFolder), 'expected package path', packageFolder)
Expand Down Expand Up @@ -181,14 +182,6 @@ const replaceLocalNpmVersions = function (basePath) {
return updatePackageJson('./packages/*/package.json')
}

const forceNpmInstall = function (packagePath, packageToInstall) {
console.log('Force installing %s', packageToInstall)
console.log('in %s', packagePath)
la(check.unemptyString(packageToInstall), 'missing package to install')

return yarn(['install', '--force', packageToInstall], packagePath)
}

const removeDevDependencies = function (packageFolder) {
const packagePath = pathToPackageJson(packageFolder)

Expand Down Expand Up @@ -252,6 +245,9 @@ const npmInstallAll = function (pathToPackages) {
return retryGlobbing(pathToPackages)
.tap(printFolders)
.mapSeries((packageFolder) => {
// Copying the yarn.lock from the root for deterministic builds
fs.writeFileSync(path.join(packageFolder, 'yarn.lock'), rootYarnLock)

return removeDevDependencies(packageFolder)
.then(() => {
return retryNpmInstall(packageFolder)
Expand All @@ -272,12 +268,5 @@ module.exports = {

runAllCleanJs,

forceNpmInstall,

replaceLocalNpmVersions,
}

if (!module.parent) {
console.log('demo force install')
forceNpmInstall('packages/server', '@ffmpeg-installer/win32-x64')
}

3 comments on commit 16516b7

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 16516b7 Jul 6, 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/7.7.0/circle-develop-16516b74b1253e3b0108fbfe14a80694ca4422a6/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 16516b7 Jul 6, 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 ia32 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/7.7.0/appveyor-develop-16516b74b1253e3b0108fbfe14a80694ca4422a6/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 16516b7 Jul 6, 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/7.7.0/appveyor-develop-16516b74b1253e3b0108fbfe14a80694ca4422a6/cypress.tgz

Please sign in to comment.