build: update to latest version of `rules_nodejs` v3.3.0 (#41599)

Updates to the latest version of `rules_nodejs` that supports
the most recent NodeJS lts version v14.16.1.

Additionally the latest version of `rules_nodejs` provides
[a package for runfile resolution](https://github.com/bazelbuild/rules_nodejs/pull/2568) w/ types that we can leverage.

PR Close #41599
This commit is contained in:
Paul Gschwendtner 2021-04-13 19:07:12 +02:00 committed by Zach Arend
parent f7e391a912
commit fd9a7ca8c9
20 changed files with 65 additions and 61 deletions

View File

@ -8,8 +8,8 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
# Fetch rules_nodejs so we can install our npm dependencies # Fetch rules_nodejs so we can install our npm dependencies
http_archive( http_archive(
name = "build_bazel_rules_nodejs", name = "build_bazel_rules_nodejs",
sha256 = "bfacf15161d96a6a39510e7b3d3b522cf61cb8b82a31e79400a84c5abcab5347", sha256 = "f533eeefc8fe1ddfe93652ec50f82373d0c431f7faabd5e6323f6903195ef227",
urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/3.2.1/rules_nodejs-3.2.1.tar.gz"], urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/3.3.0/rules_nodejs-3.3.0.tar.gz"],
) )
# Check the rules_nodejs version and download npm dependencies # Check the rules_nodejs version and download npm dependencies

View File

@ -5,8 +5,8 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
# Fetch rules_nodejs so we can install our npm dependencies # Fetch rules_nodejs so we can install our npm dependencies
http_archive( http_archive(
name = "build_bazel_rules_nodejs", name = "build_bazel_rules_nodejs",
sha256 = "bfacf15161d96a6a39510e7b3d3b522cf61cb8b82a31e79400a84c5abcab5347", sha256 = "f533eeefc8fe1ddfe93652ec50f82373d0c431f7faabd5e6323f6903195ef227",
urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/3.2.1/rules_nodejs-3.2.1.tar.gz"], urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/3.3.0/rules_nodejs-3.3.0.tar.gz"],
) )
# Fetch sass rules for compiling sass files # Fetch sass rules for compiling sass files

View File

