1133 Commits

Author SHA1 Message Date
Angular Robot
31d35b4daf build: update all non-major dependencies 2023-03-07 14:16:21 +00:00
Kristiyan Kostadinov
f3070f2e93 build: update to TypeScript 5.0
Updates the repo to TypeScript 5.0.0-beta. The remaining usages in tests and schematics will be updated once the 5.0 final version is released.
2023-03-02 18:59:49 +00:00
Alan Agius
8df900f24a build: update FW and ng-packagr dependencies to version 16
This commit update Angular and ng-packagr dependencies to version 16.
2023-02-23 10:26:07 +00:00
Alan Agius
68024234ed feat(@angular/cli): remove deprecated defaultCollection from workspace configuration
The deprecated 'defaultCollection' workspace option has been removed

BREAKING CHANGE:

The deprecated `defaultCollection` workspace option has been removed. Use `schematicCollections` instead.

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

After
```json
"schematicCollections": ["@angular/material"]
```
2023-02-17 16:10:21 +00:00
Alan Agius
d58428d3db feat(@angular/cli): remove deprecated defaultProject from workspace configuration
The deprecated 'defaultProject' workspace option has been removed

BREAKING CHANGE: The deprecated `defaultProject` workspace option has been removed. The project to use will be determined from the current working directory.
2023-02-17 16:10:21 +00:00
Alan Agius
ada4d694c3 refactor(@schematics/angular): remove version 15 migrations
These are no longer used.
2023-02-17 16:10:21 +00:00
ced
22fdd7da97 feat(@schematics/angular): generate functional resolvers and guards by default
As Angular v15.2 deprecates class-based resolvers and guards, this commit switches the `functional` flag default value to `true`.

BREAKING CHANGE: `ng g resolver` and `ng g guard` now generate a functional resolver or guard by default. It is still possible to generate a (deprecated) class-based resolver or guard by using `ng g resolver --no-functional` or `ng g guard --no-functional`.
2023-02-16 19:42:39 +00:00
ced
5ceedcb11e feat(@schematics/angular): remove deprecated CanLoad option for guards
Angular v15.1 deprecated the `CanLoad` guard in favor of `CanMatch`.
This commit removes the support for `CanLoad` when generating a guard with the CLI, to encourage developers to use `CanMatch` instead.

BREAKING CHANGE:
The CLI no longer allows to generate `CanLoad` guards. Use `CanMatch` instead.
2023-02-15 21:03:02 +00:00
Alan Agius
88fddc0503 fix(@schematics/angular): remove bootstrapping wrapping in universal schematic
The bootstrapping wrapping is no longer necessary as of 15.1.3. See: https://github.com/angular/angular/pull/48868
2023-02-07 01:00:50 +00:00
Alan Agius
7b0c1ce0ca fix(@schematics/angular): update browserslist config to include last 2 Chrome version
https://github.com/angular/angular/pull/48669 added support for the last 2 Chrome versions
2023-01-20 18:37:22 +00:00
Alan Agius
c8a3b30000 fix(@schematics/angular): replace existing BrowserModule.withServerTransition calls when running universal schematic
This change fixes an issue where calling the universal schematic on an application with existing `BrowserModule.withServerTransition` will cause an additional `.withServerTransition` call to be added.

With this change we now remove the previous `withServerTransition` call to avoid misconfiguration.

Closes #24563
2023-01-18 17:13:23 +00:00
Alan Agius
e763db8691 refactor: change JSONFile to private instead of internal
This is so that this can be used in the Universal repo which is not failing because the type is not available.

https://app.circleci.com/pipelines/github/angular/universal/4483/workflows/25535db2-4a9c-43b0-84a5-3a55071013c6/jobs/20263
2023-01-12 14:32:16 +00:00
Alan Agius
ef39987e59 build: update Angular peer deps to support ^15.2.0-next.0 2023-01-12 12:24:11 +00:00
Alan Agius
759344d2e9 refactor(@schematics/angular): remove unused local variables
`messages` is unused from the spec and thus can be removed.
2023-01-09 14:40:33 +00:00
Angular Robot
df5ca315a6 build: update all non-major dependencies 2023-01-06 15:04:14 +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
Kristiyan Kostadinov
ba895b1af6 build: update to TypeScript 4.9
Updates the project to TypeScript 4.9.
2023-01-03 16:46:36 +00:00
Alan Agius
dd2b65943d feat(@schematics/angular): add configuration files generation schematic
This commits add a schematic to generate Karma and Browserlist files which since version 15 are no longer generated by default. This schematic should be used to generate these files when further customisation is needed.

