scouting: Migrate to using npm-style packages for deps

Using the npm style for tracking dependencies makes it easier to write
common modules that our existing modules can import.

I was trying to set up a shared `Pipe` class for some modules and
couldn't work around this issue:

    scouting/www/entry/entry.module.ts:10:13 - error NG3004: Unable to import class PipeModule.
      The file /dev/shm/bazel-sandbox.62240ff599163761312fdbd652f7452abc23edc253dee6214f406f29dde5568b/linux-sandbox/192/execroot/org_frc971/bazel-out/k8-fastbuild/bin/scouting/www/pipes/pipes.module.d.ts is outside of the configured 'rootDir'.

    10   exports: [PipeModule, EntryComponent],

The simplest way to work around it is by using npm modules everywhere.
This meant that I had to convert the existing fbs messages into an npm
module too.

There should be no functional changes.

Signed-off-by: Philipp Schrader <philipp.schrader@gmail.com>
Change-Id: I4813fd304302a8bd664443023ef21aa147b80d2e
diff --git a/tools/build_rules/js.bzl b/tools/build_rules/js.bzl
index c2468f8..b735802 100644
--- a/tools/build_rules/js.bzl
+++ b/tools/build_rules/js.bzl
@@ -1,4 +1,5 @@
 load("@aspect_rules_js//js:providers.bzl", "JsInfo")
+load("@aspect_rules_js//npm:defs.bzl", "npm_package")
 load("@bazel_skylib//rules:write_file.bzl", "write_file")
 load("@aspect_bazel_lib//lib:copy_to_directory.bzl", "copy_to_directory")
 load("@aspect_bazel_lib//lib:copy_file.bzl", "copy_file")
@@ -276,13 +277,20 @@
         srcs.append(":_public_api")
 
     ng_project(
-        name = name,
+        name = "_lib",
         srcs = srcs + [":_index"],
         deps = deps + PACKAGE_DEPS,
-        visibility = visibility,
+        visibility = ["//visibility:private"],
         **kwargs
     )
 
+    npm_package(
+        name = name,
+        srcs = ["package.json", ":_lib"],
+        include_runfiles = False,
+        visibility = visibility,
+    )
+
 def rollup_bundle(name, entry_point, node_modules = "//:node_modules", deps = [], visibility = None, **kwargs):
     """Calls the upstream rollup_bundle() and exposes a .min.js file.