@ -41,11 +41,11 @@
}, },
"// 1": "dependencies are used locally and by bazel", "// 1": "dependencies are used locally and by bazel",
"dependencies": { "dependencies": {
"@angular/cli": "12.0.0-next.7",
"@angular-devkit/build-angular": "github:angular/angular-devkit-build-angular-builds#e0c1374b12cfc892844030431bc19f631c0086a5", "@angular-devkit/build-angular": "github:angular/angular-devkit-build-angular-builds#e0c1374b12cfc892844030431bc19f631c0086a5",
"@angular-devkit/build-optimizer": "0.1200.0-next.7", "@angular-devkit/build-optimizer": "0.1200.0-next.7",
"@angular-devkit/core": "12.0.0-next.7", "@angular-devkit/core": "12.0.0-next.7",
"@angular-devkit/schematics": "12.0.0-next.7", "@angular-devkit/schematics": "12.0.0-next.7",
"@angular/cli": "12.0.0-next.7",
"@babel/cli": "7.8.4", "@babel/cli": "7.8.4",
"@babel/core": "7.8.6", "@babel/core": "7.8.6",
"@babel/generator": "7.8.6", "@babel/generator": "7.8.6",
@ -54,12 +54,13 @@
"@babel/template": "7.8.6", "@babel/template": "7.8.6",
"@babel/traverse": "7.8.6", "@babel/traverse": "7.8.6",
"@babel/types": "7.8.6", "@babel/types": "7.8.6",
"@bazel/concatjs": "3.2.3", "@bazel/concatjs": "3.3.0",
"@bazel/jasmine": "3.2.3", "@bazel/jasmine": "3.3.0",
"@bazel/protractor": "3.2.3", "@bazel/protractor": "3.3.0",
"@bazel/rollup": "3.2.3", "@bazel/rollup": "3.3.0",
"@bazel/terser": "3.2.3", "@bazel/runfiles": "3.3.0",
"@bazel/typescript": "3.2.3", "@bazel/terser": "3.3.0",
"@bazel/typescript": "3.3.0",
"@microsoft/api-extractor": "7.7.11", "@microsoft/api-extractor": "7.7.11",
"@octokit/rest": "16.28.7", "@octokit/rest": "16.28.7",
"@octokit/types": "^5.5.0", "@octokit/types": "^5.5.0",
@ -159,9 +160,9 @@
}, },
"// 2": "devDependencies are not used under Bazel. Many can be removed after test.sh is deleted.", "// 2": "devDependencies are not used under Bazel. Many can be removed after test.sh is deleted.",
"devDependencies": { "devDependencies": {
"@bazel/bazelisk": "^1.7.3", "@bazel/bazelisk": "^1.7.5",
"@bazel/buildifier": "^4.0.1", "@bazel/buildifier": "^4.0.1",
"@bazel/ibazel": "^0.15.6", "@bazel/ibazel": "^0.15.8",
"@octokit/graphql": "^4.6.1", "@octokit/graphql": "^4.6.1",
"@types/cli-progress": "^3.4.2", "@types/cli-progress": "^3.4.2",
"@types/conventional-commits-parser": "^3.0.1", "@types/conventional-commits-parser": "^3.0.1",
@ -186,7 +187,7 @@
"gulp": "^4.0.2", "gulp": "^4.0.2",
"gulp-conventional-changelog": "^2.0.35", "gulp-conventional-changelog": "^2.0.35",
"husky": "6.0.0", "husky": "6.0.0",
"inquirer": "^8.0.0", "inquirer": "^8.0.0",
"karma-browserstack-launcher": "^1.3.0", "karma-browserstack-launcher": "^1.3.0",
"karma-sauce-launcher": "^2.0.2", "karma-sauce-launcher": "^2.0.2",
"madge": "^4.0.2", "madge": "^4.0.2",

View File

@ -13,6 +13,7 @@ ts_library(
deps = [ deps = [
"//packages:types", "//packages:types",
"//packages/private/testing", "//packages/private/testing",
"@npm//@bazel/runfiles",
"@npm//@types/shelljs", "@npm//@types/shelljs",
], ],
) )
@ -34,6 +35,7 @@ ts_library(
deps = [ deps = [
"//packages:types", "//packages:types",
"//packages/private/testing", "//packages/private/testing",
"@npm//@bazel/runfiles",
"@npm//@types/shelljs", "@npm//@types/shelljs",
], ],
) )
@ -53,6 +55,7 @@ ts_library(
srcs = ["example_package.spec.ts"], srcs = ["example_package.spec.ts"],
deps = [ deps = [
"//packages:types", "//packages:types",
"@npm//@bazel/runfiles",
"@npm//@types/diff", "@npm//@types/diff",
], ],
) )

View File

@ -7,13 +7,11 @@
*/ */
import {obsoleteInIvy} from '@angular/private/testing'; import {obsoleteInIvy} from '@angular/private/testing';
import {runfiles} from '@bazel/runfiles';
import * as fs from 'fs'; import * as fs from 'fs';
import * as path from 'path'; import * as path from 'path';
import * as shx from 'shelljs'; import * as shx from 'shelljs';
/** Runfiles helper from bazel to resolve file name paths. */
const runfiles = require(process.env['BAZEL_NODE_RUNFILES_HELPER']!);
// Resolve the "npm_package" directory by using the runfile resolution. Note that we need to // Resolve the "npm_package" directory by using the runfile resolution. Note that we need to
// resolve the "package.json" of the package since otherwise NodeJS would resolve the "main" // resolve the "package.json" of the package since otherwise NodeJS would resolve the "main"
// file, which is not necessarily at the root of the "npm_package". // file, which is not necessarily at the root of the "npm_package".

View File

