@schematics/angular 8.0.0 → 8.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -137,6 +137,7 @@ function addAppToWorkspaceFile(options, appDir) {
137
137
  main: `${sourceRoot}/main.ts`,
138
138
  polyfills: `${sourceRoot}/polyfills.ts`,
139
139
  tsConfig: `${projectRoot}tsconfig.app.json`,
140
+ aot: !!options.enableIvy,
140
141
  assets: [
141
142
  `${sourceRoot}/favicon.ico`,
142
143
  `${sourceRoot}/assets`,
@@ -203,7 +204,7 @@ function addAppToWorkspaceFile(options, appDir) {
203
204
  scripts: [],
204
205
  },
205
206
  },
206
- lint: {
207
+ lint: options.minimal ? undefined : {
207
208
  builder: workspace_models_1.Builders.TsLint,
208
209
  options: {
209
210
  tsConfig: [
@@ -1,3 +1 @@
1
- <p>
2
- <%= dasherize(name) %> works!
3
- </p>
1
+ <p><%= dasherize(name) %> works!</p>
package/library/index.js CHANGED
@@ -70,7 +70,12 @@ function addDependenciesToPackageJson() {
70
70
  {
71
71
  type: dependencies_1.NodeDependencyType.Dev,
72
72
  name: 'ng-packagr',
73
- version: '^5.1.0',
73
+ version: latest_versions_1.latestVersions.ngPackagr,
74
+ },
75
+ {
76
+ type: dependencies_1.NodeDependencyType.Dev,
77
+ name: 'tsickle',
78
+ version: latest_versions_1.latestVersions.tsickle,
74
79
  },
75
80
  {
76
81
  type: dependencies_1.NodeDependencyType.Dev,
@@ -66,25 +66,15 @@ function updateES5Projects() {
66
66
  updateTsConfig(tree, testConfig.options.tsConfig);
67
67
  }
68
68
  const browserslistPath = core_1.join(core_1.normalize(project.root), 'browserslist');
69
- if (typeof project.sourceRoot === 'string') {
70
- // Move the CLI 7 style browserlist to root if it's there.
71
- const srcBrowsersList = core_1.join(core_1.normalize(project.sourceRoot), 'browserslist');
72
- if (tree.exists(srcBrowsersList) && !tree.exists(browserslistPath)) {
73
- // TODO: use rename instead.
74
- // This is a hacky workaround. We should be able to just rename it.
75
- // On unit tests the rename works fine but on real projects it fails with
76
- // ERROR! browserslist does not exist..
77
- // This seems to happen because we are both renaming and then commiting an update.
78
- // But it's fine if we read/create/delete. There's a bug somewhere.
79
- // tree.rename(srcBrowsersList, browserslistPath);
80
- const content = tree.read(srcBrowsersList);
81
- if (content) {
82
- tree.create(browserslistPath, content);
83
- tree.delete(srcBrowsersList);
84
- }
85
- }
69
+ // Move the CLI 7 style browserlist to root if it's there.
70
+ const sourceRoot = project.sourceRoot === 'string'
71
+ ? project.sourceRoot
72
+ : core_1.join(core_1.normalize(project.root), 'src');
73
+ const srcBrowsersList = core_1.join(core_1.normalize(sourceRoot), 'browserslist');
74
+ if (tree.exists(srcBrowsersList)) {
75
+ tree.rename(srcBrowsersList, browserslistPath);
86
76
  }
87
- if (!tree.exists(browserslistPath)) {
77
+ else if (!tree.exists(browserslistPath)) {
88
78
  tree.create(browserslistPath, browserslistContent);
89
79
  }
90
80
  }
@@ -111,8 +101,18 @@ function updateTsConfig(tree, tsConfigPath) {
111
101
  if (isExtendedConfig) {
112
102
  json_utils_1.removePropertyInAstObject(recorder, compilerOptions, 'target');
113
103
  json_utils_1.removePropertyInAstObject(recorder, compilerOptions, 'module');
104
+ json_utils_1.removePropertyInAstObject(recorder, compilerOptions, 'downlevelIteration');
114
105
  }
115
106
  else {
107
+ const downlevelIteration = json_utils_1.findPropertyInAstObject(compilerOptions, 'downlevelIteration');
108
+ if (!downlevelIteration) {
109
+ json_utils_1.insertPropertyInAstObjectInOrder(recorder, compilerOptions, 'downlevelIteration', true, 4);
110
+ }
111
+ else if (!downlevelIteration.value) {
112
+ const { start, end } = downlevelIteration;
113
+ recorder.remove(start.offset, end.offset - start.offset);
114
+ recorder.insertLeft(start.offset, 'true');
115
+ }
116
116
  const scriptTarget = json_utils_1.findPropertyInAstObject(compilerOptions, 'target');
117
117
  if (!scriptTarget) {
118
118
  json_utils_1.insertPropertyInAstObjectInOrder(recorder, compilerOptions, 'target', 'es2015', 4);
@@ -84,7 +84,7 @@ function dropES2015PolyfillsFromFile(polyfillPath) {
84
84
  // no action required if no mention of core-js
85
85
  return;
86
86
  }
87
- const sourceFile = ts.createSourceFile(polyfillPath, content, ts.ScriptTarget.Latest, true);
87
+ const sourceFile = ts.createSourceFile(polyfillPath, content.replace(/^\uFEFF/, ''), ts.ScriptTarget.Latest, true);
88
88
  const imports = sourceFile.statements
89
89
  .filter(s => s.kind === ts.SyntaxKind.ImportDeclaration);
90
90
  if (imports.length === 0) {
@@ -4,41 +4,25 @@ const dependencies_1 = require("../../utility/dependencies");
4
4
  const latest_versions_1 = require("../../utility/latest-versions");
5
5
  function updateDependencies() {
6
6
  return (host) => {
7
- let current = dependencies_1.getPackageJsonDependency(host, '@angular-devkit/build-angular');
8
- if (current && current.version !== latest_versions_1.latestVersions.DevkitBuildAngular) {
7
+ const dependenciesToUpdate = {
8
+ '@angular-devkit/build-angular': latest_versions_1.latestVersions.DevkitBuildAngular,
9
+ '@angular-devkit/build-ng-packagr': latest_versions_1.latestVersions.DevkitBuildNgPackagr,
10
+ '@angular-devkit/build-webpack': latest_versions_1.latestVersions.DevkitBuildWebpack,
11
+ 'zone.js': latest_versions_1.latestVersions.ZoneJs,
12
+ 'tsickle': latest_versions_1.latestVersions.tsickle,
13
+ 'ng-packagr': latest_versions_1.latestVersions.ngPackagr,
14
+ // FIXME: change to ^2.3.2 as soon as it's released with the pr208 fix
15
+ 'web-animations-js': 'github:angular/web-animations-js#release_pr208',
16
+ };
17
+ for (const [name, version] of Object.entries(dependenciesToUpdate)) {
18
+ const current = dependencies_1.getPackageJsonDependency(host, name);
19
+ if (!current || current.version === version) {
20
+ continue;
21
+ }
9
22
  dependencies_1.addPackageJsonDependency(host, {
10
23
  type: current.type,
11
- name: '@angular-devkit/build-angular',
12
- version: latest_versions_1.latestVersions.DevkitBuildAngular,
13
- overwrite: true,
14
- });
15
- }
16
- current = dependencies_1.getPackageJsonDependency(host, '@angular-devkit/build-ng-packagr');
17
- if (current && current.version !== latest_versions_1.latestVersions.DevkitBuildNgPackagr) {
18
- dependencies_1.addPackageJsonDependency(host, {
19
- type: current.type,
20
- name: '@angular-devkit/build-ng-packagr',
21
- version: latest_versions_1.latestVersions.DevkitBuildNgPackagr,
22
- overwrite: true,
23
- });
24
- }
25
- current = dependencies_1.getPackageJsonDependency(host, 'zone.js');
26
- if (current && current.version !== latest_versions_1.latestVersions.ZoneJs) {
27
- dependencies_1.addPackageJsonDependency(host, {
28
- type: current.type,
29
- name: 'zone.js',
30
- version: latest_versions_1.latestVersions.ZoneJs,
31
- overwrite: true,
32
- });
33
- }
34
- // FIXME: change to ^2.3.2 as soon as it's released with the pr208 fix
35
- const webAnimationsJsVersion = 'github:angular/web-animations-js#release_pr208';
36
- current = dependencies_1.getPackageJsonDependency(host, 'web-animations-js');
37
- if (current && current.version !== webAnimationsJsVersion) {
38
- dependencies_1.addPackageJsonDependency(host, {
39
- type: current.type,
40
- name: 'web-animations-js',
41
- version: webAnimationsJsVersion,
24
+ name,
25
+ version,
42
26
  overwrite: true,
43
27
  });
44
28
  }
@@ -8,7 +8,7 @@ function* visit(directory) {
8
8
  if (entry) {
9
9
  const content = entry.content;
10
10
  if (content.includes('loadChildren')) {
11
- const source = ts.createSourceFile(entry.path, content.toString(), ts.ScriptTarget.Latest, true);
11
+ const source = ts.createSourceFile(entry.path, content.toString().replace(/^\uFEFF/, ''), ts.ScriptTarget.Latest, true);
12
12
  yield source;
13
13
  }
14
14
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@schematics/angular",
3
- "version": "8.0.0",
3
+ "version": "8.0.4",
4
4
  "description": "Schematics specific to Angular",
5
5
  "keywords": [
6
6
  "angular",
@@ -14,8 +14,8 @@
14
14
  ],
15
15
  "schematics": "./collection.json",
16
16
  "dependencies": {
17
- "@angular-devkit/core": "8.0.0",
18
- "@angular-devkit/schematics": "8.0.0"
17
+ "@angular-devkit/core": "8.0.4",
18
+ "@angular-devkit/schematics": "8.0.4"
19
19
  },
20
20
  "repository": {
21
21
  "type": "git",
@@ -5,7 +5,7 @@ import { Pipe, PipeTransform } from '@angular/core';
5
5
  })
6
6
  export class <%= classify(name) %>Pipe implements PipeTransform {
7
7
 
8
- transform(value: any, args?: any): any {
8
+ transform(value: any, ...args: any[]): any {
9
9
  return null;
10
10
  }
11
11
 
@@ -13,4 +13,7 @@ export declare const latestVersions: {
13
13
  TsLib: string;
14
14
  DevkitBuildAngular: string;
15
15
  DevkitBuildNgPackagr: string;
16
+ DevkitBuildWebpack: string;
17
+ tsickle: string;
18
+ ngPackagr: string;
16
19
  };
@@ -9,7 +9,7 @@
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
10
  exports.latestVersions = {
11
11
  // These versions should be kept up to date with latest Angular peer dependencies.
12
- Angular: '~8.0.0',
12
+ Angular: '~8.0.1',
13
13
  RxJs: '~6.4.0',
14
14
  ZoneJs: '~0.9.1',
15
15
  TypeScript: '~3.4.3',
@@ -17,4 +17,7 @@ exports.latestVersions = {
17
17
  // The versions below must be manually updated when making a new devkit release.
18
18
  DevkitBuildAngular: '~0.800.0',
19
19
  DevkitBuildNgPackagr: '~0.800.0',
20
+ DevkitBuildWebpack: '~0.800.0',
21
+ tsickle: '^0.35.0',
22
+ ngPackagr: '^5.1.0',
20
23
  };
@@ -17,7 +17,9 @@ function addConfig(options, root, tsConfigPath) {
17
17
  return (host, context) => {
18
18
  context.logger.debug('updating project configuration.');
19
19
  // Add worker glob exclusion to tsconfig.app.json.
20
- const workerGlob = 'src/**/*.worker.ts';
20
+ // Projects pre version 8 should to have tsconfig.app.json inside their application
21
+ const isInSrc = core_1.dirname(core_1.normalize(tsConfigPath)).endsWith('src');
22
+ const workerGlob = `${isInSrc ? '' : 'src/'}**/*.worker.ts`;
21
23
  const buffer = host.read(tsConfigPath);
22
24
  if (buffer) {
23
25
  const tsCfgAst = core_1.parseJsonAst(buffer.toString(), core_1.JsonParseMode.Loose);
@@ -5,10 +5,12 @@
5
5
  "outDir": "./dist/out-tsc",
6
6
  "sourceMap": true,
7
7
  "declaration": false,
8
+ "downlevelIteration": true,
8
9
  "module": "esnext",
9
10
  "moduleResolution": "node",
10
- "emitDecoratorMetadata": true,
11
11
  "experimentalDecorators": true,
12
+ "module": "esnext",
13
+ "moduleResolution": "node",
12
14
  "importHelpers": true,
13
15
  "target": "es2015",
14
16
  "typeRoots": [