1059 Commits

Author SHA1 Message Date
Kristiyan Kostadinov
48dec89e91 build: update to TypeScript 4.8 RC
Updates to the TypeScript 4.8 RC and adds some code to account for a breaking change where the decorators and modifiers of an AST node have been combined into a single array.
2022-08-22 15:28:47 -06:00
Alan Agius
4368c85983 refactor: remove unused local variables 2022-08-12 08:19:26 -04:00
Jason Bedard
db5c1fc13c test: run tests on multiple node versions 2022-08-03 10:33:46 -07:00
Angular Robot
d55eada6c2 build: update all non-major dependencies 2022-07-25 16:33:08 +02:00
Alan Agius
e995bdad32 fix(@schematics/angular): prevent numbers from class names
With this change we prevent creating classes with invalid characters.

Closes #12868
2022-07-21 19:18:48 -04:00
Alan Agius
e63375ea39 fix(@angular-devkit/core): classify string util should concat string without using a .
`.` is not a valid character in ES6 class names.

Prior to this change `foo.module` before used to be incorrectly classified to `Foo.Module` instead of `FooModule`.

Closes #13824
2022-07-21 19:18:48 -04:00
Charles Lyding
c9b2aa41da fix(@schematics/angular): Allow skipping existing dependencies in E2E schematic
The E2E schematic will now (as it did previously) skip adding dependencies
if they already exist within the `package.json` regardless of the specifier.
This is accomplished with the `existing` option for the `addDependency` rule
which allows defining the behavior for when a dependency already exists.
Currently the two option behaviors are skip and replace with replace being
the default to retain behavior for existing rule usages.
2022-07-19 13:29:37 -04:00
Kristiyan Kostadinov
b2ffc138b4 fix(@schematics/angular): incorrect logo for Angular Material
Fixes that the component generated by `ng new` had an incorrect logo for Angular Material.
2022-07-18 13:22:17 -04:00
Angular Robot
0a990c525a build: update all non-major dependencies 2022-07-14 15:21:03 -07:00
Charles Lyding
b8bf3b480b fix(@schematics/angular): only issue a warning for addDependency existing specifier
When using the `addDependency` helper rule, a package specifier mismatch will
now result in a warning instead of an error. This prevents the potential
for breaking changes in schematics that previously allowed the behavior.
The warning will also display the existing and new specifiers to better inform
the schematic user of the outcome of the schematic.
2022-07-13 11:58:37 -07:00
Alan Agius
68358f0c37 docs: remove long-description from schematics
These long descriptions were and are only handled at the Angular CLI level which makes these redundant.
2022-07-08 18:10:05 +02:00
Alan Agius
624e0b0ec6 fix(@angular-devkit/core): provide actionable warning when a workspace project has missing root property
The `root` property is required in a workspace project. Now we issue an actionable warning message when this is missing.

Note: this will become an error in the next major version.

Closes: #21310
2022-07-08 15:57:51 +02:00
Alan Agius
14f8f5c5ab fix(@schematics/angular): remove browserslist configuration
By default the defaults are now configured in ng-packagr

https://github.com/ng-packagr/ng-packagr/blob/main/src/lib/styles/stylesheet-processor.ts#L35-L47
2022-07-07 15:38:04 +02:00
Alan Agius
9e3152466b fix(@schematics/angular): prevent importing RouterModule parallel to RoutingModule
Prior to this commit, we defined routes in two places example:
```ts
@NgModule({
  declarations: [
    HomeComponent
  ],
  imports: [
    CommonModule,
    RouterModule.forChild(routes),
    HomeRoutingModule
  ]
})
export class HomeModule { }
```

Closes #17139
2022-07-06 16:33:40 +02:00
Alan Agius
ab8ab30c87 fix(@schematics/angular): use sourceRoot instead of src in universal schematic
With this change we remove the usage of hard coded `src` directory and instead infer this from the `sourceRoot` project option.

We also remove the `angularCompilerOptions.entryModule` property in the server tsconfig as this is no longer needed with Ivy.

Closes #12104
2022-06-29 08:56:11 -04:00
renovate[bot]
04160c58ce build: update all non-major dependencies 2022-06-27 08:15:08 -04:00
Alan Agius
4144642ffa build: remove unneeded dependency in ts_library
`@npm//@types/browserslist` and `@npm//rxjs` are not needed in `@schematics/angular`
2022-06-23 09:57:54 -07:00
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