从官方版本合并到本地

This commit is contained in:
YuCheng Hu 2021-08-10 19:26:23 -04:00
commit b60cd3e94a
4084 changed files with 79611 additions and 328046 deletions

View File

@ -23,14 +23,12 @@ integration/cli-hello-world-ivy-compat/node_modules
integration/cli-hello-world-ivy-i18n/node_modules
integration/cli-hello-world-ivy-minimal/node_modules
integration/cli-hello-world-lazy/node_modules
integration/cli-hello-world-lazy-rollup/node_modules
integration/dynamic-compiler/node_modules
integration/hello_world__closure/node_modules
integration/hello_world__systemjs_umd/node_modules
integration/i18n/node_modules
integration/injectable-def/node_modules
integration/ivy-i18n/node_modules
integration/language_service_plugin/node_modules
integration/ng_elements/node_modules
integration/ng_elements_schematics/node_modules
integration/ng_update/node_modules
@ -51,14 +49,12 @@ integration/cli-hello-world-ivy-compat/.yarn_local_cache
integration/cli-hello-world-ivy-i18n/.yarn_local_cache
integration/cli-hello-world-ivy-minimal/.yarn_local_cache
integration/cli-hello-world-lazy/.yarn_local_cache
integration/cli-hello-world-lazy-rollup/.yarn_local_cache
integration/dynamic-compiler/.yarn_local_cache
integration/hello_world__closure/.yarn_local_cache
integration/hello_world__systemjs_umd/.yarn_local_cache
integration/i18n/.yarn_local_cache
integration/injectable-def/.yarn_local_cache
integration/ivy-i18n/.yarn_local_cache
integration/language_service_plugin/.yarn_local_cache
integration/ng_elements/.yarn_local_cache
integration/ng_elements_schematics/.yarn_local_cache
integration/ng_update/.yarn_local_cache
@ -79,14 +75,12 @@ integration/cli-hello-world-ivy-compat/NPM_PACKAGE_MANIFEST.json
integration/cli-hello-world-ivy-i18n/NPM_PACKAGE_MANIFEST.json
integration/cli-hello-world-ivy-minimal/NPM_PACKAGE_MANIFEST.json
integration/cli-hello-world-lazy/NPM_PACKAGE_MANIFEST.json
integration/cli-hello-world-lazy-rollup/NPM_PACKAGE_MANIFEST.json
integration/dynamic-compiler/NPM_PACKAGE_MANIFEST.json
integration/hello_world__closure/NPM_PACKAGE_MANIFEST.json
integration/hello_world__systemjs_umd/NPM_PACKAGE_MANIFEST.json
integration/i18n/NPM_PACKAGE_MANIFEST.json
integration/injectable-def/NPM_PACKAGE_MANIFEST.json
integration/ivy-i18n/NPM_PACKAGE_MANIFEST.json
integration/language_service_plugin/NPM_PACKAGE_MANIFEST.json
integration/ng_elements/NPM_PACKAGE_MANIFEST.json
integration/ng_elements_schematics/NPM_PACKAGE_MANIFEST.json
integration/ng_update/NPM_PACKAGE_MANIFEST.json

View File

@ -114,18 +114,14 @@ build:remote --cpu=k8
build:remote --host_cpu=k8
# Toolchain and platform related flags
build:remote --host_javabase=@rbe_ubuntu1604_angular//java:jdk
build:remote --javabase=@rbe_ubuntu1604_angular//java:jdk
build:remote --host_java_toolchain=@bazel_tools//tools/jdk:toolchain_hostjdk8
build:remote --java_toolchain=@bazel_tools//tools/jdk:toolchain_hostjdk8
build:remote --crosstool_top=@rbe_ubuntu1604_angular//cc:toolchain
build:remote --extra_toolchains=@rbe_ubuntu1604_angular//config:cc-toolchain
build:remote --extra_execution_platforms=//tools:rbe_ubuntu1604-angular
build:remote --host_platform=//tools:rbe_ubuntu1604-angular
build:remote --platforms=//tools:rbe_ubuntu1604-angular
build:remote --crosstool_top=//dev-infra/bazel/remote-execution/cpp:cc_toolchain_suite
build:remote --extra_toolchains=//dev-infra/bazel/remote-execution/cpp:cc_toolchain
build:remote --extra_execution_platforms=//dev-infra/bazel/remote-execution:platform
build:remote --host_platform=//dev-infra/bazel/remote-execution:platform
build:remote --platforms=//dev-infra/bazel/remote-execution:platform
# Remote instance and caching
build:remote --remote_instance_name=projects/internal-200822/instances/default_instance
build:remote --remote_instance_name=projects/internal-200822/instances/primary_instance
build:remote --project_id=internal-200822
build:remote --remote_cache=remotebuildexecution.googleapis.com
build:remote --remote_executor=remotebuildexecution.googleapis.com

View File

@ -1,3 +1 @@
4.0.0
# [NB: this comment has to be after the first line, see https://github.com/bazelbuild/bazelisk/issues/117]
# When updating the Bazel version you also need to update the RBE toolchains version in package.bzl

View File