Usage
```
ng generate config karma
ng generate config browserlist
```

Closes #24294
2023-01-03 14:53:44 +00:00
Alan Agius
ace34b7af3 docs: remove default project from schematic description
The default project is deprecated.
2023-01-03 14:49:19 +00:00
Charles Lyding
8d000d1563 feat(@schematics/angular): add environments generation schematic
A schematic has been added that will allow the generation of environment files
for all existing configurations within a project. The `fileReplacements` option
will also be setup to allow the replacement of the appropriate environment file.
Environment files themselves do not provide any special behavior beyond
that of other application TypeScript files and rely on the `fileReplacements`
option for build-time behavior. The schematic will skip generating environment files
for configurations that already have an appropriately named environment file. The
`fileReplacements` option addition will also be skipped if an appropriate entry
is already present.
2022-12-13 14:27:48 +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
5b18ce1545 feat(@schematics/angular): add guardType as an alias of implements in guard schematic
`implements` option will be removed in future in favor of `guardType`. This is because the implements guard pattern is deprecated in version 15.1
2022-12-05 11:07:46 -08:00
ced
49b313f27a fix(@schematics/angular): add missing import for functional interceptor spec 2022-12-02 09:04:50 +00:00
ced
2f92fe7e58 fix(@schematics/angular): add missing semicolon in functional guard/resolver/interceptor 2022-12-02 09:04:22 +00:00
ced
b11d3f6442 fix(@schematics/angular): use proper variable in functional guard spec 2022-11-28 14:02:26 +00:00
ced
451975f765 fix(@schematics/angular): use proper variable in resolver functional spec 2022-11-28 13:54:17 +00:00
ced
9b6d190f4a fix(@schematics/angular): remove EnvironmentInjector import in functional guard spec
It is unnecessary now that the spec uses `runInInjectionContext`
The resolver spec does not have this issue as the import was missing in the spec in the first place.
2022-11-28 13:38:08 +00:00
Andrew Scott
978274cb0b refactor(@schematics/angular): Use runInInjectionContext shorthand
The runInInjectionContext helper was added in 6acae1477a.
This is a shorthand for TestBed.inject(EnvironmentInjector).runInContext.
2022-11-28 13:16:52 +00:00
ced
9299dea649 feat(@schematics/angular): generate functional interceptors
Adds a `--functional` flag to the interceptor schematic to generate a functional interceptor (as we can now do for guards and resolvers)
2022-11-28 13:16:36 +00:00
Alan Agius
5a123a61ea fix(@schematics/angular): show warning when a TS Config is not found during migrations
Prior to this change an error was shown when a non existing tsconfig was referenced in the angular.json. This causes the update to fail.

Closes #24264
2022-11-17 16:32:11 -08:00
Alan Agius
11bb8ce26f perf(@angular-devkit/build-angular): add vendor chunking to server builder
With this change we add the `vendorChunk` option in the server builder. This option should only be used in development as it is intended to be used to improve the incremental re-build time.

This improves the rebuild time as Webpack will have less modules to analyse during a change in the application. Below, we can see the impact this change has in a `ng new` application.

Without vendor chunking
```
$ ng run ssr-vendor:server:development --watch --no-vendor-chunk
Build at: 2022-11-14T08:42:27.089Z - Hash: 0325905b63e43ddb - Time: 15357ms
Build at: 2022-11-14T08:42:37.565Z - Hash: 05cb180a02524656 - Time: 2498ms
Build at: 2022-11-14T08:42:40.325Z - Hash: c5a6996ed1924088 - Time: 1862ms
Build at: 2022-11-14T08:42:43.043Z - Hash: 92ce99f38a769c19 - Time: 1516ms
```

