274 Commits

Author SHA1 Message Date
Kristiyan Kostadinov
7f570c5685 build: update to TypeScript 5.6 RC
Updates the repo to the TypeScript 5.6 RC and narrows down the version to drop support for 5.4, in line with the compiler.
2024-08-29 10:40:28 +02:00
Angular Robot
2bf8e7f296 build: update all non-major dependencies 2024-07-30 12:40:39 +02:00
Charles Lyding
5895e9fb01 test: enable no-case-declarations lint rule
The `no-case-declarations` rule is now enabled and all failures
in have been addressed within the published code. Unit tests
have been excluded.
2024-07-11 08:19:56 +02:00
Doug Parker
79821006b8 refactor: fix pipe type
An explicit cast was removed in fa9bce0e9a (diff-29e41c6172a2d68db9886be9e933ed2b477732095313e104c52a725f887276cf) which relies on [control flow narrowing](https://devblogs.microsoft.com/typescript/announcing-typescript-5-5/#control-flow-narrowing-for-constant-indexed-accesses) in TS 5.5. However, google3 is still on TS 5.4, so we can't fully depend on that feature. Using an intermediate variable makes the type narrowing work correctly even in TS 5.4.
2024-06-27 11:21:30 -07:00
Charles Lyding
7fa5c3ea9f refactor(@angular-devkit/schematics): use modern language features in test engine host
The `NodeModulesTestEngineHost` class has been adjusted to use modern JavaScript
language features such as private fields and nullish coalescing.
2024-06-26 08:31:30 -07:00
Charles Lyding
b60b7dacfa refactor(@angular-devkit/schematics): avoid double file access reading JSON files
The file system engine hosts for schematics were using a helper method to
read JSON files that was performing both an exist and read call. Besides
causing two file system calls, this also has a potential race condition
where the file may not exist by the time the read call is made. To avoid
this, a try/catch is used with the read call to handle the not existing
case.
2024-06-26 08:31:10 -07:00
Charles Lyding
d56c8de284 refactor: minor code cleanup to improve code health
Several smaller code changes to improve type information and remove now
unneeded code structures based on improvements to both Node.js, TypeScript,
and underlying dependencies.
2024-06-25 16:57:16 -04:00
Charles Lyding
fa9bce0e9a test: enable @typescript-eslint/no-unnecessary-type-assertion lint rule
The `@typescript-eslint/no-unnecessary-type-assertion` rule is now enabled and all failures
have been addressed within the code.
2024-06-25 16:57:03 -04:00
Alan Agius
aebfde28c7 build: update all non-major dependencies
Closes #27881
2024-06-25 20:53:49 +02:00
Charles Lyding
39f946a848 build: enabled isolated modules TypeScript option
The TypeScript `isolatedModules` option is now enabled for all TypeScript
code within the repository. As a result, all packages will now be built
with the option enabled. This does not affect projects created with the CLI
and is only related to the building of the actual Angular CLI code.
The `isolatedModules` option ensures that code can be emitted without the
TypeScript typechecker and allows tools other than TypeScript to potentially
be used. Code was updated to correct all errors after the option was enabled.
Additionally, some early code fixes were done to add function and accessor
return types to prepare for future `isolatedDeclarations` usage. More changes
would be needed to consider turning on `isolatedDeclarations`, however.
2024-06-23 15:34:49 +02: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
Charles Lyding
d087b5f9f2 refactor(@angular-devkit/schematics): reduce direct rxjs usage in filter host tree
All direct usage of rxjs has been removed from the FilterHostTree implementation.
This removes the need to import rxjs within the containing file. The recursive
logic has also been replaced with an iterative approach.
2024-05-15 13:42:20 -04:00
Alan Agius
7b52b98bfd fix(@angular-devkit/schematics): SchematicTestRunner.runExternalSchematic fails with "The encoded data was not valid for encoding utf-8"
When using Jest instanceof does not work correctly. See: https://github.com/jestjs/jest/issues/2549

Closes: #27643
2024-05-15 17:17:50 +02:00
Divy Srivastava
41ee8eac19 fix(@angular-devkit/schematics): use web standard error check for Deno support 2024-05-02 09:59:48 -04:00
Angular Robot
8843188080 build: update all non-major dependencies 2024-04-17 20:01:54 +02:00
Alan Agius
203c0eeb35 build: update all non-major dependencies 2024-04-08 10:10:09 -04: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
Angular Robot
ab4f98596c build: update all non-major dependencies 2024-03-06 11:37:15 +01:00
Charles Lyding
860b93a25b refactor(@angular-devkit/schematics): remove now unused internal UpdateBuffer class
The internal `UpdateBuffer` class is no longer used within the schematics package
and can be removed.
2024-02-12 13:28:07 +01:00
Charles Lyding
77f6a41a83 refactor(@angular-devkit/schematics): directly use magic-string in update recorder
The schematics `UpdateRecorder` now uses the `magic-string` library directly instead
of delegating to another class (`UpdateBuffer`) which now effectively only wraps the
`magic-string`. This also allows for improved BOM handling and repeat conversion
of strings to and from `Buffer` instances.
2024-02-12 13:28:07 +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
Angular Robot
ccdaed4e49 build: update all non-major dependencies 2024-02-06 08:42:54 -05:00
Angular Robot
5f916e7810 build: update all non-major dependencies 2024-02-01 08:31:07 -08:00
Charles Lyding
910531a3c8 refactor: remove outdated namespace syntax usage
The `namespace` TypeScript usage within the CLI has been removed. This
syntax is not recommended outside of type definition files.
2024-01-26 08:55:53 +01:00
Angular Robot
248b4c9a75 build: update all non-major dependencies 2024-01-23 10:52:36 +01:00
Alan Agius
7e9bbe442d fix(@angular-devkit/schematics): replace template line endings with platform specific
Currently, when using `ng new` on Windows, users will get a number of `LF will be replaced by CRLF the next time Git touches it` warnings.

This commit, replaces the line endings in templates to be platform specific.

Closes #26764
2024-01-03 11:44:51 +01:00
Arthur Dibe
dde1372f5b docs(@angular-devkit/schematics): add Task to glossary table
Include explanation about Task

Fixes #22764
2023-11-23 14:24:24 +01:00
michael faith
f63520bc42 fix(@angular-devkit/schematics): running external schematics with yarn pnp
This change addresses an issue encountered when running external schematics from
a yarn pnp workspace.  The function used to resolve a collection json using node
used recursion in a way that it effectively walked itself into an exception. Then,
if the exception is the type it expected, it would keep going.  This was flawed
in that yarn with pnp throws a different type of error when it failed to load
the mis-constructed collection path
(e.g. `/node_modules/@schematics/angular/collection.json/package.json`).
`ENOTDIR` instead of `MODULE_NOT_FOUND`.

This process of intentionally / knowingly walking into an exception seems problematic in
general.  So, I addressed it by first checking if the `schematics` entry in the package
is a relative path.  If it is, then don't construct the collection path from that.
If entry is not relative, then assume it's pointing at another package and we need
to recurse to get to the actual collection path.

I've tested this in both yarn pnp and non-pnp environments.
2023-10-31 08:59:41 +01:00
michael faith
081111f0e7 fix(@angular-devkit/schematics): running external schematics with yarn pnp
This change addresses an issue encountered when running external schematics from
a yarn pnp workspace.  The function used to resolve a collection json using node
used recursion in a way that it effectively walked itself into an exception. Then
if the exception is the type it expected, it would keep going.  This was flawed
in that yarn with pnp throws a different type of error when it failed to load
the mis-constructed collection path (e.g. `/node_modules/@schematics/angular/collection.json/package.json`).  `ENOTDIR` instead of `MODULE_NOT_FOUND`.

This process of intentionally / knowingly walking into an exception seems problematic in
general.  So, I addressed it by removing the recursion that was used mainly because
there's a similar need to construct the collection path from a relative path in the
package.json as there is to construct the collection path from a relative path that's
passed in.  Rather than leaning on the recursion to do this, I added the logic
at the time we pull the schematics path from the package, and move on.

Since the recursion was removed, the infinite recursion safety check at the start wasn't
needed anymore.

I've tested this in both yarn pnp and non-pnp environments.
2023-10-31 08:59:41 +01:00
Alan Agius
11420667f9 build: use single Node.js toolchain to run unit tests
E2E tests are used to run tests on multiple platforms and node.js versions.
2023-10-30 17:50:47 +01:00
Angular Robot
401be269f9 build: update dependency magic-string to v0.30.5 2023-10-13 10:46:11 +02:00
Angular Robot
3f2e2d3f9e build: update all non-major dependencies 2023-10-04 14:46:08 -04:00
Alan Agius
f600bbc97d refactor(@angular-devkit/schematics): remove deprecated runExternalSchematicAsync and runSchematicAsync
BREAKING CHANGE: deprecated `runExternalSchematicAsync` and `runSchematicAsync` methods have been removed in favor of `runExternalSchematic` and `runSchematic`.
2023-09-01 16:03:22 +02:00
Angular Robot
d90f2f6047 build: update all non-major dependencies 2023-08-29 05:10:59 -07:00
Angular Robot
6c5c71103f build: update all non-major dependencies 2023-08-03 12:36:35 -04:00
Alan Agius
ba7686283b build: update all non-major dependencies 2023-07-10 09:54:57 -04: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
Alan Agius
22c1cb66c5 fix(@angular-devkit/schematics): do not generate an UpdateBuffer for created and overridden files
`UpdateBuffer` only supports UTF-8 encoded files, which causes schematics to emit corrupted binary like files such as images.

This commit also introduce an errors when the `UpdateRecorder` is used for non UTF-8 files.

Closes #25174
2023-05-10 11:20:29 +00:00
Angular Robot
367ddabed0 build: update dependency rxjs to v7.8.1 2023-04-27 10:01:39 +00:00
Angular Robot
b564b9afb8 build: update all non-major dependencies 2023-02-22 13:06:18 +00:00
Alan Agius
8095268fa4 build: update to rxjs 7
G3 is now using RXJS version 7 which makes it possible for the CLI to also be updated to RXJS 7.

NB: this change does not remove all usages of the deprecated APIs.

Closes #24371
2023-02-16 14:59:40 +00:00
Lukas Spirig
d2ef386f46 refactor(@angular-devkit/schematics): remove UpdateBuffer and rename UpdateBuffer2 to UpdateBuffer
This PR removes the internally built `UpdateBuffer` and renames
`UpdateBuffer2` (based on magic-string) to `UpdateBuffer`. This
should have little to no impact for consumers.

BREAKING CHANGE:
The depracated `UpdateBuffer` has been removed and `UpdateBuffer2`
is renamed to `UpdateBuffer`. With this change the related and
deprecated symbols `ContentCannotBeRemovedException` and `Chunk`
have also been removed.
2023-02-15 21:04:06 +00:00
Alan Agius
f6624b974f feat(@angular-devkit/core): update SchemaRegistry compile to return Promise
Use promise based methods to reduce RXJS usage and boiler-platting.

BREAKING CHANGE: Several changes to the `SchemaRegistry`.
- `compile` method now returns a `Promise`.
- Deprecated `flatten` has been removed without replacement.
2023-02-15 21:03:30 +00:00
Angular Robot
d439cb9727 build: update all non-major dependencies 2023-02-13 14:16:12 +00:00
Charles Lyding
7f93735e98 build: use bazel to perform release builds
When performing a release via the dev-infra `ng-dev` tooling, the release
builds for the packages that will be published are now performed using bazel.
Prior to this, the release builds were performed using a custom build script
that programmatically invoked TypeScript APIs. The Bazel build and discovery
process for the releasable packages is performed by a script that is based on
the scripts from components and framework repositories. Several small modifications
were performed to match the behavior and structure of the cli repository:
* Use of `packages` as the source root in the bazel query
* Use of `pkg_npm` rule in the bazel query
* Partial transition to native Node.js `fs` APIs instead of `shelljs`
* Directory creation per package when copying output (supports multiple package scopes)
* Copying of archives (tgz) for each package

The snapshot and local build capabilities are not modified as part of this change
but will be merged in a followup as part of a larger transition to use bazel
throughout the package build process.
2023-01-05 03:21:58 +00:00
Alan Agius
207358afb8 feat(@angular-devkit/schematics): add runSchematic and runExternalSchematic methods
These async methods are a replacement for the Observable based `runSchematicAsync` and `runExternalSchematicAsync` methods.

DEPRECATED:
The Observable based `SchematicTestRunner.runSchematicAsync` and `SchematicTestRunner.runExternalSchematicAsync` method have been deprecated in favor of the Promise based `SchematicTestRunner.runSchematic` and `SchematicTestRunner.runExternalSchematic`.
2022-12-08 14:49:43 -08:00
Angular Robot
3d885fbb21 build: update all non-major dependencies 2022-12-08 12:09:04 -08:00
Alan Agius
f347538867 Revert "refactor(@angular-devkit/schematics): remove UpdateBuffer and rename UpdateBuffer2 to UpdateBuffer"
This reverts commit 9b07b469b622e083a9915ed3c24e1d53d8abf38f.
2022-10-10 20:22:03 +02:00
Günhan Gülsoy
2230374e18 refactor: remove add implicate types for better code readability
When strictNullChecks in enabled in TS compiler, the following files
cause some failures in certain environments. Fix these failures.
Also update outdated goldens.
2022-10-10 12:22:56 +02:00
Angular Robot
cdf78d4641 build: update all non-major dependencies 2022-10-10 12:22:40 +02:00