@schematics/angular 8.2.0-next.1 → 8.2.2

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.
@@ -162,11 +162,18 @@ function addAppToWorkspaceFile(options, appDir) {
162
162
  extractLicenses: true,
163
163
  vendorChunk: false,
164
164
  buildOptimizer: true,
165
- budgets: [{
165
+ budgets: [
166
+ {
166
167
  type: 'initial',
167
168
  maximumWarning: '2mb',
168
169
  maximumError: '5mb',
169
- }],
170
+ },
171
+ {
172
+ type: 'anyComponentStyle',
173
+ maximumWarning: '6kb',
174
+ maximumError: '10kb',
175
+ }
176
+ ],
170
177
  },
171
178
  },
172
179
  },
@@ -8,7 +8,7 @@ import { Component } from '@angular/core';
8
8
  <h1>
9
9
  Welcome to {{title}}!
10
10
  </h1>
11
- <img width="300" src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNTAgMjUwIj4KICAgIDxwYXRoIGZpbGw9IiNERDAwMzEiIGQ9Ik0xMjUgMzBMMzEuOSA2My4ybDE0LjIgMTIzLjFMMTI1IDIzMGw3OC45LTQzLjcgMTQuMi0xMjMuMXoiIC8+CiAgICA8cGF0aCBmaWxsPSIjQzMwMDJGIiBkPSJNMTI1IDMwdjIyLjItLjFWMjMwbDc4LjktNDMuNyAxNC4yLTEyMy4xTDEyNSAzMHoiIC8+CiAgICA8cGF0aCAgZmlsbD0iI0ZGRkZGRiIgZD0iTTEyNSA1Mi4xTDY2LjggMTgyLjZoMjEuN2wxMS43LTI5LjJoNDkuNGwxMS43IDI5LjJIMTgzTDEyNSA1Mi4xem0xNyA4My4zaC0zNGwxNy00MC45IDE3IDQwLjl6IiAvPgogIDwvc3ZnPg==">
11
+ <img width="300" alt="Angular Logo" src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNTAgMjUwIj4KICAgIDxwYXRoIGZpbGw9IiNERDAwMzEiIGQ9Ik0xMjUgMzBMMzEuOSA2My4ybDE0LjIgMTIzLjFMMTI1IDIzMGw3OC45LTQzLjcgMTQuMi0xMjMuMXoiIC8+CiAgICA8cGF0aCBmaWxsPSIjQzMwMDJGIiBkPSJNMTI1IDMwdjIyLjItLjFWMjMwbDc4LjktNDMuNyAxNC4yLTEyMy4xTDEyNSAzMHoiIC8+CiAgICA8cGF0aCAgZmlsbD0iI0ZGRkZGRiIgZD0iTTEyNSA1Mi4xTDY2LjggMTgyLjZoMjEuN2wxMS43LTI5LjJoNDkuNGwxMS43IDI5LjJIMTgzTDEyNSA1Mi4xem0xNyA4My4zaC0zNGwxNy00MC45IDE3IDQwLjl6IiAvPgogIDwvc3ZnPg==">
12
12
  </div>
13
13
  <h2>Here are some links to help you start: </h2>
14
14
  <ul>
@@ -48,7 +48,9 @@
48
48
  "routing": {
49
49
  "type": "boolean",
50
50
  "description": "When true, creates a routing NgModule.",
51
- "default": false
51
+ "default": false,
52
+ "x-prompt": "Would you like to add Angular routing?",
53
+ "x-user-analytics": 17
52
54
  },
53
55
  "prefix": {
54
56
  "type": "string",
@@ -68,6 +70,17 @@
68
70
  "less",
69
71
  "styl"
70
72
  ],
73
+ "x-prompt": {
74
+ "message": "Which stylesheet format would you like to use?",
75
+ "type": "list",
76
+ "items": [
77
+ { "value": "css", "label": "CSS" },
78
+ { "value": "scss", "label": "SCSS [ https://sass-lang.com/documentation/syntax#scss ]" },
79
+ { "value": "sass", "label": "Sass [ https://sass-lang.com/documentation/syntax#the-indented-syntax ]" },
80
+ { "value": "less", "label": "Less [ http://lesscss.org ]" },
81
+ { "value": "styl", "label": "Stylus [ http://stylus-lang.com ]" }
82
+ ]
83
+ },
71
84
  "x-user-analytics": 5
72
85
  },