With vendor chunking
```
$ ng run ssr-vendor:server:development --watch --vendor-chunk
Build at: 2022-11-14T08:43:13.631Z - Hash: 28bdfea879d01a31 - Time: 15561ms
Build at: 2022-11-14T08:43:19.396Z - Hash: cc95e2b6cb403111 - Time: 1705ms
Build at: 2022-11-14T08:43:21.296Z - Hash: 204138490668a16c - Time: 848ms
Build at: 2022-11-14T08:43:23.835Z - Hash: 4fa294b261917944 - Time: 824ms
```
2022-11-15 10:14:02 -08:00
Angular Robot
363721bc88 build: update all non-major dependencies 2022-11-10 10:10:42 +01:00
Andrew Scott
b34c719769 fixup! feat(@schematics/angular): Add schematics for generating functional router guards and resolvers 2022-11-09 09:34:07 +01:00
Andrew Scott
6c39a162be feat(@schematics/angular): Add schematics for generating functional router guards and resolvers
Functional guards and resolvers were introduced in the Angular router in v14.2.
This commit adds the ability to generate functional router guards by
specifying `--guardType` instead of `--implements`. These guards are also
accompanied by a test that includes a helper function for executing the
guard in the `TestBed` environment so that any `inject` calls in the
guard will work properly. Functional resolvers are generated by adding
the `--functional` flag.
2022-11-09 09:34:07 +01:00
Andrew Scott
f837f6dab4 fix(@schematics/angular): guard schematics should include all guards (CanMatch)
The `CanMatch` guard was added in v14.1 but not added
to the list of possible interfaces to implement.
This commit adds `CanMatch` to the list of possible
interfaces to implement. It has the same type imports
as the CanLoad interface.
2022-11-02 08:49:38 -07:00
Angular Robot
469ad87499 build: update all non-major dependencies 2022-10-31 10:11:58 -07:00
Alan Agius
3ea658818d fix(@schematics/angular): remove TypeScript target from universal schematic
This is no longer needed due to the recent changes in the CLI which always use ES2022.
2022-10-26 08:57:33 -07:00
Felix Hamann
62121f89ab feat(@schematics/angular): add sideEffects:false to library package.json 2022-10-25 10:50:17 -07:00
Alan Agius
b29ae2feda fix(@schematics/angular): add @angular/localize as type when localize package is installed
The `@angular/localize` entrypoint now exposes the global `$localize` method type.

See: https://github.com/angular/angular/pull/47763
2022-10-21 10:32:24 -04:00
Cédric Exbrayat
a1d596cdee test(@schematics/angular): test names typos 2022-10-12 11:37:15 +02:00
Alan Agius
979bce45e6 feat(@angular-devkit/build-angular): auto include @angular/platform-server/init during server builds
This changes removes the need to import `@angular/platform-server/init` in the `main.server.ts` instead we now include this as an entry-point when we are bundling as server bundle.
2022-10-12 08:57:29 +02:00
Alan Agius
a95d130ef4 feat(@angular-devkit/build-angular): auto include @angular/localize/init when found in types
With this change we remove the need to include the `@angular/localize/init` package as polyfills in `polyfills.ts`, `angular.json` and `main.server.ts`.

Instead when `@angular/localize/init` is included in the TypeScript `types` we add this as entry-point. The `@angular/localize/init` will be added as a parts of the `types` array in a seperate PR to address https://github.com/angular/angular/issues/47677 which is caused by the fact that `@angular/localize/init` types are no longer imported when `@angular/localize/init` is added as a polyfill in `angular.json`.
2022-10-12 08:57:29 +02:00
Alan Agius
639a3071c3 refactor: migrate analytics collector to use GA4
This change updates the analytics collector collector to use GA4 instead of UA. The motivation behind this change is that UA will stop collecting data in 2023.

BREAKING CHANGE:

`analyticsSharing` option in the global angular configuration has been
removed without replacement. This option was used to configure the Angular CLI to  access to your own users' CLI usage data.

If this option is used, it can be removed using `ng config --global cli.analyticsSharing undefined`.
2022-10-11 18:52:30 +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
Alan Agius
b06421d15e feat(@schematics/angular): mark projectRoot as non hidden option in application schematic
This option is useful to create an application outside of the `newProjectRoot`.

Related to https://github.com/angular/angular-cli/pull/23994
2022-10-07 11:09:43 -04:00
Dariusz Ostolski
d8bff4f1e6 feat(@schematics/angular): Added --project-root option to the library schematics
With this change user is able to specify different project root for libraries than default one.

Closes: #11927
2022-10-07 10:51:31 -04:00
Alan Agius
f2a0682dc8 feat(@schematics/angular): generate new projects using TypeScript 4.8.2
Older versions of TypeScript are no longer supported.
2022-10-07 10:37:21 -04:00
Alan Agius
301b5669a7 feat(@schematics/angular): remove ngOnInit from component template
This commit removes the `constructor` and `ngOnInit` as most of the users prefer to add this manually if needed.

Closes #23678
2022-10-04 12:45:30 -04:00
Cédric Exbrayat
84e3f7727d fix(@schematics/angular): remove empty lines
The recet removal of enableProdMode in 283b564d1de985f0af8c2fcb6192801a90baacda introduced unnecessary empty lines in main.ts
2022-09-29 18:58:01 +02:00