1042 Commits

Author SHA1 Message Date
Julien Marcou
7cbbf2f2ba fix(@schematics/angular): remove vscode testing configurations for minimal workspaces
Remove the `ng test` VS Code task and `npm test` VS Code launch configuration from the workspace
when building minimal workspaces.

Fixes #23360
2022-06-15 09:51:36 +02:00
Charles Lyding
bb43e0a7c4 test(@schematics/angular): update several tests to use async expectations
Using Jasmine's `expectAsync` allows for reduced test code when testing that
a function returning a promise rejects with a specific error.
2022-06-14 11:28:21 +02:00
Doug Parker
3bce5da1c2 docs: fix typo in latest versions package.json 2022-06-02 14:33:08 -07:00
Alan Agius
438ee6d5b5 fix(@schematics/angular): remove strict setting under application project
This setting is redundant under an application project since an application cannot be created under another application.
2022-06-02 13:02:24 -07:00
Charles Lyding
e895fc7c10 refactor(@schematics/angular): move standalone component helpers to a private export for Angular components
The standalone component helper utilities introduced into the `@angular/cdk` via
https://github.com/angular/components/pull/24931 have been added to an export path (`private/components`)
within `@schematics/angular`. The export path is primarily intended for the use of the components schematics
within `@angular/cdk` and `@angular/material`. The API exported from this path is not considered public API,
does not provide SemVer guarantees, and may be modified or removed without a deprecation cycle.
2022-05-26 11:38:13 -07:00
Renovate Bot
a28f4b3423 build: update dependency karma-jasmine-html-reporter to v2 2022-05-26 18:03:31 +02:00
Charles Lyding
707911d423 feat(@schematics/angular): support controlling addDependency utility rule install behavior
When using the `addDependency` rule from `@schematics/angular/utility` a new option is now
available that supports controlling the rule's behavior when scheduling the `NodePackageInstallTask`.
Previously, the behavior was automatic and the rule would only schedule the task if it was not already
scheduled by a previous `addDependency` rule usage for the `package.json`. This behavior is still the
default behavior. However, it can now be customized per rule invocation via the `install` rule option
which can be either `InstallBehavior.None`, `InstallBehavior.Auto`, or `InstallBehavior.Always`.
2022-05-25 11:24:39 -07:00
Charles Lyding
c3821caf98 refactor(@schematics/angular): use updated utilities in E2E schematic
Updates the E2E schematic to use the workspace and dependency utility rules exported from `@schematics/angular/utility`.
This change also removes the use of the custom path manipulation functions from `@angular-devkit/core`.
The development dependency versions for `protractor` and `jasmine-spec-reporter` are also moved to the latest
versions helper `package.json` file. This move allows the versions to be automatically updated via renovate
instead of hardcoded in the schematic source code.
2022-05-25 11:24:18 -07:00
Kristiyan Kostadinov
d2e9edd463 build: update to TypeScript 4.7 final
Bumps up the TypeScript 4.7 for our own build as well as any newly-created apps.
2022-05-25 11:15:46 -07:00
Alan Agius
e751464ea3 fix(@angular/cli): populate path with working directory in nested schematics
With this change we change the how we handle `"format": "path"` schematic property option. We replace the formatter in favour of a `SmartDefaultProvider`, which ensures that nested schematics can access the `workingDirectory`.
2022-05-24 10:19:30 -07:00
Renovate Bot
790a1711bf build: update all non-major dependencies 2022-05-24 09:59:55 -07:00
Elton Coelho
d899091d5d fix(@schematics/angular): alphabetically order imports during component generation
change the order of imports during component generation using changeDetectionStrategy set to OnPush

closes angular#23156
2022-05-18 12:58:10 -04:00
Kristiyan Kostadinov
8ed291d0a5 build: update to TypeScript 4.7 RC
Bumps up the repo to the RC version of TypeScript 4.7.
2022-05-16 09:19:26 -04:00
Alan Agius
e1ee636d78 fix(@schematics/angular): don't add path mapping to old entrypoint definition file
With the APF changes in version 14, the dts entrypoint file has been changed to `index.d.ts`, this results in TypeScript being able to resolve the type definition file without the need of the additional path to the flat module file dts.
2022-05-10 10:26:31 -07:00
Alan Agius
32281c2109 fix(@schematics/angular): add migration to remove package.json in libraries secondary entrypoints
`package.json` files have been remove from secondary entrypoints in version 14 of Angular package format (APF).

