83 Commits

Author SHA1 Message Date
Alan Agius
8e981d0880 feat(@angular-devkit/core): add handling for defaultConfiguration target definition property 2021-03-08 08:45:54 -06:00
Charles Lyding
d720d3db73 refactor(@angular-devkit/build-optimizer): improve transitional Webpack 5 compatibility
This change provides both Webpack 4 and 5 compatible types for the the build optimizer Webpack plugin.
2021-02-18 13:01:16 +01:00
Charles Lyding
1f83f305db feat(@angular-devkit/build-optimizer): support Webpack 5
The `@angular-devkit/build-optimizer` package now officially supports Webpack 5.
Webpack 4 support is temporarily maintained while the remainder of the tooling is transitioned.
2021-02-15 14:47:00 -06:00
Alan Agius
e79e7dd8d4 refactor(@angular-devkit/core): refactor NodeJsAsyncHost to use FS promises 2021-02-08 14:07:24 -05:00
Charles Lyding
76915409df refactor(@angular-devkit/schematics): allow customization of node workflow engine host
This adds an option to the NodeWorkflow to allow a custom NodeModulesEngineHost to be used with the workflow.
2021-01-28 12:44:34 +01: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
9280d87650 refactor(@angular-devkit/schematics): allow direct workflow option transforms
This change allows option transforms to be directly provided to the NodeWorkflow instead of needing to access the engine host inside the workflow after creation.  This also allows option transforms to affect the options prior to schema validation (if enabled).
2020-11-16 13:14:24 -05:00
Charles Lyding
83c91204ed fix(@angular-devkit/core): allow prompt providers to access property types
This allows prompt providers to adjust their logic based on the type of property requested.
2020-10-21 16:37:11 +02:00
Alan Agius
c5a1b21f7c refactor(@angular-devkit/core): remove unused NgBuildBuildEventLog from NgCliAnalyticsDimensions 2020-10-07 13:18:30 -04:00
Charles Lyding
660f214f9a fix(@angular-devkit/core): remove deprecated isObservable function
BREAKING CHANGE:
Deprecated `isObservable` function removed.  As an alternative, use `isObservable` from the `rxjs` package.
NOTE: This change does not affect application development.
2020-10-07 13:18:15 -04:00
Charles Lyding
34f769fcde refactor(@angular-devkit/schematics): use interface for NodeWorkflow options
This change removes the previously repeated type definitions for the options of the NodeWorkflow class.
2020-10-02 06:30:18 -04:00
Alan Agius
d3ad09508f refactor(@angular-devkit/architect): remove deprecated TestLogger
BREAKING CHANGE:

Deprecated `TestLogger` has been removed. Use `logging` API from `'@angular-devkit/core'` instead.

**Note:** this change doesn't effect application developers.
2020-09-22 10:29:53 -05:00
Charles Lyding
5ce621e371 fix(@angular-devkit/schematics): resolve external schematics from requesting collection
This change first attempts to resolve a schematic referenced via the external schematic rule from the requesting schematic collection.  This allows schematic packages that are direct dependencies of another schematic package to be used with the external schematic rule without manual package resolution code within the schematic.

Closes #18098
Closes #11026
2020-09-18 14:53:44 -05:00
Alan Agius
6d43e320b6 refactor(@angular-devkit/core): remove deprecated terminal utils
BREAKING CHANGE:

Deprecated `@angular-devkit/core` terminal API has been removed. Use 3rd party packages like chalk, colors or ansi-colors instead.

**Note:** this changes doesn't effect application developers
2020-09-10 20:19:33 +02:00
Alan Agius
208336dee0 refactor(@angular-devkit/core): remove resolve methods and options
BREAKING CHANGE: deprecated API's `ModuleNotFoundException`, `ResolveOptions`, `resolve` have been removed. Use `MODULE_NOT_FOUND` and `require.resolve` instead.