@ -19,19 +19,25 @@ version: 2.1
# 1) yarn lock file changes --> cached "node_modules" are different.
# 2) bazel repository definitions change --> cached bazel repositories are different.
# Windows needs its own cache key because binaries in node_modules are different.
# **NOTE 1 **: If you change the cache key prefix, also sync the cache_key_fallback to match.
# **NOTE 2 **: Keep the static part of the cache key as prefix to enable correct fallbacks.
# **NOTE 1 **: In order to avoid the cache from growing indefinitely and causing slow-downs, we invalidate the cache monthly.
# (See https://support.circleci.com/hc/en-us/articles/360012618473-Creating-a-daily-cache.)
# **NOTE 2 **: If you change the cache key prefix, also sync the cache_key_fallback to match.
# **NOTE 3 **: Keep the static part of the cache key as prefix to enable correct fallbacks.
# See https://circleci.com/docs/2.0/caching/#restoring-cache for how prefixes work in CircleCI.
var_3: &cache_key v1-angular-node-12-{{ checksum ".bazelversion" }}-{{ checksum "yarn.lock" }}-{{ checksum "WORKSPACE" }}-{{ checksum "packages/bazel/package.bzl" }}-{{ checksum "aio/yarn.lock" }}
var_3: &cache_key v4-angular-node-14-{{ checksum "month.txt" }}-{{ checksum ".bazelversion" }}-{{ checksum "yarn.lock" }}-{{ checksum "WORKSPACE" }}-{{ checksum "aio/yarn.lock" }}
# We invalidate the cache if the Bazel version changes because otherwise the `bazelisk` cache
# folder will contain all previously used versions and ultimately cause the cache restoring to
# be slower due to its growing size.
var_4: &cache_key_fallback v1-angular-node-12-{{ checksum ".bazelversion" }}
var_4: &cache_key_fallback v4-angular-node-14-{{ checksum "month.txt" }}-{{ checksum ".bazelversion" }}
# Windows needs its own cache key because binaries in node_modules are different.
var_3_win: &cache_key_win v4-angular-win-node-14-{{ checksum "month.txt" }}-{{ checksum ".bazelversion" }}-{{ checksum "yarn.lock" }}-{{ checksum "WORKSPACE" }}-{{ checksum "aio/yarn.lock" }}
var_4_win: &cache_key_win_fallback v4-angular-win-node-14-{{ checksum "month.txt" }}-{{ checksum ".bazelversion" }}
# Cache key for the `components-repo-unit-tests` job. **Note** when updating the SHA in the
# cache keys also update the SHA for the "COMPONENTS_REPO_COMMIT" environment variable.
var_5: &components_repo_unit_tests_cache_key v1-angular-components-09e68db8ed5b1253f2fe38ff954ef0df019fc25a
var_6: &components_repo_unit_tests_cache_key_fallback v1-angular-components-
var_5: &components_repo_unit_tests_cache_key v1-angular-components-{{ checksum "month.txt" }}-d090617912da8e70aa336aa5b4d804b1b535402e
var_6: &components_repo_unit_tests_cache_key_fallback v1-angular-components-{{ checksum "month.txt" }}
# Workspace initially persisted by the `setup` job, and then enhanced by `build-npm-packages` and
# `build-ivy-npm-packages`.
@ -60,11 +66,20 @@ var_10: &only_on_master
only:
- master
# Filter to run a job on all releasable branches.
var_11: &only_release_branches
filters:
branches:
only:
- master
- /\d+\.\d+\.x/
# Executor Definitions
# https://circleci.com/docs/2.0/reusing-config/#authoring-reusable-executors
# **NOTE 1**: Pin to exact images using an ID (SHA). See https://circleci.com/docs/2.0/circleci-images/#using-a-docker-image-id-to-pin-an-image-to-a-fixed-version.
# (Using the tag in not necessary when pinning by ID, but include it anyway for documentation purposes.)
# **NOTE 2**: If you change the version of the docker images, also change the `cache_key` suffix.
# **NOTE 3**: If you change the version of Node.js provided by the docker images, also update `.devcontainer/recommended-Dockerfile` to match the new version.
executors:
default-executor:
parameters:
@ -72,7 +87,7 @@ executors:
type: string
default: medium
docker:
- image: circleci/node:12.14.1@sha256:f9de24fc0017059cc42ef7d07db060008af65a98b1f0cdd1ef3339213226bf6d
- image: circleci/node:14.16.1@sha256:951e12268fe692615bfd155c327bd910e10c99db98404badd03879f984c32b31
resource_class: << parameters.resource_class >>
working_directory: ~/ng
@ -90,7 +105,7 @@ executors:
machine:
# Windows preview image that includes the following:
# - Visual Studio 2019 build tools
# - Node 12
# - Node 14
# - yarn 1.17
# - Python 3 3.7.4
image: windows-server-2019-vs2019:201908-02
@ -140,8 +155,8 @@ commands:
- run:
name: Set up environment
environment:
CIRCLE_GIT_BASE_REVISION: << pipeline.git.base_revision >>
CIRCLE_GIT_REVISION: << pipeline.git.revision >>
CIRCLE_GIT_BASE_REVISION: << pipeline.git.base_revision >>
CIRCLE_GIT_REVISION: << pipeline.git.revision >>
command: ./.circleci/env.sh
- run:
# Configure git as the CircleCI `checkout` command does.
@ -175,6 +190,13 @@ commands:
name: Setting up alias domain for local host.
command: echo "127.0.0.1 $SAUCE_LOCALHOST_ALIAS_DOMAIN" | sudo tee -a /etc/hosts
save_month_to_file:
description: Store the current year and month in a file, so that it can be used for computing the cache key.
steps:
- run:
name: Save month to file
command: date +%Y-%m > month.txt
# Normally this would be an individual job instead of a command.
# But startup and setup time for each individual windows job are high enough to discourage
# many small jobs, so instead we use a command for setup unless the gain becomes significant.
@ -182,11 +204,17 @@ commands:
description: Setup windows node environment
steps:
- checkout
- save_month_to_file
# Install Bazel pre-requisites that aren't in the preconfigured CircleCI Windows VM.
- run: ./.circleci/windows-env.ps1
- run: node --version
- run: yarn --version
- run: yarn install --frozen-lockfile --non-interactive
- restore_cache:
keys:
- *cache_key_win
- *cache_key_win_fallback
# On Windows `~/` is not resolved when using as a CLI value. `../` results in the same path.
- run: yarn install --frozen-lockfile --non-interactive --cache-folder ../.cache/yarn
notify_webhook_on_fail:
description: Notify a webhook about failure
@ -210,6 +238,7 @@ jobs:
executor: default-executor
steps:
- checkout
- save_month_to_file
- init_environment
- run:
name: Rebase PR on target branch
@ -231,10 +260,10 @@ jobs:
- *cache_key_fallback
- run:
name: Running Yarn install
command: yarn install --frozen-lockfile --non-interactive
command: yarn install --frozen-lockfile --non-interactive --cache-folder ~/.cache/yarn
# Yarn's requests sometimes take more than 10mins to complete.
no_output_timeout: 45m
- run: yarn --cwd aio install --frozen-lockfile --non-interactive
- run: yarn --cwd aio install --frozen-lockfile --non-interactive --cache-folder ~/.cache/yarn
# Make the bazel directories and add a file to them if they don't exist already so that
# persist_to_workspace does not fail.
- run: |
@ -397,17 +426,13 @@ jobs:
- run: yarn --cwd aio deploy-production
test_aio_local:
parameters:
viewengine:
type: boolean
default: false
executor: default-executor
steps:
- custom_attach_workspace
- init_environment
- install_chrome_libs
# Build aio (with local Angular packages)
- run: yarn --cwd aio build-local<<# parameters.viewengine >>-with-viewengine<</ parameters.viewengine >>-ci
- run: yarn --cwd aio build-local-ci
# Run unit tests
- run: yarn --cwd aio test --progress=false --watch=false
# Run e2e tests
@ -415,7 +440,10 @@ jobs:
# Run PWA-score tests
- run: yarn --cwd aio test-pwa-score-localhost $CI_AIO_MIN_PWA_SCORE
# Check the bundle sizes.
- run: yarn --cwd aio payload-size aio-local<<# parameters.viewengine >>-viewengine<</ parameters.viewengine >>
- run: yarn --cwd aio payload-size aio-local
# Run tests with RxJS v7.
- run: yarn --cwd aio add rxjs@7.1.0
- run: yarn --cwd aio test --progress=false --watch=false
test_aio_tools:
executor: default-executor
@ -423,17 +451,13 @@ jobs:
- custom_attach_workspace
- init_environment
# Install
- run: yarn --cwd aio install --frozen-lockfile --non-interactive
- run: yarn --cwd aio install --frozen-lockfile --non-interactive --cache-folder ~/.cache/yarn
- run: yarn --cwd aio extract-cli-command-docs
# Run tools tests
- run: yarn --cwd aio tools-test
- run: ./aio/aio-builds-setup/scripts/test.sh
test_docs_examples:
parameters:
viewengine:
type: boolean
default: false
executor:
name: default-executor
resource_class: xlarge
@ -443,17 +467,21 @@ jobs:
- init_environment
- install_chrome_libs
# Install aio
- run: yarn --cwd aio install --frozen-lockfile --non-interactive
- run: yarn --cwd aio install --frozen-lockfile --non-interactive --cache-folder ~/.cache/yarn
# Run examples tests. The "CIRCLE_NODE_INDEX" will be set if "parallelism" is enabled.
# Since the parallelism is set to "5", there will be five parallel CircleCI containers.
# with either "0", "1", etc as node index. This can be passed to the "--shard" argument.
- run: yarn --cwd aio example-e2e --setup --local <<# parameters.viewengine >>--viewengine<</ parameters.viewengine >> --cliSpecsConcurrency=5 --shard=${CIRCLE_NODE_INDEX}/${CIRCLE_NODE_TOTAL}
- run: yarn --cwd aio example-e2e --setup --local --cliSpecsConcurrency=5 --shard=${CIRCLE_NODE_INDEX}/${CIRCLE_NODE_TOTAL}
# Run tests with RxJS v7.
# (Exclude some examples that are not yet compatible with v7.)
- run: yarn --cwd aio/tools/examples/shared add rxjs@7.1.0 && yarn --cwd aio boilerplate:add
- run: yarn --cwd aio example-e2e --cliSpecsConcurrency=5 --shard=${CIRCLE_NODE_INDEX}/${CIRCLE_NODE_TOTAL} --exclude=practical-observable-usage --exclude=upgrade-module --exclude=upgrade-phonecat
# This job should only be run on PR builds, where `CI_PULL_REQUEST` is not `false`.
aio_preview:
executor: default-executor
environment:
AIO_SNAPSHOT_ARTIFACT_PATH: &aio_preview_artifact_path 'aio/tmp/snapshot.tgz'
AIO_SNAPSHOT_ARTIFACT_PATH: &aio_preview_artifact_path 'aio/tmp/snapshot.tgz'
steps:
- custom_attach_workspace
- init_environment
@ -472,12 +500,11 @@ jobs:
- custom_attach_workspace
- init_environment
- install_chrome_libs
- run: yarn --cwd aio install --frozen-lockfile --non-interactive
- run: yarn --cwd aio install --frozen-lockfile --non-interactive --cache-folder ~/.cache/yarn
- run:
name: Wait for preview and run tests
command: node aio/scripts/test-preview.js $CI_PULL_REQUEST $CI_COMMIT $CI_AIO_MIN_PWA_SCORE
# The `build-npm-packages` tasks exist for backwards-compatibility with old scripts and
# tests that rely on the pre-Bazel `dist/packages-dist` output structure (build.sh).
# Having multiple jobs that independently build in this manner duplicates some work; we build
@ -500,16 +527,16 @@ jobs:
root: *workspace_location
paths:
- ng/dist/packages-dist
- ng/dist/angular-in-memory-web-api-dist
- ng/dist/zone.js-dist
# Save dependencies and bazel repository cache to use on subsequent runs.
- save_cache:
key: *cache_key
paths:
- "node_modules"
- "aio/node_modules"
- "~/bazel_repository_cache"
- "~/.cache/bazelisk"
- ~/.cache/yarn
- ~/bazel_repository_cache
- ~/.cache/bazelisk
# Build the ivy npm packages.
build-ivy-npm-packages:
@ -526,6 +553,7 @@ jobs:
root: *workspace_location
paths:
- ng/dist/packages-dist-ivy-aot
- ng/dist/angular-in-memory-web-api-dist-ivy-aot
- ng/dist/zone.js-dist-ivy-aot
# This job creates compressed tarballs (`.tgz` files) for all Angular packages and stores them as
@ -536,6 +564,8 @@ jobs:
publish_packages_as_artifacts:
executor: default-executor
environment:
AIMWA_PACKAGES_DIR: &aimwa_packages_dir 'dist/angular-in-memory-web-api-dist'
AIMWA_PACKAGES_ARCHIVES_DIR: &aimwa_packages_archives_dir 'dist/angular-in-memory-web-api-dist-archives'
NG_PACKAGES_DIR: &ng_packages_dir 'dist/packages-dist'
NG_PACKAGES_ARCHIVES_DIR: &ng_packages_archives_dir 'dist/packages-dist-archives'
ZONEJS_PACKAGES_DIR: &zonejs_packages_dir 'dist/zone.js-dist'
@ -550,9 +580,17 @@ jobs:
- store_artifacts:
path: *ng_packages_archives_dir
destination: angular
# Publish `zone.js` package.
# Publish the `angular-in-memory-web-api` package.
- run:
name: Create artifacts for zone.js package
name: Create artifacts for the `angular-in-memory-web-api` package
# Need to remove the zone.js.tgz before archive
command: ./scripts/ci/create-package-archives.sh $CI_BRANCH $CI_COMMIT $AIMWA_PACKAGES_DIR $AIMWA_PACKAGES_ARCHIVES_DIR
- store_artifacts:
path: *aimwa_packages_archives_dir
destination: angular-in-memory-web-api
# Publish the `zone.js` package.
- run:
name: Create artifacts for the `zone.js` package
# Need to remove the zone.js.tgz before archive
command: rm -rf $ZONEJS_PACKAGES_DIR/archive && ./scripts/ci/create-package-archives.sh $CI_BRANCH $CI_COMMIT $ZONEJS_PACKAGES_DIR $ZONEJS_PACKAGES_ARCHIVES_DIR
- store_artifacts:
@ -564,18 +602,6 @@ jobs:
publish_snapshot:
executor: default-executor
steps:
# See below - ideally this job should not trigger for non-upstream builds.
# But since it does, we have to check this condition.
- run:
name: Skip this job for Pull Requests and Fork builds
# Note: Using `CIRCLE_*` env variables (instead of those defined in `env.sh` so that this
# step can be run before `init_environment`.
command: >
if [[ -n "${CIRCLE_PR_NUMBER}" ]] ||
[[ "$CIRCLE_PROJECT_USERNAME" != "angular" ]] ||
[[ "$CIRCLE_PROJECT_REPONAME" != "angular" ]]; then
circleci step halt
fi
- custom_attach_workspace
- init_environment
# CircleCI has a config setting to force SSH for all github connections
@ -590,6 +616,14 @@ jobs:
command: 'openssl aes-256-cbc -d -in .circleci/github_token -md md5 -k "${KEY}" -out ~/.git_credentials'
- run: ./scripts/ci/publish-build-artifacts.sh
aio_misc:
executor: default-executor
steps:
- custom_attach_workspace
- run:
name: Check website provided in contributors.json file
command: yarn node aio/scripts/test-external-urls.js
aio_monitoring_stable:
executor: default-executor
steps:
@ -642,11 +676,6 @@ jobs:
name: Starting Saucelabs tunnel service
command: ./tools/saucelabs/sauce-service.sh run
background: true
# add module umd tsc compile option so the test can work
# properly in the legacy browsers
- run: yarn tsc -p packages --module UMD
- run: yarn tsc -p modules --module UMD
- run: yarn bazel build //packages/zone.js:npm_package
# Build test fixtures for a test that rely on Bazel-generated fixtures. Note that disabling
# specific tests which are reliant on such generated fixtures is not an option as SystemJS
# in the Saucelabs legacy job always fetches referenced files, even if the imports would be
@ -655,10 +684,26 @@ jobs:
- run:
name: Preparing Bazel-generated fixtures required in legacy tests
command: |
yarn bazel build //packages/core/test:downleveled_es5_fixture
yarn bazel build \
//packages/core/test:downleveled_es5_fixture \
//packages/common/locales
# Needed for the ES5 downlevel reflector test in `packages/core/test/reflection`.
mkdir -p dist/all/@angular/core/test/reflection/
cp dist/bin/packages/core/test/reflection/es5_downleveled_inheritance_fixture.js \
dist/all/@angular/core/test/reflection/es5_downleveled_inheritance_fixture.js
# Locale files are needed for i18n tests running within Saucelabs. These are added
# directly as sources so that the TypeScript compilation of `/packages/tsconfig.json`
# can succeed. Note that the base locale and currencies files are checked-in, so
# we do not need to re-generate those through Bazel.
mkdir -p packages/common/locales/extra
cp dist/bin/packages/common/locales/*.ts packages/common/locales
cp dist/bin/packages/common/locales/extra/*.ts packages/common/locales/extra
# add module umd tsc compile option so the test can work
# properly in the legacy browsers
- run: yarn tsc -p packages/tsconfig-legacy-saucelabs.json --module UMD
- run: yarn tsc -p modules --module UMD
- run: yarn bazel build //packages/zone.js:npm_package
- run:
# Waiting on ready ensures that we don't run tests too early without Saucelabs not being ready.
name: Waiting for Saucelabs tunnel to connect
@ -694,31 +739,31 @@ jobs:
# repository to be able to support arbitrary SHAs.
- *components_repo_unit_tests_cache_key_fallback
- run:
name: "Fetching angular/components repository"
name: 'Fetching angular/components repository'
command: ./scripts/ci/clone_angular_components_repo.sh
- run:
# Run yarn install to fetch the Bazel binaries as used in the components repo.
name: Installing dependencies.
# TODO: remove this once the repo has been updated to use NodeJS v12 and Yarn 1.19.1.
# We temporarily ignore the "engines" because the Angular components repository has
# minimum dependency on NodeJS v12 and Yarn 1.19.1, but the framework repository uses
# older versions.
command: yarn --ignore-engines --cwd ${COMPONENTS_REPO_TMP_DIR} install --frozen-lockfile --non-interactive
command: yarn --cwd ${COMPONENTS_REPO_TMP_DIR} install --frozen-lockfile --non-interactive --cache-folder ~/.cache/yarn
- save_cache:
key: *components_repo_unit_tests_cache_key
paths:
# Temporary directory must be kept in sync with the `$COMPONENTS_REPO_TMP_DIR` env
# variable. It needs to be hardcoded here, because env variables interpolation is
# not supported.
- "/tmp/angular-components-repo"
- '/tmp/angular-components-repo'
- run:
# Updates the `angular/components` `package.json` file to refer to the release output
# inside the `packages-dist` directory. Note that it's not necessary to perform a yarn
# install as Bazel runs Yarn automatically when needed.
name: Setting up release packages.
command: node scripts/ci/update-deps-to-dist-packages.js ${COMPONENTS_REPO_TMP_DIR}/package.json dist/packages-dist/
# inside the `packages-dist` directory.
name: Setting up framework release packages.
command: node scripts/ci/update-framework-deps-to-dist-packages.js ${COMPONENTS_REPO_TMP_DIR}/package.json dist/packages-dist/
- run:
name: "Running `angular/components` unit tests"
# Run `yarn install` again to install the Angular packages from `packages-dist/` and update the lockfile.
# NOTE: We cannot rely on Bazel to run `yarn install`, because it uses the `--frozen-lockfile` flag and fails.
name: Installing local Angular packages.
command: yarn --cwd ${COMPONENTS_REPO_TMP_DIR} install --non-interactive --cache-folder ~/.cache/yarn
- run:
name: 'Running `angular/components` unit tests'
command: ./scripts/ci/run_angular_components_unit_tests.sh
test_zonejs:
@ -730,19 +775,19 @@ jobs:
- init_environment
- install_java
# Install
- run: yarn --cwd packages/zone.js install --frozen-lockfile --non-interactive
- run: yarn --cwd packages/zone.js install --frozen-lockfile --non-interactive --cache-folder ~/.cache/yarn
# Run zone.js tools tests
- run: yarn --cwd packages/zone.js promisetest
- run: yarn --cwd packages/zone.js promisefinallytest
- run: yarn bazel build //packages/zone.js:npm_package &&
cp dist/bin/packages/zone.js/npm_package/bundles/zone-mix.umd.js ./packages/zone.js/test/extra/ &&
cp dist/bin/packages/zone.js/npm_package/bundles/zone-patch-electron.umd.js ./packages/zone.js/test/extra/ &&
cp dist/bin/packages/zone.js/npm_package/bundles/zone.umd.js ./packages/zone.js/build/test/closure/zone.js
cp dist/bin/packages/zone.js/npm_package/bundles/zone-mix.umd.js ./packages/zone.js/test/extra/ &&
cp dist/bin/packages/zone.js/npm_package/bundles/zone-patch-electron.umd.js ./packages/zone.js/test/extra/ &&
cp dist/bin/packages/zone.js/npm_package/bundles/zone.umd.js ./packages/zone.js/build/test/closure/zone.js
- run: yarn --cwd packages/zone.js jest:test
- run: yarn --cwd packages/zone.js jest:nodetest
- run: yarn --cwd packages/zone.js electrontest
- run: yarn --cwd packages/zone.js closuretest
- run: yarn --cwd packages/zone.js/test/typings install --frozen-lockfile --non-interactive
- run: yarn --cwd packages/zone.js/test/typings install --frozen-lockfile --non-interactive --cache-folder ~/.cache/yarn
- run: yarn --cwd packages/zone.js/test/typings test
# Windows jobs
@ -753,11 +798,11 @@ jobs:
- setup_win
- run:
name: Build all windows CI targets
command: yarn bazel build --build_tag_filters=-ivy-only,-no-windows //packages/compiler-cli/... //tools/ts-api-guardian/...
command: yarn bazel build --build_tag_filters=-ivy-only //packages/compiler-cli/...
no_output_timeout: 15m
- run:
name: Test all windows CI targets
command: yarn bazel test --build_tag_filters=-no-windows --test_tag_filters="-ivy-only,-no-windows,-browser:chromium-local" //packages/compiler-cli/... //tools/ts-api-guardian/...
command: yarn bazel test --test_tag_filters="-ivy-only,-browser:chromium-local" //packages/compiler-cli/...
no_output_timeout: 15m
test_ivy_aot_win:
@ -766,13 +811,17 @@ jobs:
- setup_win
- run:
name: Build all windows CI targets
command: yarn bazel build --config=ivy --build_tag_filters=-no-ivy-aot,-no-windows,-fixme-ivy-aot //packages/compiler-cli/... //tools/ts-api-guardian/...
command: yarn bazel build --config=ivy --build_tag_filters=-no-ivy-aot,-fixme-ivy-aot //packages/compiler-cli/...
no_output_timeout: 15m
- run:
name: Test all windows CI targets
command: yarn bazel test --config=ivy --build_tag_filters=-no-windows --test_tag_filters="-no-ivy-aot,-no-windows,-fixme-ivy-aot,-browser:chromium-local" //packages/compiler-cli/... //tools/ts-api-guardian/... //packages/localize/...
command: yarn bazel test --config=ivy --test_tag_filters="-no-ivy-aot,-fixme-ivy-aot,-browser:chromium-local" //packages/compiler-cli/... //packages/localize/...
no_output_timeout: 15m
# Save dependencies to use on subsequent runs.
- save_cache:
key: *cache_key_win
paths:
- ~/.cache/yarn
workflows:
version: 2
@ -809,22 +858,12 @@ workflows:
- test_aio_local:
requires:
- build-npm-packages
- test_aio_local:
name: test_aio_local_viewengine
viewengine: true
requires:
- build-npm-packages
- test_aio_tools:
requires:
- build-npm-packages
- test_docs_examples:
requires:
- build-npm-packages
- test_docs_examples:
name: test_docs_examples_viewengine
viewengine: true
requires:
- build-npm-packages
- aio_preview:
# Only run on PR builds. (There can be no previews for non-PR builds.)
<<: *only_on_pull_requests
@ -837,34 +876,22 @@ workflows:
requires:
- build-npm-packages
- publish_snapshot:
# Note: no filters on this job because we want it to run for all upstream branches
# We'd really like to filter out pull requests here, but not yet available:
# https://discuss.circleci.com/t/workflows-pull-request-filter/14396/4
# Instead, the job just exits immediately at the first step.
<<: *only_release_branches
requires:
# Only publish if tests and integration tests pass
- test
- test_ivy_aot
# Only publish if `aio`/`docs` tests using the locally built Angular packages pass
- test_aio_local
- test_aio_local_viewengine
- test_docs_examples
- test_docs_examples_viewengine
# Get the artifacts to publish from the build-packages-dist job
# since the publishing script expects the legacy outputs layout.
- build-npm-packages
- build-ivy-npm-packages
- legacy-unit-tests-saucelabs
# Temporarily disabled components-repo-unit-tests to update rules_nodejs to 2.0.0. Breaking changes in
# rules_nodejs create a dependency sandwich between angular/angular & angular/components that are very
# difficult and time consuming to resolve and involve patching @angular/bazel in components repo such
# as https://github.com/angular/components/commit/9e7ba251207df77164d73d66620e619bcbc4d2ad. It is simpler to
# 1) land angular/angular upgrade to rule_nodejs 2.0.0 which has breaking changes
# 2) land angular/components upgrade to rules_nodejs 2.0.0 using the @angular/bazel builds snapshot
# 3) update angular/angular to the landed components commit and re-enable these tests
# - components-repo-unit-tests:
# requires:
# - build-npm-packages
- components-repo-unit-tests:
requires:
- build-npm-packages
- test_zonejs:
requires:
- setup
@ -878,6 +905,9 @@ workflows:
monitoring:
jobs:
- setup
- aio_misc:
requires:
- setup
- aio_monitoring_stable:
requires:
- setup
@ -906,4 +936,4 @@ workflows:
- schedule:
<<: *only_on_master
# Runs monitoring jobs at 10:00AM every day.
cron: "0 10 * * *"
cron: '0 10 * * *'

View File

@ -74,7 +74,7 @@ setPublicVar COMPONENTS_REPO_TMP_DIR "/tmp/angular-components-repo"
setPublicVar COMPONENTS_REPO_URL "https://github.com/angular/components.git"
setPublicVar COMPONENTS_REPO_BRANCH "master"
# **NOTE**: When updating the commit SHA, also update the cache key in the CircleCI `config.yml`.
setPublicVar COMPONENTS_REPO_COMMIT "09e68db8ed5b1253f2fe38ff954ef0df019fc25a"
setPublicVar COMPONENTS_REPO_COMMIT "d090617912da8e70aa336aa5b4d804b1b535402e"
####################################################################################################

View File

@ -41,8 +41,8 @@ copy .circleci\bazel.windows.rc ${Env:USERPROFILE}\.bazelrc
####################################################################################################
# Install specific version of node.
####################################################################################################
nvm install 12.14.1
nvm use 12.14.1
nvm install 14.16.1
nvm use 14.16.1
# These Bazel prereqs aren't needed because the CircleCI image already includes them.
# choco install yarn --version 1.16.0 --no-progress

View File

@ -1,8 +1,8 @@
# Image metadata and config.
# Ideally, the image version should be what we use on CI.
# See `executors > browsers-executor` in `.circleci/config.yml`.
FROM circleci/node:10-browsers
# Ideally, the Node.js version should match what we use on CI.
# See `executors > default-executor` in `.circleci/config.yml`.
FROM circleci/node:14-browsers
LABEL name="Angular dev environment" \
description="This image can be used to create a dev environment for building Angular." \
@ -16,13 +16,9 @@ EXPOSE 4000 4200 4433 5000 8080 9876
USER root
# Configure `Node.js`/`npm` and install utilities.
# Configure `Node.js`/`npm`.
RUN npm config --global set user root
# Ideally, the version should be what we use on CI.
# See `commands > overwrite_yarn` in `.circleci/config.yml`.
RUN npm install --global yarn@latest
# Go! (And keep going.)
CMD ["tail", "--follow", "/dev/null"]

3
.gitattributes vendored
View File

@ -5,8 +5,5 @@
*.js eol=lf
*.ts eol=lf
# API guardian patch must always use LF for tests to work
*.patch eol=lf
# Must keep Windows line ending to be parsed correctly
scripts/windows/packages.txt eol=crlf

View File

@ -1,15 +1,6 @@
> 注意新版本文档位于aio分支下master分支下是老版本的文档。
Please help us process issues more efficiently by filing an
issue using one of the following templates:
> 对于错别字或明显的语法错误,建议直接发 PR在content目录下相应的文件上直接编辑保存时就会自动变成PR
https://github.com/angular/angular/issues/new/choose
出错的URL
错误的内容(请拷贝进来一份精确的出错文本,以便我定位):
建议的修改方式(可选):
英雄留名会出现在鸣谢清单中默认使用你的github id
Thank you!

View File

@ -1,69 +0,0 @@
---
name: "\U0001F41E Bug 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-ivy
-->
<!-- ✍️--> 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.
A good way to make a minimal reproduction is to create a new app via `ng new repro-app` and add the minimum possible code to show the problem.
Share the link to the repo below along with step-by-step instructions to reproduce the problem, as well as expected and actual behavior.
Issues that don't have enough info and can't be reproduced will be closed.
You can read more about issue submission guidelines here: https://github.com/angular/angular/blob/master/CONTRIBUTING.md#submit-issue
-->
## 🔥 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,84 @@
name: Bug Report
description: Report a bug in the Angular Framework
body:
- type: dropdown
id: affected-packages
attributes:
label: Which @angular/* package(s) are the source of the bug?
options:
- animations
- bazel
- common
- compiler-cli
- compiler
- elements
- forms
- language-service
- localize
- platform-browser-dynamic
- platform-browser
- platform-server
- router
- service-worker
- upgrade
- Don't known / other
multiple: true
validations:
required: true
- type: dropdown
id: is-regression
attributes:
label: Is this a regression?
options:
- 'Yes'
- 'No'
validations:
required: true
- type: textarea
id: description
attributes:
label: Description
validations:
required: true
- type: input
id: reproduction
attributes:
label: Please provide a link to a minimal reproduction of the bug
- type: textarea
id: exception-or-error
attributes:
label: Please provide the exception or error you saw
render: true
- type: textarea
id: environment
attributes:
label: Please provide the environment you discovered this bug in
render: true
placeholder: |
Angular CLI: 12.0.5
Node: 14.17.0
Package Manager: yarn 1.22.10
OS: linux x64
Angular: 12.0.5
... animations, cli, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router
Package Version
---------------------------------------------------------
@angular-devkit/architect 0.1200.5
@angular-devkit/build-angular 12.0.5
@angular-devkit/core 12.0.5
rxjs 6.6.7
typescript 4.2.4
- type: textarea
id: other
attributes:
label: Anything else?

View File

@ -1,32 +0,0 @@
---
name: "\U0001F680 Feature 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
### Relevant 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?

View File

@ -0,0 +1,46 @@
name: 'Feature Request'
description: Suggest a feature for Angular Framework
body:
- type: dropdown
id: affected-packages
attributes:
label: Which @angular/* package(s) are relevant/releated to the feature request?
options:
- animations
- bazel
- common
- compiler-cli
- compiler
- elements
- forms
- language-service
- localize
- platform-browser-dynamic
- platform-browser
- platform-server
- router
- service-worker
- upgrade
multiple: true
- type: textarea
id: description
attributes:
label: Description
validations:
required: true
- type: textarea
id: proposed-solution
attributes:
label: Proposed solution
validations:
required: true
- type: textarea
id: alternatives-considered
attributes:
label: Alternatives considered
validations:
required: true

View File

@ -1,55 +0,0 @@
---
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. -->

42
.github/ISSUE_TEMPLATE/3-docs-bug.yaml vendored Normal file
View File

@ -0,0 +1,42 @@
name: 'Docs or angular.io Bug Report'
description: Report an issue in Angular's documentation or angular.io application
body:
- type: textarea
id: description
attributes:
label: Description
validations:
required: true
- type: input
id: affected-url
attributes:
label: What is the affected URL?
- type: textarea
id: reproduction-steps
attributes:
label: Please provide the steps to reproduce the issue
- type: textarea
id: expected-vs-actual-behavior
attributes:
label: Please provide the expected behavior vs the actual behavior you encountered
- type: textarea
id: screenshot
attributes:
label: Please provide a screenshot if possible
- type: textarea
id: exception-or-error
attributes:
label: Please provide the exception or error you saw
render: true
- type: textarea
id: browser-info
attributes:
label: Is this a browser-specific issue? If so, please specify the device, browser, and version.
render: true

View File

@ -1,11 +1,6 @@
---
name: ⚠️ Security issue disclosure
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

@ -1,16 +1,11 @@
---
name: "❓ Support request"
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:
You can get your questions answered using other communication channels. Please see:
https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question
Thank you!
🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑🛑

View File

@ -1,13 +1,8 @@
---
name: "\U0001F6E0 Angular CLI"
name: "Angular 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

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

View File

@ -4,7 +4,7 @@
size:
disabled: false
maxSizeIncrease: 2000
circleCiStatusName: "ci/circleci: test_ivy_aot"
circleCiStatusName: 'ci/circleci: test_ivy_aot'
# options for the merge plugin
merge:
@ -13,85 +13,84 @@ merge:
# set to true to disable
disabled: false
# the name of the status
context: "ci/angular: merge status"
context: 'ci/angular: merge status'
# text to show when all checks pass
successText: "All checks passed!"
successText: 'All checks passed!'
# text to show when some checks are failing
failureText: "The following checks are failing:"
failureText: 'The following checks are failing:'
# the g3 status will be added to your pull requests if they include files that match the patterns
g3Status:
# set to true to disable
disabled: false
# the name of the status
context: "google3"
context: 'google3'
# text to show when the status is pending, {{PRNumber}} will be replaced by the PR number
pendingDesc: "Googler: run g3sync presubmit {{PRNumber}}"
pendingDesc: 'Googler: run g3sync presubmit {{PRNumber}}'
# text to show when the status is success
successDesc: "Does not affect google3"
successDesc: 'Does not affect google3'
# link to use for the details
url: "http://go/angular/g3sync"
url: 'http://go/angular/g3sync'
# list of patterns to check for the files changed by the PR
# this list must be manually kept in sync with google3/third_party/javascript/angular2/copy.bara.sky
include:
- "LICENSE"
- "modules/benchmarks/**"
- "modules/system.d.ts"
- "packages/**"
- "dev-infra/benchmark/driver-utilities/**"
- 'LICENSE'
- 'modules/benchmarks/**'
- 'modules/system.d.ts'
- 'packages/**'
- 'dev-infra/benchmark/driver-utilities/**'
# list of patterns to ignore for the files changed by the PR
exclude:
- "packages/*"
- "packages/bazel/*"
- "packages/bazel/src/api-extractor/**"
- "packages/bazel/src/builders/**"
- "packages/bazel/src/ng_package/**"
- "packages/bazel/src/protractor/**"
- "packages/bazel/src/schematics/**"
- "packages/compiler-cli/src/ngcc/**"
- "packages/compiler-cli/linker/**"
- "packages/compiler-cli/ngcc/**"
- "packages/compiler-cli/src/ngtsc/sourcemaps/**"
- "packages/docs/**"
- "packages/elements/schematics/**"
- "packages/examples/**"
- "packages/language-service/**"
- "packages/localize/**"
- "packages/private/**"
- "packages/service-worker/**"
- "packages/common/locales/**"
- "packages/http/**"
- "**/.gitignore"
- "**/.gitkeep"
- "**/yarn.lock"
- "**/package.json"
- "**/third_party/**"
- "**/tsconfig-build.json"
- "**/tsconfig.json"
- "**/rollup.config.js"
- "**/BUILD.bazel"
- "**/*.md"
- "packages/**/integrationtest/**"
- "packages/**/test/**"
- "packages/zone.js/*"
- "packages/zone.js/dist/**"
- "packages/zone.js/doc/**"
- "packages/zone.js/example/**"
- "packages/zone.js/scripts/**"
- 'packages/*'
- 'packages/bazel/*'
- 'packages/bazel/src/api-extractor/**'
- 'packages/bazel/src/builders/**'
- 'packages/bazel/src/ng_package/**'
- 'packages/bazel/src/protractor/**'
- 'packages/bazel/src/schematics/**'
- 'packages/compiler-cli/src/ngcc/**'
- 'packages/compiler-cli/linker/**'
- 'packages/compiler-cli/ngcc/**'
- 'packages/compiler-cli/src/ngtsc/sourcemaps/**'
- 'packages/docs/**'
- 'packages/elements/schematics/**'
- 'packages/examples/**'
- 'packages/language-service/**'
- 'packages/localize/**'
- 'packages/private/**'
- 'packages/service-worker/**'
- 'packages/common/locales/**'
- 'packages/http/**'
- '**/.gitignore'
- '**/.gitkeep'
- '**/yarn.lock'
- '**/package.json'
- '**/third_party/**'
- '**/tsconfig-build.json'
- '**/tsconfig.json'
- '**/rollup.config.js'
- '**/BUILD.bazel'
- '**/*.md'
- 'packages/**/integrationtest/**'
- 'packages/**/test/**'
- 'packages/zone.js/*'
- 'packages/zone.js/dist/**'
- 'packages/zone.js/doc/**'
- 'packages/zone.js/example/**'
- 'packages/zone.js/scripts/**'
# comment that will be added to a PR when there is a conflict, leave empty or set to false to disable
mergeConflictComment: "Hi @{{PRAuthor}}! This PR has merge conflicts due to recent upstream merges.\nPlease help to unblock it by resolving these conflicts. Thanks!"
# label to monitor
mergeLabel: "action: merge"
mergeLabel: 'action: merge'
# adding any of these labels will also add the merge label
mergeLinkedLabels:
- "action: merge-assistance"
- 'action: merge-assistance'
# list of checks that will determine if the merge label can be added
checks:
# require that the PR has reviews from all requested reviewers
#
# This enables us to request reviews from both eng and tech writers, or multiple eng folks, and prevents accidental merges.
@ -102,27 +101,25 @@ merge:
noConflict: true
# list of labels that a PR needs to have, checked with a regexp (e.g. "target:" will work for the label "target: master")
requiredLabels:
- "target: *"
- "cla: yes"
- 'target: *'
- 'cla: yes'
# list of labels that a PR shouldn't have, checked after the required labels with a regexp
forbiddenLabels:
- "target: TBD"
- "action: cleanup"
- "action: review"
- "state: blocked"
- "cla: no"
- 'target: TBD'
- 'action: cleanup'
- 'action: review'
- 'state: blocked'
- 'cla: no'
# list of PR statuses that need to be successful
requiredStatuses:
- "ci/circleci: build"
- "ci/circleci: lint"
- "ci/circleci: publish_snapshot"
- "ci/angular: size"
- "cla/google"
- "google3"
- "pullapprove"
- 'ci/circleci: build'
- 'ci/circleci: lint'
- 'ci/angular: size'
- 'cla/google'
- 'google3'
- 'pullapprove'
# the comment that will be added when the merge label is added despite failing checks, leave empty or set to false to disable
# {{MERGE_LABEL}} will be replaced by the value of the mergeLabel option
@ -137,40 +134,29 @@ triage:
defaultMilestone: 82,
# arrays of labels that determine if an issue has been triaged by the caretaker
l1TriageLabels:
-
- "comp: *"
- - 'comp: *'
# arrays of labels that determine if an issue has been fully triaged
l2TriageLabels:
-
- "P0"
- "comp: *"
-
- "P1"
- "comp: *"
-
- "P2"
- "comp: *"
-
- "P3"
- "comp: *"
-
- "P4"
- "comp: *"
-
- "P5"
- "comp: *"
-
- "feature"
- "comp: *"
-
- "discussion"
- "comp: *"
-
- "needs clarification"
- "comp: *"
-
- "needs reproduction"
- "comp: *"
- - 'P0'
- 'comp: *'
- - 'P1'
- 'comp: *'
- - 'P2'
- 'comp: *'
- - 'P3'
- 'comp: *'
- - 'P4'
- 'comp: *'
- - 'P5'
- 'comp: *'
- - 'feature'
- 'comp: *'
- - 'discussion'
- 'comp: *'
- - 'needs clarification'
- 'comp: *'
- - 'needs reproduction'
- 'comp: *'
# options for the triage PR plugin
triagePR:
@ -182,16 +168,14 @@ triagePR:
defaultMilestone: 82,
# arrays of labels that determine if a PR has been triaged by the caretaker
l1TriageLabels:
-
- "comp: *"
- - 'comp: *'
# arrays of labels that determine if a PR has been fully triaged
l2TriageLabels:
-
- "comp: *"
- - 'comp: *'
# options for rerunning CI
rerunCircleCI:
# set to true to disable
disabled: false
# the label which when added triggers a rerun of the default CircleCI workflow
triggerRerunLabel: "action: rerun CI at HEAD"
triggerRerunLabel: 'action: rerun CI at HEAD'

