build: ensure consistent lock files across multiple machines (#17955)
* build: ensure consistent package-lock across multiple machines * build: fix linting errors and use npm ci instead of npm install * build: use a yarn.lock and yarn instead of package-lock and npm * chore: replace package-lock.json files with yarn.lock * chore: replace last instance of `npm install`
This commit is contained in:
parent
8d83518f9a
commit
98c51dd660
18 changed files with 9970 additions and 15506 deletions
|
@ -16,7 +16,8 @@
|
||||||
}],
|
}],
|
||||||
"prefer-const": ["error", {
|
"prefer-const": ["error", {
|
||||||
"destructuring": "all"
|
"destructuring": "all"
|
||||||
}]
|
}],
|
||||||
|
"node/no-deprecated-api": 0
|
||||||
},
|
},
|
||||||
"parserOptions": {
|
"parserOptions": {
|
||||||
"ecmaVersion": 6,
|
"ecmaVersion": 6,
|
||||||
|
|
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -37,7 +37,7 @@
|
||||||
/vendor/pyyaml
|
/vendor/pyyaml
|
||||||
node_modules/
|
node_modules/
|
||||||
SHASUMS256.txt
|
SHASUMS256.txt
|
||||||
**/yarn.lock
|
**/package-lock.json
|
||||||
compile_commands.json
|
compile_commands.json
|
||||||
.envrc
|
.envrc
|
||||||
|
|
||||||
|
|
2
BUILD.gn
2
BUILD.gn
|
@ -64,7 +64,7 @@ config("branding") {
|
||||||
npm_action("build_electron_definitions") {
|
npm_action("build_electron_definitions") {
|
||||||
script = "gn-typescript-definitions"
|
script = "gn-typescript-definitions"
|
||||||
args = [ rebase_path("$target_gen_dir/tsc/typings/electron.d.ts") ]
|
args = [ rebase_path("$target_gen_dir/tsc/typings/electron.d.ts") ]
|
||||||
inputs = auto_filenames.api_docs + [ "package-lock.json" ]
|
inputs = auto_filenames.api_docs + [ "yarn.lock" ]
|
||||||
|
|
||||||
outputs = [
|
outputs = [
|
||||||
"$target_gen_dir/tsc/typings/electron.d.ts",
|
"$target_gen_dir/tsc/typings/electron.d.ts",
|
||||||
|
|
5
DEPS
5
DEPS
|
@ -24,6 +24,9 @@ vars = {
|
||||||
'requests_git': 'https://github.com/kennethreitz',
|
'requests_git': 'https://github.com/kennethreitz',
|
||||||
'yaml_git': 'https://github.com/yaml',
|
'yaml_git': 'https://github.com/yaml',
|
||||||
|
|
||||||
|
# KEEP IN SYNC WITH spec-runner FILE
|
||||||
|
'yarn_version': '1.15.2',
|
||||||
|
|
||||||
# To be able to build clean Chromium from sources.
|
# To be able to build clean Chromium from sources.
|
||||||
'apply_patches': True,
|
'apply_patches': True,
|
||||||
|
|
||||||
|
@ -110,7 +113,7 @@ hooks = [
|
||||||
'action': [
|
'action': [
|
||||||
'python',
|
'python',
|
||||||
'-c',
|
'-c',
|
||||||
'import os, subprocess; os.chdir(os.path.join("src", "electron")); subprocess.check_call(["python", "script/lib/npm.py", "install"]);',
|
'import os, subprocess; os.chdir(os.path.join("src", "electron")); subprocess.check_call(["python", "script/lib/npx.py", "yarn@' + (Var("yarn_version")) + '", "install", "--frozen-lockfile"]);',
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -6,7 +6,7 @@ template("npm_action") {
|
||||||
action("npm_pre_flight_" + target_name) {
|
action("npm_pre_flight_" + target_name) {
|
||||||
inputs = [
|
inputs = [
|
||||||
"package.json",
|
"package.json",
|
||||||
"package-lock.json",
|
"yarn.lock",
|
||||||
]
|
]
|
||||||
script = "//electron/build/npm-run.py"
|
script = "//electron/build/npm-run.py"
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ template("typescript_build") {
|
||||||
inputs = [
|
inputs = [
|
||||||
invoker.tsconfig,
|
invoker.tsconfig,
|
||||||
"//electron/tsconfig.json",
|
"//electron/tsconfig.json",
|
||||||
"//electron/package-lock.json",
|
"//electron/yarn.lock",
|
||||||
"//electron/typings/internal-ambient.d.ts",
|
"//electron/typings/internal-ambient.d.ts",
|
||||||
"//electron/typings/internal-electron.d.ts",
|
"//electron/typings/internal-electron.d.ts",
|
||||||
"//electron/typings/internal-helpers.d.ts",
|
"//electron/typings/internal-helpers.d.ts",
|
||||||
|
|
13817
package-lock.json
generated
13817
package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -26,7 +26,10 @@
|
||||||
"electron-typescript-definitions": "^8.3.0",
|
"electron-typescript-definitions": "^8.3.0",
|
||||||
"eslint": "^5.13.0",
|
"eslint": "^5.13.0",
|
||||||
"eslint-config-standard": "^12.0.0",
|
"eslint-config-standard": "^12.0.0",
|
||||||
|
"eslint-plugin-import": "^2.17.2",
|
||||||
"eslint-plugin-mocha": "^5.2.0",
|
"eslint-plugin-mocha": "^5.2.0",
|
||||||
|
"eslint-plugin-node": "^8.0.1",
|
||||||
|
"eslint-plugin-standard": "^4.0.0",
|
||||||
"eslint-plugin-typescript": "^0.14.0",
|
"eslint-plugin-typescript": "^0.14.0",
|
||||||
"express": "^4.16.4",
|
"express": "^4.16.4",
|
||||||
"folder-hash": "^2.1.1",
|
"folder-hash": "^2.1.1",
|
||||||
|
|
|
@ -111,7 +111,7 @@ async function updateVersion (version) {
|
||||||
|
|
||||||
// update package metadata files with new version
|
// update package metadata files with new version
|
||||||
async function updatePackageJSON (version) {
|
async function updatePackageJSON (version) {
|
||||||
['package.json', 'package-lock.json'].forEach(async fileName => {
|
['package.json'].forEach(async fileName => {
|
||||||
const filePath = path.resolve(__dirname, '..', fileName)
|
const filePath = path.resolve(__dirname, '..', fileName)
|
||||||
const file = require(filePath)
|
const file = require(filePath)
|
||||||
file.version = version
|
file.version = version
|
||||||
|
|
|
@ -8,7 +8,7 @@ const HASH_VERSION = 1
|
||||||
// Base files to hash
|
// Base files to hash
|
||||||
const filesToHash = [
|
const filesToHash = [
|
||||||
path.resolve(__dirname, '../DEPS'),
|
path.resolve(__dirname, '../DEPS'),
|
||||||
path.resolve(__dirname, '../package-lock.json')
|
path.resolve(__dirname, '../yarn.lock')
|
||||||
]
|
]
|
||||||
|
|
||||||
const addAllFiles = (dir) => {
|
const addAllFiles = (dir) => {
|
||||||
|
|
18
script/lib/npx.py
Normal file
18
script/lib/npx.py
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
import subprocess
|
||||||
|
import sys
|
||||||
|
|
||||||
|
|
||||||
|
def npx(*npx_args):
|
||||||
|
call_args = [__get_executable_name()] + list(npx_args)
|
||||||
|
subprocess.check_call(call_args)
|
||||||
|
|
||||||
|
|
||||||
|
def __get_executable_name():
|
||||||
|
executable = 'npx'
|
||||||
|
if sys.platform == 'win32':
|
||||||
|
executable += '.cmd'
|
||||||
|
return executable
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
npx(*sys.argv[1:])
|
|
@ -144,7 +144,9 @@ async function findChangedFiles (top) {
|
||||||
async function findMatchingFiles (top, test) {
|
async function findMatchingFiles (top, test) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
const matches = []
|
const matches = []
|
||||||
klaw(top)
|
klaw(top, {
|
||||||
|
filter: f => path.basename(f) !== '.bin'
|
||||||
|
})
|
||||||
.on('end', () => resolve(matches))
|
.on('end', () => resolve(matches))
|
||||||
.on('data', item => {
|
.on('data', item => {
|
||||||
if (test(item.path)) {
|
if (test(item.path)) {
|
||||||
|
|
|
@ -25,6 +25,9 @@ const utils = require('./lib/utils')
|
||||||
|
|
||||||
const BASE = path.resolve(__dirname, '../..')
|
const BASE = path.resolve(__dirname, '../..')
|
||||||
const NPM_CMD = process.platform === 'win32' ? 'npm.cmd' : 'npm'
|
const NPM_CMD = process.platform === 'win32' ? 'npm.cmd' : 'npm'
|
||||||
|
const NPX_CMD = process.platform === 'win32' ? 'npx.cmd' : 'npx'
|
||||||
|
// KEEP IN SYNC WITH DEPS FILE
|
||||||
|
const YARN_VERSION = '1.15.2'
|
||||||
|
|
||||||
const specHashPath = path.resolve(__dirname, '../spec/.hash')
|
const specHashPath = path.resolve(__dirname, '../spec/.hash')
|
||||||
|
|
||||||
|
@ -143,7 +146,7 @@ async function installSpecModules () {
|
||||||
npm_config_nodedir: nodeDir,
|
npm_config_nodedir: nodeDir,
|
||||||
npm_config_msvs_version: '2017'
|
npm_config_msvs_version: '2017'
|
||||||
})
|
})
|
||||||
const { status } = childProcess.spawnSync(NPM_CMD, ['install'], {
|
const { status } = childProcess.spawnSync(NPX_CMD, [`yarn@${YARN_VERSION}`, 'install', '--frozen-lockfile'], {
|
||||||
env,
|
env,
|
||||||
cwd: path.resolve(__dirname, '../spec'),
|
cwd: path.resolve(__dirname, '../spec'),
|
||||||
stdio: 'inherit'
|
stdio: 'inherit'
|
||||||
|
@ -158,7 +161,7 @@ function getSpecHash () {
|
||||||
(async () => {
|
(async () => {
|
||||||
const hasher = crypto.createHash('SHA256')
|
const hasher = crypto.createHash('SHA256')
|
||||||
hasher.update(fs.readFileSync(path.resolve(__dirname, '../spec/package.json')))
|
hasher.update(fs.readFileSync(path.resolve(__dirname, '../spec/package.json')))
|
||||||
hasher.update(fs.readFileSync(path.resolve(__dirname, '../spec/package-lock.json')))
|
hasher.update(fs.readFileSync(path.resolve(__dirname, '../spec/yarn.lock')))
|
||||||
return hasher.digest('hex')
|
return hasher.digest('hex')
|
||||||
})(),
|
})(),
|
||||||
(async () => {
|
(async () => {
|
||||||
|
|
1675
spec/package-lock.json
generated
1675
spec/package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -33,6 +33,6 @@
|
||||||
},
|
},
|
||||||
"optionalDependencies": {
|
"optionalDependencies": {
|
||||||
"abstract-socket": "github:nornagon/node-abstractsocket#v8-compat",
|
"abstract-socket": "github:nornagon/node-abstractsocket#v8-compat",
|
||||||
"robotjs": "github:nornagon/robotjs#node-12"
|
"robotjs": "github:octalmage/robotjs#d870ddb486e893361e10d23d32c95c9d2b4710c9"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
1345
spec/yarn.lock
Normal file
1345
spec/yarn.lock
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue