diff --git a/.circleci/config.yml b/.circleci/config.yml index 3ba1c49ec78a..9e3c3960a1d6 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -270,6 +270,7 @@ jobs: resource_class: medium steps: - custom_attach_workspace + - install_python - run: name: Decrypt Credentials # Note: when changing the image, you might have to re-encrypt the credentials with a diff --git a/.github/workflows/feature-requests.yml b/.github/workflows/feature-requests.yml new file mode 100644 index 000000000000..7ae70b11407d --- /dev/null +++ b/.github/workflows/feature-requests.yml @@ -0,0 +1,17 @@ +name: Feature request triage bot + +on: + schedule: + # Run at 13:00 every day + - cron: '0 13 * * *' + +jobs: + feature_triage: + # To prevent this action from running in forks, we only run it if the repository is exactly the + # angular/angular-cli repository. + if: github.repository == 'angular/angular-cli' + runs-on: ubuntu-latest + steps: + - uses: angular/dev-infra/github-actions/feature-request@354871956801929457d9f08482fb81f7012ed7c8 + with: + angular-robot-key: ${{ secrets.ANGULAR_ROBOT_PRIVATE_KEY }} diff --git a/.monorepo.json b/.monorepo.json index 7faf7aaa3c40..fd68697c7b8f 100644 --- a/.monorepo.json +++ b/.monorepo.json @@ -1,45 +1,4 @@ { - "badges": [ - [ - { - "image": "https://img.shields.io/circleci/project/github/angular/angular-cli/master.svg?label=circleci", - "label": "CircleCI branch", - "url": "https://circleci.com/gh/angular/angular-cli" - }, - { - "title": "![Dependency Status](https://david-dm.org/angular/angular-cli.svg)", - "url": "https://david-dm.org/angular/angular-cli" - }, - { - "title": "![devDependency Status](https://david-dm.org/angular/angular-cli/dev-status.svg)", - "url": "https://david-dm.org/angular/angular-cli?type=dev" - } - ], - [ - { - "label": "License", - "image": "https://img.shields.io/npm/l/@angular/cli.svg", - "url": "/LICENSE" - } - ], - [ - { - "label": "GitHub forks", - "image": "https://img.shields.io/github/forks/angular/angular-cli.svg?style=social&label=Fork", - "url": "https://github.com/angular/angular-cli/fork" - }, - { - "label": "GitHub stars", - "image": "https://img.shields.io/github/stars/angular/angular-cli.svg?style=social&label=Star", - "url": "https://github.com/angular/angular-cli" - } - ] - ], - "links": { - "Gitter": "https://gitter.im/angular/angular-cli", - "Contributing": "/CONTRIBUTING.md", - "Angular CLI": "http://github.com/angular/angular-cli" - }, "packages": { "@_/benchmark": {}, "@_/builders": {}, diff --git a/CHANGELOG.md b/CHANGELOG.md index d62a4ff13cbb..490c036a6c62 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,27 @@ + + +# 13.2.2 (2022-02-02) + +### @angular-devkit/build-angular + +| Commit | Type | Description | +| --------------------------------------------------------------------------------------------------- | ---- | --------------------------------------------------------- | +| [cc5505cfc](https://github.com/angular/angular-cli/commit/cc5505cfcf12732fad4f85e6e76c8e4f0584c13a) | fix | add `whatwg-url` to downlevel exclusion list | +| [ff54b49e7](https://github.com/angular/angular-cli/commit/ff54b49e7097cda2eb835bc8c9674f71fcc91c3c) | fix | ensure to use content hash as filenames hashing mechanism | +| [b0e2bb289](https://github.com/angular/angular-cli/commit/b0e2bb289050efc77478a0f50778abbec9c5a318) | perf | update `license-webpack-plugin` to `4.0.1` | + +### @angular-devkit/core + +| Commit | Type | Description | +| --------------------------------------------------------------------------------------------------- | ---- | -------------------------------------------- | +| [c8826a973](https://github.com/angular/angular-cli/commit/c8826a9738f860e374bd65a058c6be1b02545133) | fix | correctly resolve schema references defaults | + +## Special Thanks + +Alan Agius, Derek Cormier and Joey Perrott + + + # 13.2.1 (2022-01-31) diff --git a/README.md b/README.md index 4bae010dfd5a..3f3fc0dfff21 100644 --- a/README.md +++ b/README.md @@ -10,166 +10,141 @@ Any changes to README.md directly will result in a failure on CI. --> -# Angular CLI -### Development tools and libraries specialized for Angular +

Angular CLI - The CLI tool for Angular.

-This is the home of the DevKit and the Angular CLI code. You can find the Angular CLI specific README -[here](/packages/angular/cli/README.md). +

+
+ Angular CLI logo +

+ The Angular CLI is a command-line interface tool that you use to initialize, develop, scaffold, +
and maintain Angular applications directly from a command shell.
+
+

+

+ cli.angular.io +
+

