Upgraded to Angular 9.1.0 and rules_nodejs to 1.6
Added in command to generate gui2-fw-lib as NPM package
Change-Id: Id21f6f17b6edcd09cffd237f7ece90cf97a71bc2
(cherry picked from commit 23ef672a49b5d0e736a2b5cb99fc4edac0e8b4b4)
diff --git a/web/gui2-fw-lib/BUILD.bazel b/web/gui2-fw-lib/BUILD.bazel
index 5317f34..3a42f63 100644
--- a/web/gui2-fw-lib/BUILD.bazel
+++ b/web/gui2-fw-lib/BUILD.bazel
@@ -14,9 +14,9 @@
limitations under the License.
"""
-load("@npm_angular_bazel//:index.bzl", "ng_module")
+load("@npm_angular_bazel//:index.bzl", "ng_module", "ng_package")
load("@npm_bazel_typescript//:index.bzl", "ts_library")
-load("@npm_bazel_karma//:index.bzl", "karma_web_test_suite")
+load("@npm_bazel_karma//:index.bzl", "karma_web_test")
package(default_visibility = ["//:__subpackages__"])
@@ -77,7 +77,7 @@
],
)
-karma_web_test_suite(
+karma_web_test(
name = "test",
srcs = [
# We are manaully adding the bazel generated named-UMD d3 bundle here as
@@ -105,3 +105,20 @@
"//web/gui2/src/main/webapp:rxjs_umd_modules",
],
)
+
+# bazel run //web/gui2-fw-lib:gui2-fw-lib-pkg.pack to create a tgz
+ng_package(
+ name = "npm_package",
+ srcs = ["package.json"],
+ data = glob([
+ "**/*.css",
+ "**/*.html",
+ ]),
+ entry_point = ":index.ts",
+ entry_point_name = "gui2-fw-lib",
+ include_devmode_srcs = False,
+ readme_md = ":README.md",
+ deps = [
+ ":gui2-fw-lib",
+ ],
+)
diff --git a/web/gui2-fw-lib/README.md b/web/gui2-fw-lib/README.md
index a7e71cb..b14cd2d 100644
--- a/web/gui2-fw-lib/README.md
+++ b/web/gui2-fw-lib/README.md
@@ -4,61 +4,22 @@
It is separate to the main ONOS GUI2 project which is in ~/onos/web/gui2
-The reason this has been separated out in to a separate library is to allow
-external applications e.g. Fault Management to use it, without bringing along the
-whole of GUI 2
-
-This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 7.0.4.
-
-A couple of good articles on the creation and use of __libraries__ in Angular 7 is given in
-
-[The Angular Library Series - Creating a Library with the Angular CLI](https://blog.angularindepth.com/creating-a-library-in-angular-6-87799552e7e5)
-
-and
-
-[The Angular Library Series - Building and Packaging](https://blog.angularindepth.com/creating-a-library-in-angular-6-part-2-6e2bc1e14121)
+It allows external applications e.g. [onos-gui](https://github.com/onosproject/onos-gui)
+to use it, without bringing along the whole of GUI 2
The Bazel build of this library handles the building and packaging of the library
so that other projects and libraries can use it.
-## Development tools
-
## Development server
+To build the `npm` library project using Bazel run:
+`bazel build //web/gui2-fw-lib:gui2-fw-lib-npm`
+inside the `~/onos` folder.
-To build the library project using Angular CLI run
-`bazel run @npm//:node_modules/@angular/cli/bin/ng build --prod gui2-fw-lib`
-inside the `~/onos/web/gui2-fw-lib` folder.
-
-To make the library in to an NPM package use `bazel run @nodejs//:bin/npm pack` inside the dist/gui2-fw-lib folder
-
-To build the app that surrounds the library run
-`bazel run @npm//:node_modules/@angular/cli/bin/ng build`. This app is not
-part of the ONOS GUI and is there as a placeholder for testing the library
-
-Run `bazel run @npm//:node_modules/@angular/cli/bin/ng serve` for a dev server.
-Navigate to `http://localhost:4200/`.
-The app will automatically reload if you change any of the source files.
-__NOTE__ If you make changes to files in the library, the app will not pick them up until you build the library again
+To make the library in to an NPM package use
+`bazel run //web/gui2-fw-lib:gui2-fw-lib-npm.pack`
## Code scaffolding
Run `bazel run @npm//:node_modules/@angular/cli/bin/ng generate component component-name --project=gui2-fw-lib`
to generate a new component. You can also use
`bazel run @npm//:node_modules/@angular/cli/bin/ng generate directive|pipe|service|class|guard|interface|enum|module`.
-
-## Build
-
-Run `bazel run @npm//:node_modules/@angular/cli/bin/ng build` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `--prod` flag for a production build.
-
-## Running unit tests
-
-Run `bazel run @npm//:node_modules/@angular/cli/bin/ng test` to execute the unit tests via [Karma](https://karma-runner.github.io).
-
-## Running end-to-end tests
-
-Run `bazel run @npm//:node_modules/@angular/cli/bin/ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/).
-
-## Further help
-
-To get more help on the Angular CLI use `bazel run @npm//:node_modules/@angular/cli/bin/ng help`
-or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md).
diff --git a/web/gui2-fw-lib/package.json b/web/gui2-fw-lib/package.json
new file mode 100644
index 0000000..e2be544
--- /dev/null
+++ b/web/gui2-fw-lib/package.json
@@ -0,0 +1,37 @@
+{
+ "name": "gui2-fw-lib",
+ "version": "2.3.5",
+ "author": {
+ "name": "Sean Condon",
+ "email": "sean@opennetworking.org"
+ },
+ "description": "ONOS Project GUI Framework Library built on Angular9+",
+ "keywords": [
+ "ONOS",
+ "SDN",
+ "Controller",
+ "ONF",
+ "Open",
+ "Networking",
+ "Foundation"
+ ],
+ "homepage": "https://onosproject.org/onos/",
+ "bugs": "support@opennetworking.org",
+ "license": "Apache-2.0",
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/opennetworkinglab/onos.git"
+ },
+ "peerDependencies": {
+ "@angular/common": "^9.1.0",
+ "@angular/core": "^9.1.0"
+ },
+ "main": "./bundles/gui2-fw-lib.umd.js",
+ "fesm5": "./fesm5/gui2-fw-lib.js",
+ "fesm2015": "./fesm2015/gui2-fw-lib.js",
+ "esm5": "./esm5/gui2-fw-lib_public_index.js",
+ "esm2015": "./esm2015/gui2-fw-lib_public_index.js",
+ "typings": "./index.d.ts",
+ "module": "./fesm5/gui2-fw-lib.js",
+ "es2015": "./fesm2015/gui2-fw-lib.js"
+}