With this change we delete the now redundant files and in case these contained the deprecated way of how to configure secondary entrypoints in ng-packagr we migrate these as well.
2022-05-09 10:51:56 -07:00
Kristiyan Kostadinov
7291579073 build: update to TypeScript 4.7
Bumps up the TypeScript version to 4.7.
2022-05-06 15:51:02 -07:00
Kristiyan Kostadinov
0301cf6c10 build: prepare TypeScript 4.7
Expands the version range to allow TypeScript 4.7 and makes the necessary code changes in order to support it.
2022-05-06 15:51:02 -07:00
alkavats1
d52697047a refactor: refactored the code and removed the code smells
refactored the code and removed the code smells
2022-05-06 11:11:13 -07:00
Cédric Exbrayat
b16e6f13a7 fix(@schematics/angular): remove extra space in standalone imports 2022-05-06 11:05:29 -07:00
Charles Lyding
1b2b8d96e5 refactor(@schematics/angular): track E2E ts-node version with latest-versions utility
This change allows renovate to automatically manage the dependency updates for the `ts-node` package used by the E2E schematic.
2022-05-06 11:00:55 -07:00
Charles Lyding
b07ccfbb1b feat(@schematics/angular): introduce a utility subpath export for Angular rules and utilities
The `@schematics/angular` package now contains a defined set of package `exports` including a `utility` subpath export.
A wildcard export is also temporarily defined to support transition away from existing deep-import usage.
The `@schematics/angular/utility` subpath export will contain supported utility methods used by the first-party schematics
contained within the `@schematics/angular` package and can be considered public API that will follow SemVer stability constraints.
The first group of utilities introduced in this change are used to modify the `angular.json` workspace file
within the schematics and include the `updateWorkspace` rule and `readWorkspace`/`writeWorkspace` helpers.
2022-05-03 14:04:47 -07:00
Charles Lyding
3fa38b08ba feat(@schematics/angular): introduce addDependency rule to utilities
An `addDependency` schematics rule has been added to the newly introduced `utility` subpath export for the `@schematics/angular` package.
This new rule allows for adding a package as a dependency to a `package.json`. By default the `package.json` located
at the schematic's root will be used. The `packageJsonPath` option can be used to explicitly specify
a `package.json` in a different location. The type of the dependency can also be specified instead
of the default of the `dependencies` section by using the `type` option for either development or peer dependencies.
2022-05-03 12:23:26 -07:00
Pawel Kozlowski
df9fc8f5ab refactor(@schematics/angular): include CommonModule for standalone components
This commit adds the CommonModule imports to the standalone components
generated by the Angular's ng add component schematic.
2022-05-03 12:18:54 -07:00
Kristiyan Kostadinov
7b78b7840e feat(@schematics/angular): add --standalone to ng generate
Adds the `--standalone` flag when generating components, directives or pipes through `ng generate`.
2022-04-27 15:33:48 -04:00
Charles Lyding
a0e3de2b5f refactor(@schematics/angular): use Tree's newly introduced readText and readJSON functionality
Code related to decoding buffers into strings and parsing content into JSON can now be removed by using the
support provided directly from the Tree instance for the executing schematic.
2022-04-26 19:24:55 -04:00
Charles Lyding
ccd7e71a47 refactor(@schematics/angular): minor cleanup of unneeded @angular-devkit/core imports
Several imported types and values from `@angular-devkit/core` could be removed while still
maintaining the same functionality. This further reduces the schematics direct dependence
on the `@angular-devkit/core` package.
2022-04-22 11:31:53 -04:00
Charles Lyding
291bbffcc9 refactor(@schematics/angular): use string helper re-export from @angular-devkit/schematics
By using the `strings` re-export from `@angular-devkit/schematics` instead of from `@angular-devkit/core`,
the number of imports from `@angular-devkit/core` has been reduced and lowers the direct dependency count
for many of the individual schematics.
2022-04-22 11:31:53 -04:00
Renovate Bot
c636cc8a2a build: update dependency karma-jasmine to v5 2022-04-14 13:05:09 +02:00
Renovate Bot
95954bba04 build: update all non-major dependencies 2022-04-12 10:37:05 -07:00
Alan Agius
7db433bb06 fix(@schematics/angular): provide actionable error message when routing declaration cannot be found
Due to incorrect castings previously the code would crash when the module doesn't contain an routing module with the following error:

```
Cannot read property 'properties' of undefined
```

Closes #21397
2022-04-04 10:03:40 -04:00
gauravsoni119
a5e99762ef fix(@schematics/angular): fix extra comma added when use --change-detection=onPush and --style=none to generate a component 2022-03-30 16:59:17 +02:00
Renovate Bot
53771e18b5 build: update dependency @types/jasmine to v4 2022-03-24 14:18:44 +01:00
Alan Agius
366cabc66c feat(@angular/cli): add support for multiple schematics collections
The `schematicCollections` can be placed under the `cli` option in the global `.angular.json` configuration, at the root or at project level in `angular.json` .

```jsonc
{
  "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
  "version": 1,
  "cli": {
    "schematicCollections": ["@schematics/angular", "@angular/material"]
  }
  // ...
}
```

**Rationale**
When this option is not configured and a user would like to run a schematic which is not part of `@schematics/angular`,
the collection name needs to be provided to `ng generate` command in the form of `[collection-name:schematic-name]`. This make the `ng generate` command too verbose for repeated usages.

This is where `schematicCollections` comes handle. When adding `@angular/material` to the list of `schematicCollections`, the generate command will try to locate the schematic in the specified collections.

```
ng generate navigation
```

is equivalent to:

```
ng generate @angular/material:navigation
```

**Conflicting schematic names**
When multiple collections have a schematic with the same name. Both `ng generate` and `ng new` will run the first schematic matched based on the ordering (as specified) of `schematicCollections`.

