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
This commit is contained in:
Sean Condon 2020-04-13 10:30:35 +01:00
parent 525b68a5f5
commit e4e8f6a889
8 changed files with 1030 additions and 1066 deletions

View File

@ -124,9 +124,9 @@ load("//tools/build/bazel:gnoi_workspace.bzl", "generate_gnoi")
generate_gnoi()
# For GUI2 build
RULES_NODEJS_VERSION = "1.1.0"
RULES_NODEJS_VERSION = "1.6.0"
RULES_NODEJS_SHA256 = "c97bf38546c220fa250ff2cc052c1a9eac977c662c1fc23eda797b0ce8e70a43"
RULES_NODEJS_SHA256 = "f9e7b9f42ae202cc2d2ce6d698ccb49a9f7f7ea572a78fd451696d03ef2ee116"
load("//tools/build/bazel:topo_workspace.bzl", "generate_topo_device")
@ -141,9 +141,9 @@ http_archive(
)
# Rules for compiling sass
RULES_SASS_VERSION = "1.24.0"
RULES_SASS_VERSION = "1.25.0"
RULES_SASS_SHA256 = "77e241148f26d5dbb98f96fe0029d8f221c6cb75edbb83e781e08ac7f5322c5f"
RULES_SASS_SHA256 = "c78be58f5e0a29a04686b628cf54faaee0094322ae0ac99da5a8a8afca59a647"
http_archive(
name = "io_bazel_rules_sass",
@ -171,9 +171,8 @@ node_repositories(
# TODO give this a name like `gui2_npm` once the @bazel/karma tools can tolerate a name other than `npm`
yarn_install(
name = "npm",
args = ["--frozen-lockfile"],
package_json = "//web/gui2:package.json",
use_global_yarn_cache = False,
use_global_yarn_cache = True,
yarn_lock = "//web/gui2:yarn.lock",
)

View File

@ -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 @@ ts_library(
],
)
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 @@ karma_web_test_suite(
"//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",
],
)

View File

@ -4,61 +4,22 @@ This project separates out the Framework part of the ONOS GUI2 project in to a s
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).

View File

@ -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"
}

View File

@ -1,6 +1,6 @@
load("@npm_angular_bazel//:index.bzl", "ng_module")
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__"])
@ -144,7 +144,7 @@ genrule(
&& echo '});' >> $@""",
)
karma_web_test_suite(
karma_web_test(
name = "test",
srcs = [
],

View File

@ -11,13 +11,13 @@
},
"private": true,
"dependencies": {
"@angular/animations": "9.0.0-rc.10",
"@angular/common": "9.0.0-rc.10",
"@angular/core": "9.0.0-rc.10",
"@angular/forms": "9.0.0-rc.10",
"@angular/platform-browser": "9.0.0-rc.10",
"@angular/platform-browser-dynamic": "9.0.0-rc.10",
"@angular/router": "9.0.0-rc.10",
"@angular/animations": "9.1.0",
"@angular/common": "9.1.0",
"@angular/core": "9.1.0",
"@angular/forms": "9.1.0",
"@angular/platform-browser": "9.1.0",
"@angular/platform-browser-dynamic": "9.1.0",
"@angular/router": "9.1.0",
"d3": "^5.15.0",
"rxjs": "^6.5.4",
"topojson-client": "^3.1.0",
@ -25,21 +25,21 @@
"zone.js": "0.10.2"
},
"devDependencies": {
"@angular/bazel": "9.0.0-rc.10",
"@angular/cli": "9.0.0-rc.10",
"@angular/compiler": "9.0.0-rc.10",
"@angular/compiler-cli": "9.0.0-rc.10",
"@angular/bazel": "9.1.0",
"@angular/cli": "9.1.0",
"@angular/compiler": "9.1.0",
"@angular/compiler-cli": "9.1.0",
"@bazel/hide-bazel-files": "1.1.0",
"@bazel/karma": "1.1.0",
"@bazel/protractor": "1.1.0",
"@bazel/rollup": "1.1.0",
"@bazel/terser": "1.1.0",
"@bazel/typescript": "1.1.0",
"@bazel/karma": "1.6.0",
"@bazel/protractor": "1.6.0",
"@bazel/rollup": "1.6.0",
"@bazel/terser": "1.6.0",
"@bazel/typescript": "1.6.0",
"@types/jasmine": "3.4.0",
"@types/node": "10.14.22",
"core-js": "2.6.9",
"history-server": "^1.3.1",
"html-insert-assets": "^0.4.0",
"html-insert-assets": "0.6.0",
"karma": "~4.1.0",
"karma-chrome-launcher": "2.2.0",
"karma-firefox-launcher": "1.1.0",
@ -51,7 +51,8 @@
"rollup": "^1.21.4",
"rollup-plugin-commonjs": "^10.1.0",
"rollup-plugin-node-resolve": "^5.2.0",
"rollup-plugin-sourcemaps": "~0.5.0",
"terser": "4.3.1",
"typescript": "3.7.5"
"typescript": "3.8.3"
}
}

View File

@ -10,6 +10,8 @@
"es2017",
"es2017.object"
],
"emitDecoratorMetadata": true,
"target": "es6",
// Don't scan the node_modules/@types folder for ambient types.
// This would force us to have all the types in the dependencies of
// each library.
@ -17,7 +19,7 @@
// using the ///<reference types=""/> syntax.
"types": [],
"paths": {
"org_onosproject_onos/web/gui2-fw-lib": ["web/gui2-fw-lib"]
"org_onosproject_onos/web/gui2-fw-lib": ["../gui2-fw-lib"]
}
}
}

File diff suppressed because it is too large Load Diff