Skip to content

Commit

Permalink
build: ensure consistent lock files across multiple machines (#17955)
Browse files Browse the repository at this point in the history
* 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`
  • Loading branch information
MarshallOfSound committed Apr 30, 2019
1 parent 8d83518 commit 98c51dd
Show file tree
Hide file tree
Showing 18 changed files with 9,970 additions and 15,506 deletions.
3 changes: 2 additions & 1 deletion .eslintrc.json
Expand Up @@ -16,7 +16,8 @@
}],
"prefer-const": ["error", {
"destructuring": "all"
}]
}],
"node/no-deprecated-api": 0
},
"parserOptions": {
"ecmaVersion": 6,
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Expand Up @@ -37,7 +37,7 @@
/vendor/pyyaml
node_modules/
SHASUMS256.txt
**/yarn.lock
**/package-lock.json
compile_commands.json
.envrc

Expand Down
2 changes: 1 addition & 1 deletion BUILD.gn
Expand Up @@ -64,7 +64,7 @@ config("branding") {
npm_action("build_electron_definitions") {
script = "gn-typescript-definitions"
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 = [
"$target_gen_dir/tsc/typings/electron.d.ts",
Expand Down
5 changes: 4 additions & 1 deletion DEPS
Expand Up @@ -24,6 +24,9 @@ vars = {
'requests_git': 'https://github.com/kennethreitz',
'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.
'apply_patches': True,

Expand Down Expand Up @@ -110,7 +113,7 @@ hooks = [
'action': [
'python',
'-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"]);',
],
},
{
Expand Down
4 changes: 2 additions & 2 deletions atom/common/node_bindings.cc
Expand Up @@ -130,7 +130,7 @@ namespace {
// is not modified.
std::unique_ptr<const char* []> StringVectorToArgArray(
const std::vector<std::string>& vector) {
std::unique_ptr<const char* []> array(new const char*[vector.size()]);
std::unique_ptr<const char*[]> array(new const char*[vector.size()]);
for (size_t i = 0; i < vector.size(); ++i) {
array[i] = vector[i].c_str();
}
Expand Down Expand Up @@ -325,7 +325,7 @@ node::Environment* NodeBindings::CreateEnvironment(
.Append(FILE_PATH_LITERAL("init.js"));
args.insert(args.begin() + 1, script_path.AsUTF8Unsafe());

std::unique_ptr<const char* []> c_argv = StringVectorToArgArray(args);
std::unique_ptr<const char*[]> c_argv = StringVectorToArgArray(args);
node::Environment* env = node::CreateEnvironment(
node::CreateIsolateData(context->GetIsolate(), uv_loop_, platform),
context, args.size(), c_argv.get(), 0, nullptr);
Expand Down
2 changes: 1 addition & 1 deletion build/npm.gni
Expand Up @@ -6,7 +6,7 @@ template("npm_action") {
action("npm_pre_flight_" + target_name) {
inputs = [
"package.json",
"package-lock.json",
"yarn.lock",
]
script = "//electron/build/npm-run.py"

Expand Down
2 changes: 1 addition & 1 deletion build/tsc.gni
Expand Up @@ -21,7 +21,7 @@ template("typescript_build") {
inputs = [
invoker.tsconfig,
"//electron/tsconfig.json",
"//electron/package-lock.json",
"//electron/yarn.lock",
"//electron/typings/internal-ambient.d.ts",
"//electron/typings/internal-electron.d.ts",
"//electron/typings/internal-helpers.d.ts",
Expand Down

0 comments on commit 98c51dd

Please sign in to comment.