DEPRECATED:

The `defaultCollection` workspace option has been deprecated in favor of `schematicCollections`.

Before
```json
"defaultCollection": "@angular/material"
```

After
```json
"schematicCollections": ["@angular/material"]
```

Closes #12157
2022-03-22 09:37:57 -07:00
Alan Agius
e49220fba0 feat(@schematics/angular): add migratiom to remove defaultProject in workspace config
This option is deprecated in Angular CLI and will be removed in a future major version.
2022-03-21 12:28:15 -07:00
Alan Agius
4cbfb87766 refactor(@schematics/angular): remove usage of deprecated defaultProject
This option is deprecated in Angular CLI and will be removed in a future major version.
2022-03-21 12:28:15 -07:00
Tobias Speicher
137651645c refactor: replace deprecated String.prototype.substr()
.substr() is deprecated so we replace it with .slice() which works similarily but isn't deprecated

Signed-off-by: Tobias Speicher <rootcommander@gmail.com>
2022-03-21 12:27:52 -07:00
Adrien Crivelli
09a71bab60 fix(@schematics/angular): Consolidated setup with a single beforeEach()
Since f463c8403547 we use native `async`/`await` and thus we do not need
to split setup in two `beforeEach()`
2022-03-21 12:27:09 -07:00
Charles Lyding
c927c038ba fix(@schematics/angular): remove @types/node from new projects
The `@types/node` package is now only added if E2E tests (`ng generate e2e`) or universal are added to a project.
2022-03-16 10:09:51 -04:00
Alan Agius
9ddb220c3d docs: replace app with application 2022-03-14 10:03:06 -04:00
Alan Agius
7fa3e65879 feat(@angular/cli): support TypeScript 4.6.2
BREAKING CHANGE:

Support for TypeScript 4.4 and 4.5 has been removed. Please update to TypeScript 4.6.
2022-03-10 15:36:19 -05:00
Alan Agius
2e0493130a refactor(@angular/cli): replace command line arguments parser
With this change we refactor the Angular CLI and replace the underlying args parser and command builder. We choose to use Yargs as our parser and command builder of choice. The main advantages of Yargs over other command builders are;

- Highly configurable.
- We already use it in other packages such as the compiler-cli/dev-infra etc..
- Commands and options can be added during runtime. This is a requirement that is needed to support architect and schematics commands.
- Outstanding documentation.
- The possibility to parse args without parser configuration (Free form).
- Commands are built lazily based on the arguments passed.

BREAKING CHANGE:

Several changes in the Angular CLI commands and arguments handling.

- `ng help` has been removed in favour of the `—-help` option.
- `ng —-version` has been removed in favour of `ng version` and `ng v`.
- Deprecated camel cased arguments are no longer supported. Ex. using `—-sourceMap` instead of `—-source-map` will result in an error.
- `ng update`, `—-migrate-only` option no longer accepts a string of migration name, instead use `—-migrate-only -—name <migration-name>`.
- `—-help json` help has been removed.

Closes #20976, closes #16614 and closes #16241
2022-03-09 17:18:53 +01:00
Alan Agius
90a5a4c284 build: update @types/node to ^14.15.0
Version 12 is no longer supported.
2022-03-07 19:04:35 +01:00
Alan Agius
433b6b4931 docs: remove redundant default empty strings values
(cherry picked from commit 3d928c01c8196b1caba7b373eec870540ecda79e)
2022-03-04 16:58:55 +01:00
Renovate Bot
4b529fe80c build: update all non-major dependencies 2022-02-10 14:16:24 +01:00
Alan Agius
0a1cd584d8 refactor(@angular-devkit/build-angular): remove deprecated showCircularDependencies browser and server builder option
BREAKING CHANGE:

The deprecated `showCircularDependencies` browser and server builder option has been removed. The recommended method to detect circular dependencies in project code is to use either a lint rule or other external tools.
2022-01-31 11:34:58 -08:00
Alan Agius
69ecddaa7d feat(@schematics/angular): update new and existing projects compilation target to ES2020
With this change we update the TypeScript compilation target to `ES2020` for both new and existing projects. This is because all browsers that Angular supports (https://angular.io/guide/browser-support) support `ES2020` features without the need for polyfills.
2022-01-28 11:01:09 -08:00
Alan Agius
b3082355c0 build: update @angular/ packages to version 14 prerelease 2022-01-28 10:59:53 -08:00
Alan Agius
7e7de6858d feat(@schematics/angular): update Angular dependencies to use ^ as version prefix
With this change we update Angular dependencies to use `^` instead of `~` as version prefix.

Closes #21925
2022-01-27 11:07:13 -08:00
Alan Agius
28b0cdc966 refactor(@schematics/angular): remove version 13 migrations
These migrations cannot be used with version Angular CLI 14, since `ng update` will not allow updating multiple versions at once.
2022-01-27 11:07:13 -08:00
Kasper Christensen
08152f78b2 refactor(@schematics/angular): changed casings and small reorganizing
Removed profiling files

Removed chrome-profiler-events*.json as it's no longer generated.
2022-01-12 10:04:47 -08:00