64 Commits

Author SHA1 Message Date
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
Charles Lyding
64786cf64a fix(@angular-devkit/core): remove unimplemented prompt priority
Node.js versions prior to 11 used an unstable sort for arrays with a length greater than 10.  This caused the prompt order of a schematic with more than 10 prompts to be inconsistent with the content of the file and the same schematic with several of the prompts removed.  Since priorities were never fully implemented and property dependencies will most likely be used at a higher level instead, the underlying elements have been removed with this change.

Fixes #14402
2019-05-13 15:56:39 -07:00
Charles Lyding
7d6b502387 fix(@angular-devkit/build-optimizer): remove deprecated test functions from public API 2019-05-13 15:55:52 -07:00
Charles Lyding
3fc520278c refactor(@angular-devkit/schematics): update rxjs usage in rules
rxjs has improved over time and this updates the rules to take advantage of improvements where applicable.
2019-05-09 10:11:32 -07:00
Alan Agius
968204fa2a refactor(@angular-devkit/architect): remove _registry from being a private (#14182) 2019-05-07 12:31:45 -06:00
Charles Lyding
5c969ea417 refactor(@angular-devkit/core): simplify workspace project/target addition
By returning the newly added project/target, it becomes easier to incrementally augment the new addition.
2019-04-23 10:00:15 -07:00
Charles Lyding
52a014dd23 fix(@angular-devkit/core): ignore undefined targets when adding a workspace project 2019-04-16 11:23:48 -07:00
Alan Agius
260dacfb41 test: add new architect api to golden files 2019-04-15 11:08:46 -07:00
Alan Agius
eac31541a1 test: add analytics to core golden files 2019-04-15 11:08:46 -07:00
Charles Lyding
13abfd01ec fix(@angular-devkit/schematics): fully support async rules 2019-04-15 11:02:46 -07:00
Charles Lyding
7d416103a9 feat(@angular-devkit/core): make new workspace API public 2019-04-12 11:45:48 -07:00
Charles Lyding
db14292b52 fix(@angular-devkit/architect): remove experimental API 2019-04-02 10:31:24 -07:00
Hans Larsen
15032aa2e8 feat(@angular-devkit/schematics): add support for analytics
Schematics context now have an (optional) analytics field that, if set,
should be used to report usage. This can be set even in some cases where
analytics is disabled (to a noop analytics).
2019-03-20 15:08:07 -07:00
clydin
324d9f2d4f feat(@angular-devkit/schematics): support basic promise/async based rules (#13660)
Currently, all third-party schematic developers are forced to use and directly depend on `rxjs` if any logic is asynchronous.   Doing so can can also add overhead and unneeded complexity for organizations that have chosen to standardize on async/await usage. This change allows such parties to rely on native promise support if desired.
2019-03-07 15:51:03 -08:00
Hans Larsen
041907d551 feat(@angular-devkit/core): add factories for workspace
It makes it easier instead of always copy-pasting the same findUp code
to get the workspace file.
2019-03-05 11:14:59 -08:00
Hans Larsen
0f0f289bf7 fix(@angular-devkit/core): fix true schemas post transform step
Also tighten the types a bit, and add a test that failed before and works now.
2019-02-19 13:51:29 -08:00
Hans Larsen
68220f13e4 feat(@angular-devkit/architect): New Architect API first draft
The new API has been described in this design doc:
https://docs.google.com/document/d/1SpN_2XEooI9_CPjqspAcNEBjVY874OWPZqOenjuF0qo/view

This first drafts add support for the API (given some deep imports). It is
still in draft mode but is committed to make it available to people to
start testing and moving their own builders.

This API rebuilds (not backward compatible) the Architect API package. To
use it people will need to import "@angular-devkit/architect/src/index2"
to start using it. A reference builder will be added in the next commit.

There are 2 pieces missing from this commit that will be added in the
same PR; 1) the architect-host and CLI to test, and 2) a reference
builder moved from the old API to the new one. These will be part of
the same PR.

Finally, there are missing tests in this package, but everything tested
manually and automatically works so far. Test coverage will be added
before the package is considered finished.

Due to a desire to keep architect, our tests and the scope of this PR
limited and keep the two APIs separated, every clashing files will
have a "2" suffix added to it. Once all builders have been moved and
we are sure everything works, all those files will be moved to their
final destination and the old API will be removed, in one PR.
2019-02-19 13:51:29 -08:00
Charles Lyding
d849834445 feat(@angular-devkit/core): support console logger color customization 2019-02-15 08:01:41 -08:00
Charles Lyding
d18f89d483 refactor(@angular-devkit/schematics): remove unused VirtualTree classes 2019-01-25 21:42:21 -08:00
Charles Lyding
0563e96cd2 feat(@angular-devkit/schematics): add applyToSubTree rule
This rule allows a group of rules to be applied to a scoped subdirectory of the current tree.
2019-01-18 12:14:29 -08:00