@ -7,12 +7,10 @@
*/ */
import {ivyEnabled, obsoleteInIvy} from '@angular/private/testing'; import {ivyEnabled, obsoleteInIvy} from '@angular/private/testing';
import {runfiles} from '@bazel/runfiles';
import * as path from 'path'; import * as path from 'path';
import * as shx from 'shelljs'; import * as shx from 'shelljs';
/** Runfiles helper from bazel to resolve file name paths. */
const runfiles = require(process.env['BAZEL_NODE_RUNFILES_HELPER']!);
// Resolve the "npm_package" directory by using the runfile resolution. Note that we need to // Resolve the "npm_package" directory by using the runfile resolution. Note that we need to
// resolve the "package.json" of the package since otherwise NodeJS would resolve the "main" // resolve the "package.json" of the package since otherwise NodeJS would resolve the "main"
// file, which is not necessarily at the root of the "npm_package". // file, which is not necessarily at the root of the "npm_package".

View File

@ -6,14 +6,12 @@
* found in the LICENSE file at https://angular.io/license * found in the LICENSE file at https://angular.io/license
*/ */
import {runfiles} from '@bazel/runfiles';
import * as crypto from 'crypto'; import * as crypto from 'crypto';
import {createPatch} from 'diff'; import {createPatch} from 'diff';
import * as fs from 'fs'; import * as fs from 'fs';
import * as path from 'path'; import * as path from 'path';
/** Runfiles helper from bazel to resolve file name paths. */
const runfiles = require(process.env['BAZEL_NODE_RUNFILES_HELPER']!);
type TestPackage = { type TestPackage = {
displayName: string; packagePath: string; goldenFilePath: string; displayName: string; packagePath: string; goldenFilePath: string;
}; };

View File

@ -43,6 +43,7 @@ ts_library(
tsconfig = ":tsconfig.json", tsconfig = ":tsconfig.json",
deps = [ deps = [
"//packages/private/testing", "//packages/private/testing",
"@npm//@bazel/runfiles",
], ],
) )

View File

