Compare commits

..

83 Commits
7.0.1 ... 7.0.3

Author SHA1 Message Date
926367150a release: cut the v7.0.3 release 2018-11-07 11:56:04 -08:00
14ff340e93 docs(forms): update reactive form directives API reference (#26823)
PR Close #26823
2018-11-05 15:11:42 -08:00
c8e750745a refactor(compiler): typo (#25496)
PR Close #25496
2018-11-05 12:53:04 -08:00
6b8f2da93e fix: missing semi-colon and empty line (#26945)
PR Close #26945
2018-11-05 11:37:56 -08:00
352219eafb docs: new GitHub Issue templates (#26918)
These templates take advatange of github's feature that allows
us to define multiple templates and which the UI presents to the
user and lets them choose the most appropriate template.

The goal of this is to tailor the templates to the templates to
various use-cases and bug categories and provide better guidance to
developers filing issues which should result in more efficient
processing of the issue backlog.

PR Close #26918
2018-11-05 09:51:15 -08:00
e8a8770eee style(compiler): typo fix (#26934)
PR Close #26934
2018-11-05 09:49:23 -08:00
f536261639 docs: minor edits and corrections to cli intro (#26654)
PR Close #26654
2018-11-02 13:22:10 -07:00
2d06693560 docs: edit file structure page (#26552)
PR Close #26552
2018-11-02 11:25:12 -07:00
315d95c747 fix(upgrade): make typings compatible with older AngularJS typings (#26880)
Make `angular1` typings compatible with older versions of AngularJS
typings from `@types/angular`.

Closes #26420

PR Close #26880
2018-11-02 11:24:06 -07:00
5c5b62cc86 ci: remove redundant start-xvfb step (#26869)
Since 8fc4ae51f, the jobs that need Xvfb use `*-browser` CircleCI docker
image flavors (e.g. `circleci/node:10.12-browsers`), which automatically
start Xvfb.

PR Close #26869
2018-11-02 10:37:36 -07:00
479f773bb3 ci: make integration_test job logs less verbose (#26869)
The build progress logs accounted for ~80% of the total log size, which
makes it harder to get to the interesting lines, such as error messages.

Used suggestion from [here][1].

[1]: https://github.com/angular/angular-cli/issues/11412#issuecomment-412021539

PR Close #26869
2018-11-02 10:37:36 -07:00
629c83588d build: upgrade @angular/cli in cli-hello-world integration test (#26869)
PR Close #26869
2018-11-02 10:37:36 -07:00
d96ba0ffd9 ci: fix and re-enable payload size checks for integration tests (#26869)
See #22810, #23376 and #23515 for more context.

Fixes #23376
Closes #23515

PR Close #26869
2018-11-02 10:37:36 -07:00
30700035b3 test: remove checks for non-existent directories in integration tests (#26869)
PR Close #26869
2018-11-02 10:37:36 -07:00
8c6d6b85db test: make elements integration tests less flaky (#26869)
PR Close #26869
2018-11-02 10:37:36 -07:00
0c10b57749 build(docs-infra): upgrade cli command docs sources to b50950b97 (#26915)
[Changed files](4faa81e25...b50950b97):

        - help/add.json

- help/build.json

- help/config.json

- help/doc.json

- help/e2e.json

- help/eject.json

- help/generate.json

- help/get.json

- help/help.json

- help/lint.json

- help/make-this-awesome.json

- help/new.json

- help/run.json

- help/serve.json

- help/set.json

- help/test.json

- help/update.json

- help/version.json

- help/xi18n.json

PR Close #26915
2018-11-02 10:35:55 -07:00
fe1c0d7a0c feat(docs-infra): add getting started widgets (#26059)
PR Close #26059
2018-11-02 10:34:54 -07:00
dc053859ee fix(router): remove type bludgeoning of context and outlet when running CanDeactivate (#26496)
Fixes #18253

PR Close #26496
2018-11-01 16:04:02 -07:00
4d532df52b fix(bazel): unknown replay compiler error in windows (#26711)
In Windows the compiler path ends with `.exe` thus it will never match and throw  `Unknown replay compiler`

PR Close #26711
2018-11-01 15:16:06 -07:00
5eb540cf34 docs: Webcomponents activated as of firefox 63 (#26889)
PR Close #26889
2018-11-01 14:30:22 -07:00
7697650edc fix(docs-infra): update overload rendering (#24976)
Based on the review here:
https://github.com/angular/angular/pull/24976#issuecomment-415535125

PR Close #24976
2018-11-01 14:17:12 -07:00
4517b8e618 build(docs-infra): display long overload parameter types as object (#24976)
In some overloads, the parameter type can be a large anonymous
object type.
This change displays such types as `object`. It is then up to the
documentation author to put more information about the type in the
method usage notes.

PR Close #24976
2018-11-01 14:17:12 -07:00
3abc4c9c54 build(docs-infra): fix individual API overload templates (#24976)
* Make individual overloads collapsible
* Show only the first overload expanded, rest collapsed
* Text changes to 'collapse all' once 'show all' is clicked
* Fix chevron/carrot rotation animation when overloads / overload item is expanded or collapsed

PR Close #24976
2018-11-01 14:17:12 -07:00
1d6333891c build(docs-infra): add method overload index (#24976)
PR Close #24976
2018-11-01 14:17:12 -07:00
4d4e85b708 build(docs-infra): improve API overload templates (#24976)
PR Close #24976
2018-11-01 14:17:12 -07:00
28104828d5 build: update canonical-path dependency (#26719)
This new version (1.0.0) provides a typings file!

PR Close #26719
2018-11-01 13:49:11 -07:00
77f531b6f7 release: cut the v7.0.2 release 2018-10-31 16:05:54 -07:00
3041240cbc build: remove problematic yarn prefix for running bazel 2018-10-31 16:03:29 -07:00
257ac83095 fix(core): Remove static dependency from @angular/core to @angular/compiler (#26734) (#26879) 2018-10-31 13:14:01 -07:00
bc93d47129 build(bazel): remove undeclared dep (#26875)
PR Close #26875
2018-10-31 12:50:28 -04:00
3f61071638 build(bazel): fix bad merge in BUILD file (#26875)
PR Close #26875
2018-10-31 12:50:28 -04:00
ea571aa9d1 build(bazel): generalize fix for AMD name for flat module out file (#26837)
PR Close #26837
2018-10-30 18:37:12 -04:00
40cd0371d2 docs: fixup deployment guide (#26486)
- remove sections that were not relevant (all the development stuff)
- fix incorrect info

PR Close #26486
2018-10-30 16:29:04 -04:00
8356577670 docs: Removing duplicate lines (#26754)
Duplicate lines are removed to avoid confusion.
PR Close #26754
2018-10-30 16:24:51 -04:00
45d3c8093b docs: fix typo (#26776)
PR Close #26776
2018-10-30 16:24:13 -04:00
e7eec2e44b docs: fix typo (#26773)
PR Close #26773
2018-10-30 16:23:49 -04:00
c44b93253c build: use bazel version from node modules (#26691)
* No longer depends on a custom CircleCI docker image that comes with Bazel pre-installed. Since Bazel is now available through NPM, we should be able to use the version from `@bazel/bazel` in order to enforce a consistent environment on CI and locally.
* This also reduces the amount of packages that need to be published (ngcontainer is removed)

PR Close #26691
2018-10-30 16:19:13 -04:00
cd444bc2ba build: Move non-bazel deps to devDependencies (#26691)
This makes yarn_install of ngdeps under Bazel faster, since we don't need many of the large dependencies.
It's important because downstream angular/bazel users will observe the same install time.

PR Close #26691
2018-10-30 16:19:13 -04:00
e9ae26a272 docs: replace unused variable by _ (#26768)
replace unused variable by _  to keep the code consistent between examples

PR Close #26768
2018-10-30 13:49:52 -04:00
f9856974e3 docs: describe your change... (#26784)
PR Close #26784
2018-10-30 13:49:12 -04:00
b3c6409763 fix(core): support computed base class in metadata inheritance (#24014)
PR Close #24014
2018-10-30 13:48:22 -04:00
4c3e9a32d2 docs(changelog): remove reverted fix from 6.1.10 changelog (#26401)
PR Close #26401
2018-10-30 13:47:47 -04:00
2700952040 build: fix ts-api-guardian does not work on windows w/ bazel (#26761)
* Fixes that the `ts-api-guardian` package does not work on Windows with Bazel. This is because `ts-api-guardian` does not resolve the runfiles through theNodeJS `require` function that properly handles runfiles within Bazel.

PR Close #26761
2018-10-30 13:45:58 -04:00
6d92c99c49 build: add option to disable ts-api-guardian default angular tag rules (#26761)
Since the API guardian can be also used by other projects, we should not set up the default Angular project tag rules unless specified explicitly through a given command option (`useAngularTagRules`)

PR Close #26761
2018-10-30 13:45:58 -04:00
7cefb3efd4 docs: configuration file reference (#26484)
PR Close #26484
2018-10-30 13:44:53 -04:00
1c0ab3468d docs: update example dependencies to Angular/CLI/Universal V7 releases (#26820)
PR Close #26820
2018-10-30 13:44:24 -04:00
b5ede01c09 build(docs-infra): move CLI API desciption higher up (#26568)
Closes #26556

PR Close #26568
2018-10-29 13:01:09 -04:00
98b1a9dcfe ci(docs-infra): notify caretaker about aio_monitoring failures (#26649)
PR Close #26649
2018-10-29 13:00:21 -04:00
c277c198d2 test(docs-infra): make redirection tests more robust (#26649)
PR Close #26649
2018-10-29 13:00:21 -04:00
b7d7609872 test(docs-infra): make smoke tests more robust (#26649)
PR Close #26649
2018-10-29 13:00:21 -04:00
415e3e06ed test(docs-infra): fix smoke tests (#26649)
PR Close #26649
2018-10-29 13:00:21 -04:00
0f7a850699 test(docs-infra): run basic smoke tests against PR previews (#26649)
This makes the tests run agaisnt the deployed production versions (as
part of the `aio_monitoring` job) more reliable.

PR Close #26649
2018-10-29 13:00:21 -04:00
1e2525b8a7 test: mark public_api_guard test with fixme-ivy-aot and no-ivy-jit (#26602)
These tests are currently broken because of the following reasons:
- ivy no longer emits a generated index, so the filename of the main d.ts file is different
- ivy currently exports some symbols that don't match the golden file, this needs investigation

PR Close #26602
2018-10-29 12:59:47 -04:00
bc9f534bf4 build: fix the accept binary path in ts-api-guardian error message (#26602)
Fixes #26589

PR Close #26602
2018-10-29 12:59:47 -04:00
ea2a3ca705 build: remove unused @angular/compiler ts-api-guardian golden files (#26602)
these files are not used because the api surface of this package is not considered
to be stable/public api.

the presence of these files only confuses the reader.

PR Close #26602
2018-10-29 12:59:47 -04:00
802e996e64 build: don't depend on npm packages from public api tests (#26602)
We need only the inputs from ng_module.

PR Close #26602
2018-10-29 12:59:47 -04:00
aa7dd1267b docs: add ant design mobile of angular in resources (#26562)
PR Close #26562
2018-10-26 18:10:46 -04:00
91916e7113 docs: fix indentation (#26623)
PR Close #26623
2018-10-26 18:10:15 -04:00
0e92f1eee5 docs: add links to angular subdomains (#26653)
Add link to protactor.angular.io
Replace link from github.com/angular/universal to universal.angular.io
Replace link from github.com/angular/material2 to material.angular.io

fix #18257

PR Close #26653
2018-10-26 18:09:45 -04:00
4ac3b2e2bd build(docs-infra): ensure that CLI code blocks are not auto-linked (#26675)
Some of the text in CLI API docs were being auto-linked to API
pages. This was not correct, and in fact these blocks should not
have any auto links to Angular API at all.

Closes #26570

PR Close #26675
2018-10-26 18:09:21 -04:00
20ce134961 build(docs-infra): mark code blocks to disable auto-linking (#26675)
You can now mark `<code>` blocks with a `no-auto-link` css class
to tell the code auto-linker to ignore this code block.

PR Close #26675
2018-10-26 18:09:21 -04:00
c01f3409f3 fix(compiler): generate relative paths only in summary file errors (#26759)
Previously errors in the summary file would include absolute file names.
This is undesirable as the output of a build should not depend on the
current working directory. Doing so causes nondeterminism issues in
builds.

PR Close #26759
2018-10-26 18:07:55 -04:00
71580c8e37 ci: configure chrome options for protractor (#26735) (#26788)
so that they are more suitable for CI usage.

PR Close #26735

PR Close #26788
2018-10-26 15:46:35 -04:00
e58f8b7be0 ci: mark //modules/benchmarks/src/largetable/render3:perf with fixme-ivy-* tags (#26735) (#26788)
This target fails with odd error that we need to investigate:

[01:19:32] I/direct - Using ChromeDriver directly...
[01:19:32] E/direct - Error code: 135
[01:19:32] E/direct - Error message: Could not find chromedriver at /home/circleci/.cache/bazel/_bazel_circleci/9ce5c2144ecf75d11717c0aa41e45a8d/external/ngdeps/node_modules/webdriver-manager/selenium/chromedriver_2.41. Run 'webdriver-manager update' to download binaries.
[01:19:32] E/direct - Error: Could not find chromedriver at /home/circleci/.cache/bazel/_bazel_circleci/9ce5c2144ecf75d11717c0aa41e45a8d/external/ngdeps/node_modules/webdriver-manager/selenium/chromedriver_2.41. Run 'webdriver-manager update' to download binaries.

PR Close #26735

PR Close #26788
2018-10-26 15:46:35 -04:00
046c96a3f1 ci: use yarn test-ivy-... (#26735) (#26788)
This means that we use the same command to run test on CI as when developing locally.

PR Close #26735

PR Close #26788
2018-10-26 15:46:35 -04:00
00e6569e0f build: fix symbol-extractor by passing through "compile" as environmental variable (#26735) (#26788)
PR Close #26735

PR Close #26788
2018-10-26 15:46:35 -04:00
5dbf9f721b test(ivy): fix or disable failing ivy tests (#26735) (#26788)
These tests were previously not running on CI so they have always been broken,
or got broken just recently :-(.

test(ivy): mark failing test targets with fixme-ivy-jit and fixme-ivy-local tags

PR Close #26735

PR Close #26788
2018-10-26 15:46:35 -04:00
c63bc02846 build: remove ivy build/test tag hackery now that we can (#26735) (#26788)
With https://github.com/bazelbuild/rules_nodejs/pull/388 fixed we can stop messing around
with tags and just rely on the explicitly defined tags.

PR Close #26735

PR Close #26788
2018-10-26 15:46:35 -04:00
2f3308e4f0 docs: rename ivy compile mode 'local' to 'aot' in BAZEL.md (#26735) (#26788)
PR Close #26735

PR Close #26788
2018-10-26 15:46:35 -04:00
cc5e4fb93f ci: move CircleCI env variables definition to shell script (#26786)
PR Close #26786
2018-10-26 13:26:57 -04:00
3ab9947c7f ci: add more info on how CircleCI env vars are defined (#26786)
PR Close #26786
2018-10-26 13:26:57 -04:00
b1f92db22b ci: run Xvfb in the background on CircleCI (#26786)
PR Close #26786
2018-10-26 13:26:57 -04:00
bda1e52b50 build(docs-infra): include inherited members in search index (#26676)
Closes #23800

PR Close #26676
2018-10-26 13:16:33 -04:00
1084ebc091 build(docs-infra): refactor generateKeywords processor (#26676)
PR Close #26676
2018-10-26 13:16:33 -04:00
5a3af00398 ci(docs-infra): split test_and_deploy_aio to two separate jobs (#26746)
By splitting the jobs, if something goes wrong with deploying (e.g. a
network issue), we can re-run just that part instead of having to wait
for all the tests to complete again.

In terms of total duration, the difference should be minimal, because
the two operations (testing and deploying) do not depend on shared
tasks. For example, we need to build again (for the specific target
environment; e.g. stable, next, etc.) before deploying anyway.

PR Close #26746
2018-10-25 21:17:53 -04:00
7a088af3ff build: clean up *.gz files created by payload-size.sh (#26746)
These files are not needed once the size has been calculated and there
is no point in keeping them around.

Deleting them prevents, for example, uploading unnecessary files from
`aio/dist/` to Firebase (because `deploy-to-firebase.sh` runs the
payload size checks right before deploying).

PR Close #26746
2018-10-25 21:17:53 -04:00
3e8d8ec2f5 ci(docs-infra): reduce verbosity of yarn build on CI (#26746)
PR Close #26746
2018-10-25 21:17:53 -04:00
d4ea7f1f7e ci(docs-infra): fix deployment to Firebase (#26746)
Previously, `firebase-tools@3.x` was used and the deployment from
CircleCI failed with `Unexpected error` (HTTP code: 410).

This commit ensures that we use a recent version of `firebase-tools` for
deploying to Firebase. It also ensures that we use the locally installed
`firebase-tools` (not sure where it came from before 😁).

PR Close #26746
2018-10-25 21:17:53 -04:00
23096501e2 build(docs-infra): upgrade cli command docs sources to 4faa81e25 (#26741)
PR Close #26741
2018-10-25 21:10:21 -04:00
023874426e test(upgrade): make e2e tests for upgrade docs examples less flaky (#26726)
PR Close #26726
2018-10-24 19:49:14 -04:00
aeffcdd417 test(elements): make e2e tests for elements docs examples even less flaky (#26726)
PR Close #26726
2018-10-24 19:49:14 -04:00
6d7d7c77e3 ci: only publish builds if relevant aio jobs pass (#26722)
Some of the `aio`-/`docs`-related jobs rely on the locally built Angular
packages. When these jobs fail, it could mean that there is an issue
with the Angular packages (e.g. an unintentional breaking change).

This commit ensures that the `publish_artifacts` job is not run, unless
those `aio`-/`docs`-related jobs pass.

(The `test_aio_tools` job also uses the locally built Angular packages,
but it does not exercise them in a meaningful way to be worth making it
a prerequisite for `publish_artifacts`.)

PR Close #26722
2018-10-24 19:48:41 -04:00
8da6c369e5 build(docs-infra): fix parameter type rendering (#26688)
Closes #24355

PR Close #26688
2018-10-24 19:48:10 -04:00
205 changed files with 8203 additions and 7996 deletions

View File

@ -13,7 +13,7 @@ a GitHub token that enables publishing snapshots.
To create the github_token file, we take this approach:
- Find the angular-builds:token in http://valentine
- Go inside the ngcontainer docker image so you use the same version of openssl as we will at runtime: `docker run --rm -it angular/ngcontainer`
- Go inside the CircleCI default docker image so you use the same version of openssl as we will at runtime: `docker run --rm -it circleci/node:10.12`
- echo "https://[token]:@github.com" > credentials
- openssl aes-256-cbc -e -in credentials -out .circleci/github_token -k $KEY
- If needed, base64-encode the result so you can copy-paste it out of docker: `base64 github_token`

View File

@ -7,40 +7,20 @@
# To validate changes, use an online parser, eg.
# http://yaml-online-parser.appspot.com/
# Variables
## IMPORTANT
# If you change the `docker_image` version, also change the `cache_key` suffix and the version of
# `com_github_bazelbuild_buildtools` in the `/WORKSPACE` file.
var_1: &docker_image angular/ngcontainer:0.7.0
var_2: &cache_key v2-angular-{{ .Branch }}-{{ checksum "yarn.lock" }}-0.7.0
# Note that the browser docker image comes with Chrome and Firefox preinstalled. This is just
# needed for jobs that run tests without Bazel. Bazel runs tests with browsers that will be
# fetched by the Webtesting rules. Therefore for jobs that run tests with Bazel, we don't need a
# docker image with browsers pre-installed.
# **NOTE**: If you change the version of the docker images, also change the `cache_key` suffix.
var_1: &default_docker_image circleci/node:10.12
var_2: &browsers_docker_image circleci/node:10.12-browsers
var_3: &cache_key v2-angular-{{ .Branch }}-{{ checksum "yarn.lock" }}-node-10.12
# Define common ENV vars
var_3: &define_env_vars
var_4: &define_env_vars
run:
name: Define environment variables
command: |
echo "export PROJECT_ROOT=$(pwd)" | tee -a $BASH_ENV
echo "export CI_AIO_MIN_PWA_SCORE=95" | tee -a $BASH_ENV
# This is the branch being built; e.g. `pull/12345` for PR builds.
echo "export CI_BRANCH=$CIRCLE_BRANCH" | tee -a $BASH_ENV
echo "export CI_COMMIT=$CIRCLE_SHA1" | tee -a $BASH_ENV
# `CI_COMMIT_RANGE` will only be available when `CIRCLE_COMPARE_URL` is also available,
# i.e. on push builds (a.k.a. non-PR builds). That is fine, since we only need it in push builds.
echo "export CI_COMMIT_RANGE=$(sed -r 's|^.*/([0-9a-f]+\.\.\.[0-9a-f]+)$|\1|i' <<< ${CIRCLE_COMPARE_URL:-})" | tee -a $BASH_ENV
echo "export CI_PULL_REQUEST=${CIRCLE_PR_NUMBER:-false}" | tee -a $BASH_ENV
echo "export CI_REPO_NAME=$CIRCLE_PROJECT_REPONAME" | tee -a $BASH_ENV
echo "export CI_REPO_OWNER=$CIRCLE_PROJECT_USERNAME" | tee -a $BASH_ENV
# WARNING: Secrets (do not print).
echo "export CI_SECRET_AIO_DEPLOY_FIREBASE_TOKEN=$AIO_DEPLOY_TOKEN" >> $BASH_ENV
echo "export CI_SECRET_PAYLOAD_FIREBASE_TOKEN=$ANGULAR_PAYLOAD_TOKEN" >> $BASH_ENV
# See remote cache documentation in /docs/BAZEL.md
var_4: &setup-bazel-remote-cache
run:
name: Start up bazel remote cache proxy
command: ~/bazel-remote-proxy -backend circleci://
background: true
command: ./.circleci/env.sh
var_5: &setup_bazel_remote_execution
run:
@ -48,59 +28,67 @@ var_5: &setup_bazel_remote_execution
command: openssl aes-256-cbc -d -in .circleci/gcp_token -k "$CI_REPO_NAME" -out /home/circleci/.gcp_credentials && echo "export GOOGLE_APPLICATION_CREDENTIALS=/home/circleci/.gcp_credentials" >> $BASH_ENV && sudo bash -c "cat .circleci/rbe-bazel.rc >> /etc/bazel.bazelrc"
# Settings common to each job
anchor_1: &job_defaults
var_6: &job_defaults
working_directory: ~/ng
docker:
- image: *docker_image
- image: *default_docker_image
# After checkout, rebase on top of master.
# Similar to travis behavior, but not quite the same.
# See https://discuss.circleci.com/t/1662
anchor_2: &post_checkout
var_7: &post_checkout
post: git pull --ff-only origin "refs/pull/${CI_PULL_REQUEST//*pull\//}/merge"
var_8: &yarn_install
run:
name: Running Yarn install
command: yarn install --frozen-lockfile --non-interactive
var_9: &setup_circleci_bazel_config
run:
name: Setting up CircleCI bazel configuration
command: sudo cp .circleci/bazel.rc /etc/bazel.bazelrc
version: 2
jobs:
lint:
<<: *job_defaults
resource_class: xlarge
steps:
- *define_env_vars
- checkout:
<<: *post_checkout
- run: sudo cp .circleci/bazel.rc /etc/bazel.bazelrc
- restore_cache:
key: *cache_key
- *define_env_vars
- *setup_circleci_bazel_config
- *yarn_install
# Check BUILD.bazel formatting before we have a node_modules directory
# Then we don't need any exclude pattern to avoid checking those files
- run: 'yarn buildifier -mode=check ||
(echo "BUILD files not formatted. Please run ''yarn buildifier''" ; exit 1)'
# Run the skylark linter to check our Bazel rules
- run: 'yarn skylint ||
(echo -e "\n.bzl files have lint errors. Please run ''yarn skylint''"; exit 1)'
- restore_cache:
key: *cache_key
- run: yarn install --frozen-lockfile --non-interactive
- run: ./node_modules/.bin/gulp lint
test:
<<: *job_defaults
resource_class: xlarge
steps:
- *define_env_vars
- checkout:
<<: *post_checkout
- run: sudo cp .circleci/bazel.rc /etc/bazel.bazelrc
- restore_cache:
key: *cache_key
- *define_env_vars
- *setup_circleci_bazel_config
- *yarn_install
- run: bazel info release
- run: bazel run @nodejs//:yarn
# Setup remote execution and run RBE-compatible tests.
- *setup_bazel_remote_execution
- run: bazel test //... --build_tag_filters=-ivy-only --test_tag_filters=-ivy-only,-local
- run: yarn bazel test //... --build_tag_filters=-ivy-only --test_tag_filters=-ivy-only,-local
# Now run RBE incompatible tests locally.
- run: sudo cp .circleci/bazel.rc /etc/bazel.bazelrc
- run: bazel test //... --build_tag_filters=-ivy-only,local --test_tag_filters=-ivy-only,local
- run: yarn bazel test //... --build_tag_filters=-ivy-only,local --test_tag_filters=-ivy-only,local
# CircleCI will allow us to go back and view/download these artifacts from past builds.
# Also we can use a service like https://buildsize.org/ to automatically track binary size of these artifacts.
@ -134,14 +122,16 @@ jobs:
steps:
# don't run this job on the patch branch (to preserve resources)
- run: circleci step halt
- *define_env_vars
- checkout:
<<: *post_checkout
- run: sudo cp .circleci/bazel.rc /etc/bazel.bazelrc
- run: bazel run @yarn//:yarn
- restore_cache:
key: *cache_key
- *define_env_vars
- *setup_circleci_bazel_config
- *yarn_install
- *setup_bazel_remote_execution
- run: bazel test //... --define=compile=jit --build_tag_filters=ivy-jit --test_tag_filters=ivy-jit
- run: yarn test-ivy-jit //...
test_ivy_aot:
<<: *job_defaults
@ -149,77 +139,93 @@ jobs:
steps:
# don't run this job on the patch branch (to preserve resources)
- run: circleci step halt
- *define_env_vars
- checkout:
<<: *post_checkout
- run: sudo cp .circleci/bazel.rc /etc/bazel.bazelrc
- run: bazel run @yarn//:yarn
- *setup_bazel_remote_execution
- run: bazel test //... --define=compile=aot --build_tag_filters=ivy-aot --test_tag_filters=ivy-aot
test_and_deploy_aio:
<<: *job_defaults
steps:
- *define_env_vars
- checkout:
<<: *post_checkout
- restore_cache:
key: *cache_key
- *define_env_vars
- *setup_circleci_bazel_config
- *yarn_install
- *setup_bazel_remote_execution
- run: yarn test-ivy-aot //...
test_aio:
<<: *job_defaults
docker:
# Needed because the AIO tests and the PWA score test depend on Chrome being available.
- image: *browsers_docker_image
steps:
- checkout:
<<: *post_checkout
- restore_cache:
key: *cache_key
- *define_env_vars
# Build aio
- run: yarn --cwd aio build --progress=false
# Lint the code
- run: yarn --cwd aio lint
# Run PWA-score tests
# (Run before unit and e2e tests, which destroy the `dist/` directory.)
- run:
name: Run PWA-score tests
command: xvfb-run --auto-servernum yarn --cwd aio test-pwa-score-localhost $CI_AIO_MIN_PWA_SCORE
- run: yarn --cwd aio test-pwa-score-localhost $CI_AIO_MIN_PWA_SCORE
# Check the bundle sizes.
# (Run before unit and e2e tests, which destroy the `dist/` directory.)
- run: yarn --cwd aio payload-size
# Run unit tests
- run: xvfb-run --auto-servernum yarn --cwd aio test --watch=false
- run: yarn --cwd aio test --watch=false
# Run e2e tests
- run: xvfb-run --auto-servernum yarn --cwd aio e2e
- run: yarn --cwd aio e2e
# Run unit tests for Firebase redirects
- run: yarn --cwd aio redirects-test
deploy_aio:
<<: *job_defaults
docker:
# Needed because before deploying the deploy-production script runs the PWA score tests.
- image: *browsers_docker_image
steps:
- checkout:
<<: *post_checkout
- restore_cache:
key: *cache_key
- *define_env_vars
# Deploy angular.io to production (if necessary)
- run: echo "export CI_STABLE_BRANCH=$(npm info @angular/core dist-tags.latest | sed -r 's/^\s*([0-9]+\.[0-9]+)\.[0-9]+.*$/\1.x/')" | tee -a $BASH_ENV
- run: xvfb-run --auto-servernum yarn --cwd aio deploy-production
- run: setPublicVar CI_STABLE_BRANCH "$(npm info @angular/core dist-tags.latest | sed -r 's/^\s*([0-9]+\.[0-9]+)\.[0-9]+.*$/\1.x/')"
- run: yarn --cwd aio deploy-production
test_aio_local:
<<: *job_defaults
docker:
# Needed because the AIO tests and the PWA score test depend on Chrome being available.
- image: *browsers_docker_image
steps:
- *define_env_vars
- checkout:
<<: *post_checkout
- attach_workspace:
at: dist
- restore_cache:
key: *cache_key
- attach_workspace:
at: dist
- *define_env_vars
# Build aio (with local Angular packages)
- run: yarn --cwd aio build-local --progress=false
# Run PWA-score tests
# (Run before unit and e2e tests, which destroy the `dist/` directory.)
- run:
name: Run PWA-score tests
command: xvfb-run --auto-servernum yarn --cwd aio test-pwa-score-localhost $CI_AIO_MIN_PWA_SCORE
- run: yarn --cwd aio test-pwa-score-localhost $CI_AIO_MIN_PWA_SCORE
# Run unit tests
- run: xvfb-run --auto-servernum yarn --cwd aio test --watch=false
- run: yarn --cwd aio test --watch=false
# Run e2e tests
- run: xvfb-run --auto-servernum yarn --cwd aio e2e
- run: yarn --cwd aio e2e
test_aio_tools:
<<: *job_defaults
steps:
- *define_env_vars
- checkout:
<<: *post_checkout
- attach_workspace:
at: dist
- restore_cache:
key: *cache_key
- attach_workspace:
at: dist
- *define_env_vars
# Install
- run: yarn --cwd aio install --frozen-lockfile --non-interactive
- run: yarn --cwd aio extract-cli-command-docs
@ -229,37 +235,43 @@ jobs:
test_docs_examples_0:
<<: *job_defaults
docker:
# Needed because the example e2e tests depend on Chrome.
- image: *browsers_docker_image
steps:
- *define_env_vars
- checkout:
<<: *post_checkout
- attach_workspace:
at: dist
- restore_cache:
key: *cache_key
- attach_workspace:
at: dist
- *define_env_vars
# Install root
- run: yarn install --frozen-lockfile --non-interactive
- *yarn_install
# Install aio
- run: yarn --cwd aio install --frozen-lockfile --non-interactive
# Run examples tests
- run: xvfb-run --auto-servernum yarn --cwd aio example-e2e --setup --local --shard=0/2
- run: yarn --cwd aio example-e2e --setup --local --shard=0/2
test_docs_examples_1:
<<: *job_defaults
docker:
# Needed because the example e2e tests depend on Chrome.
- image: *browsers_docker_image
steps:
- *define_env_vars
- checkout:
<<: *post_checkout
- attach_workspace:
at: dist
- restore_cache:
key: *cache_key
- attach_workspace:
at: dist
- *define_env_vars
# Install root
- run: yarn install --frozen-lockfile --non-interactive
- *yarn_install
# Install aio
- run: yarn --cwd aio install --frozen-lockfile --non-interactive
# Run examples tests
- run: xvfb-run --auto-servernum yarn --cwd aio example-e2e --setup --local --shard=1/2
- run: yarn --cwd aio example-e2e --setup --local --shard=1/2
# This job should only be run on PR builds, where `CI_PULL_REQUEST` is not `false`.
aio_preview:
@ -267,12 +279,12 @@ jobs:
environment:
AIO_SNAPSHOT_ARTIFACT_PATH: &aio_preview_artifact_path 'aio/tmp/snapshot.tgz'
steps:
- *define_env_vars
- checkout:
<<: *post_checkout
- restore_cache:
key: *cache_key
- run: yarn install --frozen-lockfile --non-interactive
- *define_env_vars
- *yarn_install
- run: ./aio/scripts/build-artifacts.sh $AIO_SNAPSHOT_ARTIFACT_PATH $CI_PULL_REQUEST $CI_COMMIT
- store_artifacts:
path: *aio_preview_artifact_path
@ -283,16 +295,19 @@ jobs:
# This job should only be run on PR builds, where `CI_PULL_REQUEST` is not `false`.
test_aio_preview:
<<: *job_defaults
docker:
# Needed because the test-preview script runs e2e tests and the PWA score test with Chrome.
- image: *browsers_docker_image
steps:
- *define_env_vars
- checkout:
<<: *post_checkout
- restore_cache:
key: *cache_key
- *define_env_vars
- run: yarn install --cwd aio --frozen-lockfile --non-interactive
- run:
name: Wait for preview and run tests
command: xvfb-run --auto-servernum node aio/scripts/test-preview.js $CI_PULL_REQUEST $CI_COMMIT $CI_AIO_MIN_PWA_SCORE
command: node aio/scripts/test-preview.js $CI_PULL_REQUEST $CI_COMMIT $CI_AIO_MIN_PWA_SCORE
# This job exists only for backwards-compatibility with old scripts and tests
# that rely on the pre-Bazel dist/packages-dist layout.
@ -305,12 +320,15 @@ jobs:
<<: *job_defaults
resource_class: xlarge
steps:
- *define_env_vars
- checkout:
<<: *post_checkout
- run: sudo cp .circleci/bazel.rc /etc/bazel.bazelrc
- run: bazel run @nodejs//:yarn
- restore_cache:
key: *cache_key
- *define_env_vars
- *setup_circleci_bazel_config
- *yarn_install
- *setup_bazel_remote_execution
- run: scripts/build-packages-dist.sh
# Save the npm packages from //packages/... for other workflow jobs to read
@ -330,23 +348,30 @@ jobs:
# See comments inside the integration/run_tests.sh script.
integration_test:
<<: *job_defaults
docker:
# Needed because the integration tests expect Chrome to be installed (e.g cli-hello-world)
- image: *browsers_docker_image
# Note: we run Bazel in one of the integration tests, and it can consume >2G
# of memory. Together with the system under test, this can exhaust the RAM
# on a 4G worker so we use a larger machine here too.
resource_class: xlarge
steps:
- *define_env_vars
- checkout:
<<: *post_checkout
- restore_cache:
key: *cache_key
- attach_workspace:
at: dist
- run: xvfb-run --auto-servernum ./integration/run_tests.sh
- *define_env_vars
- run: ./integration/run_tests.sh
# This job updates the content of repos like github.com/angular/core-builds
# for every green build on angular/angular.
publish_snapshot:
<<: *job_defaults
steps:
- checkout:
<<: *post_checkout
- *define_env_vars
# See below - ideally this job should not trigger for non-upstream builds.
# But since it does, we have to check this condition.
@ -358,8 +383,6 @@ jobs:
|| "$CI_REPO_OWNER" != "angular"
|| "$CI_REPO_NAME" != "angular"
]] && circleci step halt || true'
- checkout:
<<: *post_checkout
- attach_workspace:
at: dist
# CircleCI has a config setting to force SSH for all github connections
@ -373,15 +396,23 @@ jobs:
aio_monitoring:
<<: *job_defaults
docker:
# This job needs Chrome to be globally installed because the tests run with Protractor
# which does not load the browser through the Bazel webtesting rules.
- image: *browsers_docker_image
steps:
- *define_env_vars
- checkout:
<<: *post_checkout
- restore_cache:
key: *cache_key
- *define_env_vars
- run:
name: Run tests against the deployed apps
command: xvfb-run --auto-servernum ./aio/scripts/test-production.sh $CI_AIO_MIN_PWA_SCORE
command: ./aio/scripts/test-production.sh $CI_AIO_MIN_PWA_SCORE
- run:
name: Notify caretaker about failure
command: 'curl --request POST --header "Content-Type: application/json" --data "{\"text\":\":x: \`$CIRCLE_JOB\` job failed on build $CIRCLE_BUILD_NUM: $CIRCLE_BUILD_URL :scream:\"}" $CI_SECRET_SLACK_CARETAKER_WEBHOOK_URL'
when: on_fail
workflows:
version: 2
@ -392,7 +423,10 @@ workflows:
- test_ivy_jit
- test_ivy_aot
- build-packages-dist
- test_and_deploy_aio
- test_aio
- deploy_aio:
requires:
- test_aio
- test_aio_local:
requires:
- build-packages-dist
@ -427,6 +461,10 @@ workflows:
- test_ivy_jit
- test_ivy_aot
- integration_test
# Only publish if `aio`/`docs` tests using the locally built Angular packages pass
- test_aio_local
- test_docs_examples_0
- test_docs_examples_1
# Get the artifacts to publish from the build-packages-dist job
# since the publishing script expects the legacy outputs layout.
- build-packages-dist

View File

@ -0,0 +1,38 @@
####################################################################################################
# Helpers for defining environment variables for CircleCI.
#
# In CircleCI, each step runs in a new shell. The way to share ENV variables across steps is to
# export them from `$BASH_ENV`, which is automatically sourced at the beginning of every step (for
# the default `bash` shell).
#
# See also https://circleci.com/docs/2.0/env-vars/#using-bash_env-to-set-environment-variables.
####################################################################################################
# Set and print an environment variable.
#
# Use this function for setting environment variables that are public, i.e. it is OK for them to be
# visible to anyone through the CI logs.
#
# Usage: `setPublicVar <name> <value>`
function setPublicVar() {
setSecretVar $1 $2;
echo "$1=$2";
}
# Set (without printing) an environment variable.
#
# Use this function for setting environment variables that are secret, i.e. should not be visible to
# everyone through the CI logs.
#
# Usage: `setSecretVar <name> <value>`
function setSecretVar() {
# WARNING: Secrets (e.g. passwords, access tokens) should NOT be printed.
# (Keep original shell options to restore at the end.)
local -r originalShellOptions=$(set +o);
set +x -eu -o pipefail;
echo "export $1=\"${2:-}\";" >> $BASH_ENV;
# Restore original shell options.
eval "$originalShellOptions";
}

35
.circleci/env.sh Executable file
View File

@ -0,0 +1,35 @@
#!/usr/bin/env bash
# Load helpers and make them available everywhere (through `$BASH_ENV`).
readonly envHelpersPath="`dirname $0`/env-helpers.inc.sh";
source $envHelpersPath;
echo "source $envHelpersPath;" >> $BASH_ENV;
####################################################################################################
# Define PUBLIC environment variables for CircleCI.
####################################################################################################
setPublicVar PROJECT_ROOT "$(pwd)";
setPublicVar CI_AIO_MIN_PWA_SCORE "95";
# This is the branch being built; e.g. `pull/12345` for PR builds.
setPublicVar CI_BRANCH "$CIRCLE_BRANCH";
setPublicVar CI_COMMIT "$CIRCLE_SHA1";
# `CI_COMMIT_RANGE` will only be available when `CIRCLE_COMPARE_URL` is also available,
# i.e. on push builds (a.k.a. non-PR builds). That is fine, since we only need it in push builds.
setPublicVar CI_COMMIT_RANGE "$(sed -r 's|^.*/([0-9a-f]+\.\.\.[0-9a-f]+)$|\1|i' <<< ${CIRCLE_COMPARE_URL:-})";
setPublicVar CI_PULL_REQUEST "${CIRCLE_PR_NUMBER:-false}";
setPublicVar CI_REPO_NAME "$CIRCLE_PROJECT_REPONAME";
setPublicVar CI_REPO_OWNER "$CIRCLE_PROJECT_USERNAME";
####################################################################################################
# Define SECRET environment variables for CircleCI.
####################################################################################################
setSecretVar CI_SECRET_AIO_DEPLOY_FIREBASE_TOKEN "$AIO_DEPLOY_TOKEN";
setSecretVar CI_SECRET_PAYLOAD_FIREBASE_TOKEN "$ANGULAR_PAYLOAD_TOKEN";
# Defined in https://angular-team.slack.com/apps/A0F7VRE7N-circleci.
setSecretVar CI_SECRET_SLACK_CARETAKER_WEBHOOK_URL "$SLACK_CARETAKER_WEBHOOK_URL";
# Source `$BASH_ENV` to make the variables available immediately.
source $BASH_ENV;

View File

@ -1,59 +1,10 @@
<!--
PLEASE HELP US PROCESS GITHUB ISSUES FASTER BY PROVIDING THE FOLLOWING INFORMATION.
🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑
ISSUES MISSING IMPORTANT INFORMATION MAY BE CLOSED WITHOUT INVESTIGATION.
-->
Please help us process issues more efficiently by filing an
issue using one of the following templates:
## I'm submitting a...
<!-- Check one of the following options with "x" -->
<pre><code>
[ ] Regression (a behavior that used to work and stopped working in a new release)
[ ] Bug report <!-- Please search GitHub for a similar issue or PR before submitting -->
[ ] Performance issue
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question
[ ] Other... Please describe:
</code></pre>
https://github.com/angular/angular/issues/new/choose
## Current behavior
<!-- Describe how the issue manifests. -->
Thank you!
## Expected behavior
<!-- Describe what the desired behavior would be. -->
## Minimal reproduction of the problem with instructions
<!--
For bug reports please provide the *STEPS TO REPRODUCE* and if possible a *MINIMAL DEMO* of the problem via
https://stackblitz.com or similar (you can use this template as a starting point: https://stackblitz.com/fork/angular-gitter).
-->
## What is the motivation / use case for changing the behavior?
<!-- Describe the motivation or the concrete use case. -->
## Environment
<pre><code>
Angular version: X.Y.Z
<!-- Check whether this is still an issue in the most recent Angular version -->
Browser:
- [ ] Chrome (desktop) version XX
- [ ] Chrome (Android) version XX
- [ ] Chrome (iOS) version XX
- [ ] Firefox version XX
- [ ] Safari (desktop) version XX
- [ ] Safari (iOS) version XX
- [ ] IE version XX
- [ ] Edge version XX
For Tooling issues:
- Node version: XX <!-- run `node --version` -->
- Platform: <!-- Mac, Linux, Windows -->
Others:
<!-- Anything else relevant? Operating system version, IDE, package manager, HTTP server, ... -->
</code></pre>
🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑

63
.github/ISSUE_TEMPLATE/1-bug-report.md vendored Normal file
View File

@ -0,0 +1,63 @@
---
name: "\U0001F41EBug report"
about: Report a bug in the Angular Framework
---
<!--🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅
Oh hi there! 😄
To expedite issue processing please search open and closed issues before submitting a new one.
Existing issues often contain information about workarounds, resolution, or progress updates.
🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅-->
# 🐞 bug report
### Affected Package
<!-- Can you pin-point one or more @angular/* packages as the source of the bug? -->
<!-- ✍edit: --> The issue is caused by package @angular/....
### Is this a regression?
<!-- Did this behavior use to work in the previous version? -->
<!-- ✍️--> Yes, the previous version in which this bug was not present was: ....
### Description
<!-- ✍️--> A clear and concise description of the problem...
## 🔬 Minimal Reproduction
<!--
Please create and share minimal reproduction of the issue starting with this template: https://stackblitz.com/fork/angular-issue-repro2
-->
<!-- ✍️--> https://stackblitz.com/...
<!--
If StackBlitz is not suitable for reproduction of your issue, please create a minimal GitHub repository with the reproduction of the issue. Share the link to the repo below along with step-by-step instructions to reproduce the problem, as well as expected and actual behavior.
-->
## 🔥 Exception or Error
<pre><code>
<!-- If the issue is accompanied by an exception or an error, please share it below: -->
<!-- ✍️-->
</code></pre>
## 🌍 Your Environment
**Angular Version:**
<pre><code>
<!-- run `ng version` and paste output below -->
<!-- ✍️-->
</code></pre>
**Anything else relevant?**
<!-- ✍Is this a browser specific issue? If so, please specify the browser and version. -->
<!-- ✍Do any of these matter: operating system, IDE, package manager, HTTP server, ...? If so, please mention it below. -->

View File

@ -0,0 +1,32 @@
---
name: "\U0001F680Feature request"
about: Suggest a feature for Angular Framework
---
<!--🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅
Oh hi there! 😄
To expedite issue processing please search open and closed issues before submitting a new one.
Existing issues often contain information about workarounds, resolution, or progress updates.
🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅-->
# 🚀 feature request
### Releavant Package
<!-- Can you pin-point one or more @angular/* packages the are relevant for this feature request? -->
<!-- ✍edit: --> This feature request is for @angular/....
### Description
<!-- ✍️--> A clear and concise description of the problem or missing capability...
### Describe the solution you'd like
<!-- ✍️--> If you have a solution in mind, please describe it.
### Describe alternatives you've considered
<!-- ✍️--> Have you considered any alternative solutions or workarounds?

55
.github/ISSUE_TEMPLATE/3-docs-bug.md vendored Normal file
View File

@ -0,0 +1,55 @@
---
name: "📚 Docs or angular.io issue report"
about: Report an issue in Angular's documentation or angular.io application
---
<!--🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅
Oh hi there! 😄
To expedite issue processing please search open and closed issues before submitting a new one.
Existing issues often contain information about workarounds, resolution, or progress updates.
🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅-->
# 📚 Docs or angular.io bug report
### Description
<!-- ✍edit:--> A clear and concise description of the problem...
## 🔬 Minimal Reproduction
### What's the affected URL?**
<!-- ✍edit:--> https://angular.io/...
### Reproduction Steps**
<!-- If applicable please list the steps to take to reproduce the issue -->
<!-- ✍edit:-->
### Expected vs Actual Behavior**
<!-- If applicable please describe the difference between the expected and actual behavior after following the repro steps. -->
<!-- ✍edit:-->
## 📷Screenshot
<!-- Often a screenshot can help to capture the issue better than a long description. -->
<!-- ✍upload a screenshot:-->
## 🔥 Exception or Error
<pre><code>
<!-- If the issue is accompanied by an exception or an error, please share it below: -->
<!-- ✍️-->
</code></pre>
## 🌍 Your Environment
### Browser info
<!-- ✍Is this a browser specific issue? If so, please specify the device, browser, and version. -->
### Anything else relevant?
<!-- ✍Please provide additional info if necessary. -->

View File

@ -0,0 +1,11 @@
---
name: ⚠️ Security issue disclosure
about: Report a security issue in Angular Framework, Material, or CLI
---
🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑
Please read https://angular.io/guide/security#report-issues on how to disclose security related issues.
🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑

View File

@ -0,0 +1,16 @@
---
name: "❓Support request"
about: Questions and requests for support
---
🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑
Please do not file questions or support requests on the GitHub issues tracker.
You can get your questions answered using other communication channels. Please see:
https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question
Thank you!
🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑

13
.github/ISSUE_TEMPLATE/6-angular-cli.md vendored Normal file
View File

@ -0,0 +1,13 @@
---
name: "\U0001F6E0Angular CLI"
about: Issues and feature requests for Angular CLI
---
🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑
Please file any Angular CLI issues at: https://github.com/angular/angular-cli/issues/new
For the time being, we keep Angular CLI issues in a separate repository.
🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑

View File

@ -0,0 +1,13 @@
---
name: "\U0001F48EAngular Material"
about: Issues and feature requests for Angular Material
---
🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑
Please file any Angular Material issues at: https://github.com/angular/material2/issues/new
For the time being, we keep Angular Material issues in a separate repository.
🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑

View File

@ -8,13 +8,6 @@ exports_files([
"protractor-perf.conf.js",
])
# Developers should always run `bazel run :install`
# This ensures that package.json in subdirectories get installed as well.
alias(
name = "install",
actual = "@nodejs//:yarn",
)
filegroup(
name = "web_test_bootstrap_scripts",
# do not sort

View File

@ -1,3 +1,27 @@
<a name="7.0.3"></a>
## [7.0.3](https://github.com/angular/angular/compare/7.0.2...7.0.3) (2018-11-07)
### Bug Fixes
* **bazel:** unknown replay compiler error in windows ([#26711](https://github.com/angular/angular/issues/26711)) ([4d532df](https://github.com/angular/angular/commit/4d532df))
* **router:** remove type bludgeoning of context and outlet when running CanDeactivate ([#26496](https://github.com/angular/angular/issues/26496)) ([dc05385](https://github.com/angular/angular/commit/dc05385)), closes [#18253](https://github.com/angular/angular/issues/18253)
* **upgrade:** make typings compatible with older AngularJS typings ([#26880](https://github.com/angular/angular/issues/26880)) ([315d95c](https://github.com/angular/angular/commit/315d95c)), closes [#26420](https://github.com/angular/angular/issues/26420)
<a name="7.0.2"></a>
## [7.0.2](https://github.com/angular/angular/compare/7.0.1...7.0.2) (2018-10-31)
### Bug Fixes
* **compiler:** generate relative paths only in summary file errors ([#26759](https://github.com/angular/angular/issues/26759)) ([c01f340](https://github.com/angular/angular/commit/c01f340))
* **core:** Remove static dependency from [@angular](https://github.com/angular)/core to [@angular](https://github.com/angular)/compiler ([#26734](https://github.com/angular/angular/issues/26734)) ([#26879](https://github.com/angular/angular/issues/26879)) ([257ac83](https://github.com/angular/angular/commit/257ac83))
* **core:** support computed base class in metadata inheritance ([#24014](https://github.com/angular/angular/issues/24014)) ([b3c6409](https://github.com/angular/angular/commit/b3c6409))
<a name="7.0.1"></a>
## [7.0.1](https://github.com/angular/angular/compare/7.0.0...7.0.1) (2018-10-24)
@ -79,7 +103,6 @@ To learn about the release highlights and our new CLI-powered update workflow fo
### Bug Fixes
* **platform-browser:** fix [#22155](https://github.com/angular/angular/issues/22155), destroy hammer manager when `HammerInstance.off()` is run ([#22156](https://github.com/angular/angular/issues/22156)) ([3b4d9dc](https://github.com/angular/angular/commit/3b4d9dc))
* **upgrade:** properly destroy upgraded component elements and descendants ([#26209](https://github.com/angular/angular/issues/26209)) ([623adbb](https://github.com/angular/angular/commit/623adbb)), closes [#26208](https://github.com/angular/angular/issues/26208)

View File

@ -6,6 +6,16 @@ load(
"rules_angular_dev_dependencies",
)
# Uncomment for local bazel rules development
#local_repository(
# name = "build_bazel_rules_nodejs",
# path = "../rules_nodejs",
#)
#local_repository(
# name = "build_bazel_rules_typescript",
# path = "../rules_typescript",
#)
# Angular Bazel users will call this function
rules_angular_dependencies()
# These are the dependencies only for us

View File

@ -33,7 +33,8 @@ cd my-first-project
ng serve
</code-example>
In your browser, open http://localhost:4200/ to see the new app run.
In your browser, open http://localhost:4200/ to see the new app run.
When you use the [ng serve](cli/serve) command to build an app and serve it locally, the server automatically rebuilds the app and reloads the page when you change any of the source files.
## Workspaces and project files
@ -49,16 +50,15 @@ You can edit the generated files directly, or add to and modify them using CLI c
Use the [ng generate](cli/generate) command to add new files for additional components and services, and code for new pipes, directives, and so on.
Commands such as [add](cli/add) and [generate](cli/generate), which create or operate on apps and libraries, must be executed from within a workspace or project folder.
When you use the [ng serve](cli/serve) command to build an app and serve it locally, the server automatically rebuilds the app and reloads the page when you change any of the source files.
* See more about the [Workspace file structure](guide/file-structure).
When you use the [ng serve](cli/serve) command to build an app and serve it locally, the server automatically rebuilds the app and reloads the page when you change any of the source files.
### Workspace and project configuration
A single workspace configuration file, `angular.json`, is created at the top level of the workspace.
This is where you can set workspace-wide defaults, and specify configurations to use when the CLI builds a project for different targets.
This is where you can set per-project defaults for CLI command options, and specify configurations to use when the CLI builds a project for different targets.
The [ng config](cli/config) command lets you set and retrieve configuration values from the command line, or you can edit the `angular.json` file directly.
The [ng config](cli/config) command lets you set and retrieve configuration values from the command line, or you can edit the `angular.json` file directly.
Note that option names in the configuration file must use [camelCase](guide/glossary#case-types), while option names supplied to commands can use either camelCase or dash-case.
* See the [complete schema](https://github.com/angular/angular-cli/wiki/angular-workspace) for `angular.json`.
<!-- * Learn more about *configuration options for Angular(links to new guide or topics TBD)*. -->

View File

@ -13,6 +13,10 @@ describe('Elements', () => {
browser.wait(EC.elementToBeClickable(elem), 5000);
elem.click();
};
const waitForText = (elem: ElementFinder) => {
// Waiting for the element to have some text, makes the tests less flaky.
browser.wait(async () => /\S/.test(await elem.getText()), 5000);
}
beforeEach(() => browser.get(''));
@ -33,6 +37,8 @@ describe('Elements', () => {
messageInput.sendKeys('Angular rocks!');
click(popupComponentButton);
waitForText(popupComponent);
expect(popupComponent.getText()).toContain('Popup: Angular rocks!');
});
@ -62,6 +68,8 @@ describe('Elements', () => {
messageInput.sendKeys('Angular rocks!');
click(popupElementButton);
waitForText(popupElement);
expect(popupElement.getText()).toContain('Popup: Angular rocks!');
});

View File

@ -12,7 +12,7 @@ h2, h3 {
body {
margin: 2em;
}
body, input[text], button {
body, input[type="text"], button {
color: #888;
font-family: Cambria, Georgia;
}

View File

@ -40,7 +40,7 @@ export class HeroService {
// #enddocregion getHeroes-1
.pipe(
// #enddocregion getHeroes-2
tap(heroes => this.log('fetched heroes')),
tap(_ => this.log('fetched heroes')),
// #docregion getHeroes-2
catchError(this.handleError('getHeroes', []))
);

View File

@ -1,6 +1,6 @@
'use strict'; // necessary for es6 output in node
import { browser, element, by, ElementFinder } from 'protractor';
import { browser, element, by, ElementArrayFinder, ElementFinder } from 'protractor';
// Angular E2E Testing Guide:
// https://docs.angularjs.org/guide/e2e-testing
@ -20,6 +20,12 @@ describe('PhoneCat Application', function() {
describe('View: Phone list', function() {
// Helpers
const waitForCount = (elems: ElementArrayFinder, count: number) => {
// Wait for the list to stabilize, which may take a while (e.g. due to animations).
browser.wait(() => elems.count().then(c => c === count), 5000);
};
beforeEach(function() {
browser.get('index.html#!/phones');
});
@ -28,13 +34,16 @@ describe('PhoneCat Application', function() {
let phoneList = element.all(by.repeater('phone in $ctrl.phones'));
let query = element(by.model('$ctrl.query'));
waitForCount(phoneList, 20);
expect(phoneList.count()).toBe(20);
query.sendKeys('nexus');
waitForCount(phoneList, 1);
expect(phoneList.count()).toBe(1);
query.clear();
query.sendKeys('motorola');
waitForCount(phoneList, 8);
expect(phoneList.count()).toBe(8);
});
@ -51,6 +60,7 @@ describe('PhoneCat Application', function() {
}
queryField.sendKeys('tablet'); // Let's narrow the dataset to make the assertions shorter
waitForCount(phoneNameColumn, 2);
expect(getNames()).toEqual([
'Motorola XOOM\u2122 with Wi-Fi',
@ -66,10 +76,16 @@ describe('PhoneCat Application', function() {
});
it('should render phone specific links', function() {
let phoneList = element.all(by.repeater('phone in $ctrl.phones'));
let query = element(by.model('$ctrl.query'));
query.sendKeys('nexus');
element.all(by.css('.phones li a')).first().click();
query.sendKeys('nexus');
waitForCount(phoneList, 1);
let nexusPhone = phoneList.first();
let detailLink = nexusPhone.all(by.css('a')).first()
detailLink.click();
expect(browser.getLocationAbsUrl()).toBe('/phones/nexus-s');
});

View File

@ -1,19 +1,19 @@
# Deployment
When you are ready to deploy your Angular application to a remote server, you have various options for
deployment.
deployment.
{@a dev-deploy}
{@a copy-files}
## Simplest deployment possible
For the simplest deployment, build for development and copy the output directory to a web server.
For the simplest deployment, create a production build and copy the output directory to a web server.
1. Start with the development build:
1. Start with the production build:
<code-example language="none" class="code-shell">
ng build
ng build --prod
</code-example>
@ -22,8 +22,7 @@ For the simplest deployment, build for development and copy the output directory
3. Configure the server to redirect requests for missing files to `index.html`.
Learn more about server-side redirects [below](#fallback).
This is _not_ a production deployment. It's not optimized, and it won't be fast for users.
It might be good enough for sharing your progress and ideas internally with managers, teammates, and other stakeholders. For the next steps in deployment, see [Optimize for production](#optimize).
This is the simplest production-ready deployment of your application.
{@a deploy-to-github}
@ -31,7 +30,7 @@ It might be good enough for sharing your progress and ideas internally with mana
Another simple way to deploy your Angular app is to use [GitHub Pages](https://help.github.com/articles/what-is-github-pages/).
1. You need to [create a GitHub account](https://github.com/join) if you don't have one, and then [create a repository](https://help.github.com/articles/create-a-repo/) for your project.
1. You need to [create a GitHub account](https://github.com/join) if you don't have one, and then [create a repository](https://help.github.com/articles/create-a-repo/) for your project.
Make a note of the user name and project name in GitHub.
1. Build your project using Github project name, with the Angular CLI command [`ng build`](cli/build) and the options shown here:
@ -39,9 +38,9 @@ Make a note of the user name and project name in GitHub.
ng build --prod --output-path docs --base-href <project_name>
</code-example>
1. When the build is complete, make a copy of `docs/index.html` and name it `docs/404.html`.
1. When the build is complete, make a copy of `docs/index.html` and name it `docs/404.html`.
1. Commit your changes and push.
1. Commit your changes and push.
1. On the GitHub project page, configure it to [publish from the docs folder](https://help.github.com/articles/configuring-a-publishing-source-for-github-pages/#publishing-your-github-pages-site-from-a-docs-folder-on-your-master-branch).
@ -97,51 +96,6 @@ There is no single configuration that works for every server.
The following sections describe configurations for some of the most popular servers.
The list is by no means exhaustive, but should provide you with a good starting point.
#### Development servers
During development, the [`ng serve`](cli/serve) CLI command lets you run your app in a local browser.
The CLI recompiles the application each time you save a file,
and reloads the browser with the newly compiled application.
The app is hosted in local memory and served on `http://localhost:4200/`, using [webpack-dev-server](https://webpack.js.org/guides/development/#webpack-dev-server).
{@a serve-from-disk}
Later in development, you might want a closer approximation of how your app will behave when deployed.
You can output your distribution folder (`dist`) to disk, but you need to install a different web server.
Try installing [lite-server](https://github.com/johnpapa/lite-server); like `webpack-dev-server`, it can automatically reload your browser when you write new files.
To get the live-reload experience, you will need to run two terminals.
The first runs the build in a watch mode and compiles the application to the `dist` folder.
The second runs the web server against the `dist` folder.
The combination of these two processes provides the same behavior as `ng serve`.
1. Start the build in terminal A:
<code-example language="none" class="code-shell">
ng build --watch
</code-example>
1. Start the web server in terminal B:
<code-example language="none" class="code-shell">
lite-server --baseDir="dist"
</code-example>
The default browser opens to the appropriate URL.
* [Lite-Server](https://github.com/johnpapa/lite-server): the default dev server installed with the
[Quickstart repo](https://github.com/angular/quickstart) is pre-configured to fallback to `index.html`.
* [Webpack-Dev-Server](https://github.com/webpack/webpack-dev-server): setup the
`historyApiFallback` entry in the dev server options as follows:
<code-example>
historyApiFallback: {
disableDotRule: true,
htmlAcceptHeaders: ['text/html', 'application/xhtml+xml']
}
</code-example>
#### Production servers
* [Apache](https://httpd.apache.org/): add a
[rewrite rule](http://httpd.apache.org/docs/current/mod/mod_rewrite.html) to the `.htaccess` file as shown
(https://ngmilk.rocks/2015/03/09/angularjs-html5-mode-or-pretty-urls-on-apache-using-htaccess/):
@ -230,19 +184,9 @@ Read about how to enable CORS for specific servers at
{@a optimize}
## Optimize for production
## Production optimizations
Although deploying directly from the development environment works,
you can generate an optimized build with additional CLI command line flags,
starting with `--prod`.
### Build with _--prod_
<code-example language="none" class="code-shell">
ng build --prod
</code-example>
The `--prod` _meta-flag_ engages the following optimization features.
The `--prod` _meta-flag_ engages the following build optimization features.
* [Ahead-of-Time (AOT) Compilation](guide/aot-compiler): pre-compiles Angular component templates.
* [Production mode](#enable-prod-mode): deploys the production environment which enables _production mode_.
@ -251,25 +195,22 @@ The `--prod` _meta-flag_ engages the following optimization features.
* Uglification: rewrites code to use short, cryptic variable and function names.
* Dead code elimination: removes unreferenced modules and much unused code.
The remaining [copy deployment steps](#copy-files) are the same as before.
See [`ng build`](cli/build) for more about CLI build options and what they do.
{@a enable-prod-mode}
### Enable production mode
### Enable runtime production mode
Angular apps run in development mode by default, as you can see by the following message on the browser
console:
In addition to build optimizations, Angular also has a runtime production mode. Angular apps run in development mode by default, as you can see by the following message on the browser console:
<code-example format="nocode">
Angular is running in the development mode. Call enableProdMode() to enable the production mode.
</code-example>
Switching to _production mode_ can make it run faster by disabling development specific checks such as the dual change detection cycles.
Switching to _production mode_ makes it run faster by disabling development specific checks such as the dual change detection cycles.
Building for production (or appending the `--environment=prod` flag) enables _production mode_
Look at the CLI-generated `main.ts` to see how this works.
When you enable production builds via `--prod` command line flag, the runtime production mode is enabled as well.
{@a lazy-loading}
@ -293,7 +234,7 @@ If you do that, the module will be loaded immediately.
The bundling configuration must take lazy loading into consideration.
Because lazy-loaded modules aren't imported in JavaScript, bundlers exclude them by default.
Bundlers don't know about the router configuration and can't create separate bundles for lazy-loaded modules.
Bundlers don't know about the router configuration and can't create separate bundles for lazy-loaded modules.
You would have to create these bundles manually.
The CLI runs the
@ -388,7 +329,7 @@ for the missing files. Look at where it _tried_ to find those files and adjust t
## Building and serving for deployment
When you are designing and developing applications, you typically use `ng serve` to build your app for fast, local, iterative development.
When you are designing and developing applications, you typically use `ng serve` to build your app for fast, local, iterative development.
When you are ready to deploy, however, you must use the `ng build` command to build the app and deploy the build artifacts elsewhere.
Both `ng build` and `ng serve` clear the output folder before they build the project, but only the `ng build` command writes the generated build artifacts to the output folder.
@ -401,12 +342,12 @@ To output to a different folder, change the `outputPath` in `angular.json`.
</div>
The `ng serve` command builds, watches, and serves the application from local memory, using a local development server.
When you have deployed your app to another server, however, you might still want to serve the app so that you can continue to see changes that you make in it.
When you have deployed your app to another server, however, you might still want to serve the app so that you can continue to see changes that you make in it.
You can do this by adding the `--watch` option to the `ng build` command.
```
ng build --watch
```
Like the `ng serve` command, this regenerates output files when source files change.
Like the `ng serve` command, this regenerates output files when source files change.
For complete details of the CLI commands, see the [CLI command reference](cli).

View File

@ -107,7 +107,7 @@ The recently-developed [custom elements](https://developer.mozilla.org/en-US/doc
</tr>
<tr>
<td>Firefox</td>
<td> Set the <code>dom.webcomponents.enabled</code> and <code>dom.webcomponents.customelements.enabled</code> preferences to true. Planned to be enabled by default in version 63.</td>
<td>Supported natively as of version 63. In older versions: Set the <code>dom.webcomponents.enabled</code> and <code>dom.webcomponents.customelements.enabled</code> preferences to true.</td>
</tr>
<tr>
<td>Edge</td>

View File

@ -98,7 +98,7 @@ When the CLI generated the `CustomerDashboardComponent` for the feature module,
</code-example>
To see this HTML in the `AppComponent`, you first have to export the `CustomerDashboardComponent` in the `CustomerDashboardModule`. In `customer-dashboard.module.ts`, just beneath the `declarations` array, add an `exports` array containing `CustomerDashboardModule`:
To see this HTML in the `AppComponent`, you first have to export the `CustomerDashboardComponent` in the `CustomerDashboardModule`. In `customer-dashboard.module.ts`, just beneath the `declarations` array, add an `exports` array containing `CustomerDashboardComponent`:
<code-example path="feature-modules/src/app/customer-dashboard/customer-dashboard.module.ts" region="component-exports" header="src/app/customer-dashboard/customer-dashboard.module.ts" linenums="false">
</code-example>

View File

@ -20,16 +20,15 @@ The top level of the workspace contains a number of workspace-wide configuration
| :--------------------- | :------------------------------------------|
| `.editorconfig` | Configuration for code editors. See [EditorConfig](https://editorconfig.org/). |
| `.gitignore` | Specifies intentionally untracked files that [Git](https://git-scm.com/) should ignore. |
| `angular.json` | CLI configuration for all projects in the workspace, including configuration options for build, serve, and test tools that the CLI uses, such as [Karma](https://karma-runner.github.io/) and [Protractor](http://www.protractortest.org/). |
| `angular.json` | CLI configuration defaults for all projects in the workspace, including configuration options for build, serve, and test tools that the CLI uses, such as [TSLint](https://palantir.github.io/tslint/), [Karma](https://karma-runner.github.io/), and [Protractor](http://www.protractortest.org/). For details, see [Angular Workspace Configuration](guide/workspace-config). |
| `node_modules` | Provides [npm packages](guide/npm-packages) to the entire workspace. |
| `package.json` | Lists package dependencies. See [npm documentation](https://docs.npmjs.com/files/package.json) for the specific format and contents of this file.|
| `tsconfig.app.json` | Default [TypeScript](https://www.typescriptlang.org/) configuration for apps in the workspace. |
| `tsconfig.spec.json` | Default TypeScript configuration for e2e test apps in the workspace. |
| `tslint.json` | Default [TSLint](https://palantir.github.io/tslint/) configuration for apps in the workspace. |
| `README.md` | Introductory documentation. |
| `package.json` | Configures [npm package dependencies](guide/npm-packages) that are available to all projects in the workspace. See [npm documentation](https://docs.npmjs.com/files/package.json) for the specific format and contents of this file. |
| `package-lock.json` | Provides version information for all packages installed into `node_modules` by the npm client. See [npm documentation](https://docs.npmjs.com/files/package-lock.json) for details. If you use the yarn client, this file will be [yarn.lock](https://yarnpkg.com/lang/en/docs/yarn-lock/) instead. |
| `tsconfig.json` | Default [TypeScript](https://www.typescriptlang.org/) configuration for apps in the workspace, including TypeScript and Angular template compiler options. See [TypeScript Configuration](guide/typescript-configuration). |
| `tslint.json` | Default [TSLint](https://palantir.github.io/tslint/) configuration for apps in the workspace. |
| `README.md` | Introductory documentation. |
All projects within a workspace share this configuration context.
All projects within a workspace share a [CLI configuration context](guide/workspace-config).
Project-specific [TypeScript](https://www.typescriptlang.org/) configuration files inherit from the workspace-wide `tsconfig.*.json`, and app-specific [TSLint](https://palantir.github.io/tslint/) configuration files inherit from the workspace-wide `tslint.json`.
### Default app project files
@ -40,9 +39,9 @@ This initial app is the *default app* for CLI commands (unless you change the de
A newly generated app contains the source files for a root module, with a root component and template.
When the workspace file structure is in place, you can use the `ng generate` command on the command line to add functionality and data to the initial app.
<div class="alert is-helpful>
<div class="alert is-helpful">
Besides using the CLI on the command line, You can also use an interactive development environment like [Angular Console](https://angular.console.com), or manipulate files directly in the app's source folder and configuration files.
Besides using the CLI on the command line, you can also use an interactive development environment like [Angular Console](https://angular.console.com), or manipulate files directly in the app's source folder and configuration files.
</div>
@ -104,18 +103,6 @@ my-app/
Inside the `src/` folder, the `app/` folder contains your app's logic and data. Angular components, templates, and styles go here. An `assets/` subfolder contains images and anything else your app needs. Files at the top level of `src/` support testing and running your app.
<code-example language="none" linenums="false">
src/
app/
app.component.css
app.component.html
app.component.spec.ts
app.component.ts
app.module.ts
assets/...
...
</code-example>
| APP SOURCE FILES | PURPOSE |
| :-------------------------- | :------------------------------------------|
| `app/app.component.ts` | Defines the logic for the app's root component, named `AppComponent`. The view associated with this root component becomes the root of the [view hierarchy](guide/glossary#view-hierarchy) as you add components and services to your app. |

View File

@ -672,7 +672,7 @@ format that Angular understands, such as `.xtb`.
How you provide this information depends upon whether you compile with
the JIT compiler or the AOT compiler.
* With [AOT](guide/i18n#merge-aot), you pass the information as a configuration
* With [AOT](guide/i18n#merge-aot), you pass the information as configuration settings.
* With [JIT](guide/i18n#merge-jit), you provide the information at bootstrap time.

View File

@ -1,6 +1,6 @@
# Workspace npm dependencies
The Angular Framework, Angular CLI, and components used by Angular applicatins are packaged as [npm packages](https://docs.npmjs.com/getting-started/what-is-npm "What is npm?") and distributed via the [npm registry](https://docs.npmjs.com/).
The Angular Framework, Angular CLI, and components used by Angular applications are packaged as [npm packages](https://docs.npmjs.com/getting-started/what-is-npm "What is npm?") and distributed via the [npm registry](https://docs.npmjs.com/).
You can download and install these npm packages by using the [npm CLI client](https://docs.npmjs.com/cli/install), which is installed with and runs as a [Node.js®](https://nodejs.org "Nodejs.org") application. By default, the Angular CLI uses the npm client.
@ -138,4 +138,4 @@ Package name | Description
For information about how the Angular CLI handles packages see the following guides:
* [Building and serving](guide/build) describes how packages come together to create a development build.
* [Deployment](guide/deployment) describes how packages come together to create a production build.
* [Deployment](guide/deployment) describes how packages come together to create a production build.

View File

@ -0,0 +1,135 @@
# Angular Workspace Configuration
A file named `angular.json` at the root level of an Angular [workspace](guide/glossary#workspace) provides workspace-wide and project-specific configuration defaults for build and development tools provided by the Angular CLI.
Path values given in the configuration are relative to the root workspace folder.
## Overall JSON structure
At the top level of `angular.json`, a few properties configure the workspace, and a `projects` section contains the remaining per-project configuration options.
* `version`: The configuration-file version.
* `newProjectRoot`: Path where new projects are created. Absolute or relative to the workspace folder.
* `defaultProject`: Default project name to use in commands, where not provided as an argument. When you use `ng new` to create a new app in a new workspace, that app is the default project for the workspace until you change it here.
* `projects` : Contains a subsection for each project (library, app, e2e test app) in the workspace, with the per-project configuration options.
The initial app that you create with `ng new app_name` is listed under "projects", along with its corresponding end-to-end test app:
<code-example format="." language="none" linenums="false">
projects
app_name
...
app_name-e2e
...
</code-example>
Each additional app that you create with `ng generate application` has a corresponding end-to-end test project, with its own configuration section.
When you create a library project with `ng generate library`, the library project is also added to the `projects` section.
<div class="alert is-helpful">
Note that the `projects` section of the configuration file does not correspond exactly to the workspace file structure.
* The initial app created by `ng new` is at the top level of the workspace file structure, along with its e2e app.
* Additional apps, e2e apps, and libraries go into a `projects` folder in the workspace.
For more information, see [Workspace and project file structure](guide/file-structure).
</div>
## Project configuration options
The following top-level configuration properties are available for each project, under `projects:<project_name>`.
<code-example format="." language="json" linenums="false">
"my-v7-app": {
"root": "",
"sourceRoot": "src",
"projectType": "application",
"prefix": "app",
"schematics": {},
"architect": {}
}
</code-example>
| PROPERTY | DESCRIPTION |
| :-------------- | :---------------------------- |
| `root` | The root folder for this project's files, relative to the workspace folder. Empty for the initial app, which resides at the top level of the workspace. |
| `sourceRoot` | The root folder for this project's source files. |
| `projectType` | One of "application" or "library". An application can run independently in a browser, while a library cannot. Both an app and its e2e test app are of type "application".|
| `prefix` | A string that Angular prepends to generated selectors. Can be customized to identify an app or feature area. |
| `schematics` | An object containing schematics that customize CLI commands for this project. |
| `architect` | An object containing configuration defaults for Architect builder targets for this project. |
## Project tool configuration options
Architect is the tool that the CLI uses to perform complex tasks such as compilation and test running, according to provided configurations. The `architect` section contains a set of Architect *targets*. Many of the targets correspond to the CLI commands that run them. Some additional predefined targets can be run using the `ng run` command, and you can define your own targets.
Each target object specifies the `builder` for that target, which is the npm package for the tool that Architect runs. In addition, each target has an `options` section that configure default options for the target, and a `configurations` section that names and specifies alternative configurations for the target. See the example in [Build target](#build-target) below.
<code-example format="." language="json" linenums="false">
"architect": {
"build": { },
"serve": { },
"e2e" : { },
"test": { },
"lint": { },
"extract-i18n": { },
"server": { },
"app-shell": { }
}
</code-example>
* The `architect/build` section configures defaults for options of the `ng build` command. See [Build target]{#build-target} below for more information.
* The `architect/serve` section overrides build defaults and supplies additional serve defaults for the `ng serve` command. In addition to the options available for the `ng build` command, it adds options related to serving the app.
* The `architect/e2e` section overrides build-option defaults for building end-to-end testing apps using the `ng e2e` command.
* The `architect/test` section overrides build-option defaults for test builds and supplies additional test-running defaults for the `ng test` command.
* The `architect/lint` section configures defaults for options of the `ng lint` command, which performs code analysis on project source files. The default linting tool for Angular is [TSLint](https://palantir.github.io/tslint/).
* The `architect/extract-i18n` section configures defaults for options of the `ng-xi18n` tool used by the `ng xi18n` command, which extracts marked message strings from source code and outputs translation files.
* The `architect/server` section configures defaults for creating a Universal app with server-side rendering, using the `ng run <project>:server` command.
* The `architect/app-shell` section configures defaults for creating an app shell for a progressive web app (PWA), using the `ng run <project>:app-shell` command.
In general, the options for which you can configure defaults correspond to the command options listed in the [CLI reference page](cli) for each command.
Note that all options in the configuration file must use [camelCase](guide/glossary#case-conventions), rather than dash-case.
{@a build-target}
## Build target
The `architect/build` section configures defaults for options of the `ng build` command. It has the following top-level properties.
| PROPERTY | DESCRIPTION |
| :-------------- | :---------------------------- |
| `builder` | The npm package for the build tool used to create this target. The default is `@angular-devkit/build-angular:browser`, which uses the [webpack](https://webpack.js.org/) package bundler. |
| `options` | This section contains defaults for build options, used when no named alternative configuration is specified. See [Default build options](#build-props) below. |
| `configurations`| This section defines and names alternative configurations for different intended destinations. It contains a section for each named configuration, which sets the default options for that intended environment. See [Alternate build configurations](#build-configs) below. |
{@a build-configs}
### Alternate build configurations
By default, a `production` configuration is defined, and the `ng build` command has `--prod` option that builds using this configuration. The `production` configuration sets defaults that optimize the app in a number of ways, such bundling files, minimizing excess whitespace, removing comments and dead code, and rewriting code to use short, cryptic names ("minification").
You can define and name additional alternate configurations (such as `stage`, for instance) appropriate to your development process. Some examples of different build configurations are `stable`, `archive` and `next` used by AIO itself, and the individual locale-specific configurations required for building localized versions of an app. For details, see [Internationalization (i18n)](guide/i18n#merge-aot).
{@a build-props}
### Additional build and test options
The configurable options for a default or targeted build generally correspond to the options available for the [`ng build`](cli/build), [`ng serve`](cli/serve), and [`ng test`](cli/test) commands. For details of those options and their possible values, see the [CLI Reference](cli).
Some additional options (listed below) can only be set through the configuration file, either by direct editing or with the `ng config` command.
| OPTIONS PROPERTIES | DESCRIPTION |
| :------------------------- | :---------------------------- |
| `fileReplacements` | An object containing files and their compile-time replacements. |
| `stylePreprocessorOptions` | An object containing option-value pairs to pass to style preprocessors. |
| `assets` | An object containing paths to static assets to add to the global context of the project. The default paths point to the project's icon file and its `assets` folder. |
| `styles` | An object containing style files to add to the global context of the project. Angular CLI supports CSS imports and all major CSS preprocessors: [sass/scss](http://sass-lang.com/), [less](http://lesscss.org/), and [stylus](http://stylus-lang.com/). |
| `scripts` | An object containing JavaScript script files to add to the global context of the project. The scripts are loaded exactly as if you had added them in a `<script>` tag inside `index.html`. |
| `budgets` | Default size-budget type and threshholds for all or parts of your app. You can configure the builder to report a warning or an error when the output reaches or exceeds a threshold size. See [Configure size budgets](guide/build#configure-size-budgets). (Not available in `test` section.) |

File diff suppressed because it is too large Load Diff

View File

@ -211,7 +211,7 @@
"logo": "https://cloud.githubusercontent.com/assets/1016365/10639063/138338bc-7806-11e5-8057-d34c75f3cafc.png",
"rev": true,
"title": "Angular Universal",
"url": "https://github.com/angular/universal"
"url": "https://angular.io/guide/universal"
},
"c1": {
"desc": "Lightweight development only Node.js® server",
@ -273,6 +273,13 @@
"rev": true,
"title": "UI-jar - Test Driven Style Guide Development",
"url": "https://github.com/ui-jar/ui-jar"
},
"protactor": {
"desc": "The official end to end testing framework for Angular apps",
"logo": "",
"rev": true,
"title": "Protractor",
"url": "https://protractor.angular.io/"
}
}
},
@ -362,7 +369,7 @@
"logo": "",
"rev": true,
"title": "Angular Material",
"url": "https://github.com/angular/material2"
"url": "https://material.angular.io/"
},
"mcc": {
"desc": "Material components made by the community",
@ -377,6 +384,12 @@
"title": "Ant Design of Angular (ng-zorro-antd)",
"url": "https://ng.ant.design/docs/introduce/en"
},
"ngzorromobile": {
"desc": "A set of enterprise-class mobile UI components based on Ant Design Mobile and Angular",
"rev": true,
"title": "Ant Design Mobile of Angular (ng-zorro-antd-mobile)",
"url": "http://ng.mobile.ant.design/#/docs/introduce/en"
},
"aggrid": {
"desc": "A datagrid for Angular with enterprise style features such as sorting, filtering, custom rendering, editing, grouping, aggregation and pivoting.",
"rev": true,

View File

@ -120,3 +120,20 @@ Try this <live-example></live-example>.
<live-example embedded name="testy" stackblitz="super-stackblitz"></live-example>
<p>More text follows ...</p>
<p>Getting Started Widgets</p>
<p>Interpolation</p>
<aio-gs-interpolation></aio-gs-interpolation>
<p>Property Binding</p>
<aio-gs-property-binding></aio-gs-property-binding>
<p>Event Binding</p>
<aio-gs-event-binding></aio-gs-event-binding>
<p>NgIf</p>
<aio-gs-ng-if></aio-gs-ng-if>
<p>NgFor</p>
<aio-gs-ng-for></aio-gs-ng-for>

View File

@ -513,8 +513,14 @@
{
"url": "guide/file-structure",
"title": "Project File Structure",
"tooltip": "How your Angular workspace looks in your filesystem."
"tooltip": "How your Angular workspace looks on your filesystem."
},
{
"url": "guide/workspace-config",
"title": "Workspace Configuration",
"tooltip": "The \"angular.json\" file contains workspace and project configuration defaults for Angular CLI commands."
},
{
"url": "guide/npm-packages",
"title": "npm Dependencies",

View File

@ -18,7 +18,7 @@
"build-for": "yarn ~~build --configuration",
"prebuild-local": "yarn setup-local",
"build-local": "yarn ~~build --configuration=stable",
"extract-cli-command-docs": "node tools/transforms/cli-docs-package/extract-cli-commands.js a2129510d7d57d1c02bec563872adf0204e11a2f",
"extract-cli-command-docs": "node tools/transforms/cli-docs-package/extract-cli-commands.js b50950b97",
"lint": "yarn check-env && yarn docs-lint && ng lint && yarn example-lint && yarn tools-lint",
"test": "yarn check-env && ng test",
"pree2e": "yarn check-env && yarn update-webdriver",
@ -30,6 +30,8 @@
"setup-local": "yarn aio-use-local && yarn example-use-local",
"postsetup-local": "yarn postsetup",
"set-opensearch-url": "node --eval \"const sh = require('shelljs'); sh.set('-e'); sh.sed('-i', /PLACEHOLDER_URL/g, process.argv[1], 'dist/assets/opensearch.xml');\"",
"presmoke-tests": "yarn update-webdriver",
"smoke-tests": "protractor tests/deployment/e2e/protractor.conf.js --suite smoke --baseUrl",
"test-pwa-score": "node scripts/test-pwa-score",
"test-pwa-score-localhost": "run-p --race \"~~http-server dist -p 4200 --silent\" \"test-pwa-score http://localhost:4200 {1} {2}\" --",
"example-e2e": "yarn example-check-local && node ./tools/examples/run-example-e2e",
@ -102,18 +104,18 @@
"@types/jasminewd2": "^2.0.4",
"@types/node": "~6.0.60",
"archiver": "^1.3.0",
"canonical-path": "^0.0.2",
"canonical-path": "1.0.0",
"chalk": "^2.1.0",
"cjson": "^0.5.0",
"codelyzer": "~4.2.1",
"cross-spawn": "^5.1.0",
"css-selector-parser": "^1.3.0",
"dgeni": "^0.4.7",
"dgeni-packages": "^0.26.9",
"dgeni-packages": "^0.26.12",
"entities": "^1.1.1",
"eslint": "^3.19.0",
"eslint-plugin-jasmine": "^2.2.0",
"firebase-tools": "^3.2.1",
"firebase-tools": "^5.1.1",
"fs-extra": "^2.1.2",
"globby": "^6.1.0",
"hast-util-is-element": "^1.0.0",
@ -163,4 +165,4 @@
"xregexp": "^4.0.0",
"yargs": "^7.0.2"
}
}
}

View File

@ -2,8 +2,8 @@
"aio": {
"master": {
"uncompressed": {
"runtime": 3173,
"main": 494475,
"runtime": 3881,
"main": 499953,
"polyfills": 53926,
"prettify": 14917
}

View File

@ -13,7 +13,7 @@ readonly deployedUrl=https://pr${prNumber}-${prLastSha:0:7}.ngbuilds.io/
cd $PROJECT_ROOT/aio
# Build and store the app
yarn build
yarn build --progress=false
# Set deployedUrl as parameter in the opensearch description
# deployedUrl must end with /

View File

@ -93,7 +93,7 @@ fi
cd "`dirname $0`/.."
# Build the app
yarn build-for $deployEnv
yarn build-for $deployEnv --progress=false
# Include any mode-specific files
cp -rf src/extra-files/$deployEnv/. dist/
@ -106,8 +106,8 @@ fi
yarn payload-size
# Deploy to Firebase
firebase use "$projectId" --token "$firebaseToken"
firebase deploy --message "Commit: $CI_COMMIT" --non-interactive --token "$firebaseToken"
yarn firebase use "$projectId" --token "$firebaseToken"
yarn firebase deploy --message "Commit: $CI_COMMIT" --non-interactive --token "$firebaseToken"
# Run PWA-score tests
yarn test-pwa-score "$deployedUrl" "$CI_AIO_MIN_PWA_SCORE"

View File

@ -45,8 +45,9 @@ get(previewabilityCheckUrl).
const totalSecs = Math.round((previewCheckInterval * previewCheckAttempts) / 1000);
throw new Error(`Preview still not available after ${totalSecs}s.`);
}).
// The preview is now available. Run the PWA tests.
then(() => runPwaTests());
// The preview is now available. Run the tests.
then(() => yarnRun('smoke-tests', previewUrl)).
then(() => yarnRun('test-pwa-score', previewUrl, minPwaScore));
}).
catch(onError);
@ -93,15 +94,6 @@ function reportNoPreview(reason) {
console.log(`No (public) preview available. (Reason: ${reason})`);
}
function runPwaTests() {
return new Promise((resolve, reject) => {
const spawnOptions = {cwd: __dirname, stdio: 'inherit'};
spawn('yarn', ['test-pwa-score', previewUrl, minPwaScore], spawnOptions).
on('error', reject).
on('exit', code => (code === 0 ? resolve : reject)());
});
}
function validateArgs(args) {
if (args.length !== 3) {
const relativeScriptPath = relative('.', __filename.replace(/\.js$/, ''));
@ -119,3 +111,12 @@ function wait(delay) {
console.log(`Waiting ${delay}ms...`);
return new Promise(resolve => setTimeout(resolve, delay));
}
function yarnRun(script, ...args) {
return new Promise((resolve, reject) => {
const spawnOptions = {cwd: __dirname, stdio: 'inherit'};
spawn('yarn', [script, ...args], spawnOptions).
on('error', reject).
on('exit', code => (code === 0 ? resolve : reject)());
});
}

View File

@ -16,7 +16,7 @@ set +x -eu -o pipefail
# Install dependencies.
echo -e "\nInstalling dependencies in '$aioDir'...\n-----"
yarn install --frozen-lockfile
yarn install --frozen-lockfile --non-interactive
yarn update-webdriver
# Run checks for all URLs.

View File

@ -48,6 +48,26 @@ export const ELEMENT_MODULE_PATHS_AS_ROUTES = [
selector: 'live-example',
loadChildren: './live-example/live-example.module#LiveExampleModule'
},
{
selector: 'aio-gs-interpolation',
loadChildren: './getting-started/interpolation/interpolation.module#InterpolationModule'
},
{
selector: 'aio-gs-property-binding',
loadChildren: './getting-started/property-binding/property-binding.module#PropertyBindingModule'
},
{
selector: 'aio-gs-event-binding',
loadChildren: './getting-started/event-binding/event-binding.module#EventBindingModule'
},
{
selector: 'aio-gs-ng-if',
loadChildren: './getting-started/ng-if/ng-if.module#NgIfModule'
},
{
selector: 'aio-gs-ng-for',
loadChildren: './getting-started/ng-for/ng-for.module#NgForModule'
},
];
/**

View File

@ -0,0 +1,39 @@
import { Component } from '@angular/core';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { ContainerComponent } from './container.component';
@Component({
template: `
<aio-gs-container>
<ng-container class="template">Template</ng-container>
<ng-container class="data">Data</ng-container>
<ng-container class="result">Result</ng-container>
</aio-gs-container>
`
})
export class TestComponent {}
describe('Getting Started Container Component', () => {
let fixture: ComponentFixture<ContainerComponent>;
beforeEach(() => {
TestBed.configureTestingModule({
declarations: [ ContainerComponent, TestComponent ]
});
fixture = TestBed.createComponent(TestComponent);
fixture.detectChanges();
});
it('should project the content into the appropriate areas', () => {
const compiled = fixture.debugElement.nativeElement;
const pre = compiled.querySelector('pre');
const code = compiled.querySelector('code');
const tabledata = compiled.querySelectorAll('td');
expect(pre.textContent).toContain('Template');
expect(code.textContent).toContain('Data');
expect(tabledata[2].textContent).toContain('Result');
});
});

View File

@ -0,0 +1,80 @@
import { Component } from '@angular/core';
@Component({
selector: 'aio-gs-container',
template: `
<table>
<thead>
<tr>
<th>Template</th>
<th>Data</th>
<th>Result</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<pre><ng-content select=".template"></ng-content></pre>
</td>
<td>
<code><ng-content select=".data"></ng-content></code>
</td>
<td><ng-content select=".result"></ng-content></td>
</tr>
</tbody>
</table>
`,
styles: [
`
pre {
margin: 0;
}
code {
display: flex;
align-items: center;
}
@media only screen and (max-width: 760px),
(min-device-width: 768px) and (max-device-width: 1024px) {
/* Force table to not be like tables anymore */
table, thead, tbody, th, td, tr {
display: block;
}
/* Hide table headers (but not display: none;, for accessibility) */
thead tr {
position: absolute;
top: -9999px;
left: -9999px;
}
tr { border: 1px solid #ccc; }
td {
/* Behave like a "row" */
border: none;
border-bottom: 1px solid #eee;
position: relative;
padding-top: 10%;
}
td:before {
/* Now like a table header */
position: absolute;
/* Top/left values mimic padding */
top: 6px;
left: 6px;
width: 45%;
padding-right: 10px;
}
/* Label the data */
td:nth-of-type(1):before { content: "Template"; }
td:nth-of-type(2):before { content: "Data"; }
td:nth-of-type(3):before { content: "Result"; }
}
`
]
})
export class ContainerComponent { }

View File

@ -0,0 +1,10 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { ContainerComponent } from './container.component';
@NgModule({
imports: [ CommonModule ],
declarations: [ ContainerComponent ],
exports: [ ContainerComponent ]
})
export class ContainerModule { }

View File

@ -0,0 +1,46 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { ContainerModule } from '../container/container.module';
import { EventBindingComponent } from './event-binding.component';
import { createCustomEvent } from '../../../../testing/dom-utils';
describe('Getting Started Event Binding Component', () => {
let component: EventBindingComponent;
let fixture: ComponentFixture<EventBindingComponent>;
beforeEach(() => {
TestBed.configureTestingModule({
imports: [ ContainerModule ],
declarations: [ EventBindingComponent ]
});
fixture = TestBed.createComponent(EventBindingComponent);
component = fixture.componentInstance;
fixture.detectChanges();
spyOn(window, 'alert');
});
it('should update the name property on input change', () => {
const text = 'Hello Angular';
const compiled = fixture.debugElement.nativeElement;
const input: HTMLInputElement = compiled.querySelector('input');
input.value = text;
input.dispatchEvent(createCustomEvent(document, 'input', ''));
fixture.detectChanges();
expect(component.name).toBe(text);
});
it('should display an alert when the button is clicked', () => {
const compiled = fixture.debugElement.nativeElement;
const button: HTMLButtonElement = compiled.querySelector('button');
button.click();
expect(window.alert).toHaveBeenCalledWith('Hello, Angular!');
});
});

View File

@ -0,0 +1,30 @@
import { Component } from '@angular/core';
@Component({
selector: 'aio-gs-event-binding',
template: `
<aio-gs-container>
<ng-container class="template">&lt;button (click)="greet(name)"&gt;
Greet
&lt;/button&gt;</ng-container>
<ng-container class="data">
name = '<input #input (input)="name = input.value" [value]="name">';
</ng-container>
<ng-container class="result">
<button (click)="greet(name)">
Greet
</button>
</ng-container>
</aio-gs-container>
`,
preserveWhitespaces: true
})
export class EventBindingComponent {
name = 'Angular';
greet(name: string) {
window.alert(`Hello, ${name}!`);
}
}

View File

@ -0,0 +1,15 @@
import { NgModule, Type } from '@angular/core';
import { CommonModule } from '@angular/common';
import { WithCustomElementComponent } from '../../element-registry';
import { EventBindingComponent } from './event-binding.component';
import { ContainerModule } from '../container/container.module';
@NgModule({
imports: [ CommonModule, ContainerModule ],
declarations: [ EventBindingComponent ],
exports: [ EventBindingComponent ],
entryComponents: [ EventBindingComponent ]
})
export class EventBindingModule implements WithCustomElementComponent {
customElementComponent: Type<any> = EventBindingComponent;
}

View File

@ -0,0 +1,41 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { InterpolationComponent } from './interpolation.component';
import { ContainerModule } from '../container/container.module';
import { createCustomEvent } from '../../../../testing/dom-utils';
describe('Getting Started Interpolation Component', () => {
let component: InterpolationComponent;
let fixture: ComponentFixture<InterpolationComponent>;
beforeEach(() => {
TestBed.configureTestingModule({
imports: [ ContainerModule ],
declarations: [ InterpolationComponent ]
});
fixture = TestBed.createComponent(InterpolationComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should update the siteName property on input change', () => {
const text = 'Hello Angular';
const compiled = fixture.debugElement.nativeElement;
const input: HTMLInputElement = compiled.querySelector('input');
input.value = text;
input.dispatchEvent(createCustomEvent(document, 'input', ''));
fixture.detectChanges();
expect(component.siteName).toBe(text);
});
it('should display the siteName', () => {
const compiled = fixture.debugElement.nativeElement;
const header: HTMLHeadingElement = compiled.querySelector('h1');
expect(header.textContent).toContain('My Store');
});
});

View File

@ -0,0 +1,20 @@
import { Component } from '@angular/core';
@Component({
selector: 'aio-gs-interpolation',
template: `
<aio-gs-container>
<ng-container class="template">&lt;h1&gt;Welcome to {{'{'+'{'}}siteName{{'}'+'}'}}&lt;h1&gt;</ng-container>
<ng-container class="data">
siteName = '<input #input (input)="siteName = input.value" [value]="siteName">';
</ng-container>
<ng-container class="result"><h1>Welcome to {{ siteName }}</h1></ng-container>
</aio-gs-container>
`
})
export class InterpolationComponent {
siteName = 'My Store';
}

View File

@ -0,0 +1,15 @@
import { NgModule, Type } from '@angular/core';
import { CommonModule } from '@angular/common';
import { WithCustomElementComponent } from '../../element-registry';
import { InterpolationComponent } from './interpolation.component';
import { ContainerModule } from '../container/container.module';
@NgModule({
imports: [ CommonModule, ContainerModule ],
declarations: [ InterpolationComponent ],
exports: [ InterpolationComponent ],
entryComponents: [ InterpolationComponent ]
})
export class InterpolationModule implements WithCustomElementComponent {
customElementComponent: Type<any> = InterpolationComponent;
}

View File

@ -0,0 +1,42 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { NgForComponent } from './ng-for.component';
import { ContainerModule } from '../container/container.module';
import { ProductService } from '../product.service';
describe('Getting Started NgFor Component', () => {
let component: NgForComponent;
let fixture: ComponentFixture<NgForComponent>;
beforeEach(() => {
TestBed.configureTestingModule({
imports: [ ContainerModule ],
declarations: [ NgForComponent ],
providers: [ ProductService ]
});
fixture = TestBed.createComponent(NgForComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should display the products', () => {
const compiled = fixture.debugElement.nativeElement;
const spans = compiled.querySelectorAll('span');
expect(spans[0]!.textContent).toContain('Shoes');
expect(spans[1]!.textContent).toContain('Phones');
});
it('should display an error message if provided products JSON is invalid', () => {
fixture.detectChanges();
component.productsData$.next('bad');
fixture.detectChanges();
component.parseError$.subscribe(error => {
expect(error).toBeTruthy();
})
});
});

View File

@ -0,0 +1,46 @@
import { Component, OnInit, OnDestroy } from '@angular/core';
import { Subscription } from 'rxjs';
import { ProductService } from '../product.service';
@Component({
selector: 'aio-gs-ng-for',
template: `
<aio-gs-container>
<ng-container class="template">&lt;span *ngFor="let product of products">
{{'{'+'{'}}product{{'}'+'}'}}
&lt;/span&gt;</ng-container>
<ng-container class="data">
products = <input #input (input)="productsData$.next(input.value)" [value]="productsData$ | async">;
<div *ngIf="parseError$ | async" class="material-icons" matTooltip="The provided JSON is invalid">error_outline</div>
</ng-container>
<ng-container class="result">
<span *ngFor="let product of products$ | async">{{product}}</span>
</ng-container>
</aio-gs-container>
`,
styles: [`
span::after {
content: ' ';
}
`],
preserveWhitespaces: true
})
export class NgForComponent implements OnInit, OnDestroy {
productsData$ = this.productService.productsData$;
products$ = this.productService.products$;
parseError$ = this.productService.parseError$;
productsSub: Subscription;
constructor(private productService: ProductService) {}
ngOnInit() {
this.productsSub = this.productService.init().subscribe();
}
ngOnDestroy() {
this.productsSub.unsubscribe();
}
}

View File

@ -0,0 +1,18 @@
import { NgModule, Type } from '@angular/core';
import { CommonModule } from '@angular/common';
import { MatTooltipModule } from '@angular/material/tooltip';
import { WithCustomElementComponent } from '../../element-registry';
import { NgForComponent } from './ng-for.component';
import { ContainerModule } from '../container/container.module';
import { ProductService } from '../product.service';
@NgModule({
imports: [ CommonModule, ContainerModule, MatTooltipModule ],
declarations: [ NgForComponent ],
exports: [ NgForComponent ],
entryComponents: [ NgForComponent ],
providers: [ ProductService ]
})
export class NgForModule implements WithCustomElementComponent {
customElementComponent: Type<any> = NgForComponent;
}

View File

@ -0,0 +1,51 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { NgIfComponent } from './ng-if.component';
import { ContainerModule } from '../container/container.module';
import { ProductService } from '../product.service';
describe('Getting Started NgIf Component', () => {
let component: NgIfComponent;
let fixture: ComponentFixture<NgIfComponent>;
beforeEach(() => {
TestBed.configureTestingModule({
imports: [ ContainerModule ],
declarations: [ NgIfComponent ],
providers: [ ProductService ]
});
fixture = TestBed.createComponent(NgIfComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should display the message if products are listed', () => {
const compiled = fixture.debugElement.nativeElement;
const paragraph = compiled.querySelector('p');
expect(paragraph.textContent).toContain('available');
});
it('should not display the message if products list is empty', () => {
component.products$.next([]);
fixture.detectChanges();
const compiled = fixture.debugElement.nativeElement;
const paragraph = compiled.querySelector('p');
expect(paragraph).toBeFalsy();
});
it('should display an error message if provided products JSON is invalid', () => {
fixture.detectChanges();
component.productsData$.next('bad');
fixture.detectChanges();
component.parseError$.subscribe(error => {
expect(error).toBeTruthy();
})
});
});

View File

@ -0,0 +1,43 @@
import { Component, OnInit, OnDestroy } from '@angular/core';
import { Subscription } from 'rxjs';
import { ProductService } from '../product.service';
@Component({
selector: 'aio-gs-ng-if',
template: `
<aio-gs-container>
<ng-container class="template">&lt;p *ngIf="products.length > 0"&gt;
We still have products available.
&lt;/p&gt;</ng-container>
<ng-container class="data">
products = <input #input (input)="productsData$.next(input.value)" [value]="productsData$ | async">;
<div *ngIf="parseError$ | async" class="material-icons" matTooltip="The provided JSON is invalid">error_outline</div>
</ng-container>
<ng-container class="result">
<p *ngIf="(products$ | async)?.length > 0">
We still have products available.
</p>
</ng-container>
</aio-gs-container>
`,
preserveWhitespaces: true
})
export class NgIfComponent implements OnInit, OnDestroy {
productsData$ = this.productService.productsData$;
products$ = this.productService.products$;
parseError$ = this.productService.parseError$;
productsSub: Subscription;
constructor(private productService: ProductService) {}
ngOnInit() {
this.productsSub = this.productService.init().subscribe();
}
ngOnDestroy() {
this.productsSub.unsubscribe();
}
}

View File

@ -0,0 +1,18 @@
import { NgModule, Type } from '@angular/core';
import { CommonModule } from '@angular/common';
import { MatTooltipModule } from '@angular/material/tooltip';
import { WithCustomElementComponent } from '../../element-registry';
import { NgIfComponent } from './ng-if.component';
import { ContainerModule } from '../container/container.module';
import { ProductService } from '../product.service';
@NgModule({
imports: [ CommonModule, ContainerModule, MatTooltipModule ],
declarations: [ NgIfComponent ],
exports: [ NgIfComponent ],
entryComponents: [ NgIfComponent ],
providers: [ ProductService ]
})
export class NgIfModule implements WithCustomElementComponent {
customElementComponent: Type<any> = NgIfComponent;
}

View File

@ -0,0 +1,33 @@
import { Injectable } from '@angular/core';
import { BehaviorSubject, Subject } from 'rxjs';
import { tap, debounceTime } from 'rxjs/operators';
export const PRODUCTS = ['Shoes', 'Phones'];
@Injectable()
export class ProductService {
productsData$ = new BehaviorSubject(JSON.stringify(PRODUCTS));
products$ = new BehaviorSubject<string[]>(PRODUCTS);
parseError$ = new Subject<boolean>();
init() {
return this.productsData$.pipe(
debounceTime(250),
tap(data => {
let parsed;
try {
parsed = JSON.parse(data);
} catch (e) {
parsed = null;
}
if (parsed && Array.isArray(parsed)) {
this.products$.next(parsed);
this.parseError$.next(false);
} else {
this.parseError$.next(true);
}
}));
}
}

View File

@ -0,0 +1,46 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { PropertyBindingComponent } from './property-binding.component';
import { ContainerModule } from '../container/container.module';
import { createCustomEvent } from '../../../../testing/dom-utils';
describe('Getting Started Property Binding Component', () => {
let component: PropertyBindingComponent;
let fixture: ComponentFixture<PropertyBindingComponent>;
beforeEach(() => {
TestBed.configureTestingModule({
imports: [ ContainerModule ],
declarations: [ PropertyBindingComponent ]
});
fixture = TestBed.createComponent(PropertyBindingComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
it('should update the image title on input change', () => {
const text = 'Hello Angular';
const compiled = fixture.debugElement.nativeElement;
const input: HTMLInputElement = compiled.querySelector('input');
input.value = text;
input.dispatchEvent(createCustomEvent(document, 'input', ''));
fixture.detectChanges();
expect(component.imageTitle).toBe(text);
});
it('should display the image title', () => {
const compiled = fixture.debugElement.nativeElement;
const image: HTMLImageElement = compiled.querySelector('img');
expect(image.getAttribute('title')).toContain('Angular Logo');
});
});

View File

@ -0,0 +1,21 @@
import { Component } from '@angular/core';
@Component({
selector: 'aio-gs-property-binding',
template: `
<aio-gs-container>
<ng-container class="template">&lt;img ... [title]="imageTitle"&gt;</ng-container>
<ng-container class="data">
imageTitle = '<input #input (input)="imageTitle = input.value" [value]="imageTitle">';
</ng-container>
<ng-container class="result">
<img src="/assets/images/logos/angular/angular.svg" width="37" height="40" [title]="imageTitle">
</ng-container>
</aio-gs-container>
`
})
export class PropertyBindingComponent {
imageTitle = 'Angular Logo';
}

View File

@ -0,0 +1,15 @@
import { NgModule, Type } from '@angular/core';
import { CommonModule } from '@angular/common';
import { WithCustomElementComponent } from '../../element-registry';
import { PropertyBindingComponent } from './property-binding.component';
import { ContainerModule } from '../container/container.module';
@NgModule({
imports: [ CommonModule, ContainerModule ],
declarations: [ PropertyBindingComponent ],
exports: [ PropertyBindingComponent ],
entryComponents: [ PropertyBindingComponent ]
})
export class PropertyBindingModule implements WithCustomElementComponent {
customElementComponent: Type<any> = PropertyBindingComponent;
}

View File

@ -123,7 +123,7 @@ td {
padding: 8px 30px;
letter-spacing: 0.30px;
p {
p:first-child, p:last-child {
margin: 0;
}
}

View File

@ -1,46 +0,0 @@
.api-body {
max-width: 1200px;
table {
margin: 12px 0 24px;
th {
text-transform: none;
font-size: 16px;
font-weight: bold;
}
tr {
border-bottom: 1px solid $lightgray;
}
td {
vertical-align: middle;
}
hr {
margin: 16px 0;
}
tr:last-child {
border-bottom: none;
}
&.item-table {
td {
padding: 32px;
}
}
&.list-table {
td {
padding: 16px 24px;
}
}
.short-description {
margin-left: 0;
}
}
}

View File

@ -2,7 +2,6 @@
LAYOUT STYLES
============================== */
@import 'api-pages';
@import 'content-layout';
@import 'doc-viewer';
@import 'footer';

View File

@ -1,13 +1,111 @@
.github-links {
float: right;
.material-icons {
border-radius: 4px;
padding: 4px;
font-size: 20px;
&:hover {
background-color: $mist;
.api-body {
max-width: 1200px;
table {
margin: 12px 0 24px;
th {
text-transform: none;
font-size: 16px;
font-weight: bold;
}
tr {
border-bottom: 1px solid $lightgray;
}
td {
vertical-align: middle;
}
// This is overriding a style here:
// https://github.com/angular/angular/blob/95993e1/aio/src/styles/2-modules/_table.scss#L58-L62
tbody > tr > td tr td:first-child {
@media screen and (max-width: 480px) {
background-color: inherit;
}
}
hr {
margin: 16px 0;
}
tr:last-child {
border-bottom: none;
}
&.item-table {
td {
padding: 32px;
}
}
&.list-table {
td {
padding: 16px 24px;
}
}
.short-description {
margin-left: 0;
}
&.parameters-table {
margin-top: 0;
font-size: 14px;
box-shadow: none;
tr {
@media screen and (max-width: 480px) {
display: flex;
flex-direction: column;
}
td:first-child {
font-weight: 600;
padding-left: 16px;
width: 20%;
}
}
td {
padding: 8px 8px 8px 0;
border: 0;
vertical-align: top;
}
}
}
.class-overview {
position: relative;
code-example {
clear: left;
}
}
.short-description {
margin: 6px 0 0 10px;
}
.properties-table {
font-size: 14px;
thead th {
&:nth-child(1) {
width: 20%;
}
&:nth-child(2) {
width: 20%;
}
}
}
}
.breadcrumb-container {
display: flex;
flex-direction: row;
justify-content: space-between;
}
.api-header {
@ -18,6 +116,22 @@
flex-direction: column;
align-items: flex-start;
}
h1 {
margin-top: -4px;
}
}
.github-links {
float: right;
.material-icons {
border-radius: 4px;
padding: 4px;
font-size: 20px;
&:hover {
background-color: $mist;
}
}
}
.api-body {
@ -65,10 +179,10 @@
}
}
.api-heading {
padding: 5px 0;
font-size: 16px;
font-weight: bold;
font-size: 14px;
}
.parameters-table {
@ -80,21 +194,71 @@
}
details.overloads {
margin-left: -8px;
box-shadow: none;
.icon-action-header {
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
a {
display: flex;
}
}
.detail-contents {
padding: 0;
border: 1px solid $lightgray;
border-radius: 2px;
box-shadow: none;
> *:not(hr) {
margin: 16px 24px;
}
}
summary {
height: inherit;
padding: 8px 12px;
padding: 0;
h4 {
margin: 0;
clear: left;
}
.show-all {
display: initial;
}
.collapse-all {
display: none;
}
}
&[open] > summary {
.show-all {
display: none;
}
.collapse-all {
display: initial;
}
}
}
details.overload {
box-shadow: none;
margin: 0;
}
.from-constructor, .read-only-property, .write-only-property {
font-size: 12px;
font-weight: 600;
letter-spacing: 0.5px;
font-style: italic;
color: $blue;
background-color: $lightgray;
border-radius: 4px;
padding: 4px 6px;
}
.ngmodule-list {
@ -120,10 +284,6 @@
}
}
}
.member-name {
font-weight: bold;
}
}
.deprecated-api-item {

View File

@ -25,14 +25,7 @@ summary {
display: none; // Remove the built in details marker in webkit
}
&::before {
content: '\E5CE'; // See https://material.io/icons/#ic_expand_less
font-family: 'Material Icons';
font-size: 24px;
-webkit-font-smoothing: antialiased;
@include rotate(0deg); // We will rotate 180 degrees when details is open
float: right;
}
overflow: hidden;
}
details {
@ -42,7 +35,11 @@ details {
padding: 16px 24px;
}
&[open] > summary::before {
@include rotate(180deg); // Rotate the icon
// Rotate the icon
summary i.material-icons.expand {
@include rotate(0deg);
}
&[open] > summary i.material-icons.expand {
@include rotate(180deg);
}
}

View File

@ -3,12 +3,3 @@ hr {
background: $lightgray;
height: 1px;
}
.hr-margin {
display: block;
height: 1px;
border: 0;
margin-top: 16px;
margin-bottom: 16px;
padding: 0;
}

View File

@ -3,8 +3,8 @@
============================== */
@import 'alert';
@import 'api-pages';
@import 'api-list';
@import 'api-pages';
@import 'buttons';
@import 'callout';
@import 'card';

View File

@ -0,0 +1,16 @@
/**
* Create a `CustomEvent` (even on browsers where `CustomEvent` is not a constructor).
*/
export function createCustomEvent(doc: Document, name: string, detail: any): CustomEvent {
const bubbles = false;
const cancelable = false;
// On IE9-11, `CustomEvent` is not a constructor.
if (typeof CustomEvent !== 'function') {
const event = doc.createEvent('CustomEvent');
event.initCustomEvent(name, bubbles, cancelable, detail);
return event;
}
return new CustomEvent(name, {bubbles, cancelable, detail});
}

View File

@ -3,9 +3,11 @@
exports.config = {
allScriptsTimeout: 11000,
specs: [
'./*.e2e-spec.ts'
],
suites: {
full: './*.e2e-spec.ts',
smoke: './smoke-tests.e2e-spec.ts',
},
suite: 'full',
capabilities: {
browserName: 'chrome',
// For Travis

View File

@ -59,7 +59,9 @@ describe(browser.baseUrl, () => {
it('should serve `index.html` for unknown pages', async () => {
const aioShell = element(by.css('aio-shell'));
const heading = aioShell.element(by.css('h1'));
await page.goTo(unknownPagePath);
await browser.wait(() => page.getDocViewerText(), 5000); // Wait for the document to be loaded.
expect(aioShell.isPresent()).toBe(true);
expect(heading.getText()).toMatch(/page not found/i);

View File

@ -29,6 +29,8 @@ describe(browser.baseUrl, () => {
Object.keys(textPerUrl).forEach(url => {
it(`should show the page at '${url}'`, () => {
page.goTo(url);
browser.wait(() => page.getDocViewerText(), 5000); // Wait for the document to be loaded.
expect(page.getDocViewerText()).toContain(textPerUrl[url]);
});
});
@ -39,7 +41,7 @@ describe(browser.baseUrl, () => {
api: 'api list',
'guide/architecture': 'architecture',
'guide/http': 'httpclient',
'guide/quickstart': 'quickstart',
'guide/quickstart': 'getting started',
'guide/security': 'security',
tutorial: 'tutorial',
};
@ -47,6 +49,8 @@ describe(browser.baseUrl, () => {
Object.keys(textPerUrl).forEach(url => {
it(`should show the page at '${url}'`, () => {
page.goTo(url);
browser.wait(() => page.getDocViewerText(), 5000); // Wait for the document to be loaded.
expect(page.getDocViewerText()).toContain(textPerUrl[url]);
});
});
@ -68,6 +72,8 @@ describe(browser.baseUrl, () => {
Object.keys(textPerUrl).forEach(url => {
it(`should show the page at '${url}'`, () => {
page.goTo(url);
browser.wait(() => page.getDocViewerText(), 5000); // Wait for the document to be loaded.
expect(page.getDocViewerText()).toContain(textPerUrl[url]);
});
});

View File

@ -12,15 +12,15 @@
},
"private": true,
"dependencies": {
"@angular/animations": "~7.0.0-rc.0",
"@angular/common": "~7.0.0-rc.0",
"@angular/compiler": "~7.0.0-rc.0",
"@angular/core": "~7.0.0-rc.0",
"@angular/forms": "~7.0.0-rc.0",
"@angular/http": "~7.0.0-rc.0",
"@angular/platform-browser": "~7.0.0-rc.0",
"@angular/platform-browser-dynamic": "~7.0.0-rc.0",
"@angular/router": "~7.0.0-rc.0",
"@angular/animations": "^7.0.0",
"@angular/common": "^7.0.0",
"@angular/compiler": "^7.0.0",
"@angular/core": "^7.0.0",
"@angular/forms": "^7.0.0",
"@angular/http": "^7.0.0",
"@angular/platform-browser": "^7.0.0",
"@angular/platform-browser-dynamic": "^7.0.0",
"@angular/router": "^7.0.0",
"angular-in-memory-web-api": "^0.6.0",
"core-js": "^2.5.4",
"rxjs": "^6.3.0",
@ -28,10 +28,10 @@
"zone.js": "~0.8.26"
},
"devDependencies": {
"@angular-devkit/build-angular": "~0.9.0-rc.2",
"@angular/cli": "~7.0.0-rc.2",
"@angular/compiler-cli": "~7.0.0-rc.0",
"@angular/language-service": "~7.0.0-rc.0",
"@angular-devkit/build-angular": "^0.10.0",
"@angular/cli": "^7.0.0",
"@angular/compiler-cli": "^7.0.0",
"@angular/language-service": "^7.0.0",
"@types/jasmine": "~2.8.8",
"@types/jasminewd2": "~2.0.3",
"@types/node": "~8.9.4",

View File

@ -15,15 +15,15 @@
},
"private": true,
"dependencies": {
"@angular/animations": "~7.0.0-rc.0",
"@angular/common": "~7.0.0-rc.0",
"@angular/compiler": "~7.0.0-rc.0",
"@angular/core": "~7.0.0-rc.0",
"@angular/forms": "~7.0.0-rc.0",
"@angular/http": "~7.0.0-rc.0",
"@angular/platform-browser": "~7.0.0-rc.0",
"@angular/platform-browser-dynamic": "~7.0.0-rc.0",
"@angular/router": "~7.0.0-rc.0",
"@angular/animations": "^7.0.0",
"@angular/common": "^7.0.0",
"@angular/compiler": "^7.0.0",
"@angular/core": "^7.0.0",
"@angular/forms": "^7.0.0",
"@angular/http": "^7.0.0",
"@angular/platform-browser": "^7.0.0",
"@angular/platform-browser-dynamic": "^7.0.0",
"@angular/router": "^7.0.0",
"angular-in-memory-web-api": "^0.6.0",
"core-js": "^2.5.4",
"rxjs": "^6.3.0",
@ -31,10 +31,10 @@
"zone.js": "~0.8.26"
},
"devDependencies": {
"@angular-devkit/build-angular": "~0.9.0-rc.2",
"@angular/cli": "~7.0.0-rc.2",
"@angular/compiler-cli": "~7.0.0-rc.0",
"@angular/language-service": "~7.0.0-rc.0",
"@angular-devkit/build-angular": "^0.10.0",
"@angular/cli": "^7.0.0",
"@angular/compiler-cli": "^7.0.0",
"@angular/language-service": "^7.0.0",
"@types/jasmine": "~2.8.8",
"@types/jasminewd2": "~2.0.3",
"@types/node": "~8.9.4",

View File

@ -16,18 +16,18 @@
},
"private": true,
"dependencies": {
"@angular/animations": "~7.0.0-rc.0",
"@angular/common": "~7.0.0-rc.0",
"@angular/compiler": "~7.0.0-rc.0",
"@angular/core": "~7.0.0-rc.0",
"@angular/forms": "~7.0.0-rc.0",
"@angular/http": "~7.0.0-rc.0",
"@angular/platform-browser": "~7.0.0-rc.0",
"@angular/platform-browser-dynamic": "~7.0.0-rc.0",
"@angular/router": "~7.0.0-rc.0",
"@nguniversal/common": "^6.1.0",
"@nguniversal/express-engine": "^6.1.0",
"@nguniversal/module-map-ngfactory-loader": "^6.1.0",
"@angular/animations": "^7.0.0",
"@angular/common": "^7.0.0",
"@angular/compiler": "^7.0.0",
"@angular/core": "^7.0.0",
"@angular/forms": "^7.0.0",
"@angular/http": "^7.0.0",
"@angular/platform-browser": "^7.0.0",
"@angular/platform-browser-dynamic": "^7.0.0",
"@angular/router": "^7.0.0",
"@nguniversal/common": "^7.0.0",
"@nguniversal/express-engine": "^7.0.0",
"@nguniversal/module-map-ngfactory-loader": "^7.0.0",
"angular-in-memory-web-api": "^0.6.0",
"core-js": "^2.5.4",
"rxjs": "^6.3.0",
@ -35,11 +35,11 @@
"zone.js": "~0.8.26"
},
"devDependencies": {
"@angular-devkit/build-angular": "~0.9.0-rc.2",
"@angular/cli": "~7.0.0-rc.2",
"@angular/compiler-cli": "~7.0.0-rc.0",
"@angular/language-service": "~7.0.0-rc.0",
"@angular/platform-server": "~7.0.0-rc.0",
"@angular-devkit/build-angular": "^0.10.0",
"@angular/cli": "^7.0.0",
"@angular/compiler-cli": "^7.0.0",
"@angular/language-service": "^7.0.0",
"@angular/platform-server": "^7.0.0",
"@types/jasmine": "~2.8.8",
"@types/jasminewd2": "~2.0.3",
"@types/node": "~8.9.4",

View File

@ -18,21 +18,21 @@
"author": "",
"license": "MIT",
"dependencies": {
"@angular/animations": "~7.0.0-rc.0",
"@angular/common": "~7.0.0-rc.0",
"@angular/compiler": "~7.0.0-rc.0",
"@angular/core": "~7.0.0-rc.0",
"@angular/elements": "~7.0.0-rc.0",
"@angular/forms": "~7.0.0-rc.0",
"@angular/http": "~7.0.0-rc.0",
"@angular/platform-browser": "~7.0.0-rc.0",
"@angular/platform-browser-dynamic": "~7.0.0-rc.0",
"@angular/router": "~7.0.0-rc.0",
"@angular/service-worker": "~7.0.0-rc.0",
"@angular/upgrade": "~7.0.0-rc.0",
"@nguniversal/common": "^6.1.0",
"@nguniversal/express-engine": "^6.1.0",
"@nguniversal/module-map-ngfactory-loader": "^6.1.0",
"@angular/animations": "^7.0.0",
"@angular/common": "^7.0.0",
"@angular/compiler": "^7.0.0",
"@angular/core": "^7.0.0",
"@angular/elements": "^7.0.0",
"@angular/forms": "^7.0.0",
"@angular/http": "^7.0.0",
"@angular/platform-browser": "^7.0.0",
"@angular/platform-browser-dynamic": "^7.0.0",
"@angular/router": "^7.0.0",
"@angular/service-worker": "^7.0.0",
"@angular/upgrade": "^7.0.0",
"@nguniversal/common": "^7.0.0",
"@nguniversal/express-engine": "^7.0.0",
"@nguniversal/module-map-ngfactory-loader": "^7.0.0",
"angular-in-memory-web-api": "^0.6.0",
"core-js": "^2.5.4",
"express": "^4.14.1",
@ -42,11 +42,11 @@
"zone.js": "~0.8.26"
},
"devDependencies": {
"@angular-devkit/build-angular": "~0.9.0-rc.2",
"@angular/cli": "^7.0.0-rc.2",
"@angular/compiler-cli": "~7.0.0-rc.0",
"@angular/language-service": "~7.0.0-rc.0",
"@angular/platform-server": "~7.0.0-rc.0",
"@angular-devkit/build-angular": "^0.10.0",
"@angular/cli": "^7.0.0",
"@angular/compiler-cli": "^7.0.0",
"@angular/language-service": "^7.0.0",
"@angular/platform-server": "^7.0.0",
"@types/angular": "^1.6.47",
"@types/angular-animate": "^1.5.10",
"@types/angular-mocks": "^1.6.0",
@ -57,7 +57,7 @@
"@types/jasminewd2": "^2.0.4",
"@types/jquery": "^3.3.4",
"@types/node": "~8.9.4",
"canonical-path": "0.0.2",
"canonical-path": "1.0.0",
"concurrently": "^3.0.0",
"http-server": "^0.9.0",
"jasmine-core": "~2.99.1",

File diff suppressed because it is too large Load Diff

View File

@ -30,7 +30,9 @@ module.exports = function autoLinkCode(getDocFromAlias) {
return (ast) => {
visit(ast, 'element', (node, ancestors) => {
// Only interested in code elements that are not inside links
if (autoLinkCodeImpl.codeElements.some(elementType => is(node, elementType)) &&
if (autoLinkCodeImpl.codeElements.some(elementType =>
is(node, elementType)) &&
(!node.properties.className || node.properties.className.indexOf('no-auto-link') === -1) &&
ancestors.every(ancestor => !is(ancestor, 'a'))) {
visit(node, 'text', (node, ancestors) => {
// Only interested in text nodes that are not inside links

View File

@ -109,4 +109,11 @@ describe('autoLinkCode post-processor', () => {
processor.$process([doc]);
expect(doc.renderedContent).toEqual('<code-example><a href="a/b/myclass" class="code-anchor">MyClass</a></code-example>');
});
it('should ignore code blocks that are marked with a `no-auto-link` class', () => {
aliasMap.addDoc({ docType: 'class', id: 'MyClass', aliases: ['MyClass'], path: 'a/b/myclass' });
const doc = { docType: 'test-doc', renderedContent: '<code class="no-auto-link">MyClass</code>' };
processor.$process([doc]);
expect(doc.renderedContent).toEqual('<code class="no-auto-link">MyClass</code>');
});
});

View File

@ -47,40 +47,6 @@ module.exports = function generateKeywordsProcessor(log, readFilesProcessor) {
var ignoreWordsMap = convertToMap(wordsToIgnore);
// If the heading contains a name starting with ng, e.g. "ngController", then add the
// name without the ng to the text, e.g. "controller".
function tokenize(text) {
const rawTokens = text.split(/[\s\/]+/mg);
const tokens = [];
rawTokens.forEach(token => {
// Strip off unwanted trivial characters
token = token
.trim()
.replace(/^[_\-"'`({[<$*)}\]>.]+/, '')
.replace(/[_\-"'`({[<$*)}\]>.]+$/, '');
// Ignore tokens that contain weird characters
if (/^[\w.\-]+$/.test(token)) {
tokens.push(token.toLowerCase());
const ngTokenMatch = /^[nN]g([A-Z]\w*)/.exec(token);
if (ngTokenMatch) {
tokens.push(ngTokenMatch[1].toLowerCase());
}
}
});
return tokens;
}
function extractWords(text, words, keywordMap) {
var tokens = tokenize(text);
tokens.forEach(function(token) {
if (!keywordMap[token]) {
words.push(token);
keywordMap[token] = true;
}
});
}
const filteredDocs = docs
// We are not interested in some docTypes
.filter(function(doc) { return !docTypesToIgnore[doc.docType]; })
@ -104,14 +70,10 @@ module.exports = function generateKeywordsProcessor(log, readFilesProcessor) {
if (isString(value) && !propertiesToIgnore[key]) {
extractWords(value, words, keywordMap);
}
// Special case properties that contain content relating to "members"
// of a doc that represents, say, a class or interface
if (key === 'members' || key === 'statics') {
value.forEach(function(member) { extractWords(member.name, members, membersMap); });
}
});
extractMemberWords(doc, members, membersMap);
// Extract all the keywords from the headings
if (doc.vFile && doc.vFile.headings) {
Object.keys(doc.vFile.headings).forEach(function(headingTag) {
@ -166,4 +128,54 @@ function convertToMap(collection) {
const obj = {};
collection.forEach(key => { obj[key] = true; });
return obj;
}
// If the heading contains a name starting with ng, e.g. "ngController", then add the
// name without the ng to the text, e.g. "controller".
function tokenize(text) {
const rawTokens = text.split(/[\s\/]+/mg);
const tokens = [];
rawTokens.forEach(token => {
// Strip off unwanted trivial characters
token = token
.trim()
.replace(/^[_\-"'`({[<$*)}\]>.]+/, '')
.replace(/[_\-"'`({[<$*)}\]>.]+$/, '');
// Ignore tokens that contain weird characters
if (/^[\w.\-]+$/.test(token)) {
tokens.push(token.toLowerCase());
const ngTokenMatch = /^[nN]g([A-Z]\w*)/.exec(token);
if (ngTokenMatch) {
tokens.push(ngTokenMatch[1].toLowerCase());
}
}
});
return tokens;
}
function extractWords(text, words, keywordMap) {
var tokens = tokenize(text);
tokens.forEach(function(token) {
if (!keywordMap[token]) {
words.push(token);
keywordMap[token] = true;
}
});
}
function extractMemberWords(doc, members, membersMap) {
if (!doc) return;
if (doc.members) {
doc.members.forEach(member => extractWords(member.name, members, membersMap));
}
if (doc.statics) {
doc.statics.forEach(member => extractWords(member.name, members, membersMap));
}
if (doc.extendsClauses) {
doc.extendsClauses.forEach(clause => extractMemberWords(clause.doc, members, membersMap));
}
if (doc.implementsClauses) {
doc.implementsClauses.forEach(clause => extractMemberWords(clause.doc, members, membersMap));
}
}

View File

@ -128,6 +128,46 @@ describe('generateKeywords processor', () => {
);
});
it('should add inherited member doc properties to the search terms', () => {
const processor = processorFactory(mockLogger, mockReadFilesProcessor);
const parentClass = {
docType: 'class',
name: 'ParentClass',
members: [
{ name: 'parentMember1' },
],
statics: [
{ name: 'parentMember2' },
],
};
const parentInterface = {
docType: 'interface',
name: 'ParentInterface',
members: [
{ name: 'parentMember3' },
]
};
const childClass = {
docType: 'class',
name: 'Child',
members: [
{ name: 'childMember1' }
],
statics: [
{ name: 'childMember2' }
],
extendsClauses: [{ doc: parentClass }],
implementsClauses: [{ doc: parentInterface }]
};
const docs = [childClass, parentClass, parentInterface];
processor.$process(docs);
const keywordsDoc = docs[docs.length - 1];
expect(keywordsDoc.data[0].members.split(' ').sort().join(' ')).toEqual(
'childmember1 childmember2 parentmember1 parentmember2 parentmember3'
);
});
it('should process terms prefixed with "ng" to include the term stripped of "ng"', () => {
const processor = processorFactory(mockLogger, mockReadFilesProcessor);
const docs = [

View File

@ -2,19 +2,21 @@
{% set comma = joiner(',') %}
{% set breadcrumbDelimiter = joiner('&gt;') %}
<article>
{$ github.githubLinks(doc, versionInfo) $}
<div class="breadcrumb">
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "BreadcrumbList",
"itemListElement": [
{%- for crumb in doc.breadCrumbs %}{$ comma() $}
{ "@type": "ListItem", "position": {$ loop.index $}, "item": { "@id": "https://angular.io/{$ crumb.path $}", "name": "{$ crumb.text $}" } }{% endfor %}
]
}
</script>
{% for crumb in doc.breadCrumbs %}{% if not loop.last %} {$ breadcrumbDelimiter() $} {% if crumb.path %}<a href="{$ crumb.path $}">{$ crumb.text $}</a>{% else %}{$ crumb.text $}{% endif %}{% endif %}{% endfor %}
<div class="breadcrumb-container">
<div class="breadcrumb">
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "BreadcrumbList",
"itemListElement": [
{%- for crumb in doc.breadCrumbs %}{$ comma() $}
{ "@type": "ListItem", "position": {$ loop.index $}, "item": { "@id": "https://angular.io/{$ crumb.path $}", "name": "{$ crumb.text $}" } }{% endfor %}
]
}
</script>
{% for crumb in doc.breadCrumbs %}{% if not loop.last %} {$ breadcrumbDelimiter() $} {% if crumb.path %}<a href="{$ crumb.path $}">{$ crumb.text $}</a>{% else %}{$ crumb.text $}{% endif %}{% endif %}{% endfor %}
</div>
{$ github.githubLinks(doc, versionInfo) $}
</div>
{% block header %}
<header class="api-header">

View File

@ -40,40 +40,41 @@
{%- endmacro -%}
{%- macro renderOverloadInfo(overload, cssClass, method) -%}
<div class="overload-info">
{% if overload.shortDescription and (overload.shortDescription != method.shortDescription) %}
<div class="short-description">
{$ overload.shortDescription | marked $}
</div>{% endif %}
{% if overload.shortDescription and (overload.shortDescription != method.shortDescription) %}
<div class="short-description">
{$ overload.shortDescription | marked $}
</div>{% endif %}
<code-example language="ts" hideCopy="true" linenums="false" class="no-box api-heading">{$ renderMemberSyntax(overload) $}</code-example>
<code-example language="ts" hideCopy="true" linenums="false" class="no-box api-heading">{$ renderMemberSyntax(overload) $}</code-example>
{% if overload.deprecated !== undefined %}
<div class="deprecated">
{$ ('**Deprecated** ' + overload.deprecated) | marked $}
</div>{% endif %}
{% if overload.deprecated !== undefined %}
<div class="deprecated">
{$ ('**Deprecated** ' + overload.deprecated) | marked $}
</div>{% endif %}
<h6 class="no-anchor">Parameters</h6>
{$ params.renderParameters(overload.parameterDocs, cssClass + '-parameters', cssClass + '-parameter', true) $}
<h4 class="no-anchor">Parameters</h4>
{$ params.renderParameters(overload.parameterDocs, cssClass + '-parameters', cssClass + '-parameter') $}
{% if overload.type or overload.returns.type %}
<h4 class="no-anchor">Returns</h4>
{% marked %}`{$ (overload.type or overload.returns.type) $}`{% if overload.returns %}: {$ overload.returns.description $}{% endif %}{% endmarked %}
{% endif %}
{% if overload.type or overload.returns.type %}
<h6 class="no-anchor">Returns</h6>
{% marked %}`{$ (overload.type or overload.returns.type) $}`{% if overload.returns %}: {$ overload.returns.description $}{% endif %}{% endmarked %}
{% endif %}
{% if overload.throws.length %}
<h4 class="no-anchor">Throws</h4>
{% for error in overload.throws %}
{% marked %}`{$ (error.typeList or 'Error') $}` {$ error.description $}{% endmarked %}
{% endfor %}
{% endif %}
{% if overload.throws.length %}
<h6 class="no-anchor">Throws</h6>
{% for error in overload.throws %}
{% marked %}`{$ (error.typeList or 'Error') $}` {$ error.description $}{% endmarked %}
{% endfor %}
{% endif %}
{% if overload.description and (overload.description != method.description) -%}
<div class="description">
{$ overload.description | marked $}
{% if overload.description and (overload.description != method.description) -%}
<div class="description">
{$ overload.description | marked $}
</div>
{%- endif %}
</div>
{%- endif %}
{%- endmacro -%}
{%- macro renderMethodDetail(versionInfo, method, cssClass) -%}
@ -81,13 +82,13 @@
<table class="is-full-width method-table {$ cssClass $}">
{% if method.name !== 'constructor' %}<thead><tr><th>
<div class="with-github-links">
<h3>
{% if method.isCallMember %}<i>call signature</i>
{% elseif method.isNewMember %}<i>construct signature</i>
{% else %}{$ method.name $}()
{% endif %}
</h3>
{$ github.githubLinks(method, versionInfo) $}
<h3>
{% if method.isCallMember %}<i>call signature</i>
{% elseif method.isNewMember %}<i>construct signature</i>
{% else %}{$ method.name $}()
{% endif %}
</h3>
{$ github.githubLinks(method, versionInfo) $}
</div>
</th></tr></thead>{% endif %}
<tbody>
@ -121,16 +122,26 @@
<tr>
<td>
<details class="overloads">
<summary><h4 class="no-anchor">{$ method.overloads.length $} overloads...</h4></summary>
<summary>
<div class="icon-action-header">
<h4 class="no-anchor">{$ method.overloads.length $} overloads...</h4>
<a>
<span class="show-all">Show All</span>
<span class="collapse-all">Hide All</span>
<i class="material-icons expand">expand_more</i>
</a>
</div>
</summary>
<div class="detail-contents">
{% if method.isAbstract %}
{$ renderOverloadInfo(method, cssClass + '-overload', method) $}
<hr class="hr-margin fullwidth">
{% endif %}
{% for overload in method.overloads %}
{$ renderOverloadInfo(overload, cssClass + '-overload', method) $}
{% if not loop.last %}<hr class="hr-margin fullwidth">{% endif %}
{% endfor %}
{% if method.isAbstract %}
{$ renderOverloadInfo(method, cssClass + '-overload', method) $}
<hr class="hr-margin fullwidth">
{% endif %}
{% for overload in method.overloads %}
<h5 class="no-anchor">Overload #{$ loop.index $}</h5>
{$ renderOverloadInfo(overload, cssClass + '-overload', method) $}
{% if not loop.last %}<hr class="hr-margin">{% endif %}
{% endfor %}
</div>
</details>
</td>
@ -140,7 +151,7 @@
{% if method.description -%}
<tr>
<td class="description">
{$ method.description | marked({ h3: 'h4' }) $}
{$ method.description | marked({ h3: 'h5' }) $}
</td>
</tr>
{%- endif %}
@ -148,7 +159,8 @@
{% if method.usageNotes -%}
<tr>
<td class="usage-notes">
{$ method.usageNotes | marked({ h3: 'h4' }) $}
<h4 id="{$ method.anchor $}-usage-notes">Usage Notes</h4>
{$ method.usageNotes | marked({ h3: 'h5' }) $}
</td>
</tr>
{%- endif %}

View File

@ -17,12 +17,14 @@
<tbody>
{% for parameter in parameters %}
<tr class="{$ parameterClass $}">
<td class="param-name"><a id="{$ parameter.anchor $}"></a>{$ parameter.name $}</td>
{% if showType %}<td class="param-type"><code>{$ parameter.type $}</code></td>{% endif %}
<td class="param-name">
<a id="{$ parameter.anchor $}"></a>
<code>{$ parameter.name $}</code>
</td>
{% if showType %}<td class="param-type"><code>{% if r/^\{/.test(parameter.type) and r/\}$/.test(parameter.type) and parameter.type.length > 20 %}object{% else %}{$ parameter.type $}{% endif %}</code></td>{% endif %}
<td class="param-description">
{% marked %}
{% if (parameter.shortDescription | trim) or (parameter.description | trim) %}{$ parameter.shortDescription + '\n\n' + parameter.description $}
{% elseif not showType and parameter.type %}<p>Type: <code>{$ parameter.type $}</code>.</p>
{% endif %}
{% if parameter.isOptional or parameter.defaultValue !== undefined %}Optional. Default is `{$ parameter.defaultValue === undefined and 'undefined' or parameter.defaultValue $}`.{% endif %}
@ -34,4 +36,4 @@
{%- else -%}
<p>There are no parameters.</p>
{%- endif -%}
{%- endmacro -%}
{%- endmacro -%}

View File

@ -12,9 +12,14 @@
{$ doc.shortDescription | marked $}
{$ doc.description | marked $}
{$ cli.renderSyntax(doc) $}
{% if doc.longDescription.length %}
<h2 class="no-anchor">Description</h2>
{$ doc.longDescription | marked $}
{% endif%}
{$ cli.renderArguments(doc.positionalOptions, 2) $}
{$ cli.renderNamedOptions(doc.namedOptions, 2) $}
{$ cli.renderSubcommands(doc) $}
{$ doc.longDescription | marked $}
</div>
</article>

View File

@ -17,8 +17,8 @@
<tbody>
{% for command in doc.commands %}
<tr>
<td><a class="code-anchor" href="{$ command.path $}"><code>{$ command.name $}</code></a></td>
<td>{% for alias in command.commandAliases %}<code>{$ alias $} </code>{% endfor %}</td>
<td><a class="code-anchor" href="{$ command.path $}"><code class="no-auto-link">{$ command.name $}</code></a></td>
<td>{% for alias in command.commandAliases %}<code class="no-auto-link">{$ alias $} </code>{% endfor %}</td>
<td>{$ command.description | marked $}</td>
</tr>
{% endfor %}

View File

@ -1,6 +1,6 @@
{% macro renderSyntax(container, prefix) -%}
{% for name in container.names %}
<code-example hideCopy="true" class="no-box api-heading">ng {%if prefix %}{$ prefix $} {% endif %}<span class="cli-name">{$ name $}</span>
<code-example hideCopy="true" class="no-box api-heading no-auto-link">ng {%if prefix %}{$ prefix $} {% endif %}<span class="cli-name">{$ name $}</span>
{%- for arg in container.positionalOptions %} &lt;<var>{$ arg.name $}</var>&gt;{% endfor %}
{%- if container.namedOptions.length %} [<var>options</var>]{% endif -%}
</code-example>
@ -20,14 +20,14 @@
<tbody>
{% for option in arguments %}
<tr class="cli-option">
<td><code>&lt;<var>{$ option.name $}</var>&gt;</code></td>
<td><code class="no-auto-link">&lt;<var>{$ option.name $}</var>&gt;</code></td>
<td>
{$ option.description | marked $}
{% if option.subcommands.length -%}
<p>This option can take one of the following <a href="#{$ option.name $}-commands">sub-commands</a>:<p>
<ul>
{% for subcommand in option.subcommands %}
<li><code><a class="code-anchor" href="#{$ subcommand.name $}-command">{$ subcommand.name $}</a></code></li>
<li><code class="no-auto-link"><a class="code-anchor" href="#{$ subcommand.name $}-command">{$ subcommand.name $}</a></code></li>
{% endfor %}
</ul>
{%- endif %}
@ -53,11 +53,11 @@
{% for option in options %}
<tr class="cli-option">
<td>
<code class="cli-option-syntax">{$ renderOption(option.name, option.type, option.default, option.enum) $}</code>
<code class="cli-option-syntax no-auto-link">{$ renderOption(option.name, option.type, option.default, option.enum) $}</code>
</td>
<td>
{$ option.description | marked $}
{% if option.default !== undefined %}<p><span class="cli-default">Default:</span> <code>{$ option.default $}</code></p>{% endif %}
{% if option.default !== undefined %}<p><span class="cli-default">Default:</span> <code class="no-auto-link">{$ option.default $}</code></p>{% endif %}
{% if option.aliases.length %}<p><span class="cli-aliases">Aliases:</span> {% for alias in option.aliases %}{$ renderOptionName(alias) $}{% if not loop.last %}, {% endif %}{% endfor %}</p>{% endif %}
</td>
</tr>
@ -92,7 +92,7 @@
{% for command in container.positionalOptions %}{% if command.subcommands.length %}
<h2><a id="{$ command.name $}-commands"></a>{$ command.name | title $} commands</h2>
{% for subcommand in command.subcommands %}
<h3><code><a id="{$ subcommand.name $}-command"></a>{$ subcommand.name $}</code></h3>
<h3><code class="no-auto-link"><a id="{$ subcommand.name $}-command"></a>{$ subcommand.name $}</code></h3>
{% for name in container.names %}
{$ renderSyntax(subcommand, name) $}
{% endfor %}

File diff suppressed because it is too large Load Diff

View File

@ -9,21 +9,14 @@ Bazel.
## Installation
Install Bazel from the distribution, see [install] instructions.
On Mac, just `brew install bazel`.
In order to ensure that everyone builds Angular in a _consistent_ way, Bazel
will be installed through NPM and therefore it's not necessary to install Bazel
manually.
Bazel will install a hermetic version of Node, npm, and Yarn when
you run the first build.
The binaries for Bazel will be provided by the [`@bazel/bazel`](https://github.com/bazelbuild/rules_nodejs/tree/master/packages)
NPM package and its platform-specific dependencies.
[install]: https://bazel.build/versions/master/docs/install.html
### Installation of ibazel
Install interactive bazel runner / fs watcher via:
```
yarn global add @bazel/ibazel
```
You can access Bazel with the `yarn bazel` command
## Configuration
@ -33,12 +26,6 @@ use to execute build steps, from `build_bazel_rules_typescript`.
The sources on [GitHub] are published from Google's internal
repository (google3).
That repository defines dependencies on specific versions of
all the tools. You can run the tools Bazel installed, for
example rather than `yarn install` (which depends on whatever
version you have installed on your machine), you can
`bazel run @nodejs//:yarn`.
Bazel accepts a lot of options. We check in some options in the
`.bazelrc` file. See the [bazelrc doc]. For example, if you don't
want Bazel to create several symlinks in your project directory
@ -50,8 +37,8 @@ want Bazel to create several symlinks in your project directory
## Building Angular
- Build a package: `bazel build packages/core`
- Build all packages: `bazel build packages/...`
- Build a package: `yarn bazel build packages/core`
- Build all packages: `yarn bazel build packages/...`
You can use [ibazel] to get a "watch mode" that continuously
keeps the outputs up-to-date as you save sources. Note this is
@ -61,9 +48,9 @@ new as of May 2017 and not very stable yet.
## Testing Angular
- Test package in node: `bazel test packages/core/test:test`
- Test package in karma: `bazel test packages/core/test:test_web`
- Test all packages: `bazel test packages/...`
- Test package in node: `yarn bazel test packages/core/test:test`
- Test package in karma: `yarn bazel test packages/core/test:test_web`
- Test all packages: `yarn bazel test packages/...`
You can use [ibazel] to get a "watch mode" that continuously
keeps the outputs up-to-date as you save sources.
@ -72,19 +59,20 @@ keeps the outputs up-to-date as you save sources.
If you're experiencing problems with seemingly unrelated tests failing, it may be because you're not using the proper flags with your Bazel test runs in Angular.
See also: [`//.bazelrc`](https://github.com/angular/angular/blob/master/.bazelrc) where `--define=ivy=false` is defined as default.
See also: [`//.bazelrc`](https://github.com/angular/angular/blob/master/.bazelrc) where `--define=compile=legacy` is defined as default.
- `--config=debug`: build and launch in debug mode (see [debugging](#debugging) instructions below)
- `--test_arg=--node_options=--inspect=9228`: change the inspector port.
- `--define=compile=<option>` Controls if ivy or legacy mode is enabled. This is done by generating the [`src/ivy_switch.ts`](https://github.com/angular/angular/blob/master/packages/core/src/ivy_switch.ts) file from [`ivy_switch_legacy.ts`](https://github.com/angular/angular/blob/master/packages/core/src/ivy_switch_legacy.ts) (default), [`ivy_switch_jit.ts`](https://github.com/angular/angular/blob/master/packages/core/src/ivy_switch_jit.ts), or [`ivy_switch_local.ts`](https://github.com/angular/angular/blob/master/packages/core/src/ivy_switch_local.ts).
- `legacy`: (default behavior) compile against View Engine, e.g. `--define=compile=legacy`
- `jit`: Compile in ivy JIT mode, e.g. `--define=compile=jit`
- `local`: Compile in ivy AOT move, e.g. `--define=compile=local`
- `--test_tag_filters=<tag>`: filter tests down to tags defined in the `tag` config
of your rules in any given `BUILD.bazel`.
- `ivy-jit`: This flag should be set for tests that should be excuted with ivy JIT, e.g. `--test_tag_filters=ivy-jit`. For this, you may have to include `--define=compile=jit`.
- `ivy-local`: Only run tests that have to do with ivy AOT. For this, you may have to include `--define=compile=local`, e.g. `--test_tag_filters=ivy-local`..
- `ivy-only`: Only run ivy related tests, e.g. `--test_tag_filters=ivy-only`.
- `aot`: Compile in ivy AOT move, e.g. `--define=compile=aot`
- `--test_tag_filters=<tag>`: filter tests down to tags defined in the `tag` config of your rules in any given `BUILD.bazel`.
- `no-ivy-aot`: Useful for excluding build and test targets that are not meant to be executed in Ivy AOT mode (`--define=compile=aot`).
- `no-ivy-jit`: Useful for excluding build and test targets that are not meant to be executed in Ivy JIT mode (`--define=compile=jit`).
- `ivy-only`: Useful for excluding all Ivy build and tests targets with `--define=compile=legacy`.
- `fixme-ivy-aot`: Useful for including/excluding build and test targets that are currently broken in Ivy AOT mode (`--define=compile=aot`).
- `fixme-ivy-jit`: Useful for including/excluding build and test targets that are currently broken in Ivy JIT mode (`--define=compile=jit`).
### Debugging a Node Test
@ -92,7 +80,7 @@ of your rules in any given `BUILD.bazel`.
- Open chrome at: [chrome://inspect](chrome://inspect)
- Click on `Open dedicated DevTools for Node` to launch a debugger.
- Run test: `bazel test packages/core/test:test --config=debug`
- Run test: `yarn bazel test packages/core/test:test --config=debug`
The process should automatically connect to the debugger. For additional info and testing options, see the [nodejs_test documentation](https://bazelbuild.github.io/rules_nodejs/node/node.html#nodejs_test).
@ -129,7 +117,7 @@ First time setup:
**Setting breakpoints directly in your code files may not work in VSCode**. This is because the files you're actually debugging are built files that exist in a `./private/...` folder.
The easiest way to debug a test for now is to add a `debugger` statement in the code
and launch the bazel corresponding test (`bazel test <target> --config=debug`).
and launch the bazel corresponding test (`yarn bazel test <target> --config=debug`).
Bazel will wait on a connection. Go to the debug view (by clicking on the sidebar or
Apple+Shift+D on Mac) and click on the green play icon next to the configuration name
@ -137,7 +125,7 @@ Apple+Shift+D on Mac) and click on the green play icon next to the configuration
### Debugging a Karma Test
- Run test: `bazel run packages/core/test:test_web`
- Run test: `yarn bazel run packages/core/test:test_web`
- Open chrome at: [http://localhost:9876/debug.html](http://localhost:9876/debug.html)
- Open chrome inspector
@ -150,7 +138,7 @@ open $(bazel info output_base)/external
See subcommands that bazel executes (helpful for debugging):
```sh
bazel build //packages/core:package -s
yarn bazel build //packages/core:package -s
```
To debug nodejs_binary executable paths uncomment `find . -name rollup 1>&2` (~ line 96) in
@ -167,7 +155,7 @@ In our repo, here is how it's configured:
1) In `tools/bazel_stamp_vars.sh` we run the `git` commands to generate our versioning info.
1) In `.bazelrc` we register this script as the value for the `workspace_status_command` flag. Bazel will run the script when it needs to stamp a binary.
Note that Bazel has a `--stamp` argument to `bazel build`, but this has no effect since our stamping takes place in Skylark rules. See https://github.com/bazelbuild/bazel/issues/1054
Note that Bazel has a `--stamp` argument to `yarn bazel build`, but this has no effect since our stamping takes place in Skylark rules. See https://github.com/bazelbuild/bazel/issues/1054
## Remote cache
@ -205,7 +193,7 @@ See [bazelbuild/intellij#246](https://github.com/bazelbuild/intellij/issues/246)
If you see the following error:
```
$ bazel build packages/...
$ yarn bazel build packages/...
ERROR: /private/var/tmp/[...]/external/local_config_cc/BUILD:50:5: in apple_cc_toolchain rule @local_config_cc//:cc-compiler-darwin_x86_64: Xcode version must be specified to use an Apple CROSSTOOL
ERROR: Analysis of target '//packages/core/test/render3:render3' failed; build aborted: Analysis of target '@local_config_cc//:cc-compiler-darwin_x86_64' failed; build aborted
```
@ -227,7 +215,7 @@ If VSCode is not the root cause, you might try:
bazel clean --expunge
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
sudo xcodebuild -license
bazel build //packages/core # Run a build outside VSCode to pre-build the xcode; then safe to run VSCode
yarn bazel build //packages/core # Run a build outside VSCode to pre-build the xcode; then safe to run VSCode
```
Source: https://stackoverflow.com/questions/45276830/xcode-version-must-be-specified-to-use-an-apple-crosstool

View File

@ -10,10 +10,11 @@ To test Angular CLI applications, we use the integration test `cli-hello-world`.
When a significant change is released in the CLI, the application should be updated with `ng update`:
```bash
$ cd integration
$ ng update
# ng build
# ng test
$ cd integration/cli-hello-world
$ yarn install
$ yarn ng update @angular/cli @angular-devkit/build-angular
# yarn build
# yarn test
# typescript version
```
@ -36,7 +37,7 @@ The API for each test is:
This means that the test should be started by test script, like
```
'scripts' { 'test': 'runProgramA && assertResultIsGood' }
"scripts": {"test": "runProgramA && assertResultIsGood"}
```
Note that the `package.json` file uses a special `file://../../dist` scheme

View File

@ -2,9 +2,9 @@
"cli-hello-world": {
"master": {
"uncompressed": {
"runtime": 1110,
"main": 151765,
"polyfills": 59462
"runtime": 1497,
"main": 181839,
"polyfills": 59608
}
}
},
@ -12,32 +12,8 @@
"master": {
"uncompressed": {
"bundle": "TODO(i): temporarily increase the payload size limit from 105779 - this is due to a closure issue related to ESM reexports that still needs to be investigated",
"bundle": 178101
}
}
},
"hello_world__render3__closure": {
"master": {
"uncompressed": {
"bundle": 8153
}
}
},
"hello_world__render3__rollup": {
"master": {
"uncompressed": {
"bundle": 10129
}
}
},
"hello_world__render3__cli": {
"master": {
"uncompressed": {
"inline": 1447,
"main": 40513,
"polyfills": 60105
"bundle": 177585
}
}
}
}

View File

@ -5,6 +5,9 @@
"license": "MIT",
"dependencies": {
},
"devDependencies": {
"@bazel/bazel": "file:../../node_modules/@bazel/bazel"
},
"scripts": {
"//": "deps are listed in src/package.json which is used by yarn_install",
"//": "this package.json file is only here so that `yarn test` can be called by /integration/run_tests.sh",

View File

@ -2,3 +2,24 @@
# yarn lockfile v1
"@bazel/bazel-darwin_x64@0.18.0":
version "0.18.0"
resolved "https://registry.yarnpkg.com/@bazel/bazel-darwin_x64/-/bazel-darwin_x64-0.18.0.tgz#bab437605a702279d42f59caa4741bb327eb7dbc"
integrity sha512-um2OzgLL2Gd/W6joOpvrSTcqpnupliPNpwe/uE7sB0huBSJ/4Im0w2IlCTI6C7OfgMcbpUj4YxgUa9T6u6WY6w==
"@bazel/bazel-linux_x64@0.18.0":
version "0.18.0"
resolved "https://registry.yarnpkg.com/@bazel/bazel-linux_x64/-/bazel-linux_x64-0.18.0.tgz#0c02b2404ec95c180e17615cc7079ee07df48a69"
integrity sha512-Rq8X8bL6SgQvbOHnfPhSgF6hp+f6Fbt2w6pRmBlFvV1J+CeUyrSrrRXfnnO1bjIuq05Ur3mV8ULA0qK6rtA5lQ==
"@bazel/bazel-win32_x64@0.18.0":
version "0.18.0"
resolved "https://registry.yarnpkg.com/@bazel/bazel-win32_x64/-/bazel-win32_x64-0.18.0.tgz#aa4575fb00066dcf59a6d464971774dea6a0bafd"
integrity sha512-U2TbfK8B7dc3JqXSFwj2oXCQrxEaSzCCUkAHjAOIGOKzx/HLKIKs+NJj9IQkLLr7BsMU+Qqzo8aqo11E+Vs+aA==
"@bazel/bazel@file:../../node_modules/@bazel/bazel":
version "0.18.0"
optionalDependencies:
"@bazel/bazel-darwin_x64" "0.18.0"
"@bazel/bazel-linux_x64" "0.18.0"
"@bazel/bazel-win32_x64" "0.18.0"

View File

@ -76,6 +76,13 @@
},
"production": {
"browserTarget": "cli-hello-world:build:production"
},
"ci": {
"progress": false
},
"ci-production": {
"browserTarget": "cli-hello-world:build:production",
"progress": false
}
}
},
@ -141,6 +148,12 @@
"configurations": {
"production": {
"devServerTarget": "cli-hello-world:serve:production"
},
"ci": {
"devServerTarget": "cli-hello-world:serve:ci"
},
"ci-production": {
"devServerTarget": "cli-hello-world:serve:ci-production"
}
}
},

View File

@ -4,12 +4,12 @@
"license": "MIT",
"scripts": {
"build": "ng build --prod --progress=false",
"e2e": "ng e2e",
"e2e": "ng e2e --webdriver-update=false",
"lint": "ng lint",
"ng": "ng",
"postinstall": "webdriver-manager update --gecko=false --standalone=false $CHROMEDRIVER_VERSION_ARG",
"start": "ng serve",
"test": "ng test --progress=false && ng e2e --webdriver-update=false && ng e2e --prod --webdriver-update=false"
"test": "ng test --progress=false --watch=false && yarn e2e --configuration=ci && yarn e2e --configuration=ci-production"
},
"private": true,
"dependencies": {
@ -27,8 +27,8 @@
"zone.js": "file:../../node_modules/zone.js"
},
"devDependencies": {
"@angular-devkit/build-angular": "~0.5.0",
"@angular/cli": "7.0.0-beta.4",
"@angular-devkit/build-angular": "~0.10.3",
"@angular/cli": "7.0.3",
"@angular/compiler-cli": "file:../../dist/packages-dist/compiler-cli",
"@angular/language-service": "file:../../dist/packages-dist/language-service",
"@types/jasmine": "~2.8.3",

File diff suppressed because it is too large Load Diff

View File

@ -1,20 +1,22 @@
import { browser, element, by } from 'protractor';
import { browser, element, ExpectedConditions as EC, by } from 'protractor';
browser.waitForAngularEnabled(false);
describe('Element E2E Tests', function () {
describe('Hello World Elements', () => {
it('should display: Hello world!', function () {
browser.get('hello-world.html');
const helloWorldEl = element(by.css('hello-world-el'));
const helloWorldEl = element(by.css('hello-world-el'));
beforeEach(() => browser.get('hello-world.html'));
it('should display "Hello World!"', function () {
expect(helloWorldEl.getText()).toEqual('Hello World!');
});
it('should display: Hello Foo! via name attribute', function () {
browser.get('hello-world.html');
const helloWorldEl = element(by.css('hello-world-el'));
it('should display "Hello Foo!" via name attribute', function () {
const input = element(by.css('input[type=text]'));
['f', 'o', 'o'].forEach((key) => input.sendKeys(key));
expect(helloWorldEl.getText()).toEqual('Hello foo!');
input.sendKeys('Foo');
// Make tests less flaky on CI by waiting up to 5s for the element text to be updated.
browser.wait(EC.textToBePresentInElement(helloWorldEl, 'Hello Foo!'), 5000);
});
});
});

View File

@ -19,5 +19,3 @@ export class AppModule {
}
ngDoBootstrap() {}
}
export {HelloWorldComponent};

View File

@ -3,11 +3,8 @@ import {AppModuleNgFactory} from './app.ngfactory';
platformBrowser().bootstrapModuleFactory(AppModuleNgFactory, {ngZone: 'noop'});
const input = document.querySelector('input');
const helloWorld = document.querySelector('hello-world-el');
const input = document.querySelector('input[type=text]');
if(input && helloWorld){
input.addEventListener('input', e => {
const newText = (e.target as any).value;
helloWorld.setAttribute('name', newText);
});
input.addEventListener('input', () => helloWorld.setAttribute('name', input.value));
}

View File

@ -15,7 +15,7 @@ if $CI; then
# We don't install this by default because it contains some broken Bazel setup
# and also it's a very big dependency that we never use except when publishing
# payload sizes on CI.
yarn add --silent -D firebase-tools@3.12.0
yarn add --silent -D firebase-tools@5.1.1
source ${basedir}/scripts/ci/payload-size.sh
# NB: we don't run build-packages-dist.sh because we expect that it was done
@ -47,20 +47,21 @@ for testDir in $(ls | grep -v node_modules) ; do
yarn install --cache-folder ../$cache
yarn test || exit 1
# Track payload size for cli-hello-world and hello_world__closure and the render3 tests
if [[ $testDir == cli-hello-world ]] || [[ $testDir == hello_world__closure ]] || [[ $testDir == hello_world__render3__closure ]] || [[ $testDir == hello_world__render3__rollup ]] || [[ $testDir == hello_world__render3__cli ]]; then
if [[ $testDir == cli-hello-world ]] || [[ $testDir == hello_world__render3__cli ]]; then
if $CI && ([[ $testDir == cli-hello-world ]] || [[ $testDir == hello_world__closure ]]); then
if [[ $testDir == cli-hello-world ]]; then
yarn build
fi
#if $CI; then
# trackPayloadSize "$testDir" "dist/*.js" true false "${basedir}/integration/_payload-limits.json"
#fi
trackPayloadSize "$testDir" "dist/*.js" true false "${basedir}/integration/_payload-limits.json"
fi
# remove the temporary node modules directory to keep the source folder clean.
rm -rf node_modules
)
done
#if $CI; then
# trackPayloadSize "umd" "../dist/packages-dist/*/bundles/*.umd.min.js" false false
#fi
if $CI; then
trackPayloadSize "umd" "../dist/packages-dist/*/bundles/*.umd.min.js" false false
fi

View File

@ -17,7 +17,7 @@ ts_library(
"//modules/benchmarks/src/largetable:util_lib",
"//packages:types",
"//packages/core",
"@rxjs",
"@ngdeps//reflect-metadata",
],
)
@ -59,7 +59,11 @@ protractor_web_test(
],
on_prepare = ":protractor.on-prepare.js",
server = ":devserver",
tags = ["manual"],
tags = [
"fixme-ivy-aot",
"fixme-ivy-jit",
"ivy-only",
],
deps = [
"//modules/benchmarks/src/largetable:perf_lib",
],

View File

@ -1,6 +1,8 @@
package(default_visibility = ["//visibility:public"])
load("//tools:defaults.bzl", "ng_module")
load("//tools:defaults.bzl", "ng_module", "ng_rollup_bundle")
load("//packages/bazel:index.bzl", "protractor_web_test")
load("@build_bazel_rules_typescript//:defs.bzl", "ts_devserver")
ng_module(
name = "render3_lib",
@ -13,6 +15,54 @@ ng_module(
"//modules/benchmarks/src/tree:util_lib",
"//packages:types",
"//packages/core",
"@rxjs",
"@ngdeps//reflect-metadata",
],
)
ng_rollup_bundle(
name = "bundle",
entry_point = "modules/benchmarks/src/tree/render3/index.js",
tags = ["ivy-only"],
deps = [
":tree_lib",
],
)
genrule(
name = "favicon",
srcs = ["//modules/benchmarks:favicon"],
outs = ["favicon.ico"],
cmd = "cp $< $@",
)
ts_devserver(
name = "devserver",
static_files = [
":bundle.min_debug.js",
":bundle.min.js",
"index.html",
":favicon",
],
tags = ["ivy-only"],
)
protractor_web_test(
name = "perf",
configuration = "//:protractor-perf.conf.js",
data = [
"//packages/bazel/src/protractor/utils",
"//packages/benchpress",
],
on_prepare = ":protractor.on_prepare.js",
server = ":devserver",
tags = [
"fixme-ivy-aot",
"fixme-ivy-jit",
"ivy-only",
],
deps = [
"@ngdeps//node-uuid",
"@ngdeps//protractor",
"@ngdeps//yargs",
],
)

View File

@ -1,6 +1,6 @@
{
"name": "angular-srcs",
"version": "7.0.1",
"version": "7.0.3",
"private": true,
"branchPattern": "2.0.*",
"description": "Angular - a web framework for modern web apps",
@ -26,43 +26,28 @@
"update-webdriver": "webdriver-manager update --gecko false $CHROMEDRIVER_VERSION_ARG",
"check-env": "gulp check-env",
"commitmsg": "node ./scripts/git/commit-msg.js",
"test-ivy-jit": "bazel test --define=compile=jit --build_tag_filters=ivy-jit --test_tag_filters=ivy-jit",
"test-fixme-ivy-jit": "bazel test --define=compile=jit --build_tag_filters=-no-ivy --test_tag_filters=-no-ivy",
"test-ivy-aot": "bazel test --define=compile=aot --build_tag_filters=ivy-aot --test_tag_filters=ivy-aot",
"test-fixme-ivy-aot": "bazel test --define=compile=aot --build_tag_filters=-no-ivy --test_tag_filters=-no-ivy"
"test-ivy-jit": "bazel test --define=compile=jit --build_tag_filters=-no-ivy-jit,-fixme-ivy-jit --test_tag_filters=-no-ivy-jit,-fixme-ivy-jit",
"test-fixme-ivy-jit": "bazel test --define=compile=jit --build_tag_filters=-no-ivy-jit --test_tag_filters=-no-ivy-jit",
"test-ivy-aot": "bazel test --define=compile=aot --build_tag_filters=-no-ivy-aot,-fixme-ivy-aot --test_tag_filters=-no-ivy-aot,-fixme-ivy-aot",
"test-fixme-ivy-aot": "bazel test --define=compile=aot --build_tag_filters=-no-ivy-aot --test_tag_filters=-no-ivy-aot",
"bazel": "bazel"
},
"// 1": "dependencies are used locally and by bazel",
"dependencies": {
"@angular-devkit/schematics": "^0.5.5",
"@schematics/angular": "^0.5.4",
"core-js": "^2.4.1",
"reflect-metadata": "^0.1.3",
"rxjs": "^6.3.0",
"tslib": "^1.7.1",
"zone.js": "^0.8.26"
},
"optionalDependencies": {
"fsevents": "1.1.2"
},
"devDependencies": {
"@bazel/ibazel": "^0.1.1",
"@bazel/karma": "0.20.3",
"@bazel/typescript": "0.20.3",
"@types/angular": "^1.6.47",
"@types/base64-js": "1.2.5",
"@schematics/angular": "^0.5.4",
"@types/chokidar": "1.7.3",
"@types/convert-source-map": "^1.5.1",
"@types/diff": "^3.2.2",
"@types/fs-extra": "4.0.2",
"@types/hammerjs": "2.0.35",
"@types/jasmine": "^2.8.8",
"@types/jasminewd2": "^2.0.4",
"@types/minimist": "^1.2.0",
"@types/mock-fs": "^3.6.30",
"@types/node": "^10.9.4",
"@types/selenium-webdriver": "3.0.7",
"@types/shelljs": "^0.7.8",
"@types/source-map": "^0.5.1",
"@types/systemjs": "0.19.32",
"@types/yargs": "^11.1.1",
"@webcomponents/custom-elements": "^1.0.4",
"angular": "npm:angular@1.7",
@ -72,23 +57,57 @@
"angular-mocks-1.5": "npm:angular-mocks@1.5",
"angular-mocks-1.6": "npm:angular-mocks@1.6",
"base64-js": "1.2.1",
"canonical-path": "1.0.0",
"chokidar": "1.7.0",
"convert-source-map": "^1.5.1",
"dependency-graph": "^0.7.2",
"domino": "2.1.0",
"fs-extra": "4.0.2",
"jasmine": "^3.1.0",
"jasmine-core": "^3.1.0",
"karma": "^2.0.4",
"magic-string": "^0.25.0",
"minimist": "1.2.0",
"mock-fs": "^4.5.0",
"node-uuid": "1.4.8",
"protractor": "5.1.2",
"reflect-metadata": "^0.1.3",
"selenium-webdriver": "3.5.0",
"shelljs": "^0.8.1",
"source-map": "^0.6.1",
"source-map-support": "0.4.18",
"tsickle": "0.32.1",
"tslib": "^1.7.1",
"typescript": "~3.1.1",
"xhr2": "0.1.4",
"yargs": "9.0.1",
"zone.js": "^0.8.26"
},
"optionalDependencies": {
"fsevents": "1.1.2"
},
"// 2": "devDependencies are not used under Bazel. Many can be removed after test.sh is deleted.",
"devDependencies": {
"@bazel/bazel": "^0.18.1",
"@bazel/ibazel": "^0.1.1",
"@bazel/karma": "0.20.3",
"@types/angular": "^1.6.47",
"@types/base64-js": "1.2.5",
"@types/jasminewd2": "^2.0.4",
"@types/minimist": "^1.2.0",
"@types/systemjs": "0.19.32",
"bower": "1.8.2",
"browserstacktunnel-wrapper": "2.0.1",
"canonical-path": "0.0.2",
"chokidar": "1.7.0",
"clang-format": "1.0.41",
"cldr": "4.10.0",
"cldr-data-downloader": "0.3.2",
"cldrjs": "0.5.0",
"conventional-changelog": "^2.0.3",
"convert-source-map": "^1.5.1",
"core-js": "^2.4.1",
"cors": "2.8.4",
"dependency-graph": "^0.7.2",
"diff": "^3.5.0",
"domino": "2.1.0",
"entities": "1.1.1",
"firefox-profile": "1.0.3",
"fs-extra": "4.0.2",
"glob": "7.1.2",
"gulp": "3.9.1",
"gulp-clang-format": "1.0.23",
@ -100,44 +119,29 @@
"hammerjs": "2.0.8",
"husky": "^0.14.3",
"incremental-dom": "0.4.1",
"jasmine": "^3.1.0",
"jasmine-core": "^3.1.0",
"jpm": "1.3.1",
"karma": "^2.0.4",
"karma-browserstack-launcher": "^1.3.0",
"karma-chrome-launcher": "^2.2.0",
"karma-jasmine": "^1.1.2",
"karma-sauce-launcher": "^1.2.0",
"karma-sourcemap-loader": "^0.3.7",
"madge": "0.5.0",
"magic-string": "^0.25.0",
"minimist": "1.2.0",
"mock-fs": "^4.5.0",
"mutation-observer": "^1.0.3",
"node-uuid": "1.4.8",
"protractor": "5.1.2",
"rewire": "2.5.2",
"rollup": "0.47.4",
"rollup-plugin-commonjs": "8.1.0",
"rollup-plugin-node-resolve": "3.0.0",
"rollup-plugin-sourcemaps": "0.4.2",
"selenium-webdriver": "3.5.0",
"rxjs": "^6.3.0",
"semver": "5.4.1",
"shelljs": "^0.8.1",
"source-map": "^0.6.1",
"source-map-support": "0.4.18",
"systemjs": "0.18.10",
"tsickle": "0.32.1",
"tslint": "5.7.0",
"tslint-eslint-rules": "4.1.1",
"tsutils": "2.27.2",
"typescript": "~3.1.1",
"uglify-es": "^3.3.9",
"universal-analytics": "0.4.15",
"vlq": "0.2.2",
"vrsource-tslint-rules": "5.1.1",
"webpack": "1.12.9",
"xhr2": "0.1.4",
"yargs": "9.0.1"
"webpack": "1.12.9"
}
}

View File

@ -22,4 +22,4 @@ protractor_web_test = _protractor_web_test
protractor_web_test_suite = _protractor_web_test_suite
ng_setup_workspace = _ng_setup_workspace
# DO NOT ADD PUBLIC API without including in the documentation generation
# Run `bazel build //packages/bazel/docs` to verify
# Run `yarn bazel build //packages/bazel/docs` to verify

Some files were not shown because too many files have changed in this diff Show More