15
.github/workflows/feature-requests.yml vendored Normal file
View File

@ -0,0 +1,15 @@
name: Feature request triage bot
on:
schedule:
# Run at 14:00 every day
- cron: '0 14 * * *'
jobs:
feature_triage:
if: github.repository == 'angular/angular'
runs-on: ubuntu-latest
steps:
- uses: angular/dev-infra/github-actions/feature-request@f83903fe1ac848407ef81465f66588e5accb6537
with:
angular-robot-key: ${{ secrets.ANGULAR_ROBOT_PRIVATE_KEY }}

87
.gitignore vendored
View File

@ -1,37 +1,54 @@
.DS_STORE
/dist/
/bazel-out
/integration/bazel/bazel-*
*.log
node_modules
_temp
bower_components
jspm_packages
**/packages
build
# Include when developing application packages.
pubspec.lock
.pub
.packages
*.map
.DS_Store
**/*.iml
.idea
.vscode
**/js/latest/api
**/ts/latest/api
**/dart/latest/api
**/docs/**/_fragments
_.*
**/resources/zips
public/docs/xref-*.*
_zip-output
www*
npm-debug*.log*
**/debug.log
*.plnkr.html
plnkr.html
*.eplnkr.html
eplnkr.html
*plnkr.no-link.html
#public/docs/*/latest/guide/cheatsheet.json
protractor-results.txt
link-checker-results.txt
/dist
/public/docs/dart
/public/docs/ts/_cache
/public/docs/_examples/*/dart
.c9
.idea/
.devcontainer/*
!.devcontainer/README.md
!.devcontainer/recommended-devcontainer.json
!.devcontainer/recommended-Dockerfile
.settings/
.vscode/launch.json
.vscode/settings.json
.vscode/tasks.json
*.swo
*.swp
modules/.settings
modules/.vscode
.vimrc
.nvimrc
# Don't check in secret files
*secret.js
# Ignore npm/yarn debug log
npm-debug.log
yarn-error.log
# build-analytics
.build-analytics
# rollup-test output
/modules/rollup-test/dist/
# User specific bazel settings
.bazelrc.user
# User specific ng-dev settings
.ng-dev.user*
.notes.md
baseline.json
# Ignore .history for the xyz.local-history VSCode extension
.history
# Husky
.husky/_

11
.husky/commit-msg Executable file
View File

@ -0,0 +1,11 @@
#!/bin/sh
. "$(dirname $0)/_/husky.sh"
set +e
yarn -s ng-dev commit-message pre-commit-validate --file $1 2>/dev/null
if [ $? -ne 0 ]; then
echo "WARNING: failed to run commit message validation (ng-dev commit-mesage pre-commit-validate)"
fi
exit 0;

11
.husky/pre-commit Executable file
View File

@ -0,0 +1,11 @@
#!/bin/sh
. "$(dirname $0)/_/husky.sh"
set +e
yarn -s ng-dev format staged 2>/dev/null
if [ $? -ne 0 ]; then
echo "WARNING: failed to run file formatting (ng-dev format staged)"
fi
exit 0;

11
.husky/prepare-commit-msg Executable file
View File

@ -0,0 +1,11 @@
#!/bin/sh
. "$(dirname $0)/_/husky.sh"
set +e
yarn -s ng-dev commit-message restore-commit-message-draft $1 $2 2>/dev/null
if [ $? -ne 0 ]; then
echo "WARNING: failed to attempt to restore commit message draft (ng-dev commit-message restore-commit-message-draft)"
fi
exit 0;

View File

@ -15,5 +15,6 @@ export const caretaker: CaretakerConfig = {
name: 'Initial Triage Queue',
query: `is:open no:milestone`,
}
]
],
caretakerGroup: 'angular-caretaker',
};

View File

@ -4,6 +4,11 @@ import {FormatConfig} from '../dev-infra/format/config';
* Configuration for the `ng-dev format` command.
*/
export const format: FormatConfig = {
'prettier': {
'matchers': [
'**/*.{yaml,yml}',
]
},
'clang-format': {
'matchers': [
'**/*.{js,ts}',
@ -21,6 +26,11 @@ export const format: FormatConfig = {
'!dev-infra/build-worker.js',
// Do not format compliance test-cases since they must match generated code
'!packages/compiler-cli/test/compliance/test_cases/**/*.js',
// Do not format the locale files which are checked-in for Google3, but generated using
// the `generate-locales-tool` from `packages/common/locales`.
'!packages/core/src/i18n/locale_en.ts',
'!packages/common/locales/closure-locale.ts',
'!packages/common/src/i18n/currencies.ts',
]
},
'buildifier': true

View File

@ -14,6 +14,7 @@ export const merge: DevInfraMergeConfig['merge'] = async api => {
mergeReadyLabel: /^action: merge(-assistance)?/,
caretakerNoteLabel: /^(action: merge-assistance)|(PullApprove: disable)/,
commitMessageFixupLabel: 'commit message fixup',
breakingChangeLabel: 'flag: breaking change',
// We can pick any of the NPM packages as we are in a monorepo where all packages are
// published together with the same version and branching.
labels: await getDefaultTargetLabelConfiguration(api, github, release),
@ -24,5 +25,9 @@ export const merge: DevInfraMergeConfig['merge'] = async api => {
'master': '5aeb9a4124922d8ac08eb73b8f322905a32b0b3a',
'10.0.x': '27b95ba64a5d99757f4042073fd1860e20e3ed24',
},
// `dev-infra` and `docs-infra` are not affecting the public NPM packages. Similarly,
// the `bazel` package is not considered part of the public API so that features
// can land in patch branches.
targetLabelExemptScopes: ['dev-infra', 'docs-infra', 'bazel']
};
};

View File

@ -1,5 +1,4 @@
import {join} from 'path';
import {exec} from 'shelljs';
import {ReleaseConfig} from '../dev-infra/release/config';
/** Configuration for the `ng-dev release` command. */
@ -23,15 +22,14 @@ export const release: ReleaseConfig = {
'@angular/service-worker',
'@angular/upgrade',
],
buildPackages: async () => {
buildPackages: async (stampForRelease: boolean) => {
// The buildTargetPackages function is loaded at runtime as the loading the script causes an
// invocation of bazel.
const {buildTargetPackages} = require(join(__dirname, '../scripts/build/package-builder'));
return buildTargetPackages('dist/release-output', false, 'Release', true);
return buildTargetPackages('dist/release-output', false, 'Release', stampForRelease);
},
// TODO: This can be removed once there is an org-wide tool for changelog generation.
generateReleaseNotesForHead: async () => {
exec('yarn -s gulp changelog', {cwd: join(__dirname, '../')});
releaseNotes: {
hiddenScopes: ['aio', 'dev-infra', 'docs-infra', 'zone.js'],
},
releasePrLabels: ['comp: build & ci', 'action: merge', 'PullApprove: disable'],
};

1
.npmrc Normal file
View File

@ -0,0 +1 @@
engine-strict = true

2
.nvmrc
View File

@ -1 +1 @@
6
14.16.1

9
.prettierrc Normal file
View File

@ -0,0 +1,9 @@
{
"printWidth": 100,
"tabWidth": 2,
"tabs": false,
"singleQuote": true,
"semicolon": true,
"quoteProps": "preserve",
"bracketSpacing": false
}

View File

@ -37,7 +37,6 @@
# See reviewer list under `required-minimum-review` group. Team member names and
# usernames are managed there.
####################################################################################
# Approval Groups
####################################################################################
@ -46,10 +45,10 @@
# =========================================================
# Used for approving minor changes, large-scale refactorings, and in emergency situations.
#
# alxhub
# IgorMinar
# jelbourn
# josephperrott
# mhevery
#
# =========================================================
# @angular/framework-global-approvers-for-docs-only-changes
@ -58,9 +57,8 @@
#
# aikidave
# gkalpak
# kapunahelewong
# petebacondarwin
# TeriGlover
version: 3
@ -79,15 +77,11 @@ meta:
#
# Also note that the ordering of groups matters in this file. The only groups visible to the current
# one are those that appear above it.
no-groups-above-this-pending: &no-groups-above-this-pending
len(groups.active.pending.exclude("required-minimum-review").exclude("global-approvers").exclude("global-docs-approvers")) == 0
no-groups-above-this-rejected: &no-groups-above-this-rejected
len(groups.active.rejected.exclude("required-minimum-review").exclude("global-approvers").exclude("global-docs-approvers")) == 0
no-groups-above-this-active: &no-groups-above-this-active
len(groups.active.exclude("required-minimum-review").exclude("global-approvers").exclude("global-docs-approvers")) == 0
no-groups-above-this-pending: &no-groups-above-this-pending len(groups.active.pending.exclude("required-minimum-review").exclude("global-approvers").exclude("global-docs-approvers")) == 0
no-groups-above-this-rejected: &no-groups-above-this-rejected len(groups.active.rejected.exclude("required-minimum-review").exclude("global-approvers").exclude("global-docs-approvers")) == 0
can-be-global-approved: &can-be-global-approved "\"global-approvers\" not in groups.approved"
can-be-global-docs-approved: &can-be-global-docs-approved "\"global-docs-approvers\" not in groups.approved"
can-be-global-approved: &can-be-global-approved '"global-approvers" not in groups.approved'
can-be-global-docs-approved: &can-be-global-docs-approved '"global-docs-approvers" not in groups.approved'
defaults: &defaults
reviews:
# Authors provide their approval implicitly, this approval allows for a reviewer
@ -100,25 +94,25 @@ meta:
# turn on 'draft' support
# https://docs.pullapprove.com/config/github-api-version/
# https://developer.github.com/v3/previews/#draft-pull-requests
github_api_version: "shadow-cat-preview"
github_api_version: 'shadow-cat-preview'
pullapprove_conditions:
# https://docs.pullapprove.com/config/overrides/
# Note that overrides are processed in order.
overrides:
# For PRs which are still being worked on, either still in draft mode or indicated through WIP in
# title or label, PullApprove stays in a pending state until its ready for review.
- condition: "'WIP' not in title"
unmet_status: pending
explanation: "Waiting to send reviews as PR is WIP"
- condition: "'PR state: WIP' not in labels"
unmet_status: pending
explanation: "Waiting to send reviews as PR is WIP"
- condition: "not draft"
unmet_status: pending
explanation: "Waiting to send reviews as PR is in draft"
- if: "draft or 'WIP' in title or 'PR state: WIP' in labels"
status: pending
explanation: 'Waiting to send reviews as PR is WIP'
# Disable PullApprove on specific PRs by adding the `PullApprove: disable` label
- condition: "'PullApprove: disable' not in labels"
unmet_status: success
- if: "'PullApprove: disable' in labels"
status: success
explanation: "PullApprove skipped because of 'PullApprove: disable' label"
# If no file matching based groups are active, report this pull request as failing. Most likely,
# the PR author would need to update the PullApprove config, or create new group.
- if: len(groups.active.exclude("required-minimum-review").exclude("global-*")) == 0 and len(groups.approved.include("global-*")) == 0
status: failure
explanation: 'At least one group must match this PR. Please update an existing review group, or create a new group.'
groups:
# =========================================================
@ -175,41 +169,36 @@ groups:
reviewed_for: ignored # All reviews apply to this group whether noted via Reviewed-for or not
reviewers:
users:
- aikidave # Dave Shevitz
- alan-agius4 # Alan Agius
- alxhub # Alex Rickabaugh
- AndrewKushnir # Andrew Kushnir
- andrewseguin # Andrew Seguin
- atscott # Andrew Scott
- ayazhafiz # Ayaz Hafiz
- clydin # Charles Lyding
- crisbeto # Kristiyan Kostadinov
- dennispbrown # Denny Brown
- devversion # Paul Gschwendtner
- dgp1130 # Doug Parker
- filipesilva # Filipe Silva
- gkalpak # Georgios Kalpakas
- gregmagolan # Greg Magolan
- IgorMinar # Igor Minar
- jbogarthyde # Judy Bogart
- jelbourn # Jeremy Elbourn
- jessicajaniuk # Jessica Janiuk
- JiaLiPassion # Jia Li
- JoostK # Joost Koehoorn
- josephperrott # Joey Perrott
- juleskremer # Jules Kremer
- kapunahelewong # Kapunahele Wong
- kara # Kara Erickson
- kyliau # Keen Yee Liau
- manughub # Manu Murthy
- mgechev # Minko Gechev
- mhevery # Miško Hevery
- mmalerba # Miles Malerba
- petebacondarwin # Pete Bacon Darwin
- pkozlowski-opensource # Pawel Kozlowski
- Splaktar # Michael Prentice
- twerske # Emma Twersky
- zarend # Zach Arend
- aikidave # Dave Shevitz
- alan-agius4 # Alan Agius
- alxhub # Alex Rickabaugh
- AndrewKushnir # Andrew Kushnir
- andrewseguin # Andrew Seguin
- atscott # Andrew Scott
- ayazhafiz # Ayaz Hafiz
- clydin # Charles Lyding
- crisbeto # Kristiyan Kostadinov
- devversion # Paul Gschwendtner
- dgp1130 # Doug Parker
- filipesilva # Filipe Silva
- gkalpak # Georgios Kalpakas
- gregmagolan # Greg Magolan
- IgorMinar # Igor Minar
- jbogarthyde # Judy Bogart
- jelbourn # Jeremy Elbourn
- jessicajaniuk # Jessica Janiuk
- JiaLiPassion # Jia Li
- JoostK # Joost Koehoorn
- josephperrott # Joey Perrott
- kyliau # Keen Yee Liau
- manughub # Manu Murthy
- mgechev # Minko Gechev
- mmalerba # Miles Malerba
- petebacondarwin # Pete Bacon Darwin
- pkozlowski-opensource # Pawel Kozlowski
- Splaktar # Michael Prentice
- twerske # Emma Twersky
- zarend # Zach Arend
# =========================================================
# Framework: Animations
@ -237,7 +226,6 @@ groups:
- IgorMinar
- jelbourn
# =========================================================
# Framework: Compiler
# =========================================================
@ -258,11 +246,11 @@ groups:
])
reviewers:
users:
- alxhub
- AndrewKushnir
- alxhub
- atscott
- JoostK
# =========================================================
# Framework: Compiler / ngcc
# =========================================================
@ -279,7 +267,6 @@ groups:
- JoostK
- petebacondarwin
# =========================================================
# Framework: Migrations
# =========================================================
@ -295,7 +282,6 @@ groups:
- crisbeto
- devversion
# =========================================================
# Framework: Core
# =========================================================
@ -335,6 +321,8 @@ groups:
'aio/content/guide/component-styles.md',
'aio/content/guide/view-encapsulation.md',
'aio/content/examples/component-styles/**',
'aio/content/examples/content-projection/**',
'aio/content/guide/content-projection.md',
'aio/content/guide/dependency-injection.md',
'aio/content/examples/dependency-injection/**',
'aio/content/images/guide/dependency-injection/**',
@ -422,19 +410,20 @@ groups:
'aio/content/guide/template-statements.md',
'aio/content/guide/user-input.md',
'aio/content/examples/user-input/**',
'aio/content/images/guide/user-input/**'
'aio/content/images/guide/user-input/**',
'aio/content/guide/view-encapsulation.md',
'aio/content/examples/view-encapsulation/**',
'aio/content/images/guide/view-encapsulation/**',
'aio/content/special-elements/**'
])
reviewers:
users:
- alxhub
- AndrewKushnir
- atscott
- ~kara # do not request reviews from Kara, but allow her to approve PRs
- mhevery
- jessicajaniuk
# OOO as of 2020-09-28 - pkozlowski-opensource
# =========================================================
# Framework: Common
# =========================================================
@ -444,7 +433,7 @@ groups:
- *can-be-global-approved
- *can-be-global-docs-approved
- >
contains_any_globs(files.exclude("packages/core/schematics/**"), [
contains_any_globs(files.exclude("packages/core/schematics/**").exclude("packages/common/http/**"), [
'packages/common/**',
'packages/examples/common/**',
])
@ -453,12 +442,9 @@ groups:
- alxhub
- AndrewKushnir
- atscott
- ~kara # do not request reviews from Kara, but allow her to approve PRs
- mhevery
- jessicajaniuk
# OOO as of 2020-09-28 - pkozlowski-opensource
# =========================================================
# Framework: Http
# =========================================================
@ -481,7 +467,6 @@ groups:
- IgorMinar
- petebacondarwin
# =========================================================
# Framework: Elements
# =========================================================
@ -502,7 +487,6 @@ groups:
- andrewseguin
- gkalpak
# =========================================================
# Framework: Forms
# =========================================================
@ -535,7 +519,6 @@ groups:
users:
- AndrewKushnir
# =========================================================
# Framework: i18n
# =========================================================
@ -566,10 +549,8 @@ groups:
reviewers:
users:
- AndrewKushnir
- mhevery
- petebacondarwin
# =========================================================
# Framework: Platform Server
# =========================================================
@ -581,15 +562,16 @@ groups:
- >
contains_any_globs(files, [
'packages/platform-server/**',
'aio/content/guide/prerendering.md',
'aio/content/guide/universal.md',
'aio/content/examples/universal/**'
])
reviewers:
users:
- alan-agius4
- alxhub
- kyliau
# =========================================================
# Framework: Router
# =========================================================
@ -605,15 +587,18 @@ groups:
'aio/content/guide/router.md',
'aio/content/guide/router-tutorial.md',
'aio/content/guide/router-tutorial-toh.md',
'aio/content/guide/routing-overview.md',
'aio/content/guide/router-reference.md',
'aio/content/examples/router-tutorial/**',
'aio/content/examples/router/**',
'aio/content/images/guide/router/**'
'aio/content/images/guide/router/**',
'aio/content/guide/routing-with-urlmatcher.md',
'aio/content/examples/routing-with-urlmatcher/**'
])
reviewers:
users:
- atscott
# =========================================================
# Framework: Service Worker
# =========================================================
@ -633,6 +618,7 @@ groups:
'aio/content/guide/service-worker-config.md',
'aio/content/guide/service-worker-devops.md',
'aio/content/guide/service-worker-intro.md',
'aio/content/guide/service-worker-notifications.md',
'aio/content/images/guide/service-worker/**'
])
reviewers:
@ -641,7 +627,6 @@ groups:
- gkalpak
- IgorMinar
# =========================================================
# Framework: Upgrade
# =========================================================
@ -672,7 +657,6 @@ groups:
- gkalpak
- petebacondarwin
# =========================================================
# Framework: Testing
# =========================================================
@ -682,7 +666,7 @@ groups:
- *can-be-global-approved
- *can-be-global-docs-approved
- >
contains_any_globs(files.exclude('packages/compiler-cli/**').exclude('packages/language-service/**'), [
contains_any_globs(files.exclude('packages/compiler-cli/**').exclude('packages/language-service/**').exclude('packages/service-worker/**'), [
'packages/**/testing/**',
'aio/content/guide/testing.md',
'aio/content/guide/test-debugging.md',
@ -702,7 +686,6 @@ groups:
- IgorMinar
# OOO as of 2020-09-28 - pkozlowski-opensource
# =========================================================
# Framework: Benchmarks
# =========================================================
@ -719,7 +702,6 @@ groups:
- IgorMinar
# OOO as of 2020-09-28 - pkozlowski-opensource
# =========================================================
# Framework: Playground
# =========================================================
@ -737,7 +719,6 @@ groups:
- jelbourn
# OOO as of 2020-09-28 - pkozlowski-opensource
# =========================================================
# Framework: Security
# =========================================================
@ -759,15 +740,13 @@ groups:
reviewers:
users:
- IgorMinar
- mhevery
- jelbourn
# OOO as of 2020-09-28 - pkozlowski-opensource
reviews:
request: -1 # request reviews from everyone
required: 2 # require at least 2 approvals
request: -1 # request reviews from everyone
required: 2 # require at least 2 approvals
reviewed_for: required
# =========================================================
# Bazel
# =========================================================
@ -786,7 +765,6 @@ groups:
- josephperrott
- kyliau
# =========================================================
# Language Service
# =========================================================
@ -807,7 +785,6 @@ groups:
- atscott
- zarend
# =========================================================
# zone.js
# =========================================================
@ -824,7 +801,6 @@ groups:
reviewers:
users:
- JiaLiPassion
- mhevery
# =========================================================
# in-memory-web-api
@ -859,7 +835,6 @@ groups:
- alxhub
- josephperrott
# =========================================================
# Integration Tests
# =========================================================
@ -875,8 +850,6 @@ groups:
users:
- IgorMinar
- josephperrott
- mhevery
# =========================================================
# Docs: Contributors
@ -896,7 +869,6 @@ groups:
- mgechev
- twerske
# =========================================================
# Docs: Gettings Started & Tutorial
# =========================================================
@ -931,7 +903,6 @@ groups:
- IgorMinar
- jelbourn
# =========================================================
# Docs: Marketing
# =========================================================
@ -980,7 +951,6 @@ groups:
users:
- alxhub
# =========================================================
# Docs: Packaging, Tooling, Releasing
# =========================================================
@ -998,6 +968,7 @@ groups:
'aio/content/guide/releases.md',
'aio/content/guide/updating.md',
'aio/content/guide/deprecations.md',
'aio/content/guide/migration-legacy-message-id.md',
'aio/content/guide/migration-renderer.md',
'aio/content/guide/migration-undecorated-classes.md',
'aio/content/guide/migration-dynamic-flag.md',
@ -1005,7 +976,7 @@ groups:
'aio/content/guide/migration-localize.md',
'aio/content/guide/migration-module-with-providers.md',
'aio/content/guide/static-query-migration.md',
'aio/content/guide/updating-to-version-11.md',
'aio/content/guide/updating-to-version-12.md',
'aio/content/guide/ivy-compatibility.md',
'aio/content/guide/ivy-compatibility-examples.md'
])
@ -1014,6 +985,23 @@ groups:
- IgorMinar
- jelbourn
# =========================================================
# Docs: Angular DevTools
# =========================================================
docs-devtools:
<<: *defaults
conditions:
- *can-be-global-approved
- *can-be-global-docs-approved
- >
contains_any_globs(files, [
'aio/content/guide/devtools.md',
'aio/content/images/guide/devtools/**'
])
reviewers:
users:
- mgechev
- twerske
# =========================================================
# Tooling: Compiler API shared with Angular CLI
@ -1036,11 +1024,10 @@ groups:
- kyliau
- IgorMinar
reviews:
request: -1 # request reviews from everyone
required: 2 # require at least 2 approvals
request: -1 # request reviews from everyone
required: 2 # require at least 2 approvals
reviewed_for: required
# =========================================================
# Docs: CLI
# =========================================================
@ -1076,7 +1063,6 @@ groups:
- IgorMinar
- mgechev
# =========================================================
# Docs: CLI Libraries
# =========================================================
@ -1097,7 +1083,6 @@ groups:
- IgorMinar
- mgechev
# =========================================================
# Docs: Schematics
# =========================================================
@ -1120,7 +1105,6 @@ groups:
- IgorMinar
- mgechev
# =========================================================
# Docs-infra
# =========================================================
@ -1147,7 +1131,6 @@ groups:
'aio/content/guide/reviewing-content.md',
'aio/content/guide/updating-content-github-ui.md',
'aio/content/guide/updating-search-keywords.md',
'aio/content/guide/visual-studio-2015.md'
])
reviewers:
users:
@ -1155,7 +1138,6 @@ groups:
- IgorMinar
- petebacondarwin
# =========================================================
# Dev-infra
# =========================================================
@ -1196,7 +1178,6 @@ groups:
'tools/source-map-test/**',
'tools/symbol-extractor/**',
'tools/testing/**',
'tools/ts-api-guardian/**',
'tools/tslint/**',
'tools/utils/**',
'tools/yarn/**',
@ -1211,7 +1192,6 @@ groups:
- IgorMinar
- josephperrott
# =========================================================
# Public API
# =========================================================
@ -1241,13 +1221,13 @@ groups:
- jelbourn
- petebacondarwin
- jessicajaniuk
- zarend
# OOO as of 2020-09-28 - pkozlowski-opensource
reviews:
request: 4 # Request reviews from four people
required: 3 # Require that three people approve
reviewed_for: required
# ================================================
# Size tracking
# ================================================
@ -1270,13 +1250,13 @@ groups:
- jelbourn
- petebacondarwin
- jessicajaniuk
- zarend
# OOO as of 2020-09-28 - pkozlowski-opensource
reviews:
request: 4 # Request reviews from four people
required: 2 # Require that two people approve
reviewed_for: required
# ================================================
# Circular dependencies
# ================================================
@ -1299,12 +1279,12 @@ groups:
- jelbourn
- petebacondarwin
- jessicajaniuk
- zarend
# OOO as of 2020-09-28 - pkozlowski-opensource
####################################################################################
# Special Cases
####################################################################################
####################################################################################
# Special Cases
####################################################################################
# =========================================================
# Code Ownership
@ -1325,37 +1305,3 @@ groups:
- atscott
- jelbourn
- josephperrott
- mhevery
# ====================================================
# Catch all for if no groups match the code change
# ====================================================
fallback:
<<: *defaults
# A group is considered to be `active` for a PR if at least one of group's
# conditions matches the PR.
#
# The PullApprove CI check should fail if a PR has no `active` groups, as
# this indicates the PR is modifying a file that has no owner.
#
# This is enforced through the pullapprove verification check done
# as part of the CircleCI lint job. Failures in this lint job should be
# fixed as part of the PR. This can be done by updating the
# `.pullapprove.yml` file cover the unmatched path.
# The pullapprove verification script is part of the ng-dev tool and can be
# run locally with the command: `yarn -s ng-dev pullapprove verify`
#
# For cases in which the verification check fails to ensure coverage, this
# group will be active. The expectation is that this should be remedied
# before merging the PR as described above. In an emergency situation
# `global-approvers` can still approve PRs that match this `fallback` rule,
# but that should be an exception and not an expectation.
conditions:
- *no-groups-above-this-active
# When any of the `global-*` groups is approved, they cause other groups to deactivate.
# In those cases, the condition above would evaluate to `true` while in reality, only a global
# approval has been provided. To ensure we don't activate the fallback group in such cases,
# ensure that no explicit global approval has been provided.
- *can-be-global-approved
- *can-be-global-docs-approved