73
86
  "skipTests": {
@@ -468,7 +468,6 @@ function extractProjectsConfig(config, tree, logger) {
468
468
  projectType: 'application',
469
469
  };
470
470
  const e2eTargets = {};
471
- // tslint:disable-next-line:max-line-length
472
471
  const protractorConfig = config && config.e2e && config.e2e.protractor && config.e2e.protractor.config
473
472
  ? config.e2e.protractor.config
474
473
  : '';
@@ -9,7 +9,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
9
9
  */
10
10
  const core_1 = require("@angular-devkit/core");
11
11
  const json_utils_1 = require("../../utility/json-utils");
12
- // tslint:disable-next-line:max-line-length
13
12
  const browserslistContent = `# This file is used by the build system to adjust CSS and JS output to support the specified browsers below.
14
13
  # For additional information regarding the format and rule options, please see:
15
14
  # https://github.com/browserslist/browserslist#queries
@@ -1,2 +1,6 @@
1
1
  import { Rule } from '@angular-devkit/schematics';
2
+ export declare const ANY_COMPONENT_STYLE_BUDGET: {
3
+ type: string;
4
+ maximumWarning: string;
5
+ };
2
6
  export declare function UpdateWorkspaceConfig(): Rule;
@@ -9,6 +9,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
9
9
  */
10
10
  const core_1 = require("@angular-devkit/core");
11
11
  const json_utils_1 = require("../../utility/json-utils");
12
+ exports.ANY_COMPONENT_STYLE_BUDGET = {
13
+ type: 'anyComponentStyle',
14
+ maximumWarning: '6kb',
15
+ };
12
16
  function UpdateWorkspaceConfig() {
13
17
  return (tree) => {
14
18
  let workspaceConfigPath = 'angular.json';
@@ -44,8 +48,9 @@ function UpdateWorkspaceConfig() {
44
48
  const builder = json_utils_1.findPropertyInAstObject(buildTarget, 'builder');
45
49
  // Projects who's build builder is not build-angular:browser
46
50
  if (builder && builder.kind === 'string' && builder.value === '@angular-devkit/build-angular:browser') {
47
- updateOption('styles', recorder, buildTarget);
48
- updateOption('scripts', recorder, buildTarget);
51
+ updateStyleOrScriptOption('styles', recorder, buildTarget);
52
+ updateStyleOrScriptOption('scripts', recorder, buildTarget);
53
+ addAnyComponentStyleBudget(recorder, buildTarget);
49
54
  }
50
55
  }
51
56
  const testTarget = json_utils_1.findPropertyInAstObject(architect, 'test');
@@ -53,8 +58,8 @@ function UpdateWorkspaceConfig() {
53
58
  const builder = json_utils_1.findPropertyInAstObject(testTarget, 'builder');
54
59
  // Projects who's build builder is not build-angular:browser
55
60
  if (builder && builder.kind === 'string' && builder.value === '@angular-devkit/build-angular:karma') {
56
- updateOption('styles', recorder, testTarget);
57
- updateOption('scripts', recorder, testTarget);
61
+ updateStyleOrScriptOption('styles', recorder, testTarget);
62
+ updateStyleOrScriptOption('scripts', recorder, testTarget);
58
63
  }
59
64
  }
60
65
  }
@@ -66,16 +71,18 @@ exports.UpdateWorkspaceConfig = UpdateWorkspaceConfig;
66
71
  /**
67
72
  * Helper to retreive all the options in various configurations
68
73
  */
69
- function getAllOptions(builderConfig) {
74
+ function getAllOptions(builderConfig, configurationsOnly = false) {
70
75
  const options = [];
71
76
  const configurations = json_utils_1.findPropertyInAstObject(builderConfig, 'configurations');
72
77
  if (configurations && configurations.kind === 'object') {
73
78
  options.push(...configurations.properties.map(x => x.value));
74
79
  }
75
- options.push(json_utils_1.findPropertyInAstObject(builderConfig, 'options'));
80
+ if (!configurationsOnly) {
81
+ options.push(json_utils_1.findPropertyInAstObject(builderConfig, 'options'));
82
+ }
76
83
  return options.filter(o => o && o.kind === 'object');
77
84
  }
78
- function updateOption(property, recorder, builderConfig) {
85
+ function updateStyleOrScriptOption(property, recorder, builderConfig) {
79
86
  const options = getAllOptions(builderConfig);
80
87
  for (const option of options) {
81
88
  const propertyOption = json_utils_1.findPropertyInAstObject(option, property);
@@ -96,3 +103,34 @@ function updateOption(property, recorder, builderConfig) {
96
103
  }
97
104
  }
98
105
  }
106
+ function addAnyComponentStyleBudget(recorder, builderConfig) {
107
+ const options = getAllOptions(builderConfig, true);
108
+ for (const option of options) {
109
+ const aotOption = json_utils_1.findPropertyInAstObject(option, 'aot');
110
+ if (!aotOption || aotOption.kind !== 'true') {
111
+ // AnyComponentStyle only works for AOT
112
+ continue;
113
+ }
114
+ const budgetOption = json_utils_1.findPropertyInAstObject(option, 'budgets');
115
+ if (!budgetOption) {
116
+ // add
117
+ json_utils_1.insertPropertyInAstObjectInOrder(recorder, option, 'budgets', [exports.ANY_COMPONENT_STYLE_BUDGET], 14);
118
+ continue;
119
+ }
120
+ if (budgetOption.kind !== 'array') {
121
+ continue;
122
+ }
123
+ // if 'anyComponentStyle' budget already exists don't add.
124
+ const hasAnyComponentStyle = budgetOption.elements.some(node => {
125
+ if (!node || node.kind !== 'object') {
126
+ // skip non complex objects
127
+ return false;
128
+ }
129
+ const budget = json_utils_1.findPropertyInAstObject(node, 'type');
130
+ return !!budget && budget.kind === 'string' && budget.value === 'anyComponentStyle';
131
+ });
132
+ if (!hasAnyComponentStyle) {
133
+ json_utils_1.appendValueInAstArray(recorder, budgetOption, exports.ANY_COMPONENT_STYLE_BUDGET, 16);
134
+ }
135
+ }
136
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@schematics/angular",
3
- "version": "8.2.0-next.1",
3
+ "version": "8.2.2",
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.2.0-next.1",
18
- "@angular-devkit/schematics": "8.2.0-next.1"
17
+ "@angular-devkit/core": "8.2.2",
18
+ "@angular-devkit/schematics": "8.2.2"
19
19
  },
20
20
  "repository": {
21
21
  "type": "git",
@@ -9,6 +9,7 @@
9
9
  "files": [
10
10
  "/favicon.ico",
11
11
  "/index.html",
12
+ "/manifest.webmanifest",
12
13
  "/*.css",
13
14
  "/*.js"
14
15
  ]