**Note**: this change only effect users using `@angular-devkit/core` public API and not application developers.
2020-09-03 00:20:12 +03:00
Charles Lyding
99f4ff00e1 refactor(@angular-devkit/schematics): allow rule to return void or rule promise
This allows a rule to conditionally not return a followup rule when asynchronous.  This is useful to handle error conditions where no further action should be taken and returning void best expresses this case.
2020-09-01 20:22:00 +03:00
Charles Lyding
df70c7a857 refactor(@angular-devkit/core): remove experimental workspace API
BREAKING CHANGE:
The experimental workspace API has been removed from `@angular-devkit/core`.  This API was no longer used by the Angular CLI and was replaced with the stable workspace API also found within `@angular-devkit/core`. This change does not affect project code and is related to tooling infrastructure only.
2020-08-28 08:53:38 +01:00
Charles Lyding
301d926c8c feat(@angular-devkit/architect): support async generator based builders
"Watch" type builders (builders with more than one result) can now be implemented as async generator functions. This allows such a builder to be more easily implemented in cases where an upstream API is async iterator/generator based or when async generators are the preferred method of implementation.
2020-08-26 09:23:45 -04:00
Doug Parker
5dc60f13c3 refactor(@angular-devkit/core): fix strict typing errors in node/
This fixes a few error surfaced by adding `"strict": true` to `tsconfig.json`.
* `_callFs(fs.readdir, /* ... */)` needs explicit types because `fs.readdir` has a few overloads, which was confusing type inference.
* `TempScopedNodeJsSyncHost._sync` is an uninitialized property, but it was already being checked for `undefined`, so I simply made its type optional.
* `TempScopedNodeJsSyncHost.files` had an incorrect type assertion, but was otherwise correct. I just removed the assertion and let type inference do the trick.
2020-08-20 20:36:02 -04:00
Keen Yee Liau
5f78698024 fix(@angular-devkit/core): strict typings for json, logger, and virtual-fs
This commit fixes typings errors after "strict: true" is enabled in
tsconfig.json for the json, logger, and virtual-fs subpackages in
`@angular-devkit/core`.
2020-08-20 20:19:40 +02:00
Charles Lyding
7045cee223 refactor(@angular-devkit/core): allow creation of a host from a non-observable source 2020-08-19 16:00:33 +02:00
Alan Agius
797bcf9944 feat(@angular-devkit/core): add useXDeprecatedProvider to SchemaRegistry
Use the new provider to record usage of options which have the `x-deprecated` keyword.
2020-08-17 18:18:24 +02:00
Charles Lyding
76b1b53a4b refactor(@angular-devkit/build-optimizer): verify Program for type-checking passes 2020-08-12 19:26:53 +01:00
Charles Lyding
31c1c75bf9 refactor(@angular-devkit/schematics): remove deprecated sync test helpers
BREAKING CHANGE
Deprecated `SchematicTestRunner.runSchematic` and  `SchematicTestRunner.runExternalSchematic` have been removed. Use `SchematicTestRunner.runSchematicAsync` or `SchematicTestRunner.runExternalSchematicAsync` instead.

Note: this change only effects direct `@angular-devkit/schematics` users and not the application developers.
2020-05-05 10:50:57 -07:00
Charles Lyding
164094829d refactor(@angular-devkit/build-optimizer): removed deprecated/unused passes
BREAKING CHANGE
Deprecated and outdated optimization passes class fold and import tslib have been removed.

Note: This change only effects direct @angular-devkit/schematics users and not the application developers.
2020-05-04 10:54:48 -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
Alan Agius
b1a5f49540 refactor(@angular-devkit/schematics): remove deprecated FileSystemHost
BREAKING CHANGE
Deprecated `FileSystemHost` has been removed. Use `Host` directly instead.

Note: this change only effects direct `@angular-devkit/schematics` users and not the application developers.
2020-04-22 10:38:38 -07:00
Charles Lyding
33656f7aa8 fix(@angular-devkit/schematics): allow custom registry for node package task 2020-02-10 16:02:05 -08:00
Alan Agius
301bf18a04 feat(@angular-devkit/benchmark): add capabilities to benchmark watch processes 2020-01-22 08:58:29 -08:00
Filipe Silva
86d4385440 build: use TypeScript 3.7 2020-01-09 13:43:49 -08: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
Charles Lyding
5df776780d fix(@angular-devkit/schematics): use NodeWorkflow root to resolve collections 2019-10-28 17:48:08 -07:00
Alan Agius
341b18d8a6 refactor(@angular-devkit/schematics): remove several deprecated APIs
BREAKING CHANGE:

Removed several deprecated APIs:

- EngineHost `listSchematics` has been removed in favour of `listSchematicNames`.
- `FileSystemSink` - Use the new virtualFs.Host classes from `@angular-devkit/core`.
- `optimize` function has been remove as trees are automaticlly optimized.
- `DryRunSink` deprecated constructor that allowed to provide a directory path has been removed. Provide a `virtualFs.Host` instead.
2019-10-24 16:02:21 -07:00
Alan Agius
70e460d656 refactor: use require.resolve instead of custom resolve (#15906) 2019-10-23 09:59:36 -07:00
Alan Agius
b0dcfd08a0 fix(@angular/cli): logic to determine if the installed CLI is out of date
With this change we now check if the current CLI version is the latest published version. If it is not, we install a temporary version to run the `ng update` with.
2019-10-22 13:13:54 -07:00
Filipe Silva
7612d3e200 build: use TS 3.6.4 2019-10-16 10:00:49 -07:00
Alan Agius
c3169ae7d2 New i18n schema (#15760)
* feat(@angular-devkit/core): update schema to support new i18n options

"projects": {
  "my-app": {
    "projectType": "application",
    "schematics": {},
    "root": "",
    "i18n": {
      "sourceLocale": "en-US",
      "locales": {
        "fr": "src/locale/messages.fr.xlf"
      }
    },
    "sourceRoot": "src",
    ...
  }
}

* feat(@angular-devkit/build-angular): add new i18n options to browser and server builders

With this change we add `translateLocales` as new options for i18n in browser and server builders.

We also deprecate the following options;
* i18nLocale
* i18nFormat
* i18nFile

* feat(@angular-devkit/build-angular): deprecate `i18nFormat` and `i18nLocale` options of `extract-i18n` builder

Option `i18nFormat` has been deprecated in favor of `format` and `i18nLocale` option has been deprecated in favor of the `sourceLocale` sub option of the `i18n` project level option.

* feat(@angular/cli): add alias of `i18n-extract` for `x18n` command

* refactor: rename `translateLocales` to `localize`
2019-10-10 12:39:00 -07:00
vikerman
2303a045ee feat(@angular-devkit/build-angular): add analytics for ivy/non-ivy builds
Look for `ngComponentDef` or `ngModuleDef` in the webpack analytics plugin
to report back whether the current build is built with Ivy enabled.
2019-10-02 12:06:38 -07:00
Charles Lyding
0d104c0aba feat(@angular-devkit/architect): support accessing project metadata 2019-09-24 13:18:33 -07:00
Charles
ef360dd7f8 refactor(@angular-devkit/architect): use standard node resolution methods where possible (#15622)
* refactor(@angular-devkit/architect): use standard node resolution methods where possible

* refactor(@angular-devkit/core): use standard node resolution methods where possible
2019-09-18 14:49:22 +01:00
Charles Lyding
2a689ff3ca feat(@angular-devkit/core): auto discover multiselect schema prompt types
If a prompt is present on a schema property and the type is an array with a set of enum values, then the prompt type is a list with multiselect capabilites.  This eliminates the need to specify the longhand form for typical multiselect prompts.
2019-09-11 10:08:23 -07:00
Charles
7f6ba9e001 fix(@angular-devkit/core): track workspace targets with no original collection (#15413)
Fixes #15403
2019-08-23 11:37:06 -07:00
Simon Jespersen
0824e8beee refactor(@angular-devkit/schematics): remove optimize from host-tree
Remove unused optimize method marked for removal in version 7.0
2019-08-15 09:55:11 -07:00
Charles
b0b3212719 fix(@ngtools/webpack): cleanup more resources after modules are loaded (#15292)
* feat(@angular-devkit/core): support resetting a memory host

* fix(@ngtools/webpack): cleanup more resources after modules are loaded

Followup to #12994
2019-08-12 10:26:19 -07:00
Minko Gechev
d274add7b4
fix(@angular/cli): use correct schematic defaults considering workspace (#15041)
Fix #14986

This PR includes some refactoring to simplify the interaction
of the `NodeWorkflow` and the `BaseWorkflow` with the registry.

We were registering redundant `addPostTransform`s. Some of them in
the constructor of the `BaseWorkflow`, which did not allow us to
intercept `addUndefinedDefaults`.

Additionally, we were setting the `validateOptionsWithSchema` transform
multiple times unnecessarily.

An issue left to fix is support for the `--project` option in
schematic commands. Currently, `getProjectName` does not know about
this option, since `createWorkflow` does not know how to parse the
command line arguments. The parsing logic is implemented partially
by the concrete implementation of the `SchematicCommand` template
method.
2019-07-16 09:58:01 -07:00
Filipe Silva
7d9ead4261 feat(@angular-devkit/build-optimizer): add BuildOptimizerWebpackPlugin
Using this webpack allows determining in advance if files from a package should be skipped by the Build Optimizer loader.
2019-07-11 01:18:26 +08:00
Hans Larsen
af6c6d41d5 refactor: add count of component to analytics 2019-07-02 11:07:13 -07:00
Hans Larsen
46ade49a2f feat(@angular/cli): report RAM in gigabytes instead of megabytes
Otherwise its too much noise. Some people have weird MB count probably due to
containers and VMs.
2019-06-27 09:17:26 -07:00
ukrukarg
11c8e935b7 feat(@angular-devkit/schematics): Add registerCollection to SchematicsTestRunner
Fixes #14833
2019-06-20 10:57:24 -07:00
Charles Lyding
19ed795cb1 fix(@angular-devkit/architect): support all observable types as build results
Fixes #14579
2019-05-30 13:33:51 -07:00