File diff suppressed because one or more lines are too long

View File

@ -19,12 +19,12 @@ filegroup(
name = "web_test_bootstrap_scripts",
# do not sort
srcs = [
"@npm//:node_modules/core-js/client/core.js",
"@npm//:node_modules/core-js-bundle/index.js",
"//packages/zone.js/bundles:zone.umd.js",
"//packages/zone.js/bundles:zone-testing.umd.js",
"//packages/zone.js/bundles:task-tracking.umd.js",
"//:test-events.js",
"//:third_party/shims_for_IE.js",
"//:third_party/shims_for_internal_tests.js",
# Including systemjs because it defines `__eval`, which produces correct stack traces.
"@npm//:node_modules/systemjs/dist/system.src.js",
"@npm//:node_modules/reflect-metadata/Reflect.js",
@ -36,18 +36,18 @@ filegroup(
srcs = [
# We also declare the unminified AngularJS files since these can be used for
# local debugging (e.g. see: packages/upgrade/test/common/test_helpers.ts)
"@npm//:node_modules/angular/angular.js",
"@npm//:node_modules/angular/angular.min.js",
"@npm//:node_modules/angular-1.5/angular.js",
"@npm//:node_modules/angular-1.5/angular.min.js",
"@npm//:node_modules/angular-1.6/angular.js",
"@npm//:node_modules/angular-1.6/angular.min.js",
"@npm//:node_modules/angular-1.7/angular.js",
"@npm//:node_modules/angular-1.7/angular.min.js",
"@npm//:node_modules/angular-mocks/angular-mocks.js",
"@npm//:node_modules/angular-mocks-1.5/angular-mocks.js",
"@npm//:node_modules/angular-mocks-1.6/angular-mocks.js",
"@npm//:node_modules/angular-mocks-1.7/angular-mocks.js",
"@npm//:node_modules/angular-mocks-1.8/angular-mocks.js",
"@npm//:node_modules/angular-1.8/angular.js",
"@npm//:node_modules/angular-1.8/angular.min.js",
],
)

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
The MIT License
Copyright (c) 2017 Google, Inc.
Copyright (c) 2010-2021 Google LLC. https://angular.io/license
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

179
README.md
View File

@ -1,38 +1,159 @@
# Angular.io
Angular.io is currently the preview site for Angular 2. This site also includes links to other helpful angular resources including Angular 1, Angular Material, and AngularFire.
<h1 align="center">Angular - The modern web developer's platform.</h1>
## How you can help
- [File an issue on github](https://github.com/angular/angular.io/issues)
- [Contribute to Angular.io](https://github.com/angular/angular.js/blob/master/CONTRIBUTING.md)
<p align="center">
<img src="aio/src/assets/images/logos/angular/angular.png" alt="angular-logo" width="120px" height="120px"/>
<br>
<i>Angular is a development platform for building mobile and desktop web applications
<br> using Typescript/JavaScript and other languages.</i>
<br>
</p>
<p align="center">
<a href="https://www.angular.io"><strong>www.angular.io</strong></a>
<br>
</p>
<p align="center">
<a href="CONTRIBUTING.md">Contributing Guidelines</a>
·
<a href="https://github.com/angular/angular/issues">Submit an Issue</a>
·
<a href="https://blog.angular.io/">Blog</a>
<br>
<br>
</p>
<p align="center">
<a href="https://circleci.com/gh/angular/workflows/angular/tree/master">
<img src="https://img.shields.io/circleci/build/github/angular/angular/master.svg?logo=circleci&logoColor=fff&label=CircleCI" alt="CI status" />
</a>&nbsp;
<a href="https://www.npmjs.com/@angular/core">
<img src="https://img.shields.io/npm/v/@angular/core.svg?logo=npm&logoColor=fff&label=NPM+package&color=limegreen" alt="Angular on npm" />
</a>&nbsp;
<a href="https://discord.gg/angular">
<img src="https://img.shields.io/discord/463752820026376202.svg?logo=discord&logoColor=fff&label=Discord&color=7389d8" alt="Discord conversation" />
</a>
</p>
<hr>
## Documentation
Get started with Angular, learn the fundamentals and explore advanced topics on our documentation website.
- [Getting Started][quickstart]
- [Architecture][architecture]
- [Components and Templates][componentstemplates]
- [Forms][forms]
- [API][api]
### Advanced
- [Angular Elements][angularelements]
- [Server Side Rendering][ssr]
- [Schematics][schematics]
- [Lazy Loading][lazyloading]
## Development Setup
1. Install version 0.17 of [Harp](http://harpjs.com/) (This is the current harp version.)
2. cd into root directory `angular.io/`
3. run `harp server`
4. Open this url in the browser: [http://localhost:9000/](http://localhost:9000/)
## Development setup with watches
1. cd into root directory `angular.io/`
2. run `gulp serve-and-watch`
3. Open this url in the browser: [http://localhost:9000/](http://localhost:9000/)
4. Refresh your browser to see any changes.
### Prerequisites
## Development setup with watches and browser reload
1. cd into root directory `angular.io/`
2. run `gulp serve-and-sync`
3. browser will launch ( on localhost:3000 instead of localhost:9000) and stay refreshed automatically.
- Install [Node.js] which includes [Node Package Manager][npm]
## Technology Used
- Angular 1.x: The production ready version of Angular
- Angular Material: An implementation of Material Design in Angular.js
- Harp: The static web server with built-in preprocessing.
- Sass: A professional grade CSS extension language
- Normalize: A modern, HTML5-ready alternative to CSS resets
- Grids: A highly customizable CSS Grid Framework built with Sass
- Prettify: A JS module and CSS for syntax highlighting of source code snippets.
- Icomoon: Custom built icon fonts
### Setting Up a Project
Install the Angular CLI globally:
## License
Powered by Google ©2010-2015. Code licensed under the [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0). Documentation licensed under [CC BY 3.0](http://creativecommons.org/licenses/by/3.0/).
```
npm install -g @angular/cli
```
Create workspace:
```
ng new [PROJECT NAME]
```
Run the application:
```
cd [PROJECT NAME]
ng serve
```
Angular is cross-platform, fast, scalable, has incredible tooling, and is loved by millions.
## Quickstart
[Get started in 5 minutes][quickstart].
## Ecosystem
<p>
<img src="/docs/images/angular-ecosystem-logos.png" alt="angular ecosystem logos" width="500px" height="auto">
</p>
- [Angular Command Line (CLI)][cli]
- [Angular Material][angularmaterial]
## Changelog
[Learn about the latest improvements][changelog].
## Upgrading
Check out our [upgrade guide](https://update.angular.io/) to find out the best way to upgrade your project.
## Contributing
### Contributing Guidelines
Read through our [contributing guidelines][contributing] to learn about our submission process, coding rules and more.
### Want to Help?
Want to file a bug, contribute some code, or improve documentation? Excellent! Read up on our guidelines for [contributing][contributing] and then check out one of our issues labeled as <kbd>[help wanted](https://github.com/angular/angular/labels/help%20wanted)</kbd> or <kbd>[good first issue](https://github.com/angular/angular/labels/good%20first%20issue)</kbd>.
### Code of Conduct
Help us keep Angular open and inclusive. Please read and follow our [Code of Conduct][codeofconduct].
## Community
Join the conversation and help the community.
- [Twitter][twitter]
- [Discord][discord]
- [Gitter][gitter]
- [YouTube][youtube]
- [StackOverflow][stackoverflow]
- Find a Local [Meetup][meetup]
[![Love Angular badge](https://img.shields.io/badge/angular-love-blue?logo=angular&angular=love)](https://www.github.com/angular/angular)
**Love Angular? Give our repo a star :star: :arrow_up:.**
[contributing]: CONTRIBUTING.md
[quickstart]: https://angular.io/start
[changelog]: CHANGELOG.md
[ng]: https://angular.io
[documentation]: https://angular.io/docs
[angularmaterial]: https://material.angular.io/
[cli]: https://cli.angular.io/
[architecture]: https://angular.io/guide/architecture
[componentstemplates]: https://angular.io/guide/displaying-data
[forms]: https://angular.io/guide/forms-overview
[api]: https://angular.io/api
[angularelements]: https://angular.io/guide/elements
[ssr]: https://angular.io/guide/universal
[schematics]: https://angular.io/guide/schematics
[lazyloading]: https://angular.io/guide/lazy-loading-ngmodules
[node.js]: https://nodejs.org/
[npm]: https://www.npmjs.com/get-npm
[codeofconduct]: CODE_OF_CONDUCT.md
[twitter]: https://www.twitter.com/angular
[discord]: https://discord.gg/angular
[gitter]: https://gitter.im/angular/angular
[stackoverflow]: https://stackoverflow.com/questions/tagged/angular
[youtube]: https://youtube.com/angular
[meetup]: https://www.meetup.com/find/?keywords=angular"

View File

@ -8,8 +8,8 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
# Fetch rules_nodejs so we can install our npm dependencies
http_archive(
name = "build_bazel_rules_nodejs",
sha256 = "bfacf15161d96a6a39510e7b3d3b522cf61cb8b82a31e79400a84c5abcab5347",
urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/3.2.1/rules_nodejs-3.2.1.tar.gz"],
sha256 = "4681ca88d512d57196d064d1441549080d8d17d119174a1229d1717a16a4a489",
urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/4.0.0-beta.1/rules_nodejs-4.0.0-beta.1.tar.gz"],
)
# Check the rules_nodejs version and download npm dependencies
@ -21,7 +21,7 @@ check_rules_nodejs_version(minimum_version_string = "2.2.0")
# Setup the Node.js toolchain
node_repositories(
node_version = "12.14.1",
node_version = "14.16.1",
package_json = ["//:package.json"],
)
@ -34,11 +34,6 @@ yarn_install(
yarn_lock = "//:yarn.lock",
)
# Load angular dependencies
load("//packages/bazel:package.bzl", "rules_angular_dev_dependencies")
rules_angular_dev_dependencies()
# Load protractor dependencies
load("@npm//@bazel/protractor:package.bzl", "npm_bazel_protractor_dependencies")
@ -49,40 +44,21 @@ load("@io_bazel_rules_webtesting//web:repositories.bzl", "web_test_repositories"
web_test_repositories()
load("//dev-infra/browsers:browser_repositories.bzl", "browser_repositories")
load("//dev-infra/bazel/browsers:browser_repositories.bzl", "browser_repositories")
browser_repositories()
# Setup the rules_sass toolchain
load("@io_bazel_rules_sass//:defs.bzl", "sass_repositories")
load("//packages/common/locales/generate-locales-tool:cldr-data.bzl", "cldr_data_repository")
sass_repositories()
# Setup the skydoc toolchain
load("@io_bazel_skydoc//skylark:skylark.bzl", "skydoc_repositories")
skydoc_repositories()
load("@bazel_toolchains//rules:environments.bzl", "clang_env")
load("@bazel_toolchains//rules:rbe_repo.bzl", "rbe_autoconfig")
rbe_autoconfig(
name = "rbe_ubuntu1604_angular",
# Need to specify a base container digest in order to ensure that we can use the checked-in
# platform configurations for the "ubuntu16_04" image. Otherwise the autoconfig rule would
# need to pull the image and run it in order determine the toolchain configuration. See:
# https://github.com/bazelbuild/bazel-toolchains/blob/4.0.0/configs/ubuntu16_04_clang/versions.bzl
base_container_digest = "sha256:f6568d8168b14aafd1b707019927a63c2d37113a03bcee188218f99bd0327ea1",
# Note that if you change the `digest`, you might also need to update the
# `base_container_digest` to make sure marketplace.gcr.io/google/rbe-ubuntu16-04-webtest:<digest>
# and marketplace.gcr.io/google/rbe-ubuntu16-04:<base_container_digest> have
# the same Clang and JDK installed. Clang is needed because of the dependency on
# @com_google_protobuf. Java is needed for the Bazel's test executor Java tool.
digest = "sha256:dddaaddbe07a61c2517f9b08c4977fc23c4968fcb6c0b8b5971e955d2de7a961",
env = clang_env(),
registry = "marketplace.gcr.io",
# We can't use the default "ubuntu16_04" RBE image provided by the autoconfig because we need
# a specific Linux kernel that comes with "libx11" in order to run headless browser tests.
repository = "google/rbe-ubuntu16-04-webtest",
use_checked_in_confs = "Force",
cldr_data_repository(
name = "cldr_data",
# Since we use the Github archives for CLDR 37, we need to specify a path
# to the available locales. This wouldn't be needed with CLDR 39 as that
# comes with an official JSON archive not containing a version suffix.
available_locales_path = "cldr-core-37.0.0/availableLocales.json",
urls = {
"https://github.com/unicode-cldr/cldr-core/archive/37.0.0.zip": "32b5c49c3874aa342b90412c207b42e7aefb2435295891fb714c34ce58b3c706",
"https://github.com/unicode-cldr/cldr-dates-full/archive/37.0.0.zip": "e1c410dd8ad7d75df4a5393efaf5d28f0d56c0fa126c5d66e171a3f21a988a1e",
"https://github.com/unicode-cldr/cldr-numbers-full/archive/37.0.0.zip": "a921b90cf7f436e63fbdd55880f96e39a203acd9e174b0ceafa20a02c242a12e",
},
)

91
aio/.eslintrc.json Normal file
View File

@ -0,0 +1,91 @@
{
"root": true,
"overrides": [
{
"files": [
"*.ts"
],
"parserOptions": {
"project": [
"tsconfig.json",
"tests/e2e/tsconfig.json"
],
"createDefaultProgram": true
},
"extends": [
"plugin:@angular-eslint/ng-cli-compat",
"plugin:@angular-eslint/ng-cli-compat--formatting-add-on",
"plugin:@angular-eslint/template/process-inline-templates"
],
"rules": {
"@typescript-eslint/ban-types": "error",
"@angular-eslint/component-selector": [
"error",
{
"type": "element",
"prefix": "aio",
"style": "kebab-case"
}
],
"@angular-eslint/directive-selector": [
"error",
{
"type": "attribute",
"prefix": "aio",
"style": "camelCase"
}
],
"dot-notation": "error",
"indent": "off",
"@typescript-eslint/member-delimiter-style": ["error", {
"singleline": {
"delimiter": "comma",
"requireLast": false
}
}],
"@typescript-eslint/member-ordering": "off",
"@typescript-eslint/naming-convention": "off",
"no-console": ["error", {"allow": ["log", "warn", "error"]}],
"no-empty-function": "off",
"no-restricted-syntax": [
"error",
{
"selector": "CallExpression[callee.name=/^(fdescribe|fit)$/]",
"message": "Don't keep jasmine focus methods."
}
],
"no-shadow": "off",
"@typescript-eslint/no-shadow": ["error"],
"no-tabs": "error",
"no-underscore-dangle": "off",
"no-unused-expressions": "error",
"no-use-before-define": "off",
"prefer-arrow/prefer-arrow-functions": "off",
"quotes": "off",
"@typescript-eslint/quotes": ["error", "single", {"avoidEscape": true}],
"semi": "error"
}
},
{
"files": [
"*.html"
],
"extends": [
"plugin:@angular-eslint/template/recommended"
],
"rules": {
"@angular-eslint/template/accessibility-alt-text": "error",
"@angular-eslint/template/accessibility-elements-content": "error",
"@angular-eslint/template/accessibility-label-has-associated-control": "error",
"@angular-eslint/template/accessibility-table-scope": "error",
"@angular-eslint/template/accessibility-valid-aria": "error",
"@angular-eslint/template/click-events-have-key-events": "error",
"@angular-eslint/template/eqeqeq": "off",
"@angular-eslint/template/mouse-events-have-key-events": "error",
"@angular-eslint/template/no-autofocus": "error",
"@angular-eslint/template/no-distracting-elements": "error",
"@angular-eslint/template/no-positive-tabindex": "error"
}
}
]
}

1
aio/.npmrc Normal file
View File

@ -0,0 +1 @@
engine-strict = true

View File

@ -19,9 +19,6 @@ Here are the most important tasks you might need to use:
* `yarn build` - create a production build of the application (after installing dependencies, boilerplate, etc).
* `yarn build-local` - same as `build`, but use `setup-local` instead of `setup`.
* `yarn build-local-with-viewengine` - same as `build-local`, but in addition also turns on `ViewEngine` (pre-Ivy) mode in aio.
(Note: To turn on `ViewEngine` mode in docs examples, see `yarn boilerplate:add:viewengine` below.)
* `yarn start` - run a development web server that watches the files; then builds the doc-viewer and reloads the page, as necessary.
* `yarn serve-and-sync` - run both the `docs-watch` and `start` in the same console.
* `yarn lint` - check that the doc-viewer code follows our style rules.
@ -35,7 +32,6 @@ Here are the most important tasks you might need to use:
* `yarn docs-test` - run the unit tests for the doc generation code.
* `yarn boilerplate:add` - generate all the boilerplate code for the examples, so that they can be run locally.
* `yarn boilerplate:add:viewengine` - same as `boilerplate:add` but also turns on `ViewEngine` (pre-Ivy) mode.
* `yarn boilerplate:remove` - remove all the boilerplate code that was added via `yarn boilerplate:add`.
* `yarn create-example` - create a new example directory containing initial source files.
@ -46,7 +42,6 @@ Here are the most important tasks you might need to use:
- `--setup`: generate boilerplate, force webdriver update & other setup, then run tests.
- `--local`: run e2e tests with the local version of Angular contained in the "dist" folder.
_Requires `--setup` in order to take effect._
- `--viewengine`: run e2e tests in `ViewEngine` (pre-Ivy) mode.
- `--filter=foo`: limit e2e tests to those containing the word "foo".
> **Note for Windows users**

View File

@ -33,7 +33,7 @@
"shelljs": "^0.8.4",
"source-map-support": "^0.5.19",
"tar-stream": "^2.1.3",
"tslib": "^2.1.0"
"tslib": "^2.2.0"
},
"devDependencies": {
"@types/body-parser": "^1.19.0",
@ -49,6 +49,6 @@
"supertest": "^4.0.2",
"tslint": "^6.1.3",
"tslint-jasmine-noSkipOrFocus": "^1.0.9",
"typescript": "^4.2.3"
"typescript": "~4.3.4"
}
}

View File

@ -2505,10 +2505,10 @@ tslib@^1.8.1:
version "1.9.3"
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.9.3.tgz#d7e4dd79245d85428c4d7e4822a79917954ca286"
tslib@^2.1.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.1.0.tgz#da60860f1c2ecaa5703ab7d39bc05b6bf988b97a"
integrity sha512-hcVC3wYEziELGGmEEXue7D75zbwIIVUMWAVbHItGPx0ziyXxrOMQx4rQEVEV45Ut/1IotuEvwqPopzIOkDMf0A==
tslib@^2.2.0:
version "2.2.0"
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.2.0.tgz#fb2c475977e35e241311ede2693cee1ec6698f5c"
integrity sha512-gS9GVHRU+RGn5KQM2rllAlR3dU6m7AcpJKdtH8gFvQiC4Otgk98XnmMU+nZenHt/+VhnBPWwgrJsyrdcw6i23w==
tslint-jasmine-noSkipOrFocus@^1.0.9:
version "1.0.9"
@ -2563,10 +2563,10 @@ typedarray-to-buffer@^3.1.5:
dependencies:
is-typedarray "^1.0.0"
typescript@^4.2.3:
version "4.2.3"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.2.3.tgz#39062d8019912d43726298f09493d598048c1ce3"
integrity sha512-qOcYwxaByStAWrBf4x0fibwZvMRG+r4cQoTjbPtUlrWjBHbmCAww1i448U0GJ+3cNNEtebDteo/cHOR3xJ4wEw==
typescript@~4.3.4:
version "4.3.4"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.3.4.tgz#3f85b986945bcf31071decdd96cf8bfa65f9dcbc"
integrity sha512-uauPG7XZn9F/mo+7MrsRjyvbxFpzemRjKEZXS4AK83oP2KKOJPvb+9cO/gmnv8arWZvhnjVOXz7B49m1l0e9Ew==
undefsafe@^2.0.2:
version "2.0.2"

View File

@ -11,16 +11,19 @@
"newProjectRoot": "projects",
"projects": {
"site": {
"root": "",
"sourceRoot": "src",
"projectType": "application",
"prefix": "aio",
"schematics": {
"@schematics/angular:application": {
"strict": true
},
"@schematics/angular:component": {
"inlineStyle": true,
"style": "scss"
}
},
"root": "",
"sourceRoot": "src",
"prefix": "aio",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
@ -29,38 +32,61 @@
"index": "src/index.html",
"main": "src/main.ts",
"polyfills": "src/polyfills.ts",
"ngswConfigPath": "src/generated/ngsw-config.json",
"tsConfig": "tsconfig.app.json",
"webWorkerTsConfig": "tsconfig.worker.json",
"aot": true,
"optimization": true,
"buildOptimizer": true,
"optimization": {
"fonts": true,
"scripts": true,
"styles": {
"inlineCritical": false,
"minify": true
}
},
"outputHashing": "all",
"sourceMap": true,
"statsJson": true,
"extractLicenses": true,
"namedChunks": true,
"vendorChunk": false,
"assets": [
"src/assets",
"src/generated",
"src/pwa-manifest.json",
"src/google385281288605d160.html"
"src/google385281288605d160.html",
{
"input": "src/generated",
"output": "generated",
"glob": "**",
"ignore": [
"ngsw-config.json"
]
}
],
"styles": [
"src/styles/main.scss"
"src/styles/main.scss",
{
"inject": false,
"input": "src/styles/custom-themes/dark-theme.scss",
"bundleName": "dark-theme"
},
{
"inject": false,
"input": "src/styles/custom-themes/light-theme.scss",
"bundleName": "light-theme"
}
],
"scripts": [],
"budgets": [
{
"type": "initial",
"maximumWarning": "850kb",
"maximumError": "1mb"
},
{
"type": "anyComponentStyle",
"maximumWarning": "6kb"
"maximumWarning": "2kb",
"maximumError": "4kb"
}
]
},
"configurations": {
"fast": {
"optimization": false
},
"next": {
"fileReplacements": [
{
@ -99,18 +125,20 @@
},
"ci": {
"progress": false
},
"development": {
"buildOptimizer": false,
"optimization": false,
"outputHashing": "none",
"vendorChunk": true,
"extractLicenses": false
}
}
},
"defaultConfiguration": "stable"
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "site:build"
},
"configurations": {
"fast": {
"browserTarget": "site:build:fast"
},
"next": {
"browserTarget": "site:build:next"
},
@ -125,8 +153,12 @@
},
"ci": {
"browserTarget": "site:build:ci"
},
"development": {
"browserTarget": "site:build:development"
}
}
},
"defaultConfiguration": "development"
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
@ -144,27 +176,32 @@
"karmaConfig": "karma.conf.js",
"assets": [
"src/assets",
"src/generated",
"src/pwa-manifest.json",
"src/google385281288605d160.html"
],
"styles": [
"src/styles/main.scss"
"src/styles/main.scss",
{
"inject": false,
"input": "src/styles/custom-themes/dark-theme.scss",
"bundleName": "dark-theme"
},
{
"inject": false,
"input": "src/styles/custom-themes/light-theme.scss",
"bundleName": "light-theme"
}
],
"scripts": []
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"builder": "@angular-eslint/builder:lint",
"options": {
"tsConfig": [
"tsconfig.app.json",
"tsconfig.spec.json",
"tsconfig.worker.json",
"tests/e2e/tsconfig.json"
],
"exclude": [
"**/node_modules/**"
"lintFilePatterns": [
"src/!(generated)/**/*.ts",
"src/!(generated)/**/*.html",
"tests/**/*.ts"
]
}
},

View File

@ -33,8 +33,8 @@ cd my-first-project
ng serve
</code-example>
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.
In your browser, open http://localhost:4200/ to see the new application run.
When you use the [ng serve](cli/serve) command to build an application and serve it locally, the server automatically rebuilds the application and reloads the page when you change any of the source files.
<div class="alert is-helpful">
@ -46,17 +46,17 @@ When you use the [ng serve](cli/serve) command to build an app and serve it loca
## Workspaces and project files
The [ng new](cli/new) command creates an *Angular workspace* folder and generates a new app skeleton.
A workspace can contain multiple apps and libraries.
The initial app created by the [ng new](cli/new) command is at the top level of the workspace.
When you generate an additional app or library in a workspace, it goes into a `projects/` subfolder.
The [ng new](cli/new) command creates an *Angular workspace* folder and generates a new application skeleton.
A workspace can contain multiple applications and libraries.
The initial application created by the [ng new](cli/new) command is at the top level of the workspace.
When you generate an additional application or library in a workspace, it goes into a `projects/` subfolder.
A newly generated app contains the source files for a root module, with a root component and template.
Each app has a `src` folder that contains the logic, data, and assets.
A newly generated application contains the source files for a root module, with a root component and template.
Each application has a `src` folder that contains the logic, data, and assets.
You can edit the generated files directly, or add to and modify them using CLI commands.
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.
Commands such as [add](cli/add) and [generate](cli/generate), which create or operate on applications and libraries, must be executed from within a workspace or project folder.
* See more about the [Workspace file structure](guide/file-structure).

View File

@ -20,29 +20,27 @@ This ID is a string that looks like `UA-123456-12`.
You can choose to use a descriptive string as the key value, or be assigned a random key when you run the CLI command.
For example, the following command adds a configuration key named "tracking".
<code-example language="sh" class="code-shell">
<code-example language="sh">
ng config --global cli.analyticsSharing.tracking UA-123456-12
</code-example>
To turn off this feature, run the following command:
<code-example language="sh" class="code-shell">
<code-example language="sh">
ng config --global --remove cli.analyticsSharing
</code-example>
## Per user tracking
You can add a custom user ID to the global configuration, in order to identify unique usage of commands and flags.
If that user enables CLI analytics for their own project, your analytics display tracks and labels their individual usage.
<code-example language="sh" class="code-shell">
<code-example language="sh">
ng config --global cli.analyticsSharing.user SOME_USER_NAME
</code-example>
To generate a new random user ID, run the following command:
<code-example language="sh" class="code-shell">
<code-example language="sh">
ng config --global cli.analyticsSharing.user ""
</code-example>

View File

@ -6,7 +6,7 @@
@description
Angular throws an `ExpressionChangedAfterItHasBeenCheckedError` when an expression value has been changed after change detection has completed. Angular only throws this error in development mode.
In dev mode, Angular performs an additional check after each change detection run, to ensure the bindings havent changed. This catches errors where the view is left in an inconsistent state. This can occur, for example, if a method or getter returns a different value each time it is called, or if a child component changes values on its parent. If either of these occur, this is a sign that change detection is not stabilized. Angular throws the error to ensure data is always reflected correctly in the view, which prevents erratic UI behavior or a possible infinite loop.
In development mode, Angular performs an additional check after each change detection run, to ensure the bindings havent changed. This catches errors where the view is left in an inconsistent state. This can occur, for example, if a method or getter returns a different value each time it is called, or if a child component changes values on its parent. If either of these occur, this is a sign that change detection is not stabilized. Angular throws the error to ensure data is always reflected correctly in the view, which prevents erratic UI behavior or a possible infinite loop.
This error commonly occurs when youve added template expressions or begun to implement lifecycle hooks like `ngAfterViewInit` or `ngOnChanges`. It is also common when dealing with loading status and asynchronous operations, or a child component changes its parent bindings.
@ -17,4 +17,4 @@ Ensure that there are no changes to the bindings in the template after change de
If you are binding to methods in the view, ensure that the invocation does not update any of the other bindings in the template.
Read more about which solution is right for you in ['Everything you need to know about the "ExpressionChangedAfterItHasBeenCheckedError" error'](https://indepth.dev/everything-you-need-to-know-about-the-expressionchangedafterithasbeencheckederror-error/) and why this is useful at ['Angular Debugging "Expression has changed after it was checked": Simple Explanation (and Fix)'](https://blog.angular-university.io/angular-debugging/).
Read more about which solution is right for you in ['Everything you need to know about the "ExpressionChangedAfterItHasBeenCheckedError" error'](https://indepth.dev/posts/1001/everything-you-need-to-know-about-the-expressionchangedafterithasbeencheckederror-error) and why this is useful at ['Angular Debugging "Expression has changed after it was checked": Simple Explanation (and Fix)'](https://blog.angular-university.io/angular-debugging/).

View File

@ -8,4 +8,4 @@ There is no injection token for a constructor parameter at compile time. [Inject
@debugging
Look at the parameter that throws the error and all uses of the class. This error is commonly thrown when a constructor defines parameters with primitive types like `string`, `number`, `boolean`, and `Object`.
Use the [@Injectable](api/core/Injectable) method or [@Inject](api/core/Inject) decorator from `@angular/core` to ensure that the type you are injecting is reified (has a runtime representation). Make sure to add a provider to this decorator so that you do not throw [NG0201: No Provider Found](errors/NG0201).
Use the `@Injectable` method or `@Inject` decorator from `@angular/core` to ensure that the type you are injecting is reified (has a runtime representation). Make sure to add a provider to this decorator so that you do not throw [NG0201: No Provider Found](errors/NG0201).

View File

@ -0,0 +1,32 @@
@name Invalid Shadow DOM selector
@category compiler
@shortDescription Component selector does not match shadow DOM requirements
@description
The selector of a component using `ViewEncapsulation.ShadowDom` doesn't match the custom element tag name requirements.
In order for a tag name to be considered a valid custom element name, it has to:
* Be in lower case.
* Contain a hyphen.
* Start with a letter (a-z).
@debugging
Rename your component's selector so that it matches the requirements.
**Before:**
```typescript
@Component({
selector: 'comp',
encapsulation: ViewEncapsulation.ShadowDom
...
})
```
**After:**
```typescript
@Component({
selector: 'app-comp',
encapsulation: ViewEncapsulation.ShadowDom
...
})
```

View File

@ -53,3 +53,5 @@ component being compiled. Here are some ideas for fixing the problem:
that is stored in an independent file that can be imported to both dependent files without
causing an import cycle.
* Move the classes that reference each other into the same file, to avoid any imports between them.
* Convert import statements to type-only imports (using `import type` syntax) if the imported declarations
are only used as types, as type-only imports do not contribute to cycles.

View File

@ -0,0 +1,14 @@
@name Invalid metadata
@category compiler
@shortDescription Invalid @NgModule() metadata
@description
This error represents the import or export of an `@NgModule()` that doesn't have valid metadata.
@debugging
The library might have been processed with `ngcc`.
If this is the case, try removing and reinstalling `node_modules`.
This error is likely due to the library being published for Angular Ivy, which cannot be used in this View Engine application.
If that is not the case then it might be a View Engine based library that was converted to Ivy by ngcc during a postinstall step.
Check the peer dependencies to ensure that you're using a compatible version of Angular.

View File

@ -16,6 +16,6 @@ Use the element name in the error to find the file(s) where the element is being
Check that the name and selector are correct. If the component is from a different module or import, check that the component is exported from its origin module and imported into the correct `*.modules.ts` file, and declared in the imports list.
When using custom elements or web components, ensure that you add [`CUSTOM_ELEMENTS_SCHEMA`](api/core/CUSTOM_ELEMENTS_SCHEMA) to the app module.
When using custom elements or web components, ensure that you add [`CUSTOM_ELEMENTS_SCHEMA`](api/core/CUSTOM_ELEMENTS_SCHEMA) to the application module.
If this does not resolve the error, check the imported libraries for any recent changes to the exports and properties you are using, and restart your server.

View File

@ -89,7 +89,7 @@ describe('AngularJS to Angular Quick Reference Tests', () => {
return element.all(by.css('app-movie-list tbody > tr'));
}
async function testFavoriteHero(heroName: string, expectedLabel: string) {
async function testFavoriteHero(heroName: string | null, expectedLabel: string) {
const movieListComp = element(by.tagName('app-movie-list'));
const heroInput = movieListComp.element(by.tagName('input'));
const favoriteHeroLabel = movieListComp.element(by.tagName('h3'));

View File

@ -16,7 +16,7 @@ export class AppComponent {
eventType = '<not clicked yet>';
isActive = true;
isImportant = true;
movie: IMovie = null;
movie: IMovie;
movies: IMovie[] = [];
showImage = true;
title = 'AngularJS to Angular Quick Ref Cookbook';

View File

@ -1,4 +1,3 @@
/* tslint:disable:no-unused-variable */
// #docplaster
import { Component } from '@angular/core';
import { IMovie } from './movie';
@ -16,7 +15,7 @@ import { MovieService } from './movie.service';
// #docregion class
export class MovieListComponent {
// #enddocregion class
favoriteHero: string;
favoriteHero: string | undefined;
showImage = false;
movies: IMovie[];

View File

@ -77,7 +77,7 @@ describe('Animation Tests', () => {
});
describe('Status Slider Component', () => {
const activeColor = 'rgba(255, 165, 0, 1)';
const activeColor = 'rgba(117, 70, 0, 1)';
const inactiveColor = 'rgba(0, 0, 255, 1)';
beforeAll(async () => {

View File

@ -1,7 +1,9 @@
// #docregion
import { animation, style, animate } from '@angular/animations';
// #docplaster
// #docregion animation-const, trigger-const
import { animation, style, animate, trigger, transition, useAnimation } from '@angular/animations';
// #enddocregion trigger-const
export const transAnimation = animation([
export const transitionAnimation = animation([
style({
height: '{{ height }}',
opacity: '{{ opacity }}',
@ -9,3 +11,19 @@ export const transAnimation = animation([
}),
animate('{{ time }}')
]);
// #enddocregion animation-const
// #docregion trigger-const
export const triggerAnimation = trigger('openClose', [
transition('open => closed', [
useAnimation(transitionAnimation, {
params: {
height: 0,
opacity: 1,
backgroundColor: 'red',
time: '1s'
}
})
])
]);
// #enddocregion trigger-const

View File

@ -1,4 +1,3 @@
// #docregion reusable
import {
animation, trigger, animateChild, group,
transition, animate, style, query
@ -12,7 +11,6 @@ export const transAnimation = animation([
}),
animate('{{ time }}')
]);
// #enddocregion reusable
// Routable animations
// #docregion route-animations

View File

@ -1,7 +1,3 @@
:host {
display: block;
}
section {
margin-top: 100px;
nav a {
padding: .7rem;
}

View File

@ -1,6 +1,10 @@
<h1>Animations</h1>
Toggle All Animations <input type="checkbox" [checked]="!animationsDisabled" (click)="toggleAnimations()"/>
<input type="checkbox"
id="animation-toggle"
[checked]="!animationsDisabled"
(click)="toggleAnimations()">
<label for="animation-toggle">Toggle All Animations</label>
<nav>
<a id="home" routerLink="/home" routerLinkActive="active">Home</a>

View File

@ -31,7 +31,7 @@ import { Hero } from './hero';
// #enddocregion auto-calc
})
export class HeroListAutoComponent {
@Input() heroes: Hero[];
@Input() heroes: Hero[] = [];
@Output() remove = new EventEmitter<number>();

View File

@ -44,7 +44,7 @@ import { Hero } from './hero';
// #enddocregion animationdef
})
export class HeroListEnterLeaveComponent {
@Input() heroes: Hero[];
@Input() heroes: Hero[] = [];
@Output() remove = new EventEmitter<number>();

View File

@ -64,7 +64,7 @@ import { Hero } from './hero';
// #enddocregion animationdef
})
export class HeroListGroupsComponent {
@Input() heroes: Hero[];
@Input() heroes: Hero[] = [];
@Output() remove = new EventEmitter<number>();

View File

@ -1,51 +1,33 @@
.heroes {
margin: 0 0 2em 0;
list-style-type: none;
padding: 0;
width: 15em;
}
.heroes li {
position: relative;
height: 2.3em;
overflow:hidden;
margin: .5em;
margin: .5em 0;
}
.heroes li > .inner {
cursor: pointer;
background-color: #EEE;
padding: .3em 0;
height: 1.6em;
padding: .3rem 0;
height: 1.6rem;
border-radius: 4px;
width: 19em;
}
.heroes li:hover > .inner {
color: #607D8B;
color: black;
background-color: #DDD;
transform: translateX(.1em);
}
.heroes a {
color: #888;
text-decoration: none;
position: relative;
display: block;
width: 250px;
}
.heroes a:hover {
color:#607D8B;
}
.heroes .badge {
display: inline-block;
font-size: small;
color: white;
padding: 0.8em 0.7em 0 0.7em;
background-color: #607D8B;
line-height: 1em;
background-color: #3d5157;
position: relative;
left: -1px;
top: -4px;
@ -56,38 +38,12 @@
border-radius: 4px 0 0 4px;
}
.button {
background-color: #eee;
border: none;
padding: 5px 10px;
border-radius: 4px;
cursor: pointer;
font-family: Arial, sans-serif;
}
button:hover {
background-color: #cfd8dc;
}
button.delete {
position: relative;
left: 24em;
top: -32px;
background-color: gray !important;
color: white;
display: inherit;
padding: 5px 8px;
width: 2em;
label {
display: block;
padding-bottom: .5rem;
}
input {
font-size: 100%;
margin-bottom: 2px;
width: 11em;
}
.heroes input {
position: relative;
top: -3px;
width: 12em;
margin-bottom: 1rem;
}

View File

@ -2,18 +2,22 @@
<h2>Filter/Stagger</h2>
<form>
<input #criteria (input)="updateCriteria(criteria.value)" placeholder="Search Heroes" />
</form>
<label for="search">Search heroes: </label>
<input type="text"
id="search"
#criteria (input)="updateCriteria(criteria.value)"
placeholder="Search heroes">
</form>
<!-- #docregion filter-animations -->
<ul class="heroes" [@filterAnimation]="heroTotal">
<!-- #enddocregion filter-animations -->
<!-- #enddocregion filter-animations -->
<li *ngFor="let hero of heroes" class="hero">
<div class="inner">
<span class="badge">{{ hero.id }}</span>
<span>{{ hero.name }}</span>
</div>
</li>
<!-- #docregion filter-animations -->
<!-- #docregion filter-animations -->
</ul>
<!-- #enddocregion filter-animations -->
<!-- #enddocregion filter-animations -->

View File

@ -4,6 +4,7 @@
import { Component, HostBinding, OnInit } from '@angular/core';
import { trigger, transition, animate, style, query, stagger } from '@angular/animations';
import { HEROES } from './mock-heroes';
import { Hero } from './hero';
// #docregion filter-animations
@Component({
@ -58,7 +59,7 @@ export class HeroListPageComponent implements OnInit {
heroTotal = -1;
// #enddocregion filter-animations
get heroes() { return this._heroes; }
private _heroes = [];
private _heroes: Hero[] = [];
ngOnInit() {
this._heroes = HEROES;

View File

@ -5,7 +5,8 @@ import { Component } from '@angular/core';
template: `
<section>
<h2>Open Close Component</h2>
<input type="checkbox" [checked]="logging" (click)="toggleLogging()"/> Console Log Animation Events
<input type="checkbox" id="log-checkbox" [checked]="logging" (click)="toggleLogging()"/>
<label for="log-checkbox">Console Log Animation Events</label>
<app-open-close [logging]="logging"></app-open-close>
</section>

View File

@ -1,10 +1,10 @@
<!-- #docplaster -->
<!-- #docregion trigger -->
<nav>
<button (click)="toggle()">Toggle Open/Close</button>
</nav>
<!-- #docregion compare, trigger -->
<div [@openClose]="isOpen ? 'open' : 'closed'" class="open-close-container">
<p>The box is now {{ isOpen ? 'Open' : 'Closed' }}!</p>
</div>
<!-- #enddocregion compare, trigger -->
<!-- #enddocregion trigger -->

View File

@ -21,8 +21,8 @@ import { trigger, transition, state, animate, style } from '@angular/animations'
})),
state('closed', style({
width: '100px',
opacity: 0.5,
backgroundColor: 'green'
opacity: 0.8,
backgroundColor: '#c6ecff'
})),
transition('* => *', [
animate('1s')

View File

@ -1,5 +1,6 @@
:host {
display: block;
margin-top: 1rem;
}
.open-close-container {

View File

@ -1,10 +1,8 @@
<nav>
<button (click)="toggle()">Toggle Open/Close</button>
</nav>
<button (click)="toggle()">Toggle Open/Close</button>
<div [@openClose]="isOpen ? 'open' : 'closed'"
(@openClose.start)="onAnimationEvent($event)"
(@openClose.done)="onAnimationEvent($event)"
class="open-close-container">
class="open-close-container">
<p>The box is now {{ isOpen ? 'Open' : 'Closed' }}!</p>
</div>

View File

@ -20,8 +20,8 @@ import { trigger, transition, state, animate, style, AnimationEvent } from '@ang
// #docregion state2
state('closed', style({
height: '100px',
opacity: 0.5,
backgroundColor: 'green'
opacity: 0.8,
backgroundColor: '#c6ecff'
})),
// #enddocregion state2, trigger-wildcard1
// #docregion transition1

View File

@ -8,19 +8,19 @@ import { trigger, transition, state, animate, style, keyframes } from '@angular/
animations: [
trigger('slideStatus', [
state('inactive', style({ backgroundColor: 'blue' })),
state('active', style({ backgroundColor: 'orange' })),
state('active', style({ backgroundColor: '#754600' })),
// #docregion keyframesWithOffsets
transition('* => active', [
animate('2s', keyframes([
style({ backgroundColor: 'blue', offset: 0}),
style({ backgroundColor: 'red', offset: 0.8}),
style({ backgroundColor: 'orange', offset: 1.0})
style({ backgroundColor: '#754600', offset: 1.0})
])),
]),
transition('* => inactive', [
animate('2s', keyframes([
style({ backgroundColor: 'orange', offset: 0}),
style({ backgroundColor: '#754600', offset: 0}),
style({ backgroundColor: 'red', offset: 0.2}),
style({ backgroundColor: 'blue', offset: 1.0})
]))

View File

@ -88,7 +88,7 @@ async function heroFromDetail(detail: ElementFinder): Promise<Hero> {
// Get hero id from the first <div>
const id = await detail.all(by.css('div')).first().getText();
// Get name from the h2
const name = await detail.element(by.css('h4')).getText();
const name = await detail.element(by.css('app-hero-detail h2')).getText();
return {
id: +id.substr(id.indexOf(' ') + 1),
name: name.substr(0, name.lastIndexOf(' ')),

View File

@ -5,6 +5,7 @@ import { Component } from '@angular/core';
@Component({
selector: 'app-root',
template: `
<h1>Architecture Example</h1>
<app-hero-list></app-hero-list>
<app-sales-tax></app-sales-tax>
`

View File

@ -1,10 +1,10 @@
<hr>
<h4>{{hero.name}} Detail</h4>
<h2>{{hero.name}} Detail</h2>
<div>Id: {{hero.id}}</div>
<label>Name:
<!-- #docregion ngModel -->
<input [(ngModel)]="hero.name">
<!-- #enddocregion ngModel -->
</label>
<br />
<label>Power: <input [(ngModel)]="hero.power"></label>
<label for="hero-name">Name: </label>
<!-- #docregion ngModel -->
<input type="text" id="hero-name" [(ngModel)]="hero.name">
<!-- #enddocregion ngModel -->
<label for="hero-power">Power: </label>
<input type="text" for="hero-name" [(ngModel)]="hero.power">

View File

@ -7,5 +7,5 @@ import { Hero } from './hero';
templateUrl: './hero-detail.component.html'
})
export class HeroDetailComponent {
@Input() hero: Hero;
@Input() hero!: Hero;
}

View File

@ -1,7 +1,7 @@
<!-- #docregion -->
<h2>Hero List</h2>
<p><i>Pick a hero from the list</i></p>
<p><i>Select a hero from the list to see details.</i></p>
<ul>
<li *ngFor="let hero of heroes" (click)="selectHero(hero)">
{{hero.name}}

View File

@ -13,8 +13,8 @@ import { HeroService } from './hero.service';
// #docregion class
export class HeroListComponent implements OnInit {
// #enddocregion metadata
heroes: Hero[];
selectedHero: Hero;
heroes: Hero[] = [];
selectedHero: Hero | undefined;
// #docregion ctor
constructor(private service: HeroService) { }

View File

@ -7,11 +7,12 @@ import { TaxRateService } from './tax-rate.service';
selector: 'app-sales-tax',
template: `
<h2>Sales Tax Calculator</h2>
<label>Amount: <input #amountBox (change)="0"></label>
<p><i>Enter a number and press enter to calculate tax.</i></p>
<label for="amount-input">Amount: </label>
<input type="text" id="amount-input" #amountBox (change)="0">
<div *ngIf="amountBox.value">
The sales tax is
{{ getTax(amountBox.value) | currency:'USD':true:'1.2-2' }}
<p>The sales tax is
{{ getTax(amountBox.value) | currency:'USD':true:'1.2-2' }}</p>
</div>
`,
providers: [SalesTaxService, TaxRateService]

View File

@ -0,0 +1,23 @@
ul {
padding-left: 0;
}
li {
list-style-type: none;
padding: 1rem;
background-color: aliceblue;
border: 1px solid #444;
margin-bottom: .5rem;
}
li:hover {
background-color: #444;
color: white;
cursor: pointer;
}
label {
display: block;
padding-bottom: .4rem;
margin-top: 1rem;
}

View File

@ -5,7 +5,8 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<base href="/">
<link rel="stylesheet" href="assets/architecture.css">
</head>
<body>
<app-root></app-root>
</body>

View File

@ -13,17 +13,17 @@ describe('Attribute binding example', () => {
});
it('should display an Aria button', async () => {
expect(await element.all(by.css('button')).get(0).getText()).toBe('Go for it with Aria');
expect(await element.all(by.css('button')).get(0).getText()).toBe('Create and set an attribute with Aria');
});
it('should display a blue background on div', async () => {
it('should display a black background on div', async () => {
const div = element.all(by.css('div')).get(1);
expect(await div.getCssValue('background-color')).toEqual('rgba(25, 118, 210, 1)');
expect(await div.getCssValue('background-color')).toEqual('rgba(0, 0, 0, 1)');
});
it('should display a blue div with a red border', async () => {
it('should display a black div with a light blue double border', async () => {
const div = element.all(by.css('div')).get(1);
expect(await div.getCssValue('border')).toEqual('2px solid rgb(212, 30, 46)');
expect(await div.getCssValue('border')).toEqual('16px double rgb(87, 209, 255)');
});
it('should display a div with many classes', async () => {

View File

@ -1,22 +1,32 @@
.special {
background-color: #1976d2;
background-color: black;
color: #ffffff;
margin-bottom: .5rem;
padding: 1rem;
}
.item {
font-weight: bold;
}
.clearance {
border: 2px solid #d41e2e;
}
.item-clearance {
font-style: italic;
border: 1rem double #57d1ff;
}
.new-class {
background-color: #ed1b2f;
font-style: italic;
color: #fff;
/* Styles for demo */
comp-with-host-binding {
display: block;
margin: 1rem 0;
}
td {
padding: 1rem;
text-align: center;
}
h3 {
padding: 1rem 0 .75rem 0;
}
.readability {
background-color: black;
padding: .5rem;
margin: 1rem 0;
}

View File

@ -35,19 +35,22 @@
<!-- The `class.special` binding overrides any value for the `special` class in `classExpression`. -->
<div [class.special]="isSpecial" [class]="classExpression">Some text.</div>
<!-- The `style.color` binding overrides any value for the `color` property in `styleExpression`. -->
<div [style.color]="color" [style]="styleExpression">Some text.</div>
<!-- The `style.border` binding overrides any value for the `border` property in `styleExpression`. -->
<div [style.border]="border" [style]="styleExpression">Some text.</div>
<!-- #enddocregion basic-specificity -->
<!-- #docregion source-specificity -->
<h3>Source specificity</h3>
<!-- The `class.special` template binding overrides any host binding to the `special` class set by `dirWithClassBinding` or `comp-with-host-binding`.-->
<comp-with-host-binding [class.special]="isSpecial" dirWithClassBinding>Some text.</comp-with-host-binding>
<comp-with-host-binding [class.special]="isSpecial" dirWithClassBinding></comp-with-host-binding>
<!-- The `style.color` template binding overrides any host binding to the `color` property set by `dirWithStyleBinding` or `comp-with-host-binding`. -->
<comp-with-host-binding [style.color]="color" dirWithStyleBinding>Some text.</comp-with-host-binding>
<!-- #enddocregion source-specificity -->
<div>
<comp-with-host-binding [style.color]="color" dirWithStyleBinding></comp-with-host-binding>
</div>
<!-- #docregion dynamic-priority -->
<h3>Dynamic vs static</h3>
@ -55,15 +58,18 @@
<!-- If `classExpression` has a value for the `special` class, this value overrides the `class="special"` below -->
<div class="special" [class]="classExpression">Some text.</div>
<!-- If `styleExpression` has a value for the `color` property, this value overrides the `style="color: blue"` below -->
<div style="color: blue" [style]="styleExpression">Some text.</div>
<!-- If `styleExpression` has a value for the `border` property, this value overrides the `style="border: dotted darkblue 3px"` below -->
<div style="border: dotted darkblue 3px" [style]="styleExpression">Some text.</div>
<!-- #enddocregion dynamic-priority -->
<!-- #docregion style-delegation -->
<comp-with-host-binding dirWithHostBinding></comp-with-host-binding>
<!-- #enddocregion style-delegation -->
<div class="readability">
<!-- #docregion style-delegation -->
<comp-with-host-binding dirWithHostBinding></comp-with-host-binding>
<!-- #enddocregion style-delegation -->
</div>
<!-- #docregion attribute-decorator -->
<app-my-input-with-attribute-decorator type="number"></app-my-input-with-attribute-decorator>
<!-- #enddocregion attribute-decorator -->

View File

@ -6,10 +6,11 @@ import { Component } from '@angular/core';
styleUrls: ['./app.component.css']
})
export class AppComponent {
actionName = 'Go for it';
actionName = 'Create and set an attribute';
isSpecial = true;
canSave = true;
classExpression = 'special clearance';
styleExpression = 'color: red';
styleExpression = 'border: solid red 3px';
color = 'blue';
border = '.5rem dashed black';
}

View File

@ -9,11 +9,10 @@ export class CompWithHostBindingComponent {
isSpecial = false;
@HostBinding('style.color')
color = 'green';
color = 'pink';
// #docregion hostbinding
@HostBinding('style.width')
width = '200px';
// #enddocregion hostbinding
}

View File

@ -2,7 +2,7 @@ import { Attribute, Component } from '@angular/core';
@Component({
selector: 'app-my-input-with-attribute-decorator',
template: 'The type of the input is: {{ type }}'
template: '<p>The type of the input is: {{ type }}</p>'
})
export class MyInputWithAttributeDecoratorComponent {
constructor(@Attribute('type') public type: string) { }

View File

@ -7,5 +7,5 @@ import { Component } from '@angular/core';
})
// #docregion class
export class AppComponent {
color: string;
color = '';
}

View File

@ -19,7 +19,7 @@ export class HighlightDirective {
}
@HostListener('mouseleave') onMouseLeave() {
this.highlight(null);
this.highlight('');
}
private highlight(color: string) {

View File

@ -11,7 +11,7 @@ export class HighlightDirective {
constructor(private el: ElementRef) { }
// #docregion input
@Input() appHighlight: string;
@Input() appHighlight = '';
// #enddocregion input
@HostListener('mouseenter') onMouseEnter() {
@ -19,7 +19,7 @@ export class HighlightDirective {
}
@HostListener('mouseleave') onMouseLeave() {
this.highlight(null);
this.highlight('');
}
private highlight(color: string) {

View File

@ -9,10 +9,10 @@ export class HighlightDirective {
constructor(private el: ElementRef) { }
// #docregion defaultColor
@Input() defaultColor: string;
@Input() defaultColor = '';
// #enddocregion defaultColor
@Input('appHighlight') highlightColor: string;
@Input('appHighlight') highlightColor = '';
// #docregion mouse-enter
@HostListener('mouseenter') onMouseEnter() {
@ -21,7 +21,7 @@ export class HighlightDirective {
// #enddocregion mouse-enter
@HostListener('mouseleave') onMouseLeave() {
this.highlight(null);
this.highlight('');
}
private highlight(color: string) {

View File

@ -7,7 +7,7 @@ describe('Binding syntax e2e tests', () => {
// helper function used to test what's logged to the console
async function logChecker(contents) {
async function logChecker(contents: string) {
const logs = await browser.manage().logs().get(logging.Type.BROWSER);
const messages = logs.filter(({ message }) => message.indexOf(contents) !== -1 ? true : false);
expect(messages.length).toBeGreaterThan(0);

View File

@ -8,7 +8,7 @@ import { Component, ViewChild, ElementRef } from '@angular/core';
})
export class AppComponent {
@ViewChild('bindingInput') bindingInput: ElementRef;
@ViewChild('bindingInput') bindingInput!: ElementRef;
isUnchanged = true;

View File

@ -8,7 +8,7 @@
<p>Current item name: {{currentItem.name}}</p>
<p>
<label for="without">without NgModel:</label>
<input [value]="currentItem.name" (input)="currentItem.name=getValue($event.target)" id="without">
<input [value]="currentItem.name" (input)="currentItem.name=getValue($event)" id="without">
</p>
<p>

View File

@ -13,16 +13,16 @@ export class AppComponent implements OnInit {
isUnchanged = true;
isActive = true;
nullCustomer = null;
nullCustomer: string | null = null;
currentCustomer = {
name: 'Laura'
};
item: Item; // defined to demonstrate template context precedence
items: Item[];
item!: Item; // defined to demonstrate template context precedence
items: Item[] = [];
// #docregion item
currentItem: Item;
currentItem!: Item;
// #enddocregion item
@ -34,11 +34,11 @@ export class AppComponent implements OnInit {
itemIdIncrement = 1;
// #docregion setClasses
currentClasses: {};
currentClasses: Record<string, boolean> = {};
// #enddocregion setClasses
// #docregion setStyles
currentStyles: {};
currentStyles: Record<string, string> = {};
// #enddocregion setStyles
ngOnInit() {
@ -114,8 +114,8 @@ export class AppComponent implements OnInit {
trackById(index: number, item: any): number { return item.id; }
getValue(target: EventTarget): string {
return (target as HTMLInputElement).value;
getValue(event: Event): string {
return (event.target as HTMLInputElement).value;
}
}

View File

@ -10,7 +10,7 @@ import { Item } from '../item';
export class ItemDetailComponent {
@Input() item: Item;
@Input() item!: Item;
constructor() { }

View File

@ -8,7 +8,7 @@ import { Item } from './item';
// #docregion input
export class StoutItemComponent {
@Input() item: Item;
@Input() item!: Item;
}
// #enddocregion input
@ -18,7 +18,7 @@ export class StoutItemComponent {
template: `This is the brightest {{item.name}} in town.`
})
export class BestItemComponent {
@Input() item: Item;
@Input() item!: Item;
}
@Component({
@ -26,7 +26,7 @@ export class BestItemComponent {
template: `Which is the slimmest {{item.name}}?`
})
export class DeviceItemComponent {
@Input() item: Item;
@Input() item!: Item;
}
@Component({
@ -34,7 +34,7 @@ export class DeviceItemComponent {
template: `Has anyone seen my {{item.name}}?`
})
export class LostItemComponent {
@Input() item: Item;
@Input() item!: Item;
}
@Component({
@ -42,7 +42,7 @@ export class LostItemComponent {
template: `{{message}}`
})
export class UnknownItemComponent {
@Input() item: Item;
@Input() item!: Item;
get message() {
return this.item && this.item.name ?
`${this.item.name} is strange and mysterious.` :

View File

@ -3,7 +3,7 @@ export class Item {
static items: Item[] = [
new Item(
null,
0,
'Teapot',
'stout'
),
@ -15,7 +15,7 @@ export class Item {
constructor(
public id?: number,
public id: number,
public name?: string,
public feature?: string,
public url?: string,
@ -25,6 +25,6 @@ export class Item {
}
clone(): Item {
return Object.assign(new Item(), this);
return Object.assign(new Item(this.id), this);
}
}

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