@ -7,12 +7,10 @@
*/ */
import {obsoleteInIvy, onlyInIvy} from '@angular/private/testing'; import {obsoleteInIvy, onlyInIvy} from '@angular/private/testing';
import {runfiles} from '@bazel/runfiles';
import {existsSync, readFileSync} from 'fs'; import {existsSync, readFileSync} from 'fs';
import {dirname, join} from 'path'; import {dirname, join} from 'path';
/** Runfiles helper from bazel to resolve file name paths. */
const runfiles = require(process.env['BAZEL_NODE_RUNFILES_HELPER']!);
describe('flat_module ng_module', () => { describe('flat_module ng_module', () => {
let packageOutput: string; let packageOutput: string;
let flatModuleOutFile: string; let flatModuleOutFile: string;

View File

@ -5,6 +5,7 @@ ts_library(
testonly = True, testonly = True,
srcs = ["ng_module_ivy_test.ts"], srcs = ["ng_module_ivy_test.ts"],
tags = ["ivy-only"], tags = ["ivy-only"],
deps = ["@npm//@bazel/runfiles"],
) )
# `ng_module` with `compilation_mode` explicitly set to `partial`. # `ng_module` with `compilation_mode` explicitly set to `partial`.

View File

@ -6,11 +6,9 @@
* found in the LICENSE file at https://angular.io/license * found in the LICENSE file at https://angular.io/license
*/ */
import {runfiles} from '@bazel/runfiles';
import {readFileSync} from 'fs'; import {readFileSync} from 'fs';
/** Runfiles helper from bazel to resolve file name paths. */
const runfiles = require(process.env['BAZEL_NODE_RUNFILES_HELPER']!);
describe('ng_module with ivy enabled', () => { describe('ng_module with ivy enabled', () => {
describe('default compilation mode', () => { describe('default compilation mode', () => {
it('should generate definitions', () => { it('should generate definitions', () => {

View File

@ -175,7 +175,7 @@ def npm_integration_test(name, **kwargs):
) )
tags = kwargs.pop("tags", []) tags = kwargs.pop("tags", [])
npm_deps = ["@npm//tmp"] npm_deps = ["@npm//tmp", "@npm//@bazel/runfiles"]
nodejs_test( nodejs_test(
name = name, name = name,

View File

@ -10,7 +10,7 @@ const spawnSync = require('child_process').spawnSync;
const fs = require('fs'); const fs = require('fs');
const path = require('path'); const path = require('path');
const tmp = require('tmp'); const tmp = require('tmp');
const runfiles = require(process.env['BAZEL_NODE_RUNFILES_HELPER']); const {runfiles} = require('@bazel/runfiles');
const VERBOSE_LOGS = !!process.env['VERBOSE_LOGS']; const VERBOSE_LOGS = !!process.env['VERBOSE_LOGS'];

View File

@ -55,6 +55,7 @@ nodejs_binary(
name = "karma-saucelabs", name = "karma-saucelabs",
data = [ data = [
"sauce-service.sh", "sauce-service.sh",
"@npm//@bazel/runfiles",
"@npm//karma", "@npm//karma",
"@npm//sauce-connect", "@npm//sauce-connect",
"@npm//shelljs", "@npm//shelljs",

View File

@ -10,7 +10,7 @@
const shell = require('shelljs'); const shell = require('shelljs');
const karmaBin = require.resolve('karma/bin/karma'); const karmaBin = require.resolve('karma/bin/karma');
const runfiles = require(process.env['BAZEL_NODE_RUNFILES_HELPER']); const {runfiles} = require('@bazel/runfiles');
const sauceService = runfiles.resolveWorkspaceRelative(process.argv[2]); const sauceService = runfiles.resolveWorkspaceRelative(process.argv[2]);
process.argv = [ process.argv = [
process.argv[0], process.argv[0],

View File

@ -14,6 +14,7 @@ ts_library(
), ),
deps = [ deps = [
"//packages:types", "//packages:types",
"@npm//@bazel/runfiles",
"@npm//typescript", "@npm//typescript",
], ],
) )

View File

@ -6,10 +6,10 @@
* found in the LICENSE file at https://angular.io/license * found in the LICENSE file at https://angular.io/license
*/ */
import {runfiles} from '@bazel/runfiles';
import * as fs from 'fs'; import * as fs from 'fs';
import {SymbolExtractor} from './symbol_extractor';
const runfiles = require(process.env['BAZEL_NODE_RUNFILES_HELPER'] as string); import {SymbolExtractor} from './symbol_extractor';
if (require.main === module) { if (require.main === module) {
const args = process.argv.slice(2) as [string, string]; const args = process.argv.slice(2) as [string, string];

View File

@ -61,6 +61,7 @@ ts_library(
tsconfig = "//tools:tsconfig-test", tsconfig = "//tools:tsconfig-test",
deps = [ deps = [
":lib", ":lib",
"@npm//@bazel/runfiles",
"@npm//@types/jasmine", "@npm//@types/jasmine",
"@npm//@types/node", "@npm//@types/node",
"@npm//jasmine", "@npm//jasmine",

View File

@ -7,7 +7,7 @@
*/ */
const path = require('path'); const path = require('path');
const runfiles = require(process.env['BAZEL_NODE_RUNFILES_HELPER']); const {runfiles} = require('@bazel/runfiles');
// Change directories to the path of the ts-api-guardian source tree. We need to resolve an actual // Change directories to the path of the ts-api-guardian source tree. We need to resolve an actual
// path of a tree because we want to determine the path to the directory that includes all // path of a tree because we want to determine the path to the directory that includes all

View File

@ -1000,7 +1000,7 @@
lodash "^4.17.13" lodash "^4.17.13"
to-fast-properties "^2.0.0" to-fast-properties "^2.0.0"
"@bazel/bazelisk@^1.7.3": "@bazel/bazelisk@^1.7.5":
version "1.7.5" version "1.7.5"
resolved "https://registry.yarnpkg.com/@bazel/bazelisk/-/bazelisk-1.7.5.tgz#dd1a52e3d23464f72de55aa3dc4777847fa85373" resolved "https://registry.yarnpkg.com/@bazel/bazelisk/-/bazelisk-1.7.5.tgz#dd1a52e3d23464f72de55aa3dc4777847fa85373"
integrity sha512-JHwP9JhfZUSoj4sku471Bjw4uE773U2Agujnx0CdPkeRk25khy1l3VyjaPaHB+z1fmMnM6ED3M7tetQUsovUQg== integrity sha512-JHwP9JhfZUSoj4sku471Bjw4uE773U2Agujnx0CdPkeRk25khy1l3VyjaPaHB+z1fmMnM6ED3M7tetQUsovUQg==
@ -1010,47 +1010,52 @@
resolved "https://registry.yarnpkg.com/@bazel/buildifier/-/buildifier-4.0.1.tgz#52cfbad5cbb86e9183a29dde2370cd465730ea0d" resolved "https://registry.yarnpkg.com/@bazel/buildifier/-/buildifier-4.0.1.tgz#52cfbad5cbb86e9183a29dde2370cd465730ea0d"
integrity sha512-BTmtvJbeeEVrqRApI1gr5hvPgYcHLpdGJ5EXNXEWO692ztMPSj5fB/dH0xUlaW45jn6LimYx8ymqTMhj3538og== integrity sha512-BTmtvJbeeEVrqRApI1gr5hvPgYcHLpdGJ5EXNXEWO692ztMPSj5fB/dH0xUlaW45jn6LimYx8ymqTMhj3538og==
"@bazel/concatjs@3.2.3": "@bazel/concatjs@3.3.0":
version "3.2.3" version "3.3.0"
resolved "https://registry.yarnpkg.com/@bazel/concatjs/-/concatjs-3.2.3.tgz#ac52f13187dbcf22284cbd6773447d888d1fb5ed" resolved "https://registry.yarnpkg.com/@bazel/concatjs/-/concatjs-3.3.0.tgz#5d3c48aa1f19faeaaca54120248408e2cdc4150f"
integrity sha512-Cf6Zsg6oxjihu2QTpUaUxCkY6CPxQVuC7qxN6Qt2IiPOKsn39aZlNbEzZ9IQP1LP/xjdQqsjth6BY04c722eUA== integrity sha512-Hat4q+3xU3KhO5y0ibQdxT6do/6vnygVJn7WS+1jYfJduMwQivM20k3gPZZw++358f9UYu0fzhnEa05fBZ9bQQ==
dependencies: dependencies:
protobufjs "6.8.8" protobufjs "6.8.8"
source-map-support "0.5.9" source-map-support "0.5.9"
tsutils "2.27.2" tsutils "2.27.2"
"@bazel/ibazel@^0.15.6": "@bazel/ibazel@^0.15.8":
version "0.15.8" version "0.15.8"
resolved "https://registry.yarnpkg.com/@bazel/ibazel/-/ibazel-0.15.8.tgz#355632324fb4504611acb6f4a40cc6570c1a6c87" resolved "https://registry.yarnpkg.com/@bazel/ibazel/-/ibazel-0.15.8.tgz#355632324fb4504611acb6f4a40cc6570c1a6c87"
integrity sha512-VC60wGXKkzN35DZJnrlujl+fttLSdTBVrT+Hb9P+6nkR+dciN48f1KgluauG3DPopF/N681XhAiTYxg1WfGIYg== integrity sha512-VC60wGXKkzN35DZJnrlujl+fttLSdTBVrT+Hb9P+6nkR+dciN48f1KgluauG3DPopF/N681XhAiTYxg1WfGIYg==
"@bazel/jasmine@3.2.3": "@bazel/jasmine@3.3.0":
version "3.2.3" version "3.3.0"
resolved "https://registry.yarnpkg.com/@bazel/jasmine/-/jasmine-3.2.3.tgz#fee0372af7ee85354a58cb1457b61c53ce76f50a" resolved "https://registry.yarnpkg.com/@bazel/jasmine/-/jasmine-3.3.0.tgz#40d64507dec504df79d8877f6ceb9d9b0ea7886a"
integrity sha512-d1VxXVbpahnQrCihXyzHRcINeDKubA2v7VkMuDhRLrf/VagUkmg0PC6fYQ7AwniNUoR74s5sv/McMnpxfwOQ8g== integrity sha512-nsB1P/NQIOvxSTqVmQ3BqOSRQOvhqBP3M7owqDOl+3aQy1oIekXtj0S4s4pVFVMUFZf4acXXgZ4TOv0uuMOB5Q==
dependencies: dependencies:
c8 "~7.5.0" c8 "~7.5.0"
jasmine-reporters "~2.4.0" jasmine-reporters "~2.4.0"
"@bazel/protractor@3.2.3": "@bazel/protractor@3.3.0":
version "3.2.3" version "3.3.0"
resolved "https://registry.yarnpkg.com/@bazel/protractor/-/protractor-3.2.3.tgz#9e36275c5ec450fb24ef5cecafdf681d1fbb9090" resolved "https://registry.yarnpkg.com/@bazel/protractor/-/protractor-3.3.0.tgz#6465f90e7bfa7aaf183aa855e6b17b3a3cd06f48"
integrity sha512-sFBvfDKI8M398RI9ZeaI4hd0xsnKmWDIsv25rqt4DfO67fNNiEvOCkEgSq36e32ht5C8N01XlBpm/O0WNdL+0Q== integrity sha512-QT8HeAZ7E7Q7IVU0KOSBc7GT9Aj/jjaX4UtDcYr0nHVi6wLnvJ+yLjrdgLcQ40Xpdd9FoR0lXT+cxN8jrBjGbQ==
"@bazel/rollup@3.2.3": "@bazel/rollup@3.3.0":
version "3.2.3" version "3.3.0"
resolved "https://registry.yarnpkg.com/@bazel/rollup/-/rollup-3.2.3.tgz#eb6b17f89da5d38b035a6d59a99000f2d5ada667" resolved "https://registry.yarnpkg.com/@bazel/rollup/-/rollup-3.3.0.tgz#f3b8a9593080f9dce1cf25dd5f3e6afc6a2afd61"
integrity sha512-7PmJqekk92OaiwwEN3dYsp5qbZX8cqr0WkFUiaM3FBsNYVoN/rdh+VxQJWTuDGLjWiHxLwE95YwVHcvwerSrCg== integrity sha512-LuAIikmze3/KQgw2z6KHGX5YGhXQm7kdsSd8SXvrkauO0LFjorB2bReOMWBsjIA7dvqP48skOvM2OrFsDWeZqQ==
"@bazel/terser@3.2.3": "@bazel/runfiles@3.3.0":
version "3.2.3" version "3.3.0"
resolved "https://registry.yarnpkg.com/@bazel/terser/-/terser-3.2.3.tgz#18849cb01f6a9fd840955547b0a9dbf63f02c720" resolved "https://registry.yarnpkg.com/@bazel/runfiles/-/runfiles-3.3.0.tgz#4bc0c3a12bb690a4361416f18577dd066b8cbb4e"
integrity sha512-SzX3ytgt8+i36sODPO9ju0LbjKXB8w9zi00S+XNManQTRilNrr/NODTYbBzKrjuebA/o52NMpvRGigRd1Z2RGg== integrity sha512-hUsQJN37h2wMinddTPyPbLA4PSRCXHzJOmxMRLrlnOyW01ekOXMxtiryCodrEnB6qkOSsVk1JJ8Bb+CJkDSM7A==
"@bazel/typescript@3.2.3": "@bazel/terser@3.3.0":
version "3.2.3" version "3.3.0"
resolved "https://registry.yarnpkg.com/@bazel/typescript/-/typescript-3.2.3.tgz#6e40bdb7c5294e588bac3b7d1269e58b98a1856c" resolved "https://registry.yarnpkg.com/@bazel/terser/-/terser-3.3.0.tgz#8f4036bcd9e00cf0add15020962d6eb513c9fc74"
integrity sha512-Q1Yin/AYdh9yrkSJo3H6nVn6mMaohr5syjLd0Df0w7WI4zerdJTxrY5nhoWZwO/S1rPj8/MedDwZudCqPDeDMA== integrity sha512-F5RqBLYqev9zSuPCpz8CpQui3I6DuPgrOBIadGq8D+c3341dyR2QxwYcJ2ZEiMtCMWtNM1KsOF2vQsvE7HnqqQ==
"@bazel/typescript@3.3.0":
version "3.3.0"
resolved "https://registry.yarnpkg.com/@bazel/typescript/-/typescript-3.3.0.tgz#6781f3aec3f974b864519ae9f47eaf09b134910b"
integrity sha512-neprCOVshAjlDAHgD5PAA4uqhkBzWve20Rl07Ip6BGnCNhU3XLkv+b86TtyWcU8tYMILoCSey9gzXs07XhEz6g==
dependencies: dependencies:
protobufjs "6.8.8" protobufjs "6.8.8"
semver "5.6.0" semver "5.6.0"