Keen Yee Liau 85866defa4 fix(bazel): Set module_name and enable ng test (#27715)
Relative imports in Typescript files only work when module_name is
defined in ts_library (when run in Node.js).
See issue https://github.com/bazelbuild/rules_typescript/issues/360

With that fixed, `ng test` now works.

`ng build` requires `node_modules` to be available in the project
directory, so it's not usable yet. Running `yarn` in project directory
does not work because of postinstall version check.

PR Close #27715
2018-12-17 16:43:09 -08:00
..

Schematics for Bazel

Development notes

To test any local changes, run

bazel build //packages/bazel:npm_package

then cd to the npm package in the dist folder and run yarn link. Next run yarn link again in the directory where the ng command is invoked. Make sure the ng command is local, and not the global installation.

Generate .d.ts file from JSON schema

The script to generate .d.ts file is located in the Angular CLI repo. Make sure the CLI repository is checked out on your local machine.

Then, in the CLI repository, run the following command

bazel run //tools:quicktype_runner -- \
  ~/Documents/GitHub/angular/packages/bazel/src/schematics/ng-new/schema.json \
  ~/Documents/GitHub/angular/packages/bazel/src/schematics/ng-new/schema.d.ts

TODOs

  1. Make the ts_json_schema rule re-usable and portable.
  2. Add comments in BUILD files. See discussion here.