49 Commits

Author SHA1 Message Date
Paul Gschwendtner
9dd3f0344f
Further clean-up rules_nodejs npm workspace and remove yarn.lock (#29779)
* build: disconnect `@npm` workspace from main project

This will speed up significantly as we don't need to fetch all
dependencies again just for the `@npm` repository that is at this point
only leveraged by the `ng_package` rule for some of its dependencies.

This commit allows us to drop the `yarn.lock` and Aspect lock files, and
allows us to independently migrate `ng_package` to `rules_js`.

It also allows us to drop the `_rjs` TS interop layer in follow-up commits.

* build: drop `_rjs` suffix from `ts_project` targets

We don't need the `ts_project` interop in principle
at this point. We only have one remaining instance left for the SSR
`ng_package` integration. This commit cleans up all usages.

* build: remove yarn

* build: avoid duplicated dependencies at top-level

`rules_js` seems to be sensitive if there are similar versions of the same
package installed, but with differently matched peer dependencies. This
is fine because we can (and should long-term) move those dependencies to
their package-local `package.json` files. This commit unblocks the
migration and highlights how we can move deps to the individual packages
in the future.

* build: update checkout github action

This will allow us to use pnpm.

* build: update node to avoid strict-engines error caused by `npm`

Avoids:

```
Lockfile is up to date, resolution step is skipped
 ERR_PNPM_UNSUPPORTED_ENGINE  Unsupported environment (bad pnpm and/or Node.js version)

Your Node version is incompatible with "npm@11.2.0".

Expected version: ^20.17.0 || >=22.9.0
Got: v20.11.1
```

Note that we won't update the WORKSPACE test version as that would mean
we need to update the Node engines for shipped packages; and we can't do
this right now without introducing a breaking change.

* build: fix missing dependency for spec bundling

The beasties JS sources weren't available for bundling in the
`bazel-bin`, and this surfaced in RBE. This commit fixes this.
2025-03-11 10:05:52 +01:00
Alan Agius
e6be37601d refactor(@angular-devkit/schematics): remove deprecated NodePackageLinkTask
BREAKING CHANGE: The `NodePackageLinkTask` has been removed without a replacement. Create a custom task if needed.

Note: This does not affect application developers.
2025-03-03 15:59:49 +01:00
Joey Perrott
5358aa4b04 refactor(@angular-devkit/schematics): fix dependencies and import paths for strict deps requirements 2025-02-20 14:18:10 -05:00
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
Joey Perrott
33ed6e875e refactor: move builtin module imports to use node: prefix imports 2025-02-14 11:09:23 -08: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
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
8b68d9fe7c build: migrate @angular-devkit/schematics to ts_project
The `@angular-devkit/schematics` package has been migrated to the `rules_js` ts_project rule.
The tsconfig path mappings for the `@angular-devkit` scope have also been cleaned up now that
all the packages within this scope have been migrated.
2025-01-06 12:19:23 -05:00
Ash Ramirez
434a3740f0 refactor(@angular/cli): update aio links -> adev links
Updates for all angular.io links to the new angular.dev domain. Additionally, adjustment to new resources where the equivalent does not exist on the new site (e.g. Tour of Heroes tutorial)
2024-06-06 11:12:06 +02:00
Alan Agius
7975845831 refactor(@angular-devkit/schematics): deprecate NodePackageLinkTask
DEPRECATED: `NodePackageLinkTask` in `@angular-devkit/schematics`. A custom task should be created instead.
2024-03-14 16:04:20 +01:00
Alan Agius
cc916c1997 fix(@angular-devkit/schematics): add bun to known package managers
Fixes an issue that causes `Unknown package manager "bun".` is thrown when running `NodePackageTask` executor
2024-02-09 14:07:38 +01:00
Charles Lyding
11e0a51b17 build: minor cleanup of bazel build rules
BUILD files for each package have had outdated glob excludes removed.
Additionally, some src args have been reduced to a single file where possible.
The root bazel ignore file has also been expanded to include all node module
directories in each package. The ignore file does not appear to currently support
globs so each path has been individually specified.
2023-05-22 09:36:44 -04:00
Charles Lyding
e402c2358c build: adjust BUILD file external comment markers
Improvements to the syncing process allow for reduced usage of the comment markers.
2022-08-31 08:37:19 -04:00
Charles Lyding
901f5dd7fc fix(@angular-devkit/schematics): support ignore scripts package installs with Yarn 2+
Yarn 2 and higher no longer support the `--ignore-scripts` flag.
The `NodePackageInstallTask` will now spawn Yarn with environment variables to ignore
scripts instead of the commandline option. Other package managers remain unchanged.
This provides the necessary functionality for the task without relying on Yarn
commandline options.
2022-05-27 14:08:29 -04:00
Charles Lyding
9ff2c55e85 fix(@angular-devkit/schematics): support quiet package installs with Yarn 2+
Yarn 2 and higher no longer support the `--silent` flag.
The `NodePackageInstallTask` will now spawn package managers with the stdout ignored when quiet
mode is needed and only show stderr when the process exits unsuccessfully. This
provides the necessary functionality for the task without relying on package manager
options.
2022-05-27 14:08:11 -04:00
Charles Lyding
0e6425fd88 feat(@angular-devkit/schematics): disable package script execution by default in NodePackageInstallTask
In an effort to improve supply chain security, the `NodePackageInstallTask` will now use the package
manager's `--ignore-scripts` option by default. Without the option, all direct and transitive
dependencies would have their scripts executed during the task's package manager installation operation.
The change only affects the package manager behavior controlled by the Schematics `NodePackageInstallTask`.

First-party Angular schematics do not currently require any direct or transitive dependency
`install`/`postinstall` scripts to execute. Only two dependencies within a v14.0 new project would
potentially be affected by this: `nice-napi` (transitive from `piscina`) and `esbuild`. The `nice-napi`
functionality of `piscina` is unused within the Angular CLI with no plans to use it in the future.
Even if it was used, the `install` script runs `node-gyp-build` which would only have an effect
(based on the current version 1.0.2) on platforms that are not Windows, darwin-x64, or linux-x64.
In the event this functionality is eventually used, the Angular CLI could be setup to automatically execute
this particular script for unsupported platforms. For `esbuild`, the `postinstall` functionality
performs an optional native binary bootstrap optimization but would only be performed if not
using Windows or Yarn. As such, it would not be performed for many users regardless of the change in
this commit. If noticeable performance regressions on platforms where the optimization was previously
performed are reported, the script could also be setup to be automatically run by the Angular CLI during
project creation and/or first build.

BREAKING CHANGE: Schematics `NodePackageInstallTask` will not execute package scripts by default
The `NodePackageInstallTask` will now use the package manager's `--ignore-scripts` option by default.
The `--ignore-scripts` option will prevent package scripts from executing automatically during an install.
If a schematic installs packages that need their `install`/`postinstall` scripts to be executed, the
`NodePackageInstallTask` now contains an `allowScripts` boolean option which can be enabled to provide the
previous behavior for that individual task. As with previous behavior, the `allowScripts` option will
prevent the individual task's usage of the `--ignore-scripts` option but will not override the package
manager's existing configuration.
2022-04-29 16:37:56 -07:00
Alan Agius
e78f6ab5d8 feat(@angular-devkit/build-angular): remove deprecated tslint builder
BREAKING CHANGE:

Deprecated `@angular-devkit/build-angular:tslint` builder has been removed. Use https://github.com/angular-eslint/angular-eslint instead.
2021-08-02 16:57:56 +01:00
Alan Agius
053b7d66c2 feat(@angular-devkit/schematics): remove deprecated tslint APIs
BREAKING CHANGE:

With this change we remove the following deprecated APIs
- `TslintFixTask`
- `TslintFixTaskOptions`

**Note:** this only effects schematics developers.
2021-08-02 16:57:56 +01:00
Charles Lyding
222e711136 build: add secondary entrypoint package.json files to packages
The new public API tooling searches for nested package.json files to determine the location of secondary entrypoints. All secondary entrypoints for the CLI related packages now contain a secondary entrypoint package.json file.
The internal monorepo package discovery script was also updated to support the presence of the nested package.json files.
2021-07-21 14:55:18 -07:00
Charles Lyding
b3d7080147 build: enable esModuleInterop TypeScript option
The `esModuleInterop` option is recommended to be enable by TypeScript and corrects several assumptions TypeScript would otherwise make when importing CommonJS files.
This option change helps ensure compatibility as packages move towards ESM.
Reference: https://www.typescriptlang.org/tsconfig#esModuleInterop
2021-06-13 11:45:55 -04:00
Charles Lyding
f7dc97f40e refactor(@angular-devkit/schematics): allow use of a package manager's force option
This change allows consumers of the `NodeWorkflow` to configure the package installation task to use a package manager's `--force` option. This will be used by the `@angular/cli` update command when the update command's force option is used. This change is not intended to enable a schematic to adjust the force option.
2021-05-10 16:21:25 +01:00
Charles Lyding
c1512e4274 build: update files to be eslint compliant
All TypeScript files have been updated to pass the new eslint-based linting checks. eslint compatible disabling comments have also been added in place of the previous tslint comments.
2021-05-03 07:31:02 -04:00
Charles Lyding
37a06a7c37 build: format all files
All files are now formatted using the ng-dev tools via prettier.
2021-04-28 16:05:49 -07:00
Joey Perrott
003854257c build: migrate all file header to use Google LLC rather than Google Inc 2021-04-27 08:35:22 +02:00
Alan Agius
aedfcc1862 build: update to @types/node version 12 2021-02-08 14:07:24 -05:00
Alan Agius
1cd8aa61f4 refactor(@angular-devkit/schematics): replace NodePackageInstallTaskOptions class with interface
In this context this is not a breaking change for two reasons.

- `NodePackageInstallTaskOptions` is not exported.
- `NodePackageInstallTask` is using `NodePackageInstallTaskOptions` with `Partial` type which would cause the Class to become an object literal. This can be seen here: efb97c87f0/packages/schematics/angular/ng-new/index.ts (L81-L84)
2020-12-16 13:53:29 +00:00
Charles Lyding
445fe1d4e6 fix(@angular-devkit/schematics): show active package manager with install task
The manager that is being used to perform the package installation will now be shown during the installation.  This provides more insight to the user as well as providing additional troubleshooting information in the event of a failure.
2020-10-19 20:12:08 +02:00
Alan Agius
fed47b00cb refactor(@angular-devkit/schematics): deprecate TslintFixTask and it's options option
As part of tslint deprecation we are also deprecated the TslintFixTask. Users should use `ng lint --fix` directly instead
2020-10-07 11:12:58 -04:00
Alan Agius
d1adba1347 build: update build_bazel_rules_nodejs to 2.0.2 2020-08-19 16:00:07 +02:00
Charles Lyding
4e76f5a4aa fix(@angular-devkit/schematics): ensure task option values are defined 2020-08-12 19:27:38 +01:00
Charles Lyding
3f780804fd refactor(@angular-devkit/schematics): adjust types to support strict mode 2020-08-12 19:27:38 +01:00
Filipe Silva
b51cf8d1e6 build: use ts_library macro with common defaults 2020-04-30 15:12:46 -07:00
Filipe Silva
9a28114f6b test: remove non-bazel test setup 2020-04-30 15:12:46 -07:00
Filipe Silva
eceb5cdaa6 build: use rules_nodejs 1.6.0 features
Contains fixes related to the symlink behaviour inside of bazel. Without it, webpack needs to be configured to be aware of symlinks and preserve the paths.
2020-04-30 15:12:46 -07:00
Keen Yee Liau
e5db6a8ccd build: BUILD files formatted to have load statements at the top 2020-04-23 10:31:56 -07:00
Filipe Silva
60e92d54fb style: reformat bazel files 2020-04-07 09:07:19 -07:00
Filipe Silva
1e01d98ae2 build: workaround bazel module resolution bug
See https://github.com/bazelbuild/rules_nodejs/issues/313 for details.
2020-04-07 09:07:19 -07:00
Filipe Silva
5f3f736936 build: move BUILD.bazel files for secondary entry points into own folder
Without this change, module names will be computed with incorrect paths containing duplicate path fragments (e.g. `@angular-devkit/architect/testing/testing/test-logger`).
2020-04-07 09:07:19 -07:00
Charles Lyding
33656f7aa8 fix(@angular-devkit/schematics): allow custom registry for node package task 2020-02-10 16:02:05 -08:00
Filipe Silva
325dcd005f fix(@angular-devkit/schematics): show spinner for package install 2019-10-28 17:48:30 -07:00
Filipe Silva
4d23a0f0d8 fix(@angular-devkit/schematics): hide install output by default
Current output:
```
kamik@RED-X1C6 MINGW64 /d/sandbox/latest-app (master)
$ ng update @angular/cli --next --force
Using package manager: 'yarn'
Collecting installed dependencies...
Found 30 dependencies.
Fetching dependency metadata from registry...
                  Package "@angular-devkit/build-angular" has a missing peer dependency of "@angular/localize" @ "^9.0.0-next.11".
    Updating package.json with dependency @angular/cli @ "9.0.0-next.15" (was "9.0.0-next.14")...
    Updating package.json with dependency @angular-devkit/build-angular @ "0.900.0-next.15" (was "0.900.0-next.14")...
    Updating package.json with dependency typescript @ "3.6.4" (was "3.5.3")...
UPDATE package.json (1353 bytes)
warning @angular-devkit/build-angular@0.900.0-next.15: The engine "pnpm" appears to be invalid.
warning @angular-devkit/build-optimizer@0.900.0-next.15: The engine "pnpm" appears to be invalid.
warning @ngtools/webpack@9.0.0-next.15: The engine "pnpm" appears to be invalid.
warning @angular-devkit/architect@0.900.0-next.15: The engine "pnpm" appears to be invalid.
warning @angular-devkit/build-webpack@0.900.0-next.15: The engine "pnpm" appears to be invalid.
warning @angular-devkit/core@9.0.0-next.15: The engine "pnpm" appears to be invalid.
warning @angular/cli@9.0.0-next.15: The engine "pnpm" appears to be invalid.
warning @schematics/update@0.900.0-next.15: The engine "pnpm" appears to be invalid.
warning @angular-devkit/schematics@9.0.0-next.15: The engine "pnpm" appears to be invalid.
warning @schematics/angular@9.0.0-next.15: The engine "pnpm" appears to be invalid.
Compiling @angular/animations : es2015 as esm2015
Compiling @angular/compiler/testing : es2015 as esm2015
Compiling @angular/core : es2015 as esm2015
Compiling @angular/common : es2015 as esm2015
Compiling @angular/animations/browser : es2015 as esm2015
Compiling @angular/animations/browser/testing : es2015 as esm2015
Compiling @angular/core/testing : es2015 as esm2015
Compiling @angular/platform-browser : es2015 as esm2015
Compiling @angular/common/testing : es2015 as esm2015
Compiling @angular/platform-browser/testing : es2015 as esm2015
Compiling @angular/platform-browser/animations : es2015 as esm2015
Compiling @angular/common/http : es2015 as esm2015
Compiling @angular/router : es2015 as esm2015
Compiling @angular/forms : es2015 as esm2015
Compiling @angular/platform-browser-dynamic : es2015 as esm2015
Compiling @angular/common/http/testing : es2015 as esm2015
Compiling @angular/router/testing : es2015 as esm2015
Compiling @angular/platform-browser-dynamic/testing : es2015 as esm2015
```

New success output:
```
kamik@RED-X1C6 MINGW64 /d/sandbox/latest-app (master)
$ ng update @angular/cli --next --force
Using package manager: 'yarn'
Collecting installed dependencies...
Found 30 dependencies.
Fetching dependency metadata from registry...
                  Package "@angular-devkit/build-angular" has a missing peer dependency of "@angular/localize" @ "^9.0.0-next.11".
    Updating package.json with dependency @angular/cli @ "9.0.0-next.15" (was "9.0.0-next.14")...
    Updating package.json with dependency @angular-devkit/build-angular @ "0.900.0-next.15" (was "0.900.0-next.14")...
    Updating package.json with dependency typescript @ "3.6.4" (was "3.5.3")...
UPDATE package.json (1353 bytes)
Installing packages...
Packages installed successfully.
```

New error output:
```
kamik@RED-X1C6 MINGW64 /d/sandbox/latest-app (master)
$ ng update @angular/cli --next --force
Using package manager: 'yarn'
Collecting installed dependencies...
Found 30 dependencies.
Fetching dependency metadata from registry...
                  Package "@angular-devkit/build-angular" has a missing peer dependency of "@angular/localize" @ "^9.0.0-next.11".
    Updating package.json with dependency @angular/cli @ "9.0.0-next.15" (was "9.0.0-next.14")...
    Updating package.json with dependency @angular-devkit/build-angular @ "0.900.0-next.15" (was "0.900.0-next.14")...
    Updating package.json with dependency typescript @ "3.6.4" (was "3.5.3")...
UPDATE package.json (1353 bytes)
Installing packages...
warning @angular-devkit/build-angular@0.900.0-next.15: The engine "pnpm" appears to be invalid.
warning @angular-devkit/architect@0.900.0-next.15: The engine "pnpm" appears to be invalid.
warning @angular-devkit/build-optimizer@0.900.0-next.15: The engine "pnpm" appears to be invalid.
warning @ngtools/webpack@9.0.0-next.15: The engine "pnpm" appears to be invalid.
warning @angular-devkit/core@9.0.0-next.15: The engine "pnpm" appears to be invalid.
warning @angular-devkit/build-webpack@0.900.0-next.15: The engine "pnpm" appears to be invalid.
warning @angular/cli@9.0.0-next.15: The engine "pnpm" appears to be invalid.
warning @schematics/angular@9.0.0-next.15: The engine "pnpm" appears to be invalid.
warning @angular-devkit/schematics@9.0.0-next.15: The engine "pnpm" appears to be invalid.
warning @schematics/update@0.900.0-next.15: The engine "pnpm" appears to be invalid.
Compiling @angular/animations : es2015 as esm2015
Compiling @angular/compiler/testing : es2015 as esm2015
Compiling @angular/core : es2015 as esm2015
Compiling @angular/common : es2015 as esm2015
Compiling @angular/animations/browser : es2015 as esm2015
Compiling @angular/animations/browser/testing : es2015 as esm2015
Compiling @angular/core/testing : es2015 as esm2015
Compiling @angular/platform-browser : es2015 as esm2015
Compiling @angular/common/testing : es2015 as esm2015
Compiling @angular/platform-browser/testing : es2015 as esm2015
Compiling @angular/platform-browser/animations : es2015 as esm2015
Compiling @angular/common/http : es2015 as esm2015
Compiling @angular/forms : es2015 as esm2015
Compiling @angular/router : es2015 as esm2015
Compiling @angular/platform-browser-dynamic : es2015 as esm2015
Compiling @angular/common/http/testing : es2015 as esm2015
Compiling @angular/platform-browser-dynamic/testing : es2015 as esm2015
Compiling @angular/router/testing : es2015 as esm2015
Package install failed, see above.
```
2019-10-28 17:48:30 -07:00
c4605
3aee401397 fix(@angular-devkit/schematics): fix use install subcommand when override package manager to yarn 2019-06-26 11:21:09 -07:00
Alan Agius
bebd8b6c09 refactor: use standard node resolution and use async/await instead of rxjs 2019-06-06 14:07:37 -07:00
Charles Lyding
43a968942c feat(@angular-devkit/schematics): support pnpm as a package manager option 2019-02-08 16:06:11 -08:00
Alan Agius
b38a13dc02 fix(@angular-devkit/schematics): upgrade refactoring with tslint emits too much whitespace
Fixes #12653
2018-10-31 14:57:53 -07:00
Filipe Silva
9720077a4b build: make resolution logic compatible with Bazel 2018-08-22 16:36:10 -07:00
Hans
d67a4bf535 feat(@angular-devkit/schematics): allow tslintfix task on files
Before we only allowed tsconfig files (with includes added). This is necessary
for the lint fixing for schematics to target specific files.

Also added a feature that look for the tslint.json file if no tslint.json
file or configuration object was passed. Skipping the first argument to the
task constructor will look for the tslint closest to EVERY files being
linted.
2018-07-25 21:27:47 -07:00
Alan Agius
3108ce30ab refactor: remove redundant error in catch 2018-07-02 08:20:59 -04:00
Hans Larsen
44086c60ff build: move devkit repo back to angular-cli 2018-06-05 18:50:06 -07:00