Sandbox javascript build further
postgresql was failing to find configuration, add it to the sandbox.
When building JS, we were getting the following error:
[!] RollupError: Node tried to load your configuration file as CommonJS
even though it is likely an ES module. To resolve this, change the
extension of your configuration to ".mjs", set "type": "module" in your
package.json file or pass the "--bundleConfigAsCjs" flag.
Rename the configuration to be mjs to make it happy, and fix other leaks
found at the same time.
Change-Id: I59d8f9624b349ff5b27a6eeed8923f8d13d56744
Signed-off-by: Austin Schuh <austin.linux@gmail.com>
diff --git a/debian/postgresql_amd64.BUILD b/debian/postgresql_amd64.BUILD
index 400ab82..16c351c 100644
--- a/debian/postgresql_amd64.BUILD
+++ b/debian/postgresql_amd64.BUILD
@@ -43,6 +43,7 @@
srcs = ["%s.sh" % binary],
data = glob([
"usr/lib/**/*",
+ "usr/share/postgresql/**/*",
"lib/**/*",
]),
visibility = ["//visibility:public"],
diff --git a/scouting/BUILD b/scouting/BUILD
index ba6ab6b..8da1400 100644
--- a/scouting/BUILD
+++ b/scouting/BUILD
@@ -50,7 +50,9 @@
],
runner = "scouting_test_runner.js",
tags = [
- "no-remote-cache",
+ # This test fails for some reason when run on remote execution. It
+ # would be great to figure out why and fix it.
+ "no-remote",
],
)
diff --git a/tools/build_rules/js.bzl b/tools/build_rules/js.bzl
index bb15c2c..a41f30c 100644
--- a/tools/build_rules/js.bzl
+++ b/tools/build_rules/js.bzl
@@ -174,6 +174,10 @@
entry_points = [entry_point],
srcs = entry_deps,
define = NG_PROD_DEFINE if production else NG_DEV_DEFINE,
+ deps = [
+ "//:node_modules/@babel/core",
+ "//:node_modules/@angular/compiler-cli",
+ ],
format = "esm",
output_dir = True,
splitting = True,
@@ -301,7 +305,7 @@
copy_file(
name = name + "__rollup_config",
src = "//:rollup.config.js",
- out = name + "__rollup_config.js",
+ out = name + "__rollup_config.mjs",
)
upstream_rollup_bundle(
@@ -312,7 +316,7 @@
],
node_modules = node_modules,
sourcemap = "false",
- config_file = ":%s__rollup_config.js" % name,
+ config_file = ":%s__rollup_config.mjs" % name,
entry_point = entry_point,
**kwargs
)
@@ -387,7 +391,7 @@
copy_file(
name = name + "_config",
- out = name + "_cypress.config.js",
+ out = name + "_cypress.config.mjs",
src = "//tools/build_rules/js:cypress.config.js",
visibility = ["//visibility:private"],
)
@@ -401,7 +405,7 @@
name = name,
args = [
"run",
- "--config-file=%s_cypress.config.js" % name,
+ "--config-file=%s_cypress.config.mjs" % name,
"--browser=" + chrome_location,
],
browsers = ["@chrome_linux//:all"],
diff --git a/tools/build_rules/js/BUILD b/tools/build_rules/js/BUILD
index 86a0288..4221b05 100644
--- a/tools/build_rules/js/BUILD
+++ b/tools/build_rules/js/BUILD
@@ -1,5 +1,6 @@
load("@npm//:@angular/compiler-cli/package_json.bzl", angular_compiler_cli = "bin")
load(":ts.bzl", "ts_project")
+load("@aspect_bazel_lib//lib:copy_file.bzl", "copy_file")
exports_files([
"cypress.config.js",
@@ -16,7 +17,6 @@
name = "ngc.esbuild",
srcs = ["ngc.esbuild.ts"],
tsconfig = "//:tsconfig.node",
- visibility = ["//visibility:public"],
deps = [
"//:node_modules/@angular/compiler-cli",
"//:node_modules/@babel/core",
@@ -25,6 +25,13 @@
],
)
+copy_file(
+ name = "ngc_esbuild_js_copy",
+ src = ":ngc.esbuild.js",
+ out = "ngc.esbuild.mjs",
+ visibility = ["//visibility:public"],
+)
+
py_binary(
name = "assemble_service_worker_files",
srcs = [
diff --git a/tools/build_rules/js/ng.bzl b/tools/build_rules/js/ng.bzl
index 0a0f1e1..d4fe78c 100644
--- a/tools/build_rules/js/ng.bzl
+++ b/tools/build_rules/js/ng.bzl
@@ -20,6 +20,6 @@
esbuild(
name = name,
- config = "//tools/build_rules/js:ngc.esbuild.js",
+ config = "//tools/build_rules/js:ngc.esbuild.mjs",
**kwargs
)