-[![CircleCI branch](https://img.shields.io/circleci/project/github/angular/angular-cli/master.svg?label=circleci)](https://circleci.com/gh/angular/angular-cli) [![Dependency Status](https://david-dm.org/angular/angular-cli.svg)](https://david-dm.org/angular/angular-cli) [![devDependency Status](https://david-dm.org/angular/angular-cli/dev-status.svg)](https://david-dm.org/angular/angular-cli?type=dev) +

+ Contributing Guidelines + · + Submit an Issue + · + Blog +
+
+

-[![License](https://img.shields.io/npm/l/@angular/cli.svg)](/LICENSE) +

+ + CI status +   + + Discord conversation + +

-[![GitHub forks](https://img.shields.io/github/forks/angular/angular-cli.svg?style=social&label=Fork)](https://github.com/angular/angular-cli/fork) [![GitHub stars](https://img.shields.io/github/stars/angular/angular-cli.svg?style=social&label=Star)](https://github.com/angular/angular-cli) +
+## Documentation +Get started with Angular CLI, learn the fundamentals and explore advanced topics on our documentation website. -### Quick Links -[Gitter](https://gitter.im/angular/angular-cli) | [Contributing](/CONTRIBUTING.md) | [Angular CLI](http://github.com/angular/angular-cli) | -|---|---|---| +- [Getting started][quickstart] +- [CLI][cli] +- [Workspace and project file structure][filestructure] +- [Workspace configuration][workspaceconfig] +- [Schematics][schematics] ----- +## Development Setup -## The Goal of Angular CLI -The Angular CLI creates, manages, builds and test your Angular projects. It's built on top of the -Angular DevKit. +### Prerequisites -## The Goal of DevKit +- Install [Node.js] which includes [Node Package Manager][npm] -DevKit's goal is to provide a large set of libraries that can be used to manage, develop, deploy and -analyze your code. +### Setting Up a Project -# Getting Started - Local Development +Install the Angular CLI globally: -## Installation - -To get started locally, follow these instructions: - -1. If you haven't done it already, [make a fork of this repo](https://github.com/angular/angular-cli/fork). -1. Clone to your local computer using `git`. -1. Make sure that you have Node 12.14 or 14.0 installed. See instructions [here](https://nodejs.org/en/download/). -1. Make sure that you have `yarn` installed; see instructions [here](https://yarnpkg.com/lang/en/docs/install/). -1. Run `yarn` (no arguments) from the root of your clone of this project to install dependencies. - -## Building and Installing the CLI - -To make a local build: - -```shell -yarn build --local +``` +npm install -g @angular/cli ``` -This generates a number of tarballs in the `dist/` directory. To actually use -the locally built tools, switch to another repository reproducing the specific -issue you want to fix (or just generate a local repo with `ng new`). Then -install the locally built packages: +Create workspace: -```shell -cd "${EXAMPLE_ANGULAR_PROJECT_REPO}" -npm install -D ${CLI_REPO}/dist/*.tgz +``` +ng new [PROJECT NAME] ``` -Builds of this example project will use tooling created from the previous local -build and include any local changes. When using the CLI, it will automatically -check for a local install and use that if present. This means you can just run: +Run the application: -```shell -npm install -g @angular/cli +``` +cd [PROJECT NAME] +ng serve ``` -to get a global install of the latest CLI release. Then running any `ng` command -in the example project will automatically find and use the local build of the -CLI. - -Note: If you are testing `ng update`, be aware that installing all the tarballs -will also update the framework (`@angular/core`) to the latest version. In this -case, simply install the CLI alone with -`npm install -D ${CLI_REPO}/dist/_angular_cli.tgz`, that way the rest of the -project remains to be upgraded with `ng update`. +Angular is cross-platform, fast, scalable, has incredible tooling, and is loved by millions. -## Debugging +## Quickstart -To debug an invocation of the CLI, [build and install the CLI for an example -project](#building-and-installing-the-cli), then run the desired `ng` command -as: +[Get started in 5 minutes][quickstart]. -```shell -node --inspect-brk node_modules/.bin/ng ... -``` +## Ecosystem -This will trigger a breakpoint as the CLI starts up. You can connect to this -using the supported mechanisms for your IDE, but the simplest option is to open -Chrome to [chrome://inspect](chrome://inspect) and then click on the `inspect` -link for the `node_modules/.bin/ng` Node target. +

+ angular ecosystem logos +

-Unfortunately, the CLI dynamically `require()`'s other files mid-execution, so -the debugger is not aware of all the source code files before hand. As a result, -it is tough to put breakpoints on files before the CLI loads them. The easiest -workaround is to use the `debugger;` statement to stop execution in the file you -are interested in, and then you should be able to step around and set breakpoints -as expected. +- [Angular Framework][aio] +- [Angular Material][angularmaterial] -## Testing +## Changelog -There are two different test suites which can be run locally: +[Learn about the latest improvements][changelog]. -### Unit tests - * Run all tests: `yarn bazel test //packages/...` - * Run a subset of the tests, use the full Bazel target example: `yarn bazel test //packages/schematics/angular:angular_test` - * For a complete list of test targets use the following Bazel query: `yarn bazel query "tests(//packages/...)"` +## Upgrading -You can find more info about debugging [tests with Bazel in the docs.](https://github.com/angular/angular-cli/blob/master/docs/process/bazel.md#debugging-jasmine_node_test) +Check out our [upgrade guide](https://update.angular.io/) to find out the best way to upgrade your project. -### End to end tests - * Run: `node tests/legacy-cli/run_e2e.js` - * Run a subset of the tests: `node tests/legacy-cli/run_e2e.js tests/legacy-cli/e2e/tests/i18n/ivy-localize-*` +## Contributing -When running the debug commands, Node will stop and wait for a debugger to attach. -You can attach your IDE to the debugger to stop on breakpoints and step through the code. Also, see [IDE Specific Usage](#ide-specific-usage) for a -simpler debug story. +### Contributing Guidelines -When debugging a specific test, change `describe()` or `it()` to `fdescribe()` -and `fit()` to focus execution to just that one test. This will keep the output clean and speed up execution by not running irrelevant tests. +Read through our [contributing guidelines][contributing] to learn about our submission process, coding rules and more. -## IDE Specific Usage +### Want to Help? -Some additional tips for developing in specific IDEs. +Want to report 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 [help wanted](https://github.com/angular/angular-cli/labels/help%20wanted) or [good first issue](https://github.com/angular/angular-cli/labels/good%20first%20issue). -### Intellij IDEA / WebStorm +### Code of Conduct -To load the project in Intellij products, simply `Open` the repository folder. -Do **not** `Import Project`, because that will overwrite the existing -configuration. +Help us keep Angular open and inclusive. Please read and follow our [Code of Conduct][codeofconduct]. -Once opened, the editor should automatically detect run configurations in the -workspace. Use the drop down to choose which one to run and then click the `Run` -button to start it. When executing a debug target, make sure to click the -`Debug` icon to automatically attach the debugger (if you click `Run`, Node will -wait forever for a debugger to attach). +### Developer Guide -![Intellij IDEA run configurations](docs/images/run-configurations.png) +Read through our [developer guide][developer] to learn about how to build and test the Angular CLI locally. -## Creating New Packages -Adding a package to this repository means running two separate commands: +## Community -1. `schematics devkit:package PACKAGE_NAME`. This will update the `.monorepo` file, and create the - base files for the new package (package.json, src/index, etc). -1. `devkit-admin templates`. This will update the README and all other template files that might - have changed when adding a new package. +Join the conversation and help the community. -For private packages, you will need to add a `"private": true` key to your package.json manually. -This will require re-running the template admin script. +- [Twitter][twitter] +- [Discord][discord] +- [Gitter][gitter] +- [YouTube][youtube] +- [StackOverflow][stackoverflow] +- Find a Local [Meetup][meetup] -# Packages +## Packages This is a monorepo which contains many tools and packages: -## Tools +### Tools | Project | Package | Version | Links | |---|---|---|---| @@ -178,14 +153,13 @@ This is a monorepo which contains many tools and packages: **Schematics CLI** | [`@angular-devkit/schematics-cli`](https://npmjs.com/package/@angular-devkit/schematics-cli) | [![latest](https://img.shields.io/npm/v/%40angular-devkit%2Fschematics-cli/latest.svg)](https://npmjs.com/package/@angular-devkit/schematics-cli) | [![snapshot](https://img.shields.io/badge/snapshot--blue.svg)](https://github.com/angular/angular-devkit-schematics-cli-builds) -## Packages +### Packages | Project | Package | Version | Links | |---|---|---|---| **Architect** | [`@angular-devkit/architect`](https://npmjs.com/package/@angular-devkit/architect) | [![latest](https://img.shields.io/npm/v/%40angular-devkit%2Farchitect/latest.svg)](https://npmjs.com/package/@angular-devkit/architect) | [![README](https://img.shields.io/badge/README--green.svg)](/packages/angular_devkit/architect/README.md) [![snapshot](https://img.shields.io/badge/snapshot--blue.svg)](https://github.com/angular/angular-devkit-architect-builds) **Build Angular** | [`@angular-devkit/build-angular`](https://npmjs.com/package/@angular-devkit/build-angular) | [![latest](https://img.shields.io/npm/v/%40angular-devkit%2Fbuild-angular/latest.svg)](https://npmjs.com/package/@angular-devkit/build-angular) | [![README](https://img.shields.io/badge/README--green.svg)](/packages/angular_devkit/build_angular/README.md) [![snapshot](https://img.shields.io/badge/snapshot--blue.svg)](https://github.com/angular/angular-devkit-build-angular-builds) -**Build Optimizer** | [`@angular-devkit/build-optimizer`](https://npmjs.com/package/@angular-devkit/build-optimizer) | [![latest](https://img.shields.io/npm/v/%40angular-devkit%2Fbuild-optimizer/latest.svg)](https://npmjs.com/package/@angular-devkit/build-optimizer) | [![README](https://img.shields.io/badge/README--green.svg)](/packages/angular_devkit/build_optimizer/README.md) [![snapshot](https://img.shields.io/badge/snapshot--blue.svg)](https://github.com/angular/angular-devkit-build-optimizer-builds) **Build Webpack** | [`@angular-devkit/build-webpack`](https://npmjs.com/package/@angular-devkit/build-webpack) | [![latest](https://img.shields.io/npm/v/%40angular-devkit%2Fbuild-webpack/latest.svg)](https://npmjs.com/package/@angular-devkit/build-webpack) | [![README](https://img.shields.io/badge/README--green.svg)](/packages/angular_devkit/build_webpack/README.md) [![snapshot](https://img.shields.io/badge/snapshot--blue.svg)](https://github.com/angular/angular-devkit-build-webpack-builds) **Core** | [`@angular-devkit/core`](https://npmjs.com/package/@angular-devkit/core) | [![latest](https://img.shields.io/npm/v/%40angular-devkit%2Fcore/latest.svg)](https://npmjs.com/package/@angular-devkit/core) | [![README](https://img.shields.io/badge/README--green.svg)](/packages/angular_devkit/core/README.md) [![snapshot](https://img.shields.io/badge/snapshot--blue.svg)](https://github.com/angular/angular-devkit-core-builds) **Schematics** | [`@angular-devkit/schematics`](https://npmjs.com/package/@angular-devkit/schematics) | [![latest](https://img.shields.io/npm/v/%40angular-devkit%2Fschematics/latest.svg)](https://npmjs.com/package/@angular-devkit/schematics) | [![README](https://img.shields.io/badge/README--green.svg)](/packages/angular_devkit/schematics/README.md) [![snapshot](https://img.shields.io/badge/snapshot--blue.svg)](https://github.com/angular/angular-devkit-schematics-builds) @@ -204,3 +178,26 @@ This is a monorepo which contains many tools and packages: **Webpack Angular Plugin** | [`@ngtools/webpack`](https://npmjs.com/package/@ngtools/webpack) | [![latest](https://img.shields.io/npm/v/%40ngtools%2Fwebpack/latest.svg)](https://npmjs.com/package/@ngtools/webpack) | [![snapshot](https://img.shields.io/badge/snapshot--blue.svg)](https://github.com/angular/ngtools-webpack-builds) + +**Love Angular CLI? Give our repo a star :star: :arrow_up:.** + +[contributing]: CONTRIBUTING.md +[developer]: docs/DEVELOPER.md +[quickstart]: https://angular.io/start +[changelog]: CHANGELOG.md +[documentation]: https://angular.io/docs +[angularmaterial]: https://material.angular.io/ +[cli]: https://cli.angular.io/ +[aio]: https://angular.io/ +[workspaceconfig]: https://angular.io/guide/workspace-config +[schematics]: https://angular.io/guide/schematics +[filestructure]: https://angular.io/guide/file-structure +[node.js]: https://nodejs.org/ +[npm]: https://www.npmjs.com/get-npm +[codeofconduct]: https://github.com/angular/angular/blob/master/CODE_OF_CONDUCT.md +[twitter]: https://www.twitter.com/angular +[discord]: https://discord.gg/angular +[gitter]: https://gitter.im/angular/angular-cli +[stackoverflow]: https://stackoverflow.com/questions/tagged/angular-cli +[youtube]: https://youtube.com/angular +[meetup]: https://www.meetup.com/find/?keywords=angular diff --git a/docs/DEVELOPER.md b/docs/DEVELOPER.md new file mode 100644 index 000000000000..c8c58812bebb --- /dev/null +++ b/docs/DEVELOPER.md @@ -0,0 +1,170 @@ +# Building and Testing Angular CLI + +## Installation + +To get started locally, follow these instructions: + +1. If you haven't done it already, [make a fork of this repo](https://github.com/angular/angular-cli/fork). +1. Clone to your local computer using `git`. +1. Make sure that you have Node `v12.20`, `v14.15`, or `v16.10` installed. See instructions [here](https://nodejs.org/en/download/). +1. Make sure that you have `yarn` installed; see instructions [here](https://yarnpkg.com/lang/en/docs/install/). +1. Run `yarn` (no arguments) from the root of your clone of this project to install dependencies. + +## Building and Installing the CLI + +To make a local build: + +```shell +yarn build --local +``` + +This generates a number of tarballs in the `dist/` directory. To actually use +the locally built tools, switch to another repository reproducing the specific +issue you want to fix (or just generate a local repo with `ng new`). Then +install the locally built packages: + +```shell +cd "${EXAMPLE_ANGULAR_PROJECT_REPO}" +npm install -D ${CLI_REPO}/dist/*.tgz +``` + +Builds of this example project will use tooling created from the previous local +build and include any local changes. When using the CLI, it will automatically +check for a local install and use that if present. This means you can just run: + +```shell +npm install -g @angular/cli +``` + +to get a global install of the latest CLI release. Then running any `ng` command +in the example project will automatically find and use the local build of the +CLI. + +Note: If you are testing `ng update`, be aware that installing all the tarballs +will also update the framework (`@angular/core`) to the latest version. In this +case, simply install the CLI alone with +`npm install -D ${CLI_REPO}/dist/_angular_cli.tgz`, that way the rest of the +project remains to be upgraded with `ng update`. + +## Debugging + +To debug an invocation of the CLI, [build and install the CLI for an example +project](#building-and-installing-the-cli), then run the desired `ng` command +as: + +```shell +node --inspect-brk node_modules/.bin/ng ... +``` + +This will trigger a breakpoint as the CLI starts up. You can connect to this +using the supported mechanisms for your IDE, but the simplest option is to open +Chrome to [chrome://inspect](chrome://inspect) and then click on the `inspect` +link for the `node_modules/.bin/ng` Node target. + +Unfortunately, the CLI dynamically `require()`'s other files mid-execution, so +the debugger is not aware of all the source code files before hand. As a result, +it is tough to put breakpoints on files before the CLI loads them. The easiest +workaround is to use the `debugger;` statement to stop execution in the file you +are interested in, and then you should be able to step around and set breakpoints +as expected. + +## Testing + +There are two different test suites which can be run locally: + +### Unit tests + +- Run all tests: `yarn bazel test //packages/...` +- Run a subset of the tests, use the full Bazel target example: `yarn bazel test //packages/schematics/angular:angular_test` +- For a complete list of test targets use the following Bazel query: `yarn bazel query "tests(//packages/...)"` + +You can find more info about debugging [tests with Bazel in the docs.](https://github.com/angular/angular-cli/blob/master/docs/process/bazel.md#debugging-jasmine_node_test) + +### End to end tests + +- Run: `node tests/legacy-cli/run_e2e.js` +- Run a subset of the tests: `node tests/legacy-cli/run_e2e.js tests/legacy-cli/e2e/tests/i18n/ivy-localize-*` + +When running the debug commands, Node will stop and wait for a debugger to attach. +You can attach your IDE to the debugger to stop on breakpoints and step through the code. Also, see [IDE Specific Usage](#ide-specific-usage) for a +simpler debug story. + +When debugging a specific test, change `describe()` or `it()` to `fdescribe()` +and `fit()` to focus execution to just that one test. This will keep the output clean and speed up execution by not running irrelevant tests. + +## IDE Specific Usage + +Some additional tips for developing in specific IDEs. + +### Intellij IDEA / WebStorm + +To load the project in Intellij products, simply `Open` the repository folder. +Do **not** `Import Project`, because that will overwrite the existing +configuration. + +Once opened, the editor should automatically detect run configurations in the +workspace. Use the drop down to choose which one to run and then click the `Run` +button to start it. When executing a debug target, make sure to click the +`Debug` icon to automatically attach the debugger (if you click `Run`, Node will +wait forever for a debugger to attach). + +![Intellij IDEA run configurations](images/run-configurations.png) + +### VS Code + +In order to debug some Angular CLI behaviour using Visual Studio Code, you can run `npm run build`, and then use a launch configuration like the following: + +```json +{ + "type": "node", + "request": "launch", + "name": "ng serve", + "cwd": "", + "program": "${workspaceFolder}/dist/@angular/cli/bin/ng", + "args": [ + "", + ...other arguments + ], + "console": "integratedTerminal" +} +``` + +Then you can add breakpoints in `dist/@angular` files. + +For more informations about Node.js debugging in VS Code, see the related [VS Code Documentation](https://code.visualstudio.com/docs/nodejs/nodejs-debugging). + +## CPU Profiling + +In order to investigate performance issues, CPU profiling is often useful. + +### Creating a profile + +Node.js 16+ users can use the Node.js command line argument `--cpu-prof` to create a CPU profile. + +```bash +node --cpu-prof node_modules/.bin/ng build +``` + +In addition to this one, another, more elaborated way to capture a CPU profile using the Chrome Devtools is detailed in https://github.com/angular/angular-cli/issues/8259#issue-269908550. + +#### Opening a profile + +You can use the Chrome Devtools to process it. To do so: + +1. open `chrome://inspect` in Chrome +1. click on "Open dedicated DevTools for Node" +1. go to the "profiler" tab +1. click on the "Load" button and select the generated `.cpuprofile` file +1. on the left panel, select the associated file + +## Creating New Packages + +Adding a package to this repository means running two separate commands: + +1. `schematics devkit:package PACKAGE_NAME`. This will update the `.monorepo` file, and create the + base files for the new package (package.json, src/index, etc). +1. `devkit-admin templates`. This will update the README and all other template files that might + have changed when adding a new package. + +For private packages, you will need to add a `"private": true` key to your package.json manually. +This will require re-running the template admin script. diff --git a/docs/images/angular-cli-logo.png b/docs/images/angular-cli-logo.png new file mode 100644 index 000000000000..279687174851 Binary files /dev/null and b/docs/images/angular-cli-logo.png differ diff --git a/docs/images/angular-ecosystem-logos.png b/docs/images/angular-ecosystem-logos.png new file mode 100644 index 000000000000..f1f311b3d9d3 Binary files /dev/null and b/docs/images/angular-ecosystem-logos.png differ diff --git a/lib/packages.ts b/lib/packages.ts index 4844a370cb64..af923e99d72c 100644 --- a/lib/packages.ts +++ b/lib/packages.ts @@ -152,14 +152,15 @@ const packageJsonPaths = [ ..._findPrimaryPackageJsonFiles(path.join(__dirname, '..', 'packages'), excludeRe), ]; -function _exec(cmd: string) { - return execSync(cmd).toString().trim(); +function _exec(cmd: string, opts?: { cwd?: string }) { + return execSync(cmd, opts).toString().trim(); } let gitShaCache: string; function _getSnapshotHash(_pkg: PackageInfo): string { if (!gitShaCache) { - gitShaCache = _exec('git log --format=%h -n1'); + const opts = { cwd: __dirname }; // Ensure we call git from within this repo + gitShaCache = _exec('git log --format=%h -n1', opts); } return gitShaCache; diff --git a/package.json b/package.json index a954e48bd19c..48c968ac7596 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@angular/devkit-repo", - "version": "13.2.1", + "version": "13.2.2", "private": true, "description": "Software Development Kit for Angular", "bin": { @@ -70,7 +70,7 @@ "@angular/compiler": "13.1.3", "@angular/compiler-cli": "13.1.3", "@angular/core": "13.1.3", - "@angular/dev-infra-private": "https://github.com/angular/dev-infra-private-builds.git#2024033f3123cd1beed78d43ec7269467cd9fa93", + "@angular/dev-infra-private": "https://github.com/angular/dev-infra-private-builds.git#3a34722a82fb0e8cd3fa00dfc5476767a35e021a", "@angular/forms": "13.1.3", "@angular/localize": "13.1.3", "@angular/material": "13.1.3", @@ -168,7 +168,7 @@ "less": "4.1.2", "less-loader": "10.2.0", "license-checker": "^25.0.0", - "license-webpack-plugin": "4.0.0", + "license-webpack-plugin": "4.0.1", "loader-utils": "3.2.0", "magic-string": "0.25.7", "mini-css-extract-plugin": "2.5.3", diff --git a/packages/angular/cli/README.md b/packages/angular/cli/README.md index ced76bc505d0..07b498c785dc 100644 --- a/packages/angular/cli/README.md +++ b/packages/angular/cli/README.md @@ -1,273 +1,5 @@ -## Angular CLI +# Angular CLI - The CLI tool for Angular. - +The sources for this package are in the [Angular CLI](https://github.com/angular/angular-cli) repository. Please file issues and pull requests against that repository. -[![Dependency Status][david-badge]][david-badge-url] -[![devDependency Status][david-dev-badge]][david-dev-badge-url] - -[![npm](https://img.shields.io/npm/v/%40angular/cli.svg)][npm-badge-url] -[![npm](https://img.shields.io/npm/v/%40angular/cli/next.svg)][npm-badge-url] -[![npm](https://img.shields.io/npm/l/@angular/cli.svg)][license-url] -[![npm](https://img.shields.io/npm/dm/@angular/cli.svg)][npm-badge-url] - -[![Join the chat at https://gitter.im/angular/angular-cli](https://img.shields.io/gitter/room/nwjs/nw.js.svg)](https://gitter.im/angular/angular-cli?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) - -[![GitHub forks](https://img.shields.io/github/forks/angular/angular-cli.svg?style=social&label=Fork)](https://github.com/angular/angular-cli/fork) -[![GitHub stars](https://img.shields.io/github/stars/angular/angular-cli.svg?style=social&label=Star)](https://github.com/angular/angular-cli) - -## Note - -If you are updating from a beta or RC version, check out our [1.0 Update Guide](https://github.com/angular/angular-cli/wiki/stories-1.0-update). - -If you wish to collaborate, check out [our issue list](https://github.com/angular/angular-cli/issues). - -Before submitting new issues, have a look at [issues marked with the `type: faq` label](https://github.com/angular/angular-cli/issues?utf8=%E2%9C%93&q=is%3Aissue%20label%3A%22type%3A%20faq%22%20). - -## Prerequisites - -Both the CLI and generated project have dependencies that require Node 8.9 or higher, together -with NPM 5.5.1 or higher. - -## Table of Contents - -- [Installation](#installation) -- [Usage](#usage) -- [Generating a New Project](#generating-and-serving-an-angular-project-via-a-development-server) -- [Generating Components, Directives, Pipes and Services](#generating-components-directives-pipes-and-services) -- [Updating Angular CLI](#updating-angular-cli) -- [Development Hints for working on Angular CLI](#development-hints-for-working-on-angular-cli) -- [Documentation](#documentation) -- [License](#license) - -## Installation - -**BEFORE YOU INSTALL:** please read the [prerequisites](#prerequisites) - -### Install Globally - -```bash -npm install -g @angular/cli -``` - -### Install Locally - -```bash -npm install @angular/cli -``` - -To run a locally installed version of the angular-cli, you can call `ng` commands directly by adding the `.bin` folder within your local `node_modules` folder to your PATH. The `node_modules` and `.bin` folders are created in the directory where `npm install @angular/cli` was run upon completion of the install command. - -Alternatively, you can install [npx](https://www.npmjs.com/package/npx) and run `npx ng ` within the local directory where `npm install @angular/cli` was run, which will use the locally installed angular-cli. - -### Install Specific Version (Example: 6.1.1) - -```bash -npm install -g @angular/cli@6.1.1 -``` - -## Usage - -```bash -ng help -``` - -### Generating and serving an Angular project via a development server - -```bash -ng new PROJECT-NAME -cd PROJECT-NAME -ng serve -``` - -Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files. - -You can configure the default HTTP host and port used by the development server with two command-line options : - -```bash -ng serve --host 0.0.0.0 --port 4201 -``` - -### Generating Components, Directives, Pipes and Services - -You can use the `ng generate` (or just `ng g`) command to generate Angular components: - -```bash -ng generate component my-new-component -ng g component my-new-component # using the alias - -# components support relative path generation -# if in the directory src/app/feature/ and you run -ng g component new-cmp -# your component will be generated in src/app/feature/new-cmp -# but if you were to run -ng g component ./newer-cmp -# your component will be generated in src/app/newer-cmp -# if in the directory src/app you can also run -ng g component feature/new-cmp -# and your component will be generated in src/app/feature/new-cmp -``` - -You can find all possible blueprints in the table below: - -| Scaffold | Usage | -| ------------------------------------------------------ | --------------------------------- | -| [Component](https://angular.io/cli/generate#component) | `ng g component my-new-component` | -| [Directive](https://angular.io/cli/generate#directive) | `ng g directive my-new-directive` | -| [Pipe](https://angular.io/cli/generate#pipe) | `ng g pipe my-new-pipe` | -| [Service](https://angular.io/cli/generate#service) | `ng g service my-new-service` | -| [Class](https://angular.io/cli/generate#class) | `ng g class my-new-class` | -| [Guard](https://angular.io/cli/generate#guard) | `ng g guard my-new-guard` | -| [Interface](https://angular.io/cli/generate#interface) | `ng g interface my-new-interface` | -| [Enum](https://angular.io/cli/generate#enum) | `ng g enum my-new-enum` | -| [Module](https://angular.io/cli/generate#module) | `ng g module my-module` | - -angular-cli will add reference to `components`, `directives` and `pipes` automatically in the `app.module.ts`. If you need to add this references to another custom module, follow these steps: - -1. `ng g module new-module` to create a new module -2. call `ng g component new-module/new-component` - -This should add the new `component`, `directive` or `pipe` reference to the `new-module` you've created. - -### Updating Angular CLI - -If you're using Angular CLI `1.0.0-beta.28` or less, you need to uninstall `angular-cli` package. It should be done due to changing of package's name and scope from `angular-cli` to `@angular/cli`: - -```bash -npm uninstall -g angular-cli -npm uninstall --save-dev angular-cli -``` - -To update Angular CLI to a new version, you must update both the global package and your project's local package. - -Global package: - -```bash -npm uninstall -g @angular/cli -npm cache verify -# if npm version is < 5 then use `npm cache clean` -npm install -g @angular/cli@latest -``` - -Local project package: - -```bash -rm -rf node_modules dist # use rmdir /S/Q node_modules dist in Windows Command Prompt; use rm -r -fo node_modules,dist in Windows PowerShell -npm install --save-dev @angular/cli@latest -npm install -``` - -If you are updating to 1.0 from a beta or RC version, check out our [1.0 Update Guide](https://github.com/angular/angular-cli/wiki/stories-1.0-update). - -You can find more details about changes between versions in [the Releases tab on GitHub](https://github.com/angular/angular-cli/releases). - -## Development Hints for working on Angular CLI - -### Working with master - -```bash -git clone https://github.com/angular/angular-cli.git -yarn -npm run build -cd dist/@angular/cli -npm link -``` - -`npm link` is very similar to `npm install -g` except that instead of downloading the package -from the repo, the just built `dist/@angular/cli/` folder becomes the global package. -Additionally, this repository publishes several packages and we use special logic to load all of them -on development setups. - -Any changes to the files in the `angular-cli/` folder will immediately affect the global `@angular/cli` package, -meaning that, in order to quickly test any changes you make to the cli project, you should simply just run `npm run build` -again. - -Now you can use `@angular/cli` via the command line: - -```bash -ng new foo -cd foo -npm link @angular/cli -ng serve -``` - -`npm link @angular/cli` is needed because by default the globally installed `@angular/cli` just loads -the local `@angular/cli` from the project which was fetched remotely from npm. -`npm link @angular/cli` symlinks the global `@angular/cli` package to the local `@angular/cli` package. -Now the `angular-cli` you cloned before is in three places: -The folder you cloned it into, npm's folder where it stores global packages and the Angular CLI project you just created. - -You can also use `ng new foo --link-cli` to automatically link the `@angular/cli` package. - -Please read the official [npm-link documentation](https://docs.npmjs.com/cli/link) -and the [npm-link cheatsheet](http://browsenpm.org/help#linkinganynpmpackagelocally) for more information. - -To run the Angular CLI E2E test suite, use the `node ./tests/legacy-cli/run_e2e` command. -It can also receive a filename to only run that test (e.g. `node ./tests/legacy-cli/run_e2e tests/legacy-cli/e2e/tests/build/dev-build.ts`). - -As part of the test procedure, all packages will be built and linked. -You will need to re-run `npm link` to re-link the development Angular CLI environment after tests finish. - -### Debugging with VS Code - -In order to debug some Angular CLI behaviour using Visual Studio Code, you can run `npm run build`, and then use a launch configuration like the following: - -```json -{ - "type": "node", - "request": "launch", - "name": "ng serve", - "cwd": "", - "program": "${workspaceFolder}/dist/@angular/cli/bin/ng", - "args": [ - "", - ...other arguments - ], - "console": "integratedTerminal" -} -``` - -Then you can add breakpoints in `dist/@angular` files. - -For more informations about Node.js debugging in VS Code, see the related [VS Code Documentation](https://code.visualstudio.com/docs/nodejs/nodejs-debugging). - -### CPU Profiling - -In order to investigate performance issues, CPU profiling is often useful. - -#### Creating a profile - -Node.js 16+ users can use the Node.js command line argument `--cpu-prof` to create a CPU profile. - -```bash -node --cpu-prof node_modules/.bin/ng build -``` - -In addition to this one, another, more elaborated way to capture a CPU profile using the Chrome Devtools is detailed in https://github.com/angular/angular-cli/issues/8259#issue-269908550. - -#### Opening a profile - -You can use the Chrome Devtools to process it. To do so: - -1. open `chrome://inspect` in Chrome -1. click on "Open dedicated DevTools for Node" -1. go to the "profiler" tab -1. click on the "Load" button and select the generated `.cpuprofile` file -1. on the left panel, select the associated file - -## Documentation - -The documentation for the Angular CLI is located on our [documentation website](https://angular.io/cli). - -## License - -[MIT](https://github.com/angular/angular-cli/blob/master/LICENSE) - -[travis-badge]: https://travis-ci.org/angular/angular-cli.svg?branch=master -[travis-badge-url]: https://travis-ci.org/angular/angular-cli -[david-badge]: https://david-dm.org/angular/angular-cli.svg -[david-badge-url]: https://david-dm.org/angular/angular-cli -[david-dev-badge]: https://david-dm.org/angular/angular-cli/dev-status.svg -[david-dev-badge-url]: https://david-dm.org/angular/angular-cli?type=dev -[npm-badge]: https://img.shields.io/npm/v/@angular/cli.svg -[npm-badge-url]: https://www.npmjs.com/package/@angular/cli -[license-url]: https://github.com/angular/angular-cli/blob/master/LICENSE +Usage information and reference details can be found in repository [README](../../../README.md) file. diff --git a/packages/angular_devkit/build_angular/BUILD.bazel b/packages/angular_devkit/build_angular/BUILD.bazel index 1318fa917519..b952accb81a3 100644 --- a/packages/angular_devkit/build_angular/BUILD.bazel +++ b/packages/angular_devkit/build_angular/BUILD.bazel @@ -222,6 +222,7 @@ pkg_npm( "//packages/angular_devkit/architect:package.json", "//packages/angular_devkit/build_webpack:package.json", "//packages/angular_devkit/core:package.json", + "//packages/ngtools/webpack:package.json", ], deps = [ ":README.md", diff --git a/packages/angular_devkit/build_angular/package.json b/packages/angular_devkit/build_angular/package.json index c1a9e7cecd34..056b89a40aee 100644 --- a/packages/angular_devkit/build_angular/package.json +++ b/packages/angular_devkit/build_angular/package.json @@ -39,7 +39,7 @@ "karma-source-map-support": "1.4.0", "less": "4.1.2", "less-loader": "10.2.0", - "license-webpack-plugin": "4.0.0", + "license-webpack-plugin": "4.0.1", "loader-utils": "3.2.0", "mini-css-extract-plugin": "2.5.3", "minimatch": "3.0.4", diff --git a/packages/angular_devkit/build_angular/src/builders/karma/schema.json b/packages/angular_devkit/build_angular/src/builders/karma/schema.json index d527486607f6..74d5274a6af1 100644 --- a/packages/angular_devkit/build_angular/src/builders/karma/schema.json +++ b/packages/angular_devkit/build_angular/src/builders/karma/schema.json @@ -70,7 +70,7 @@ "items": { "type": "string" }, - "description": "Globs of files to include, relative to workspace or project root. \nThere are 2 special cases:\n - when a path to directory is provided, all spec files ending \".spec.@(ts|tsx)\" will be included\n - when a path to a file is provided, and a matching spec file exists it will be included instead" + "description": "Globs of files to include, relative to workspace or project root. \nThere are 2 special cases:\n - when a path to directory is provided, all spec files ending \".spec.@(ts|tsx)\" will be included\n - when a path to a file is provided, and a matching spec file exists it will be included instead." }, "sourceMap": { "description": "Output source maps for scripts and styles. For more information, see https://angular.io/guide/workspace-config#source-map-configuration.", diff --git a/packages/angular_devkit/build_angular/src/utils/build-options.ts b/packages/angular_devkit/build_angular/src/utils/build-options.ts index 70715e8c2b7d..0daf9506bf74 100644 --- a/packages/angular_devkit/build_angular/src/utils/build-options.ts +++ b/packages/angular_devkit/build_angular/src/utils/build-options.ts @@ -17,6 +17,7 @@ import { IndexUnion, InlineStyleLanguage, Localize, + OutputHashing, SourceMapClass, } from '../builders/browser/schema'; import { Schema as DevServerSchema } from '../builders/dev-server/schema'; @@ -42,7 +43,7 @@ export interface BuildOptions { bundleDependencies?: boolean; externalDependencies?: string[]; watch?: boolean; - outputHashing?: string; + outputHashing?: OutputHashing; poll?: number; index?: IndexUnion; deleteOutputPath?: boolean; diff --git a/packages/angular_devkit/build_angular/src/webpack/configs/common.ts b/packages/angular_devkit/build_angular/src/webpack/configs/common.ts index e19db3fb4c27..545d877a4c80 100644 --- a/packages/angular_devkit/build_angular/src/webpack/configs/common.ts +++ b/packages/angular_devkit/build_angular/src/webpack/configs/common.ts @@ -98,7 +98,7 @@ export async function getCommonConfig(wco: WebpackConfigOptions): Promise('@angular/compiler-cli'); // determine hashing format - const hashFormat = getOutputHashFormat(buildOptions.outputHashing || 'none'); + const hashFormat = getOutputHashFormat(buildOptions.outputHashing); if (buildOptions.progress) { extraPlugins.push(new ProgressPlugin(platform)); @@ -383,7 +383,9 @@ export async function getCommonConfig(wco: WebpackConfigOptions): Promise; diff --git a/packages/angular_devkit/build_optimizer/package.json b/packages/angular_devkit/build_optimizer/package.json index 4d7ea7a06693..ed1c2eef0341 100644 --- a/packages/angular_devkit/build_optimizer/package.json +++ b/packages/angular_devkit/build_optimizer/package.json @@ -3,6 +3,7 @@ "version": "0.0.0-EXPERIMENTAL-PLACEHOLDER", "description": "Angular Build Optimizer", "experimental": true, + "private": true, "main": "src/index.js", "typings": "src/index.d.ts", "bin": { diff --git a/packages/angular_devkit/core/src/json/schema/registry.ts b/packages/angular_devkit/core/src/json/schema/registry.ts index edf50c078c44..38b7134e8c72 100644 --- a/packages/angular_devkit/core/src/json/schema/registry.ts +++ b/packages/angular_devkit/core/src/json/schema/registry.ts @@ -209,9 +209,6 @@ export class CoreSchemaRegistry implements SchemaRegistry { } } - if (fullReference.startsWith('#')) { - fullReference = fullReference.slice(0, -1); - } const resolvedSchema = this._ajv.getSchema(fullReference); return { diff --git a/packages/angular_devkit/core/src/json/schema/transforms.ts b/packages/angular_devkit/core/src/json/schema/transforms.ts index 362d2b667465..9bad19d0b37e 100644 --- a/packages/angular_devkit/core/src/json/schema/transforms.ts +++ b/packages/angular_devkit/core/src/json/schema/transforms.ts @@ -20,6 +20,8 @@ export function addUndefinedDefaults( return value; } + value ??= schema.default; + const types = getTypesOfSchema(schema); if (types.size === 0) { return value; diff --git a/packages/angular_devkit/core/src/json/schema/transforms_spec.ts b/packages/angular_devkit/core/src/json/schema/transforms_spec.ts index d9292a55a1ec..a4fc18a88558 100644 --- a/packages/angular_devkit/core/src/json/schema/transforms_spec.ts +++ b/packages/angular_devkit/core/src/json/schema/transforms_spec.ts @@ -218,4 +218,42 @@ describe('addUndefinedDefaults', () => { expect(dataObj.obj.b).toBeTrue(); expect(dataObj.obj.c).toBeFalse(); }); + + it('should add defaults to undefined properties when using $refs', async () => { + const registry = new CoreSchemaRegistry(); + registry.addPreTransform(addUndefinedDefaults); + const dataNoObj: Record = {}; + + const dataObj: Record = { + boolRef: true, + }; + + const validator = registry.compile({ + definitions: { + boolRef: { + default: false, + type: 'boolean', + }, + }, + properties: { + bool: { + default: false, + type: 'boolean', + }, + boolRef: { + $ref: '#/definitions/boolRef', + }, + }, + }); + + const result1 = await validator.pipe(mergeMap((validator) => validator(dataNoObj))).toPromise(); + expect(result1.success).toBeTrue(); + expect(dataNoObj['bool']).toBeFalse(); + expect(dataNoObj['boolRef']).toBeFalse(); + + const result2 = await validator.pipe(mergeMap((validator) => validator(dataObj))).toPromise(); + expect(result2.success).toBeTrue(); + expect(dataObj['bool']).toBeFalse(); + expect(dataObj['boolRef']).toBeTrue(); + }); }); diff --git a/scripts/snapshots.ts b/scripts/snapshots.ts index 1e7442c8833b..c1de7a60956c 100644 --- a/scripts/snapshots.ts +++ b/scripts/snapshots.ts @@ -12,7 +12,7 @@ import * as fs from 'fs'; import * as os from 'os'; import * as path from 'path'; import { PackageInfo, packages } from '../lib/packages'; -import build from './build'; +import build from './build-bazel'; import create from './create'; // Added to the README.md of the snapshot. This is markdown. diff --git a/scripts/templates/readme.ejs b/scripts/templates/readme.ejs index fa99b54cbcb8..481a0175c720 100644 --- a/scripts/templates/readme.ejs +++ b/scripts/templates/readme.ejs @@ -10,168 +10,135 @@ Any changes to README.md directly will result in a failure on CI. --> -# Angular CLI -### Development tools and libraries specialized for Angular - -This is the home of the DevKit and the Angular CLI code. You can find the Angular CLI specific README -[here](/packages/angular/cli/README.md). - -<%# Badges are created here. %> -<% for (const section of monorepo.badges) { - for (const { label, image, title, url } of section) { - if (image) { - %>[![<%= label %>](<%= image %>)]<% - } else { - %>[<%= title %>]<% - } - %>(<%= url %>) <% - } %> +

Angular CLI - The CLI tool for Angular.

-<% } %> +

+
+ Angular CLI logo +

+ The Angular CLI is a command-line interface tool that you use to initialize, develop, scaffold, +
and maintain Angular applications directly from a command shell.
+
+

-### Quick Links -<% for (const link of Object.keys(monorepo.links)) { - %>[<%= link %>](<%= monorepo.links[link] %>) | <% -} %> -<% for (const link of Object.keys(monorepo.links)) { -%>|---<% -} %>| +

+ cli.angular.io +
+

+ +

+ Contributing Guidelines + · + Submit an Issue + · + Blog +
+
+

----- +

+ + CI status +   + + Discord conversation + +

-## The Goal of Angular CLI +
-The Angular CLI creates, manages, builds and test your Angular projects. It's built on top of the -Angular DevKit. +## Documentation -## The Goal of DevKit +Get started with Angular CLI, learn the fundamentals and explore advanced topics on our documentation website. -DevKit's goal is to provide a large set of libraries that can be used to manage, develop, deploy and -analyze your code. +- [Getting started][quickstart] +- [CLI][cli] +- [Workspace and project file structure][filestructure] +- [Workspace configuration][workspaceconfig] +- [Schematics][schematics] -# Getting Started - Local Development +## Development Setup -## Installation -To get started locally, follow these instructions: +### Prerequisites -1. If you haven't done it already, [make a fork of this repo](https://github.com/angular/angular-cli/fork). -1. Clone to your local computer using `git`. -1. Make sure that you have Node 12.14 or 14.0 installed. See instructions [here](https://nodejs.org/en/download/). -1. Make sure that you have `yarn` installed; see instructions [here](https://yarnpkg.com/lang/en/docs/install/). -1. Run `yarn` (no arguments) from the root of your clone of this project to install dependencies. +- Install [Node.js] which includes [Node Package Manager][npm] -## Building and Installing the CLI +### Setting Up a Project -To make a local build: +Install the Angular CLI globally: -```shell -yarn build --local +``` +npm install -g @angular/cli ``` -This generates a number of tarballs in the `dist/` directory. To actually use -the locally built tools, switch to another repository reproducing the specific -issue you want to fix (or just generate a local repo with `ng new`). Then -install the locally built packages: +Create workspace: -```shell -cd "${EXAMPLE_ANGULAR_PROJECT_REPO}" -npm install -D ${CLI_REPO}/dist/*.tgz +``` +ng new [PROJECT NAME] ``` -Builds of this example project will use tooling created from the previous local -build and include any local changes. When using the CLI, it will automatically -check for a local install and use that if present. This means you can just run: +Run the application: -```shell -npm install -g @angular/cli +``` +cd [PROJECT NAME] +ng serve ``` -to get a global install of the latest CLI release. Then running any `ng` command -in the example project will automatically find and use the local build of the -CLI. - -Note: If you are testing `ng update`, be aware that installing all the tarballs -will also update the framework (`@angular/core`) to the latest version. In this -case, simply install the CLI alone with -`npm install -D ${CLI_REPO}/dist/_angular_cli.tgz`, that way the rest of the -project remains to be upgraded with `ng update`. +Angular is cross-platform, fast, scalable, has incredible tooling, and is loved by millions. -## Debugging +## Quickstart -To debug an invocation of the CLI, [build and install the CLI for an example -project](#building-and-installing-the-cli), then run the desired `ng` command -as: +[Get started in 5 minutes][quickstart]. -```shell -node --inspect-brk node_modules/.bin/ng ... -``` +## Ecosystem -This will trigger a breakpoint as the CLI starts up. You can connect to this -using the supported mechanisms for your IDE, but the simplest option is to open -Chrome to [chrome://inspect](chrome://inspect) and then click on the `inspect` -link for the `node_modules/.bin/ng` Node target. +

+ angular ecosystem logos +

-Unfortunately, the CLI dynamically `require()`'s other files mid-execution, so -the debugger is not aware of all the source code files before hand. As a result, -it is tough to put breakpoints on files before the CLI loads them. The easiest -workaround is to use the `debugger;` statement to stop execution in the file you -are interested in, and then you should be able to step around and set breakpoints -as expected. +- [Angular Framework][aio] +- [Angular Material][angularmaterial] -## Testing +## Changelog -There are two different test suites which can be run locally: +[Learn about the latest improvements][changelog]. -### Unit tests - * Run all tests: `yarn bazel test //packages/...` - * Run a subset of the tests, use the full Bazel target example: `yarn bazel test //packages/schematics/angular:angular_test` - * For a complete list of test targets use the following Bazel query: `yarn bazel query "tests(//packages/...)"` +## Upgrading -You can find more info about debugging [tests with Bazel in the docs.](https://github.com/angular/angular-cli/blob/master/docs/process/bazel.md#debugging-jasmine_node_test) +Check out our [upgrade guide](https://update.angular.io/) to find out the best way to upgrade your project. -### End to end tests - * Run: `node tests/legacy-cli/run_e2e.js` - * Run a subset of the tests: `node tests/legacy-cli/run_e2e.js tests/legacy-cli/e2e/tests/i18n/ivy-localize-*` +## Contributing -When running the debug commands, Node will stop and wait for a debugger to attach. -You can attach your IDE to the debugger to stop on breakpoints and step through the code. Also, see [IDE Specific Usage](#ide-specific-usage) for a -simpler debug story. +### Contributing Guidelines -When debugging a specific test, change `describe()` or `it()` to `fdescribe()` -and `fit()` to focus execution to just that one test. This will keep the output clean and speed up execution by not running irrelevant tests. +Read through our [contributing guidelines][contributing] to learn about our submission process, coding rules and more. -## IDE Specific Usage +### Want to Help? -Some additional tips for developing in specific IDEs. +Want to report 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 [help wanted](https://github.com/angular/angular-cli/labels/help%20wanted) or [good first issue](https://github.com/angular/angular-cli/labels/good%20first%20issue). -### Intellij IDEA / WebStorm +### Code of Conduct -To load the project in Intellij products, simply `Open` the repository folder. -Do **not** `Import Project`, because that will overwrite the existing -configuration. +Help us keep Angular open and inclusive. Please read and follow our [Code of Conduct][codeofconduct]. -Once opened, the editor should automatically detect run configurations in the -workspace. Use the drop down to choose which one to run and then click the `Run` -button to start it. When executing a debug target, make sure to click the -`Debug` icon to automatically attach the debugger (if you click `Run`, Node will -wait forever for a debugger to attach). +### Developer Guide -![Intellij IDEA run configurations](docs/images/run-configurations.png) +Read through our [developer guide][developer] to learn about how to build and test the Angular CLI locally. -## Creating New Packages -Adding a package to this repository means running two separate commands: +## Community -1. `schematics devkit:package PACKAGE_NAME`. This will update the `.monorepo` file, and create the - base files for the new package (package.json, src/index, etc). -1. `devkit-admin templates`. This will update the README and all other template files that might - have changed when adding a new package. +Join the conversation and help the community. -For private packages, you will need to add a `"private": true` key to your package.json manually. -This will require re-running the template admin script. +- [Twitter][twitter] +- [Discord][discord] +- [Gitter][gitter] +- [YouTube][youtube] +- [StackOverflow][stackoverflow] +- Find a Local [Meetup][meetup] -# Packages +## Packages This is a monorepo which contains many tools and packages: @@ -182,7 +149,7 @@ This is a monorepo which contains many tools and packages: sections.unshift(undefined); %> -## Tools +### Tools | Project | Package | Version | Links | |---|---|---|---| @@ -209,7 +176,7 @@ if (mrPkg.snapshotRepo) { } %> <% } %> -## Packages +### Packages <% for (const section of sections) { %><%= section ? '#### ' + section : '' %> @@ -239,3 +206,26 @@ for (const pkgName of Object.keys(packages)) { } %> <% } %> <% } %> + +**Love Angular CLI? Give our repo a star :star: :arrow_up:.** + +[contributing]: CONTRIBUTING.md +[developer]: docs/DEVELOPER.md +[quickstart]: https://angular.io/start +[changelog]: CHANGELOG.md +[documentation]: https://angular.io/docs +[angularmaterial]: https://material.angular.io/ +[cli]: https://cli.angular.io/ +[aio]: https://angular.io/ +[workspaceconfig]: https://angular.io/guide/workspace-config +[schematics]: https://angular.io/guide/schematics +[filestructure]: https://angular.io/guide/file-structure +[node.js]: https://nodejs.org/ +[npm]: https://www.npmjs.com/get-npm +[codeofconduct]: https://github.com/angular/angular/blob/master/CODE_OF_CONDUCT.md +[twitter]: https://www.twitter.com/angular +[discord]: https://discord.gg/angular +[gitter]: https://gitter.im/angular/angular-cli +[stackoverflow]: https://stackoverflow.com/questions/tagged/angular-cli +[youtube]: https://youtube.com/angular +[meetup]: https://www.meetup.com/find/?keywords=angular diff --git a/tests/legacy-cli/e2e/tests/build/build-app-shell.ts b/tests/legacy-cli/e2e/tests/build/build-app-shell.ts deleted file mode 100644 index 5c13f7a27a3e..000000000000 --- a/tests/legacy-cli/e2e/tests/build/build-app-shell.ts +++ /dev/null @@ -1,168 +0,0 @@ -import { stripIndent } from 'common-tags'; -import { getGlobalVariable } from '../../utils/env'; -import { expectFileToMatch, writeFile } from '../../utils/fs'; -import { installWorkspacePackages } from '../../utils/packages'; -import { ng } from '../../utils/process'; -import { updateJsonFile } from '../../utils/project'; -import { readNgVersion } from '../../utils/version'; - -export default function () { - let platformServerVersion = readNgVersion(); - - if (getGlobalVariable('argv')['ng-snapshots']) { - platformServerVersion = require('../../ng-snapshot/package.json').dependencies[ - '@angular/platform-server' - ]; - } - - return Promise.resolve() - .then(() => - updateJsonFile('angular.json', (workspaceJson) => { - const appArchitect = workspaceJson.projects['test-project'].architect; - appArchitect['server'] = { - builder: '@angular-devkit/build-angular:server', - options: { - outputPath: 'dist/test-project-server', - main: 'src/main.server.ts', - tsConfig: 'tsconfig.server.json', - }, - }; - appArchitect['app-shell'] = { - builder: '@angular-devkit/build-angular:app-shell', - options: { - browserTarget: 'test-project:build', - serverTarget: 'test-project:server', - route: '/shell', - }, - }; - }), - ) - .then(() => - writeFile( - './tsconfig.server.json', - ` - { - "extends": "./tsconfig.app.json", - "compilerOptions": { - "outDir": "../dist-server", - "baseUrl": "./", - "module": "commonjs", - "types": [] - }, - "files": [ - "src/main.server.ts" - ], - "include": [ - "src/**/*.d.ts" - ], - "angularCompilerOptions": { - "entryModule": "src/app/app.server.module#AppServerModule" - } - } - `, - ), - ) - .then(() => - writeFile( - './src/main.server.ts', - ` - import { enableProdMode } from '@angular/core'; - - import { environment } from './environments/environment'; - - if (environment.production) { - enableProdMode(); - } - - export { AppServerModule } from './app/app.server.module'; - export { renderModule } from '@angular/platform-server'; - `, - ), - ) - .then(() => - writeFile( - './src/app/app.component.html', - stripIndent` - Hello World - - `, - ), - ) - .then(() => - writeFile( - './src/app/app.module.ts', - stripIndent` - import { BrowserModule } from '@angular/platform-browser'; - import { NgModule } from '@angular/core'; - import { RouterModule } from '@angular/router'; - - import { AppComponent } from './app.component'; - - @NgModule({ - imports: [ - BrowserModule.withServerTransition({ appId: 'appshell-play' }), - RouterModule - ], - declarations: [AppComponent], - bootstrap: [AppComponent] - }) - export class AppModule { } - `, - ), - ) - .then(() => - writeFile( - './src/app/app.server.module.ts', - stripIndent` - import {NgModule} from '@angular/core'; - import {ServerModule} from '@angular/platform-server'; - import { Routes, RouterModule } from '@angular/router'; - - import { AppModule } from './app.module'; - import { AppComponent } from './app.component'; - import { ShellComponent } from './shell.component'; - - const routes: Routes = [ - { path: 'shell', component: ShellComponent } - ]; - - @NgModule({ - imports: [ - // The AppServerModule should import your AppModule followed - // by the ServerModule from @angular/platform-server. - AppModule, - ServerModule, - RouterModule.forRoot(routes), - ], - // Since the bootstrapped component is not inherited from your - // imported AppModule, it needs to be repeated here. - bootstrap: [AppComponent], - declarations: [ShellComponent], - }) - export class AppServerModule {} - `, - ), - ) - .then(() => - writeFile( - './src/app/shell.component.ts', - stripIndent` - import { Component } from '@angular/core'; - @Component({ - selector: 'app-shell', - template: '

shell Works!

', - styles: [] - }) - export class ShellComponent {} - `, - ), - ) - .then(() => - updateJsonFile('package.json', (packageJson) => { - const dependencies = packageJson['dependencies']; - dependencies['@angular/platform-server'] = platformServerVersion; - }).then(() => installWorkspacePackages()), - ) - .then(() => ng('run', 'test-project:app-shell')) - .then(() => expectFileToMatch('dist/test-project/index.html', /shell Works!/)); -} diff --git a/tools/defaults.bzl b/tools/defaults.bzl index 61f2c1d35ae1..6651baca0d31 100644 --- a/tools/defaults.bzl +++ b/tools/defaults.bzl @@ -70,7 +70,7 @@ def pkg_npm(name, pkg_deps = [], use_prodmode_output = False, **kwargs): # Version of the local package being built, generated via the `--workspace_status_command` flag. "0.0.0-PLACEHOLDER": "{BUILD_SCM_VERSION}", "0.0.0-EXPERIMENTAL-PLACEHOLDER": "{BUILD_SCM_EXPERIMENTAL_VERSION}", - "BUILD_SCM_HASH-PLACEHOLDER": "{BUILD_SCM_COMMIT_SHA}", + "BUILD_SCM_HASH-PLACEHOLDER": "{BUILD_SCM_ABBREV_HASH}", "0.0.0-ENGINES-NODE": RELEASE_ENGINES_NODE, "0.0.0-ENGINES-NPM": RELEASE_ENGINES_NPM, "0.0.0-ENGINES-YARN": RELEASE_ENGINES_YARN, diff --git a/tools/snapshot_repo_filter.bzl b/tools/snapshot_repo_filter.bzl index 8d7a1eb4b739..8e4369806415 100644 --- a/tools/snapshot_repo_filter.bzl +++ b/tools/snapshot_repo_filter.bzl @@ -8,7 +8,7 @@ load("//:constants.bzl", "SNAPSHOT_REPOS") def _generate_snapshot_repo_filter(): filter = "" for (i, pkg_name) in enumerate(SNAPSHOT_REPOS.keys()): - filter += "{sep}(..|objects|select(has(\"{pkg_name}\")))[\"{pkg_name}\"] |= \"github:{snapshot_repo}:BUILD_SCM_HASH-PLACEHOLDER\"\n".format( + filter += "{sep}(..|objects|select(has(\"{pkg_name}\")))[\"{pkg_name}\"] |= \"github:{snapshot_repo}#BUILD_SCM_HASH-PLACEHOLDER\"\n".format( sep = "| " if i > 0 else "", pkg_name = pkg_name, snapshot_repo = SNAPSHOT_REPOS[pkg_name], diff --git a/yarn.lock b/yarn.lock index 0c54a3d7c065..7893afa195d2 100644 --- a/yarn.lock +++ b/yarn.lock @@ -42,7 +42,7 @@ "@angular-devkit/core" "13.2.0-rc.1" rxjs "6.6.7" -"@angular-devkit/build-angular@^13.2.0-rc": +"@angular-devkit/build-angular@13.2.0-rc.1": version "13.2.0-rc.1" resolved "https://registry.yarnpkg.com/@angular-devkit/build-angular/-/build-angular-13.2.0-rc.1.tgz#d07eeec25c00c9ed025aa599263d98ad22d39f4a" integrity sha512-kKElUuHAocImUQmYnlkmk/8UJh8eYw7GqvcfSxIcxJ8euLS2hnavmUCexxtlPsgWmwJTdwXDnRYVCmr4n8hQqA== @@ -203,14 +203,13 @@ dependencies: tslib "^2.0.0" -"@angular/dev-infra-private@https://github.com/angular/dev-infra-private-builds.git#2024033f3123cd1beed78d43ec7269467cd9fa93": - version "0.0.0-354871956801929457d9f08482fb81f7012ed7c8" - uid "2024033f3123cd1beed78d43ec7269467cd9fa93" - resolved "https://github.com/angular/dev-infra-private-builds.git#2024033f3123cd1beed78d43ec7269467cd9fa93" +"@angular/dev-infra-private@https://github.com/angular/dev-infra-private-builds.git#3a34722a82fb0e8cd3fa00dfc5476767a35e021a": + version "0.0.0-c922f5b23611024bc9d94833ae147f6048ab0275" + resolved "https://github.com/angular/dev-infra-private-builds.git#3a34722a82fb0e8cd3fa00dfc5476767a35e021a" dependencies: "@actions/core" "^1.4.0" "@actions/github" "^5.0.0" - "@angular-devkit/build-angular" "^13.2.0-rc" + "@angular-devkit/build-angular" "13.2.0-rc.1" "@angular/benchpress" "0.2.1" "@babel/core" "^7.16.0" "@bazel/bazelisk" "^1.10.1" @@ -7127,6 +7126,13 @@ license-webpack-plugin@4.0.0: dependencies: webpack-sources "^3.0.0" +license-webpack-plugin@4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/license-webpack-plugin/-/license-webpack-plugin-4.0.1.tgz#957930fa595f5b65aa0b21bfd2c19644486f3d9f" + integrity sha512-SQum9mg3BgnY5BK+2KYl4W7pk9b26Q8tW2lTsO6tidD0/Ds9ksdXvp3ip2s9LqDjj5gtBMyWRfOPZptWj4PfCg== + dependencies: + webpack-sources "^3.0.0" + lie@~3.3.0: version "3.3.0" resolved "https://registry.yarnpkg.com/lie/-/lie-3.3.0.tgz#dcf82dee545f46074daf200c7c1c5a08e0f40f6a" @@ -9628,7 +9634,6 @@ sass@1.49.0, sass@^1.32.8: "sauce-connect-proxy@https://saucelabs.com/downloads/sc-4.6.4-linux.tar.gz": version "0.0.0" - uid "992e2cb0d91e54b27a4f5bbd2049f3b774718115" resolved "https://saucelabs.com/downloads/sc-4.6.4-linux.tar.gz#992e2cb0d91e54b27a4f5bbd2049f3b774718115" saucelabs@^1.5.0: