1224 Commits

Author SHA1 Message Date
Joey Perrott
ca1e86b684 build: disable failing strict_deps targets
Disable all failing strict_deps targets with TODOs to fix them moving forward.
2025-02-19 15:22:58 -05:00
Angular Robot
9f870b4051 build: update all non-major dependencies 2025-02-18 07:46:41 -05:00
Charles Lyding
11fab9c7dd feat(@angular/build): add application builder karma testing to package
An `application` only variant of the `karma` builder found within the
`@angular-devkit/build-angular` package is now available within the
`@angular/build` package as `@angular/build:karma`. This builder will
only use the `application` builder found within `@angular/build` and
does not provide the `builderMode` option as `application` would be the
only valid value. Testing behavior is effectively equivalent to using the
`@angular-devkit/build-angular:karma` builder with the `builderMode`
option set to `application`. However, several options have been adjusted:
* `builderMode` was removed
* `fileReplacements` legacy structure (`src`/`replaceWith`) removed
* `polyfills` only accepts an array of strings
* `loader` has been added
* `define` has been added
* `externalDependencies` has been added
2025-02-18 06:28:08 -05:00
Joey Perrott
33ed6e875e refactor: move builtin module imports to use node: prefix imports 2025-02-14 11:09:23 -08:00
Alan Agius
09f5006b5c fix(@angular/cli): prefer installed package as fallback when listing package groups
Previously, the package group name defaulted to the first item in the list. This update prioritizes an installed package as the fallback instead.

Closes #29627
2025-02-13 21:40:05 +01:00
Alan Agius
f5689e9525 refactor(@angular/cli): handle undefined ng add collection name
Fixes an issue where JSON help extraction fails if the `ng add` collection name is undefined.
2025-02-13 16:09:43 +01:00
Alan Agius
8c7c7ac691 fix(@angular/cli): correctly parse and resolve relative schematic collection names on Windows
Previously, the logic incorrectly extracted the drive letter as the collection name when the schematic collection was specified as relative on Windows. This fix ensures that relative paths are parsed and resolved correctly, preventing the drive letter from being mistakenly treated as the collection name.

Closes #29559
2025-02-13 08:47:45 +01:00
Angular Robot
cf2d54b222 build: update all non-major dependencies 2025-02-06 15:19:51 -08:00
Angular Robot
7a8ff1f099 build: update all non-major dependencies 2025-02-03 14:35:08 -08:00
Angular Robot
02d87bcf33 build: update all non-major dependencies 2025-01-31 08:28:30 +01:00
Paul Gschwendtner
01ea33e372 build: migrate CLI schema generation to rules_js
Migrates the CLI schema generation to `rules_js`, also significantly
simplifying the rule boilerplate.
2025-01-30 11:16:46 +01:00
Angular Robot
0fe4a5493f build: update all non-major dependencies 2025-01-29 08:30:27 +01:00
skander23000
6f9a764526
docs: fix relative link to README not working on npm repo (#29496)
The link to the README was relative, which caused it to break when viewed on the npm repository. The link has been updated to an absolute URL to ensure it works properly.
2025-01-28 09:08:50 +01:00
Alan Agius
8535c11182 fix(@angular/build): replace deprecation of i18n.baseHref with a warning
In certain scenarios, users build applications with the same `baseHref` when using i18n, primarily for deploying localized applications across multiple domains. To address this, we are removing the deprecation of `i18n.baseHref` and will revisit potential options as part of https://github.com/angular/angular-cli/issues/29111

Instead of deprecating `i18n.baseHref`, we now issue a warning when it is used with SSR, as this may lead to undefined behavior.

Closes #29396
2025-01-21 16:36:34 +01:00
Paul Gschwendtner
1a4157d88c build: migrate @angular/cli tests to use rules_js
Integrates `@angular/cli` into the pnpm workspace and wires up the
native `rules_js` rules.

One nice benefits that highlight here:

- `resolve` runtime dependency is only installed in the CLI folder, and
  we can pull it from there. --> Locally managed deps! :yay:
2025-01-17 16:29:45 +01:00
Paul Gschwendtner
4fee94a96c build: rename //:root_modules to //:node_modules.
This is necessary as `rules_js` requires this "common name" when dealing
with Yarn workspaces, linking first party dependencies automatically.

In the future, we may be able to send a PR to `rules_js` to support a
custom name somehow.
2025-01-15 19:20:40 +01:00
Angular Robot
23ebfd9440 build: update all non-major dependencies 2025-01-15 10:56:18 +01:00
Alan Agius
214ac8998d refactor(@angular/cli): replace VERSION with Bazel-stamped version
Previously, the version was retrieved from the `package.json`. With this update, the version is now sourced using Bazel stamping.
2025-01-13 19:49:37 +01:00
Paul Gschwendtner
e31be733b6 build: support substituting/stamping files other than package.json
Similart to `pkg_npm` from `rules_nodejs`, we should have a way to make
use of the stamp constants/placeholders throughout individual package
files. This is not possible at all with `rules_js`'s `npm_package` rule,
nor does it support stamp substitutions out of the box at all.

We have our own `expand_template` machinery to substitute `package.json`
files of npm archives, but we need to expand this to support arbitrary
files inside a package. This will be opt-in for explicitly listed files;
which is a good compromise for simplicity of supporting this.

This commit adds the necessary functionality and demonstrates the
feature by fixing `@angular/build`.
2025-01-13 19:19:06 +01:00
Paul Gschwendtner
5660d05874 build: migrate @angular/cli to npm_package
This allows this package to be used in the pnpm workspace, and is a step
further with the `rules_js` migration.
2025-01-13 19:19:06 +01:00
Paul Gschwendtner
a8335cf950 build: never use interop targets for ts compilations
* Removes `interop_deps` from the `ts_project` interop macro.
* Keeps `_rjs` suffix for now as we still need the interop targets for
  e.g. `jasmine_node_test` and the `rules_nodejs` linker.

In follow-ups we can remove the suffix, and interop layer.
2025-01-09 09:42:06 +01:00
Charles Lyding
2c9d7368fc feat(@angular/build): add ng-packagr builder to the package
To support migration to the `@angular/build` package which contains the
`application` builder that is used by all new projects, the `ng-packagr`
builder used to build Angular libraries is also now available within this
package. This removes the need for projects that are using the application
builder but also would like to build a library from having to install the
Webpack related `@angular-devkit/build-angular` package.  This can result
in a significant reduction in overall Node.js packages installed within the
project.
2025-01-08 12:21:48 -05:00
Charles Lyding
8a87ff810b build: migrate @angular/cli to ts_project
The `@angular/cli` package has been migrated to the `rules_js` ts_project rule.
2024-12-23 13:33:16 -05:00
Angular Robot
099b5a7d53 build: update all non-major dependencies 2024-12-23 09:22:06 -05:00
Angular Robot
ac97292ebd build: update all non-major dependencies 2024-12-20 11:01:47 -08:00
Angular Robot
947948434f build: update all non-major dependencies 2024-12-19 10:30:49 -05:00
Angular Robot
12f2026581 build: update all non-major dependencies 2024-12-11 07:56:48 -08:00
Angular Robot
e126bf9018 build: update all non-major dependencies 2024-12-08 15:32:03 +01:00
Alan Agius
0a570c0c2e feat(@angular/build): add support for customizing URL segments with i18n
Previously, the `baseHref` option under each locale allowed for generating a unique base href for specific locales. However, users were still required to handle file organization manually, and `baseHref` appeared to be primarily designed for this purpose.

This commit introduces a new `subPath` option, which simplifies the i18n process, particularly in static site generation (SSG) and server-side rendering (SSR). When the `subPath` option is used, the `baseHref` is ignored. Instead, the `subPath` serves as both the base href and the name of the directory containing the localized version of the app.

Below is an example configuration showcasing the use of `subPath`:

```json
"i18n": {
  "sourceLocale": {
    "code": "en-US",
    "subPath": ""
  },
  "locales": {
    "fr-BE": {
      "subPath": "fr",
      "translation": "src/i18n/messages.fr-BE.xlf"
    },
    "de-BE": {
      "subPath": "de",
      "translation": "src/i18n/messages.de-BE.xlf"
    }
  }
}
```

The following tree structure demonstrates how the `subPath` organizes localized build output:
```
dist/
├── app/
│   └── browser/  # Default locale, accessible at `/`
│       ├── fr/  # Locale for `fr-BE`, accessible at `/fr`
│       └── de/  # Locale for `de-BE`, accessible at `/de`
```

DEPRECATED: The `baseHref` option under `i18n.locales` and `i18n.sourceLocale` in `angular.json` is deprecated in favor of `subPath`.

The `subPath` defines the URL segment for the locale, serving as both the HTML base HREF and the directory name for output. By default, if not specified, `subPath` will use the locale code.

Closes #16997 and closes #28967
2024-12-07 19:00:32 +01:00
James Henry
692e990750
docs(@angular/cli): update angular-eslint reference (#29001) 2024-12-02 10:02:01 +01:00
Alan Agius
4ef45ecf99 fix(@angular/cli): correctly select package versions in descending order during ng add
When using the `ng add` command, the package version selection logic was not correctly selected based on the available versions in desc order. This could lead to selecting an unintended version of the package.

Closes: #28985
2024-11-27 15:00:59 +01:00
Jan Krems
3a017aa2b9 build: fix peer dep warning for listr2
The previous version specified `@inquirer/prompts < 7` which caused
a warning about invalid peer deps. The only difference between 2.0.17
and 2.0.18 is that this range was expanded to `< 8`.

See: https://github.com/listr2/listr2/issues/730

Fixes: https://github.com/angular/angular-cli/issues/28870
2024-11-15 11:03:50 -08:00
Paweł Fraś
af14769245 fix(@angular/cli): support default options for multiselect list x-prompt 2024-11-13 09:09:04 -08:00
Angular Robot
14bc784f09 build: update all non-major dependencies 2024-11-12 13:13:19 -08:00
Alan Agius
daea0ab685 docs: replace @note with @remarks
Updated TSDoc comments by replacing @note with @remarks across the codebase. This aligns with TSDoc's preferred conventions, where @remarks is used for supplementary explanations and additional context.
2024-11-05 15:00:05 +01:00
Charles Lyding
7c6cb9593a fix(@angular/cli): recommend optional application update migration during v19 update
The optional application builder migration will now default to enabled and
recommended during the update process (`ng update`) for v19. The migration
is still optional and can be unselected if preferred when updating.
2024-11-01 11:29:14 -04:00
Angular Robot
afec9297dc build: update all non-major dependencies 2024-10-28 14:36:59 -04:00
Doug Parker
62877bdf2b refactor(@angular-devkit/build-angular): remove Protractor builder and schematics
BREAKING CHANGE: Protractor is no longer supported.

Protractor was marked end-of-life in August 2023 (see https://protractortest.org/). Projects still relying on Protractor should consider migrating to another E2E testing framework, several support solid migration paths from Protractor.

* https://angular.dev/tools/cli/end-to-end
* https://blog.angular.dev/the-state-of-end-to-end-testing-with-angular-d175f751cb9c
2024-10-21 14:50:18 -07:00
Angular Robot
b63607c773 build: update dependency pacote to v20 2024-10-18 19:49:54 +00:00
Angular Robot
e448cf6ee9 build: update all non-major dependencies 2024-10-15 09:30:59 -07:00
Angular Robot
4656c541d2 build: update all non-major dependencies 2024-10-08 10:10:55 -07:00
Angular Robot
5c57e1da36 build: update dependency @inquirer/prompts to v7 2024-10-07 09:44:53 -07:00
Alan Agius
4941725f9e refactor: remove unused methods and locals 2024-10-04 13:16:13 +02:00
Angular Robot
a896b74ac1 build: update all non-major dependencies 2024-09-30 09:53:17 +02:00
Angular Robot
be3f3ff82f build: update dependency pacote to v19 2024-09-28 15:24:09 -04:00
Angular Robot
c0b1221ef4 build: update dependency npm-package-arg to v12 2024-09-27 11:20:07 -04:00
Angular Robot
0b4294af4a build: update dependency npm-pick-manifest to v10 2024-09-27 09:29:02 -04:00
Charles Lyding
f249e7e856 perf(@angular/cli): enable Node.js compile code cache when available
The Angular CLI will now enable the Node.js compile cache when available
for use. Node.js v22.8 and higher currently provide support for this feature.
The compile cache stores the v8 intermediate forms of JavaScript code for the Angular
CLI itself. This provides a speed up to initialization on subsequent uses the Angular CLI.
The Node.js cache is stored in a temporary directory in a globally accessible
location so that all Node.js instances of a compatible version can share the
cache. The code cache can be disabled if preferred via `NODE_DISABLE_COMPILE_CACHE=1`.

Based on initial profiling, this change provides an ~6% production build time
improvement for a newly generated project once the cache is available.

```
Benchmark 1: NODE_DISABLE_COMPILE_CACHE=1 node ./node_modules/.bin/ng build
  Time (mean ± σ):      2.617 s ±  0.016 s    [User: 3.795 s, System: 1.284 s]
  Range (min … max):    2.597 s …  2.640 s    10 runs

Benchmark 2: node ./node_modules/.bin/ng build
  Time (mean ± σ):      2.475 s ±  0.017 s    [User: 3.555 s, System: 1.354 s]
  Range (min … max):    2.454 s …  2.510 s    10 runs

Summary
  node ./node_modules/.bin/ng build ran
    1.06 ± 0.01 times faster than NODE_DISABLE_COMPILE_CACHE=1 node ./node_modules/.bin/ng build
```
2024-09-18 09:30:57 -04:00
Angular Robot
93542bfc6d build: update dependency @inquirer/prompts to v6 2024-09-16 08:19:49 +02:00
Alan Agius
de17cbcb88 Revert "perf(@angular/cli): enable Node.js compile code cache when available"
This reverts commit ecc107d83bfdfd9d5dd1087e264892d60361625c.
2024-09-13 11:26:15 +02:00