@skyux/packages 8.0.0-alpha.2 → 8.0.0-alpha.20

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.
Files changed (49) hide show
  1. package/collection.json +4 -4
  2. package/package.json +53 -49
  3. package/src/polyfills.js +6 -2
  4. package/src/schematics/migrations/migration-collection.json +7 -2
  5. package/src/schematics/migrations/update-8/add-compat-stylesheets/add-compat-stylesheets.d.ts +2 -0
  6. package/src/schematics/migrations/update-8/add-compat-stylesheets/add-compat-stylesheets.js +203 -0
  7. package/src/schematics/migrations/update-8/add-compat-stylesheets/add-compat-stylesheets.js.map +1 -0
  8. package/src/schematics/migrations/update-8/update-polyfill/update-polyfill.schematic.d.ts +5 -1
  9. package/src/schematics/migrations/update-8/update-polyfill/update-polyfill.schematic.js +97 -48
  10. package/src/schematics/migrations/update-8/update-polyfill/update-polyfill.schematic.js.map +1 -1
  11. package/src/schematics/ng-add/ng-add.schematic.d.ts +2 -1
  12. package/src/schematics/ng-add/ng-add.schematic.js +7 -3
  13. package/src/schematics/ng-add/ng-add.schematic.js.map +1 -1
  14. package/src/schematics/ng-add/schema.d.ts +9 -0
  15. package/src/schematics/ng-add/schema.js +3 -0
  16. package/src/schematics/ng-add/schema.js.map +1 -0
  17. package/src/schematics/ng-add/schema.json +13 -1
  18. package/src/schematics/ng-generate/polyfills/polyfills.schematic.d.ts +6 -0
  19. package/src/schematics/ng-generate/polyfills/polyfills.schematic.js +16 -0
  20. package/src/schematics/ng-generate/polyfills/polyfills.schematic.js.map +1 -0
  21. package/src/schematics/ng-generate/polyfills/schema.d.ts +9 -0
  22. package/src/schematics/ng-generate/polyfills/schema.js +3 -0
  23. package/src/schematics/ng-generate/polyfills/schema.js.map +1 -0
  24. package/src/schematics/ng-generate/polyfills/schema.json +13 -0
  25. package/src/schematics/rules/add-polyfills-config.d.ts +4 -1
  26. package/src/schematics/rules/add-polyfills-config.js +36 -21
  27. package/src/schematics/rules/add-polyfills-config.js.map +1 -1
  28. package/src/schematics/rules/apply-skyux-stylesheets-to-workspace.d.ts +1 -1
  29. package/src/schematics/rules/apply-skyux-stylesheets-to-workspace.js +18 -15
  30. package/src/schematics/rules/apply-skyux-stylesheets-to-workspace.js.map +1 -1
  31. package/src/schematics/rules/ensure-peers-installed.d.ts +1 -1
  32. package/src/schematics/rules/modify-tsconfig.d.ts +2 -0
  33. package/src/schematics/rules/modify-tsconfig.js +14 -0
  34. package/src/schematics/rules/modify-tsconfig.js.map +1 -0
  35. package/src/schematics/testing/tree.d.ts +5 -0
  36. package/src/schematics/testing/tree.js +12 -0
  37. package/src/schematics/testing/tree.js.map +1 -0
  38. package/src/schematics/utility/json-file.d.ts +2 -2
  39. package/src/schematics/utility/json-file.js +3 -3
  40. package/src/schematics/utility/json-file.js.map +1 -1
  41. package/src/schematics/utility/workspace.d.ts +14 -6
  42. package/src/schematics/utility/workspace.js +20 -4
  43. package/src/schematics/utility/workspace.js.map +1 -1
  44. package/src/polyfills.d.ts +0 -0
  45. package/src/polyfills.js.map +0 -1
  46. package/src/schematics/migrations/update-8/update-polyfill/schema.json +0 -7
  47. package/src/schematics/rules/replace-typescript-imports.d.ts +0 -9
  48. package/src/schematics/rules/replace-typescript-imports.js +0 -32
  49. package/src/schematics/rules/replace-typescript-imports.js.map +0 -1
package/collection.json CHANGED
@@ -6,10 +6,10 @@
6
6
  "factory": "./src/schematics/ng-add/ng-add.schematic",
7
7
  "schema": "./src/schematics/ng-add/schema.json"
8
8
  },
9
- "update-polyfill": {
10
- "description": "Remove code from polyfills.ts/test.ts and add @skyux/packages/polyfills to workspace config.",
11
- "factory": "./src/schematics/migrations/update-8/update-polyfill/update-polyfill.schematic#updatePolyfillSchematic",
12
- "schema": "./src/schematics/migrations/update-8/update-polyfill/schema.json"
9
+ "polyfills": {
10
+ "description": "Add @skyux/packages/polyfills to project config.",
11
+ "factory": "./src/schematics/ng-generate/polyfills/polyfills.schematic",
12
+ "schema": "./src/schematics/ng-generate/polyfills/schema.json"
13
13
  }
14
14
  }
15
15
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skyux/packages",
3
- "version": "8.0.0-alpha.2",
3
+ "version": "8.0.0-alpha.20",
4
4
  "author": "Blackbaud, Inc.",
5
5
  "description": "Handles the `ng update` command for SKY UX component libraries.",
6
6
  "keywords": [
@@ -19,9 +19,13 @@
19
19
  "main": "./src/index.js",
20
20
  "exports": {
21
21
  ".": {
22
+ "types": "./src/index.d.ts",
22
23
  "default": "./src/index.js",
23
24
  "require": "./src/index.js"
24
25
  },
26
+ "./package.json": {
27
+ "default": "./package.json"
28
+ },
25
29
  "./polyfills": {
26
30
  "default": "./src/polyfills.js"
27
31
  }
@@ -33,61 +37,61 @@
33
37
  "ng-update": {
34
38
  "migrations": "./src/schematics/migrations/migration-collection.json",
35
39
  "packageGroup": {
36
- "@skyux-sdk/prettier-schematics": "8.0.0-alpha.2",
37
- "@skyux-sdk/testing": "8.0.0-alpha.2",
38
- "@skyux/a11y": "8.0.0-alpha.2",
39
- "@skyux/action-bars": "8.0.0-alpha.2",
40
- "@skyux/ag-grid": "8.0.0-alpha.2",
41
- "@skyux/angular-tree-component": "8.0.0-alpha.2",
42
- "@skyux/animations": "8.0.0-alpha.2",
43
- "@skyux/assets": "8.0.0-alpha.2",
44
- "@skyux/autonumeric": "8.0.0-alpha.2",
45
- "@skyux/avatar": "8.0.0-alpha.2",
46
- "@skyux/colorpicker": "8.0.0-alpha.2",
47
- "@skyux/config": "8.0.0-alpha.2",
48
- "@skyux/core": "8.0.0-alpha.2",
49
- "@skyux/data-manager": "8.0.0-alpha.2",
50
- "@skyux/datetime": "8.0.0-alpha.2",
40
+ "@skyux-sdk/prettier-schematics": "8.0.0-alpha.20",
41
+ "@skyux-sdk/testing": "8.0.0-alpha.20",
42
+ "@skyux/a11y": "8.0.0-alpha.20",
43
+ "@skyux/action-bars": "8.0.0-alpha.20",
44
+ "@skyux/ag-grid": "8.0.0-alpha.20",
45
+ "@skyux/angular-tree-component": "8.0.0-alpha.20",
46
+ "@skyux/animations": "8.0.0-alpha.20",
47
+ "@skyux/assets": "8.0.0-alpha.20",
48
+ "@skyux/autonumeric": "8.0.0-alpha.20",
49
+ "@skyux/avatar": "8.0.0-alpha.20",
50
+ "@skyux/colorpicker": "8.0.0-alpha.20",
51
+ "@skyux/config": "8.0.0-alpha.20",
52
+ "@skyux/core": "8.0.0-alpha.20",
53
+ "@skyux/data-manager": "8.0.0-alpha.20",
54
+ "@skyux/datetime": "8.0.0-alpha.20",
51
55
  "@skyux/docs-tools": "^7.0.0",
52
- "@skyux/errors": "8.0.0-alpha.2",
53
- "@skyux/flyout": "8.0.0-alpha.2",
54
- "@skyux/forms": "8.0.0-alpha.2",
55
- "@skyux/grids": "8.0.0-alpha.2",
56
- "@skyux/http": "8.0.0-alpha.2",
57
- "@skyux/i18n": "8.0.0-alpha.2",
58
- "@skyux/icons": "^5.2.0",
59
- "@skyux/indicators": "8.0.0-alpha.2",
60
- "@skyux/inline-form": "8.0.0-alpha.2",
61
- "@skyux/layout": "8.0.0-alpha.2",
62
- "@skyux/list-builder": "8.0.0-alpha.2",
63
- "@skyux/list-builder-common": "8.0.0-alpha.2",
64
- "@skyux/list-builder-view-checklist": "8.0.0-alpha.2",
65
- "@skyux/list-builder-view-grids": "8.0.0-alpha.2",
66
- "@skyux/lists": "8.0.0-alpha.2",
67
- "@skyux/lookup": "8.0.0-alpha.2",
68
- "@skyux/modals": "8.0.0-alpha.2",
69
- "@skyux/navbar": "8.0.0-alpha.2",
70
- "@skyux/omnibar-interop": "8.0.0-alpha.2",
71
- "@skyux/pages": "8.0.0-alpha.2",
72
- "@skyux/phone-field": "8.0.0-alpha.2",
73
- "@skyux/popovers": "8.0.0-alpha.2",
74
- "@skyux/progress-indicator": "8.0.0-alpha.2",
75
- "@skyux/router": "8.0.0-alpha.2",
76
- "@skyux/select-field": "8.0.0-alpha.2",
77
- "@skyux/split-view": "8.0.0-alpha.2",
78
- "@skyux/tabs": "8.0.0-alpha.2",
79
- "@skyux/text-editor": "8.0.0-alpha.2",
80
- "@skyux/theme": "8.0.0-alpha.2",
81
- "@skyux/tiles": "8.0.0-alpha.2",
82
- "@skyux/toast": "8.0.0-alpha.2",
83
- "@skyux/validation": "8.0.0-alpha.2",
56
+ "@skyux/errors": "8.0.0-alpha.20",
57
+ "@skyux/flyout": "8.0.0-alpha.20",
58
+ "@skyux/forms": "8.0.0-alpha.20",
59
+ "@skyux/grids": "8.0.0-alpha.20",
60
+ "@skyux/http": "8.0.0-alpha.20",
61
+ "@skyux/i18n": "8.0.0-alpha.20",
62
+ "@skyux/icons": "^6.0.0",
63
+ "@skyux/indicators": "8.0.0-alpha.20",
64
+ "@skyux/inline-form": "8.0.0-alpha.20",
65
+ "@skyux/layout": "8.0.0-alpha.20",
66
+ "@skyux/list-builder": "8.0.0-alpha.20",
67
+ "@skyux/list-builder-common": "8.0.0-alpha.20",
68
+ "@skyux/list-builder-view-checklist": "8.0.0-alpha.20",
69
+ "@skyux/list-builder-view-grids": "8.0.0-alpha.20",
70
+ "@skyux/lists": "8.0.0-alpha.20",
71
+ "@skyux/lookup": "8.0.0-alpha.20",
72
+ "@skyux/modals": "8.0.0-alpha.20",
73
+ "@skyux/navbar": "8.0.0-alpha.20",
74
+ "@skyux/omnibar-interop": "8.0.0-alpha.20",
75
+ "@skyux/pages": "8.0.0-alpha.20",
76
+ "@skyux/phone-field": "8.0.0-alpha.20",
77
+ "@skyux/popovers": "8.0.0-alpha.20",
78
+ "@skyux/progress-indicator": "8.0.0-alpha.20",
79
+ "@skyux/router": "8.0.0-alpha.20",
80
+ "@skyux/select-field": "8.0.0-alpha.20",
81
+ "@skyux/split-view": "8.0.0-alpha.20",
82
+ "@skyux/tabs": "8.0.0-alpha.20",
83
+ "@skyux/text-editor": "8.0.0-alpha.20",
84
+ "@skyux/theme": "8.0.0-alpha.20",
85
+ "@skyux/tiles": "8.0.0-alpha.20",
86
+ "@skyux/toast": "8.0.0-alpha.20",
87
+ "@skyux/validation": "8.0.0-alpha.20",
84
88
  "ag-grid-angular": "^28.2.1",
85
89
  "ag-grid-community": "^28.2.1",
86
90
  "ag-grid-enterprise": "^28.2.1"
87
91
  }
88
92
  },
89
93
  "peerDependencies": {
90
- "@angular/cli": "^15.1.5"
94
+ "@angular/cli": "^15.2.1"
91
95
  },
92
96
  "dependencies": {
93
97
  "fs-extra": "10.1.0",
package/src/polyfills.js CHANGED
@@ -1,2 +1,6 @@
1
- "use strict";
2
- //# sourceMappingURL=polyfills.js.map
1
+ 'use strict';
2
+
3
+ // Fix for crossvent `global is not defined` error. The crossvent library is used by Dragula,
4
+ // which in turn is used by multiple SKY UX components.
5
+ // https://github.com/bevacqua/dragula/issues/602
6
+ window.global = window;
@@ -1,14 +1,19 @@
1
1
  {
2
2
  "schematics": {
3
3
  "noop": {
4
- "version": "8.0.0-alpha.2",
4
+ "version": "8.0.0-alpha.20",
5
5
  "factory": "./noop/noop.schematic",
6
6
  "description": "Update all SKY UX component packages"
7
7
  },
8
8
  "update-polyfill": {
9
9
  "version": "8.0.0-alpha.0",
10
- "factory": "./update-8/update-polyfill/update-polyfill",
10
+ "factory": "./update-8/update-polyfill/update-polyfill.schematic",
11
11
  "description": "Remove code from polyfills.ts/test.ts and add @skyux/packages/polyfills to workspace config."
12
+ },
13
+ "add-compat-stylesheets": {
14
+ "version": "8.0.0-alpha.0",
15
+ "factory": "./update-8/add-compat-stylesheets/add-compat-stylesheets",
16
+ "description": "Add a backwards-compatible stylesheet with styles that have been removed from components in SKY UX 8."
12
17
  }
13
18
  }
14
19
  }
@@ -0,0 +1,2 @@
1
+ import { Rule } from '@angular-devkit/schematics';
2
+ export default function (): Rule;
@@ -0,0 +1,203 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const schematics_1 = require("@angular-devkit/schematics");
4
+ const tree_1 = require("../../../utility/tree");
5
+ const workspace_1 = require("../../../utility/workspace");
6
+ const COMPAT_CSS_FILE_NAME = 'skyux8-compat.css';
7
+ const compatStyles = {
8
+ libraries: [
9
+ {
10
+ name: '@skyux/forms',
11
+ components: [
12
+ {
13
+ name: 'selection box',
14
+ styles: [
15
+ {
16
+ css: `
17
+ :root {
18
+ --sky-compat-selection-box-grid-margin-bottom: 0;
19
+ }
20
+ `,
21
+ instructions: `
22
+ The bottom margin for the \`sky-selection-box-grid\` has been changed to compensate for the spacing applied to its child \`sky-selection-box\` components. To address this, remove this block of CSS and address any spacing issues by adding the appropriate margin class to the selection box grid. See https://developer.blackbaud.com/skyux/design/styles/spacing for a list of supported spacing classes.`,
23
+ },
24
+ ],
25
+ },
26
+ ],
27
+ },
28
+ {
29
+ name: '@skyux/layout',
30
+ components: [
31
+ {
32
+ name: 'action button',
33
+ styles: [
34
+ {
35
+ css: `
36
+ :root {
37
+ --sky-compat-action-button-flex-margin: 0;
38
+ --sky-compat-action-button-flex-sm-padding: 10px;
39
+ }
40
+ `,
41
+ instructions: `
42
+ The top and bottom margins have been removed from the \`sky-action-button-container\` component. To address this, remove this block of CSS and address any spacing issues by adding the appropriate margin class to the action button container. See https://developer.blackbaud.com/skyux/design/styles/spacing for a list of supported spacing classes.`,
43
+ },
44
+ ],
45
+ },
46
+ {
47
+ name: 'text expand repeater',
48
+ styles: [
49
+ {
50
+ css: `
51
+ :root {
52
+ --sky-compat-text-expand-repeater-margin-top: unset;
53
+ }
54
+ `,
55
+ instructions: `
56
+ The top margin has been removed from the \`sky-text-expand-repeater\` component. To address this, remove this block of CSS and address any spacing issues by adding the appropriate margin class to the element above each text expand repeater or padding class to each text expand repeater's parent element. See https://developer.blackbaud.com/skyux/design/styles/spacing for a list of supported spacing classes.`,
57
+ },
58
+ ],
59
+ },
60
+ ],
61
+ },
62
+ {
63
+ name: '@skyux/pages',
64
+ components: [
65
+ {
66
+ name: 'page header',
67
+ styles: [
68
+ {
69
+ css: `
70
+ :root {
71
+ --sky-compat-page-header-margin-top-and-bottom: 0.67em;
72
+ }
73
+ `,
74
+ instructions: `
75
+ The top and bottom margins have been removed from the \`sky-page-header\` component. To address this, remove this block of CSS and address any spacing issues by adding the appropriate margin class to the action button container. See https://developer.blackbaud.com/skyux/design/styles/spacing for a list of supported spacing classes.`,
76
+ },
77
+ ],
78
+ },
79
+ ],
80
+ },
81
+ {
82
+ name: '@skyux/tabs',
83
+ components: [
84
+ {
85
+ name: 'tabs',
86
+ styles: [
87
+ {
88
+ css: `
89
+ :root {
90
+ --sky-compat-tabset-tabs-modal-margin: 0;
91
+ --sky-compat-tabset-wizard-modal-margin: 0 0 10px;
92
+ }
93
+ `,
94
+ instructions: `
95
+ The left, right, and bottom margins for the \`sky-tabset\` within a modal have been changed in default theme to follow design best practices. To address this, remove this block of CSS and address any conflicting classes or styles that were previously fixing the incorrect spacing of the tabset.`,
96
+ },
97
+ ],
98
+ },
99
+ ],
100
+ },
101
+ ],
102
+ };
103
+ function getProjectSourcePath(projectDefinition) {
104
+ /*istanbul ignore else*/
105
+ if (projectDefinition.sourceRoot) {
106
+ return `${projectDefinition.sourceRoot}/app`;
107
+ }
108
+ else {
109
+ return `${projectDefinition.root}/src/app`;
110
+ }
111
+ }
112
+ function buildCommentBlock(message) {
113
+ return `/${'*'.repeat(79)}
114
+ * ${message.replace(/(?![^\n]{1,75}$)([^\n]{1,75})\s/g, '$1\n * ')}
115
+ ${'*'.repeat(79)}/`;
116
+ }
117
+ function buildComponentCss(component) {
118
+ let contents = buildCommentBlock(`COMPONENT: ${component.name.toUpperCase()}`);
119
+ for (const style of component.styles) {
120
+ contents += `
121
+
122
+ ${buildCommentBlock(style.instructions.trim())}
123
+
124
+ ${style.css.trim()}
125
+ `;
126
+ }
127
+ return contents;
128
+ }
129
+ function writeStylesheet(sourceRoot, contents) {
130
+ const filePath = `${sourceRoot}/${COMPAT_CSS_FILE_NAME}`;
131
+ return (tree) => {
132
+ if (tree.exists(filePath)) {
133
+ tree.overwrite(filePath, contents);
134
+ }
135
+ else {
136
+ tree.create(filePath, contents);
137
+ }
138
+ };
139
+ }
140
+ function addStylesheetToWorkspace() {
141
+ return () => (0, workspace_1.updateWorkspace)((workspace) => {
142
+ for (const project of workspace.projects.values()) {
143
+ for (const targetName of ['build', 'test']) {
144
+ if (project.extensions.projectType === 'application') {
145
+ const target = project.targets.get(targetName);
146
+ const sourceRoot = getProjectSourcePath(project);
147
+ const filePath = `${sourceRoot}/${COMPAT_CSS_FILE_NAME}`;
148
+ /* istanbul ignore else */
149
+ if (target && target.options) {
150
+ const styles = (target.options.styles = (target.options.styles ||
151
+ []));
152
+ if (!styles.includes(filePath)) {
153
+ styles.push(filePath);
154
+ }
155
+ }
156
+ }
157
+ }
158
+ }
159
+ });
160
+ }
161
+ function getCompatStyles(tree) {
162
+ let contents = '';
163
+ const packageJson = JSON.parse((0, tree_1.readRequiredFile)(tree, '/package.json'));
164
+ for (const library of compatStyles.libraries) {
165
+ if (packageJson.dependencies?.[library.name] ||
166
+ packageJson.devDependencies?.[library.name]) {
167
+ for (const component of library.components) {
168
+ contents += `
169
+ ${buildComponentCss(component)}`;
170
+ }
171
+ }
172
+ }
173
+ return contents
174
+ ? `${buildCommentBlock(`TODO: The following component libraries introduced visual breaking changes in SKY UX 8. Each block of CSS reintroduces the styles that were changed or removed for backwards compatibility. You will need to do the following before migrating to the next major version of SKY UX:
175
+ - Address each of the changes by following the instructions
176
+ in each block of CSS, then remove the block.
177
+ - Delete this file after all blocks have been addressed.
178
+ - Remove each occurrence of this file in your project's
179
+ angular.json file.`)}
180
+ ${contents}`
181
+ : undefined;
182
+ }
183
+ function default_1() {
184
+ return async (tree) => {
185
+ const { workspace } = await (0, workspace_1.getWorkspace)(tree);
186
+ const styles = getCompatStyles(tree);
187
+ const rules = [];
188
+ for (const [, projectDefinition] of workspace.projects.entries()) {
189
+ if (projectDefinition.extensions.projectType === 'application') {
190
+ if (styles) {
191
+ const sourcePath = getProjectSourcePath(projectDefinition);
192
+ rules.push(writeStylesheet(sourcePath, styles));
193
+ }
194
+ }
195
+ }
196
+ if (styles) {
197
+ rules.push(addStylesheetToWorkspace());
198
+ }
199
+ return (0, schematics_1.chain)(rules);
200
+ };
201
+ }
202
+ exports.default = default_1;
203
+ //# sourceMappingURL=add-compat-stylesheets.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"add-compat-stylesheets.js","sourceRoot":"","sources":["../../../../../../../../../libs/components/packages/src/schematics/migrations/update-8/add-compat-stylesheets/add-compat-stylesheets.ts"],"names":[],"mappings":";;AACA,2DAA+D;AAE/D,gDAAyD;AACzD,0DAA2E;AAE3E,MAAM,oBAAoB,GAAG,mBAAmB,CAAC;AAEjD,MAAM,YAAY,GAAG;IACnB,SAAS,EAAE;QACT;YACE,IAAI,EAAE,cAAc;YACpB,UAAU,EAAE;gBACV;oBACE,IAAI,EAAE,eAAe;oBACrB,MAAM,EAAE;wBACN;4BACE,GAAG,EAAE;;;;CAIlB;4BACa,YAAY,EAAE;+YACmX;yBAClY;qBACF;iBACF;aACF;SACF;QACD;YACE,IAAI,EAAE,eAAe;YACrB,UAAU,EAAE;gBACV;oBACE,IAAI,EAAE,eAAe;oBACrB,MAAM,EAAE;wBACN;4BACE,GAAG,EAAE;;;;;CAKlB;4BACa,YAAY,EAAE;0VAC8T;yBAC7U;qBACF;iBACF;gBACD;oBACE,IAAI,EAAE,sBAAsB;oBAC5B,MAAM,EAAE;wBACN;4BACE,GAAG,EAAE;;;;CAIlB;4BACa,YAAY,EAAE;yZAC6X;yBAC5Y;qBACF;iBACF;aACF;SACF;QACD;YACE,IAAI,EAAE,cAAc;YACpB,UAAU,EAAE;gBACV;oBACE,IAAI,EAAE,aAAa;oBACnB,MAAM,EAAE;wBACN;4BACE,GAAG,EAAE;;;;CAIlB;4BACa,YAAY,EAAE;8UACkT;yBACjU;qBACF;iBACF;aACF;SACF;QACD;YACE,IAAI,EAAE,aAAa;YACnB,UAAU,EAAE;gBACV;oBACE,IAAI,EAAE,MAAM;oBACZ,MAAM,EAAE;wBACN;4BACE,GAAG,EAAE;;;;;CAK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,IAAI,CAAC,EAC3C;YACA,KAAK,MAAM,SAAS,IAAI,OAAO,CAAC,UAAU,EAAE;gBAC1C,QAAQ,IAAI;EAClB,iBAAiB,CAAC,SAAS,CAAC,EAAE,CAAC;aAC1B;SACF;KACF;IAED,OAAO,QAAQ;QACb,CAAC,CAAC,GAAG,iBAAiB,CAClB;;;;;qBAKa,CACd;EACL,QAAQ,EAAE;QACR,CAAC,CAAC,SAAS,CAAC;AAChB,CAAC;AAED;IACE,OAAO,KAAK,EAAE,IAAI,EAAE,EAAE;QACpB,MAAM,EAAE,SAAS,EAAE,GAAG,MAAM,IAAA,wBAAY,EAAC,IAAI,CAAC,CAAC;QAC/C,MAAM,MAAM,GAAG,eAAe,CAAC,IAAI,CAAC,CAAC;QACrC,MAAM,KAAK,GAAW,EAAE,CAAC;QAEzB,KAAK,MAAM,CAAC,EAAE,iBAAiB,CAAC,IAAI,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,EAAE;YAChE,IAAI,iBAAiB,CAAC,UAAU,CAAC,WAAW,KAAK,aAAa,EAAE;gBAC9D,IAAI,MAAM,EAAE;oBACV,MAAM,UAAU,GAAG,oBAAoB,CAAC,iBAAiB,CAAC,CAAC;oBAC3D,KAAK,CAAC,IAAI,CAAC,eAAe,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC,CAAC;iBACjD;aACF;SACF;QAED,IAAI,MAAM,EAAE;YACV,KAAK,CAAC,IAAI,CAAC,wBAAwB,EAAE,CAAC,CAAC;SACxC;QAED,OAAO,IAAA,kBAAK,EAAC,KAAK,CAAC,CAAC;IACtB,CAAC,CAAC;AACJ,CAAC;AArBD,4BAqBC"}
@@ -1,2 +1,6 @@
1
1
  import { Rule } from '@angular-devkit/schematics';
2
- export declare function updatePolyfillSchematic(): Rule;
2
+ /**
3
+ * Removes SKY UX specific polyfills from 'src/polyfills.ts' and 'src/test.ts' files.
4
+ * Adds '@skyux/packages/polyfills' to the affected project's configuration.
5
+ */
6
+ export default function updatePolyfillSchematic(): Rule;
@@ -1,6 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.updatePolyfillSchematic = void 0;
4
3
  const tslib_1 = require("tslib");
5
4
  const schematics_1 = require("@angular-devkit/schematics");
6
5
  const ts = tslib_1.__importStar(require("@schematics/angular/third_party/github.com/Microsoft/TypeScript/lib/typescript"));
@@ -8,63 +7,113 @@ const add_polyfills_config_1 = require("../../../rules/add-polyfills-config");
8
7
  const workspace_1 = require("../../../utility/workspace");
9
8
  const polyfillBlockStart = `* SKY UX POLYFILLS - DO NOT MODIFY THIS SECTION`;
10
9
  const polyfillBlockEnd = `* END SKY UX POLYFILLS`;
11
- function removePolyfillCode() {
10
+ function removePolyfillCode(projectName, project) {
12
11
  return async (tree) => {
13
- const { workspace } = await (0, workspace_1.getWorkspace)(tree);
14
- workspace.projects.forEach((project) => {
15
- ['polyfills.ts', 'test.ts'].forEach((filename) => {
16
- const path = `${project.root}/src/${filename}`;
17
- if (tree.exists(path)) {
18
- const polyfillsFile = tree.readText(path).replace(/\r\n/g, `\n`);
19
- const polyfillBlockStartIndex = polyfillsFile.indexOf(polyfillBlockStart);
20
- const polyfillBlockEndIndex = polyfillsFile.indexOf(polyfillBlockEnd);
21
- if (polyfillBlockStartIndex !== -1 && polyfillBlockEndIndex !== -1) {
22
- const changeStart = polyfillsFile.lastIndexOf(`/*`, polyfillBlockStartIndex);
23
- const changeEnd = polyfillsFile.indexOf(`*/`, polyfillBlockEndIndex) + 2;
24
- const change = tree.beginUpdate(path);
25
- change.remove(changeStart, changeEnd - changeStart);
26
- tree.commitUpdate(change);
27
- }
28
- else {
29
- const sourceFile = ts.createSourceFile(path, polyfillsFile, ts.ScriptTarget.Latest, true);
30
- // Find the expression that assigns the global property to the window object.
31
- const expression = sourceFile.statements.find((node) => {
32
- if (ts.isExpressionStatement(node)) {
33
- const expression = node.expression;
34
- if (ts.isBinaryExpression(expression)) {
35
- const left = expression.left;
36
- if (ts.isPropertyAccessExpression(left)) {
37
- let leftExpression = left.expression;
38
- if (ts.isParenthesizedExpression(leftExpression)) {
39
- leftExpression = leftExpression.expression;
40
- }
41
- if (ts.isAsExpression(leftExpression) &&
42
- ts.isIdentifier(leftExpression.expression) &&
43
- leftExpression.expression.text === 'window' &&
44
- left.name.text === 'global') {
45
- const right = expression.right;
46
- if (ts.isIdentifier(right) && right.text === 'window') {
47
- return true;
48
- }
12
+ // Saves a list of files that need to be checked for SKY UX polyfills.
13
+ const polyfillsFiles = new Set();
14
+ // Saves a list of targets that use each polyfills file.
15
+ const targetsWithPolyfills = new Map();
16
+ // Check each target for 'polyfills' configuration.
17
+ for (const [targetName, target] of project.targets.entries()) {
18
+ const files = [];
19
+ // src/test.ts
20
+ if (targetName === 'test' && target.options?.main) {
21
+ files.push(target.options.main);
22
+ }
23
+ // src/polyfills.ts
24
+ if (target.options?.polyfills) {
25
+ files.push(target.options.polyfills);
26
+ }
27
+ for (const file of files) {
28
+ // Save the file to the list of files that need to be checked.
29
+ polyfillsFiles.add(file);
30
+ // Save a list of targets that use each file.
31
+ const set = targetsWithPolyfills.get(file);
32
+ if (set) {
33
+ set.add(targetName);
34
+ }
35
+ else {
36
+ targetsWithPolyfills.set(file, new Set([targetName]));
37
+ }
38
+ }
39
+ }
40
+ // Loop through each file and remove our polyfill, if it exists.
41
+ for (const polyfillsFile of polyfillsFiles) {
42
+ if (tree.exists(polyfillsFile)) {
43
+ const contents = tree.readText(polyfillsFile).replace(/\r\n/g, `\n`);
44
+ const polyfillBlockStartIndex = contents.indexOf(polyfillBlockStart);
45
+ const polyfillBlockEndIndex = contents.indexOf(polyfillBlockEnd);
46
+ // Check for comment-block syntax.
47
+ if (polyfillBlockStartIndex !== -1 && polyfillBlockEndIndex !== -1) {
48
+ const changeStart = contents.lastIndexOf(`/*`, polyfillBlockStartIndex);
49
+ const changeEnd = contents.indexOf(`*/`, polyfillBlockEndIndex) + 2;
50
+ const change = tree.beginUpdate(polyfillsFile);
51
+ change.remove(changeStart, changeEnd - changeStart);
52
+ tree.commitUpdate(change);
53
+ }
54
+ else {
55
+ const sourceFile = ts.createSourceFile(polyfillsFile, contents, ts.ScriptTarget.Latest, true);
56
+ // Find the expression that assigns the global property to the window object.
57
+ const expression = sourceFile.statements.find((node) => {
58
+ if (ts.isExpressionStatement(node)) {
59
+ const expression = node.expression;
60
+ if (ts.isBinaryExpression(expression)) {
61
+ const left = expression.left;
62
+ if (ts.isPropertyAccessExpression(left)) {
63
+ let leftExpression = left.expression;
64
+ if (ts.isParenthesizedExpression(leftExpression)) {
65
+ leftExpression = leftExpression.expression;
66
+ }
67
+ if (ts.isAsExpression(leftExpression) &&
68
+ ts.isIdentifier(leftExpression.expression) &&
69
+ leftExpression.expression.text === 'window' &&
70
+ left.name.text === 'global') {
71
+ const right = expression.right;
72
+ if (ts.isIdentifier(right) && right.text === 'window') {
73
+ return true;
49
74
  }
50
75
  }
51
76
  }
52
77
  }
53
- return false;
54
- });
55
- if (expression) {
56
- const change = tree.beginUpdate(path);
57
- change.remove(expression.pos, expression.end - expression.pos);
58
- tree.commitUpdate(change);
59
78
  }
79
+ return false;
80
+ });
81
+ if (expression) {
82
+ const change = tree.beginUpdate(polyfillsFile);
83
+ change.remove(expression.pos, expression.end - expression.pos);
84
+ tree.commitUpdate(change);
85
+ }
86
+ else {
87
+ // The file doesn't include our polyfill, so remove it from the list of
88
+ // targets that need the new polyfills config.
89
+ targetsWithPolyfills.delete(polyfillsFile);
60
90
  }
61
91
  }
62
- });
63
- });
92
+ }
93
+ }
94
+ // Only update the project config if our polyfill was found in the files.
95
+ if (targetsWithPolyfills.size > 0) {
96
+ // Flatten all targets into a single array of unique values.
97
+ const targetsToUpdate = Array.from(new Set(Array.from(targetsWithPolyfills.values())
98
+ .map((x) => Array.from(x.values()))
99
+ .flat()));
100
+ return (0, add_polyfills_config_1.addPolyfillsConfig)(projectName, targetsToUpdate);
101
+ }
64
102
  };
65
103
  }
104
+ /**
105
+ * Removes SKY UX specific polyfills from 'src/polyfills.ts' and 'src/test.ts' files.
106
+ * Adds '@skyux/packages/polyfills' to the affected project's configuration.
107
+ */
66
108
  function updatePolyfillSchematic() {
67
- return (0, schematics_1.chain)([removePolyfillCode(), (0, add_polyfills_config_1.addPolyfillsConfig)()]);
109
+ return async (tree) => {
110
+ const { workspace } = await (0, workspace_1.getWorkspace)(tree);
111
+ const rules = [];
112
+ for (const [projectName, project] of workspace.projects.entries()) {
113
+ rules.push(removePolyfillCode(projectName, project));
114
+ }
115
+ return (0, schematics_1.chain)(rules);
116
+ };
68
117
  }
69
- exports.updatePolyfillSchematic = updatePolyfillSchematic;
118
+ exports.default = updatePolyfillSchematic;
70
119
  //# sourceMappingURL=update-polyfill.schematic.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"update-polyfill.schematic.js","sourceRoot":"","sources":["../../../../../../../../../libs/components/packages/src/schematics/migrations/update-8/update-polyfill/update-polyfill.schematic.ts"],"names":[],"mappings":";;;;AAAA,2DAAyD;AACzD,2HAAqG;AAErG,8EAAyE;AACzE,0DAA0D;AAE1D,MAAM,kBAAkB,GAAG,iDAAiD,CAAC;AAC7E,MAAM,gBAAgB,GAAG,wBAAwB,CAAC;AAElD,SAAS,kBAAkB;IACzB,OAAO,KAAK,EAAE,IAAI,EAAiB,EAAE;QACnC,MAAM,EAAE,SAAS,EAAE,GAAG,MAAM,IAAA,wBAAY,EAAC,IAAI,CAAC,CAAC;QAC/C,SAAS,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;YACrC,CAAC,cAAc,EAAE,SAAS,CAAC,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE;gBAC/C,MAAM,IAAI,GAAG,GAAG,OAAO,CAAC,IAAI,QAAQ,QAAQ,EAAE,CAAC;gBAC/C,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE;oBACrB,MAAM,aAAa,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,O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AAC,cAAc,CAAC,EAAE;4CAChD,cAAc,GAAG,cAAc,CAAC,UAAU,CAAC;yCAC5C;wCACD,IACE,EAAE,CAAC,cAAc,CAAC,cAAc,CAAC;4CACjC,EAAE,CAAC,YAAY,CAAC,cAAc,CAAC,UAAU,CAAC;4CAC1C,cAAc,CAAC,UAAU,CAAC,IAAI,KAAK,QAAQ;4CAC3C,IAAI,CAAC,IAAI,CAAC,IAAI,KAAK,QAAQ,EAC3B;4CACA,MAAM,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC;4CAC/B,IAAI,EAAE,CAAC,YAAY,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,IAAI,KAAK,QAAQ,EAAE;gDACrD,OAAO,IAAI,CAAC;6CACb;yCACF;qCACF;iCACF;6BACF;4BACD,OAAO,KAAK,CAAC;wBACf,CAAC,CAAC,CAAC;wBACH,IAAI,UAAU,EAAE;4BACd,MAAM,MAAM,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;4BACtC,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,GAAG,EAAE,UAAU,CAAC,GAAG,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC;4BAC/D,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;yBAC3B;qBACF;iBACF;YACH,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CAAC;AACJ,CAAC;AAED,SAAgB,uBAAuB;IACrC,OAAO,IAAA,kBAAK,EAAC,CAAC,kBAAkB,EAAE,EAAE,IAAA,yCAAkB,GAAE,CAAC,CAAC,CAAC;AAC7D,CAAC;AAFD,0DAEC"}
1
+ {"version":3,"file":"update-polyfill.schematic.js","sourceRoot":"","sources":["../../../../../../../../../libs/components/packages/src/schematics/migrations/update-8/update-polyfill/update-polyfill.schematic.ts"],"names":[],"mappings":";;;AACA,2DAAyD;AACzD,2HAAqG;AAErG,8EAAyE;AACzE,0DAA0D;AAE1D,MAAM,kBAAkB,GA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AAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC;iBAClC,IAAI,EAAE,CACV,CACF,CAAC;YAEF,OAAO,IAAA,yCAAkB,EAAC,WAAW,EAAE,eAAe,CAAC,CAAC;SACzD;IACH,CAAC,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,SAAwB,uBAAuB;IAC7C,OAAO,KAAK,EAAE,IAAI,EAAE,EAAE;QACpB,MAAM,EAAE,SAAS,EAAE,GAAG,MAAM,IAAA,wBAAY,EAAC,IAAI,CAAC,CAAC;QAC/C,MAAM,KAAK,GAAW,EAAE,CAAC;QAEzB,KAAK,MAAM,CAAC,WAAW,EAAE,OAAO,CAAC,IAAI,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,EAAE;YACjE,KAAK,CAAC,IAAI,CAAC,kBAAkB,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC,CAAC;SACtD;QAED,OAAO,IAAA,kBAAK,EAAC,KAAK,CAAC,CAAC;IACtB,CAAC,CAAC;AACJ,CAAC;AAXD,0CAWC"}
@@ -1,2 +1,3 @@
1
1
  import { Rule } from '@angular-devkit/schematics';
2
- export default function ngAdd(): Rule;
2
+ import { Schema } from './schema';
3
+ export default function ngAdd(options: Schema): Rule;
@@ -9,6 +9,8 @@ const fs_extra_1 = tslib_1.__importDefault(require("fs-extra"));
9
9
  const add_polyfills_config_1 = require("../rules/add-polyfills-config");
10
10
  const apply_skyux_stylesheets_to_workspace_1 = require("../rules/apply-skyux-stylesheets-to-workspace");
11
11
  const install_angular_cdk_1 = require("../rules/install-angular-cdk");
12
+ const modify_tsconfig_1 = require("../rules/modify-tsconfig");
13
+ const workspace_1 = require("../utility/workspace");
12
14
  function installEssentialSkyUxPackages(skyuxVersion) {
13
15
  return async (tree) => {
14
16
  const packageNames = [
@@ -27,16 +29,18 @@ function installEssentialSkyUxPackages(skyuxVersion) {
27
29
  }
28
30
  };
29
31
  }
30
- function ngAdd() {
32
+ function ngAdd(options) {
31
33
  return async (tree, context) => {
34
+ const { projectName } = await (0, workspace_1.getRequiredProject)(tree, options.project);
32
35
  // Get the currently installed version of SKY UX.
33
36
  const { version: skyuxVersion } = fs_extra_1.default.readJsonSync((0, core_1.normalize)(`${__dirname}/../../../package.json`));
34
37
  context.addTask(new tasks_1.NodePackageInstallTask());
35
38
  return (0, schematics_1.chain)([
36
39
  installEssentialSkyUxPackages(skyuxVersion),
37
40
  (0, install_angular_cdk_1.installAngularCdk)(),
38
- (0, add_polyfills_config_1.addPolyfillsConfig)(),
39
- (0, apply_skyux_stylesheets_to_workspace_1.applySkyuxStylesheetsToWorkspace)(),
41
+ (0, add_polyfills_config_1.addPolyfillsConfig)(projectName, ['build', 'test']),
42
+ (0, apply_skyux_stylesheets_to_workspace_1.applySkyuxStylesheetsToWorkspace)(projectName),
43
+ (0, modify_tsconfig_1.modifyTsConfig)(),
40
44
  ]);
41
45
  };
42
46
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ng-add.schematic.js","sourceRoot":"","sources":["../../../../../../../libs/components/packages/src/schematics/ng-add/ng-add.schematic.ts"],"names":[],"mappings":";;;AAAA,+CAAiD;AACjD,2DAAyD;AACzD,4DAA0E;AAC1E,2EAGkD;AAElD,gEAA0B;AAE1B,wEAAmE;AACnE,wGAAiG;AACjG,sEAAiE;AAEjE,SAAS,6BAA6B,CAAC,YAAoB;IACzD,OAAO,KAAK,EAAE,IAAI,EAAE,EAAE;QACpB,MAAM,YAAY,GAAG;YACnB,eAAe;YACf,aAAa;YACb,aAAa;YACb,cAAc;SACf,CAAC;QAEF,KAAK,MAAM,WAAW,IAAI,YAAY,EAAE;YACtC,IAAA,uCAAwB,EAAC,IAAI,EAAE;gBAC7B,IAAI,EAAE,iCAAkB,CAAC,OAAO;gBAChC,IAAI,EAAE,WAAW;gBACjB,OAAO,EAAE,IAAI,YAAY,EAAE;gBAC3B,SAAS,EAAE,IAAI;aAChB,CAAC,CAAC;SACJ;IACH,CAAC,CAAC;AACJ,CAAC;AAED,SAAwB,KAAK;IAC3B,OAAO,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE;QAC7B,iDAAiD;QACjD,MAAM,EAAE,OAAO,EAAE,YAAY,EAAE,GAAG,kBAAE,CAAC,YAAY,CAC/C,IAAA,gBAAS,EAAC,GAAG,SAAS,wBAAwB,CAAC,CAChD,CAAC;QAEF,OAAO,CAAC,OAAO,CAAC,IAAI,8BAAsB,EAAE,CAAC,CAAC;QAE9C,OAAO,IAAA,kBAAK,EAAC;YACX,6BAA6B,CAAC,YAAY,CAAC;YAC3C,IAAA,uCAAiB,GAAE;YACnB,IAAA,yCAAkB,GAAE;YACpB,IAAA,uEAAgC,GAAE;SACnC,CAAC,CAAC;IACL,CAAC,CAAC;AACJ,CAAC;AAhBD,wBAgBC"}
1
+ {"version":3,"file":"ng-add.schematic.js","sourceRoot":"","sources":["../../../../../../../libs/components/packages/src/schematics/ng-add/ng-add.schematic.ts"],"names":[],"mappings":";;;AAAA,+CAAiD;AACjD,2DAAyD;AACzD,4DAA0E;AAC1E,2EAGkD;AAElD,gEAA0B;AAE1B,wEAAmE;AACnE,wGAAiG;AACjG,sEAAiE;AACjE,8DAA0D;AAC1D,oDAA0D;AAI1D,SAAS,6BAA6B,CAAC,YAAoB;IACzD,OAAO,KAAK,EAAE,IAAI,EAAE,EAAE;QACpB,MAAM,YAAY,GAAG;YACnB,eAAe;YACf,aAAa;YACb,aAAa;YACb,cAAc;SACf,CAAC;QAEF,KAAK,MAAM,WAAW,IAAI,YAAY,EAAE;YACtC,IAAA,uCAAwB,EAAC,IAAI,EAAE;gBAC7B,IAAI,EAAE,iCAAkB,CAAC,OAAO;gBAChC,IAAI,EAAE,WAAW;gBACjB,OAAO,EAAE,IAAI,YAAY,EAAE;gBAC3B,SAAS,EAAE,IAAI;aAChB,CAAC,CAAC;SACJ;IACH,CAAC,CAAC;AACJ,CAAC;AAED,SAAwB,KAAK,CAAC,OAAe;IAC3C,OAAO,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE;QAC7B,MAAM,EAAE,WAAW,EAAE,GAAG,MAAM,IAAA,8BAAkB,EAAC,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;QAExE,iDAAiD;QACjD,MAAM,EAAE,OAAO,EAAE,YAAY,EAAE,GAAG,kBAAE,CAAC,YAAY,CAC/C,IAAA,gBAAS,EAAC,GAAG,SAAS,wBAAwB,CAAC,CAChD,CAAC;QAEF,OAAO,CAAC,OAAO,CAAC,IAAI,8BAAsB,EAAE,CAAC,CAAC;QAE9C,OAAO,IAAA,kBAAK,EAAC;YACX,6BAA6B,CAAC,YAAY,CAAC;YAC3C,IAAA,uCAAiB,GAAE;YACnB,IAAA,yCAAkB,EAAC,WAAW,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;YAClD,IAAA,uEAAgC,EAAC,WAAW,CAAC;YAC7C,IAAA,gCAAc,GAAE;SACjB,CAAC,CAAC;IACL,CAAC,CAAC;AACJ,CAAC;AAnBD,wBAmBC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Represents options passed via Angular CLI.
3
+ */
4
+ export interface Schema {
5
+ /**
6
+ * The name of the project.
7
+ */
8
+ project?: string;
9
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../../../../../libs/components/packages/src/schematics/ng-add/schema.ts"],"names":[],"mappings":""}
@@ -1 +1,13 @@
1
- {}
1
+ {
2
+ "$schema": "http://json-schema.org/schema",
3
+ "type": "object",
4
+ "properties": {
5
+ "project": {
6
+ "type": "string",
7
+ "description": "The name of the project.",
8
+ "$default": {
9
+ "$source": "projectName"
10
+ }
11
+ }
12
+ }
13
+ }
@@ -0,0 +1,6 @@
1
+ import { Rule } from '@angular-devkit/schematics';
2
+ import { Schema } from './schema';
3
+ /**
4
+ * Adds '@skyux/packages/polyfills' to a project's configuration.
5
+ */
6
+ export default function generatePolyfills(options: Schema): Rule;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const schematics_1 = require("@angular-devkit/schematics");
4
+ const add_polyfills_config_1 = require("../../rules/add-polyfills-config");
5
+ const workspace_1 = require("../../utility/workspace");
6
+ /**
7
+ * Adds '@skyux/packages/polyfills' to a project's configuration.
8
+ */
9
+ function generatePolyfills(options) {
10
+ return async (tree) => {
11
+ const { projectName } = await (0, workspace_1.getRequiredProject)(tree, options.project);
12
+ return (0, schematics_1.chain)([(0, add_polyfills_config_1.addPolyfillsConfig)(projectName, ['build', 'test'])]);
13
+ };
14
+ }
15
+ exports.default = generatePolyfills;
16
+ //# sourceMappingURL=polyfills.schematic.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"polyfills.schematic.js","sourceRoot":"","sources":["../../../../../../../../libs/components/packages/src/schematics/ng-generate/polyfills/polyfills.schematic.ts"],"names":[],"mappings":";;AAAA,2DAAyD;AAEzD,2EAAsE;AACtE,uDAA6D;AAI7D;;GAEG;AACH,SAAwB,iBAAiB,CAAC,OAAe;IACvD,OAAO,KAAK,EAAE,IAAI,EAAE,EAAE;QACpB,MAAM,EAAE,WAAW,EAAE,GAAG,MAAM,IAAA,8BAAkB,EAAC,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;QAExE,OAAO,IAAA,kBAAK,EAAC,CAAC,IAAA,yCAAkB,EAAC,WAAW,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;IACrE,CAAC,CAAC;AACJ,CAAC;AAND,oCAMC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Represents options passed via Angular CLI.
3
+ */
4
+ export interface Schema {
5
+ /**
6
+ * The name of the project to add polyfills to.
7
+ */
8
+ project?: string;
9
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../../../../../../libs/components/packages/src/schematics/ng-generate/polyfills/schema.ts"],"names":[],"mappings":""}
@@ -0,0 +1,13 @@
1
+ {
2
+ "$schema": "http://json-schema.org/schema",
3
+ "type": "object",
4
+ "properties": {
5
+ "project": {
6
+ "type": "string",
7
+ "description": "The name of the project.",
8
+ "$default": {
9
+ "$source": "projectName"
10
+ }
11
+ }
12
+ }
13
+ }
@@ -1,2 +1,5 @@
1
1
  import { Rule } from '@angular-devkit/schematics';
2
- export declare function addPolyfillsConfig(): Rule;
2
+ /**
3
+ * Adds '@skyux/packages/polyfills' to the given targets' configuration.
4
+ */
5
+ export declare function addPolyfillsConfig(projectName: string, targetNames: string[]): Rule;
@@ -2,33 +2,48 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.addPolyfillsConfig = void 0;
4
4
  const workspace_1 = require("../utility/workspace");
5
+ // List of approved builders the polyfill can be added to.
5
6
  const polyfillsBuilders = [
6
7
  '@angular-devkit/build-angular:browser',
7
8
  '@angular-devkit/build-angular:karma',
8
9
  '@blackbaud-internal/skyux-angular-builders:browser',
9
10
  '@blackbaud-internal/skyux-angular-builders:karma',
10
11
  ];
11
- function addPolyfillsConfig() {
12
- return (0, workspace_1.updateWorkspace)((workspace) => {
13
- workspace.projects.forEach((project) => {
14
- project.targets.forEach((target) => {
15
- if (polyfillsBuilders.includes(target.builder)) {
16
- if (!target.options?.polyfills) {
17
- target.options = {
18
- ...(target.options || {}),
19
- polyfills: [],
20
- };
21
- }
22
- else if (typeof target.options.polyfills === 'string') {
23
- target.options.polyfills = [target.options.polyfills];
24
- }
25
- if (Array.isArray(target.options.polyfills) &&
26
- !target.options.polyfills.includes('@skyux/packages/polyfills')) {
27
- target.options.polyfills.push('@skyux/packages/polyfills');
28
- }
29
- }
30
- });
31
- });
12
+ /**
13
+ * Adds '@skyux/packages/polyfills' to the given targets' configuration.
14
+ */
15
+ function addPolyfillsConfig(projectName, targetNames) {
16
+ return (_tree, context) => (0, workspace_1.updateWorkspace)((workspace) => {
17
+ const project = workspace.projects.get(projectName);
18
+ /* istanbul ignore next */
19
+ if (!project) {
20
+ return;
21
+ }
22
+ for (const targetName of targetNames) {
23
+ const target = project.targets.get(targetName);
24
+ /* istanbul ignore next */
25
+ if (!target) {
26
+ return;
27
+ }
28
+ // Abort if builder is not approved.
29
+ if (!polyfillsBuilders.includes(target.builder)) {
30
+ context.logger.warn(`Could not add polyfills to the '${projectName}' project's '${targetName}' target because it does not use an approved builder. (wanted one of ${polyfillsBuilders.join(' | ')})`);
31
+ continue;
32
+ }
33
+ if (!target.options?.polyfills) {
34
+ target.options = {
35
+ ...(target.options || {}),
36
+ polyfills: [],
37
+ };
38
+ }
39
+ else if (typeof target.options.polyfills === 'string') {
40
+ target.options.polyfills = [target.options.polyfills];
41
+ }
42
+ if (Array.isArray(target.options.polyfills) &&
43
+ !target.options.polyfills.includes('@skyux/packages/polyfills')) {
44
+ target.options.polyfills.push('@skyux/packages/polyfills');
45
+ }
46
+ }
32
47
  });
33
48
  }
34
49
  exports.addPolyfillsConfig = addPolyfillsConfig;
@@ -1 +1 @@
1
- {"version":3,"file":"add-polyfills-config.js","sourceRoot":"","sources":["../../../../../../../libs/components/packages/src/schematics/rules/add-polyfills-config.ts"],"names":[],"mappings":";;;AAEA,oDAAuD;AAEvD,MAAM,iBAAiB,GAAG;IACxB,uCAAuC;IACvC,qCAAqC;IACrC,oDAAoD;IACpD,kDAAkD;CACnD,CAAC;AAEF,SAAgB,kBAAkB;IAChC,OAAO,IAAA,2BAAe,EAAC,CAAC,SAAS,EAAE,EAAE;QACnC,SAAS,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;YACrC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE;gBACjC,IAAI,iBAAiB,CAAC,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE;oBAC9C,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,SAAS,EAAE;wBAC9B,MAAM,CAAC,OAAO,GAAG;4BACf,GAAG,CAAC,MAAM,CAAC,OAAO,IAAI,EAAE,CAAC;4BACzB,SAAS,EAAE,EAAE;yBACd,CAAC;qBACH;yBAAM,IAAI,OAAO,MAAM,CAAC,OAAO,CAAC,SAAS,KAAK,QAAQ,EAAE;wBACvD,MAAM,CAAC,OAAO,CAAC,SAAS,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;qBACvD;oBACD,IACE,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC;wBACvC,CAAC,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,QAAQ,CAAC,2BAA2B,CAAC,EAC/D;wBACA,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,2BAA2B,CAAC,CAAC;qBAC5D;iBACF;YACH,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC;AAvBD,gDAuBC"}
1
+ {"version":3,"file":"add-polyfills-config.js","sourceRoot":"","sources":["../../../../../../../libs/components/packages/src/schematics/rules/add-polyfills-config.ts"],"names":[],"mappings":";;;AAEA,oDAAuD;AAEvD,0DAA0D;AAC1D,MAAM,iBAAiB,GAAG;IACxB,uCAAuC;IACvC,qCAAqC;IACrC,oDAAoD;IACpD,kDAAkD;CACnD,CAAC;AAEF;;GAEG;AACH,SAAgB,kBAAkB,CAChC,WAAmB,EACnB,WAAqB;IAErB,OAAO,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE,CACxB,IAAA,2BAAe,EAAC,CAAC,SAAS,EAAE,EAAE;QAC5B,MAAM,OAAO,GAAG,SAAS,CAAC,QAAQ,CAAC,GAAG,C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(): Rule;
2
+ export declare function applySkyuxStylesheetsToWorkspace(projectName: string): Rule;
@@ -3,21 +3,24 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.applySkyuxStylesheetsToWorkspace = void 0;
4
4
  const theme_1 = require("../utility/theme");
5
5
  const workspace_1 = require("../utility/workspace");
6
- function applySkyuxStylesheetsToWorkspace() {
7
- return () => (0, workspace_1.updateWorkspace)((workspace) => {
8
- for (const project of workspace.projects.values()) {
9
- for (const targetName of ['build', 'test']) {
10
- // Ignore build target for libraries.
11
- if (targetName === 'build' &&
12
- project.extensions.projectType === 'library') {
13
- continue;
14
- }
15
- // Add SKY UX stylesheets array to target.
16
- const target = project.targets.get(targetName);
17
- /*istanbul ignore else*/
18
- if (target && target.options) {
19
- target.options.styles = (0, theme_1.ensureSkyuxStylesheets)(target.options.styles);
20
- }
6
+ function applySkyuxStylesheetsToWorkspace(projectName) {
7
+ return (0, workspace_1.updateWorkspace)((workspace) => {
8
+ const project = workspace.projects.get(projectName);
9
+ /* istanbul ignore next */
10
+ if (!project) {
11
+ return;
12
+ }
13
+ for (const targetName of ['build', 'test']) {
14
+ // Ignore build target for libraries.
15
+ if (targetName === 'build' &&
16
+ project.extensions.projectType === 'library') {
17
+ continue;
18
+ }
19
+ // Add SKY UX stylesheets array to target.
20
+ const target = project.targets.get(targetName);
21
+ /*istanbul ignore else*/
22
+ if (target && target.options) {
23
+ target.options.styles = (0, theme_1.ensureSkyuxStylesheets)(target.options.styles);
21
24
  }
22
25
  }
23
26
  });
@@ -1 +1 @@
1
- {"version":3,"file":"apply-skyux-stylesheets-to-workspace.js","sourceRoot":"","sources":["../../../../../../../libs/components/packages/src/schematics/rules/apply-skyux-stylesheets-to-workspace.ts"],"names":[],"mappings":";;;AAEA,4CAA0D;AAC1D,oDAAuD;AAEvD,SAAgB,gCAAgC;IAC9C,OAAO,GAAG,EAAE,CACV,IAAA,2BAAe,EAAC,CAAC,SAAS,EAAE,EAAE;QAC5B,KAAK,MAAM,OAAO,IAAI,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,EAAE;YACjD,KAAK,MAAM,UAAU,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,EAAE;gBAC1C,qCAAqC;gBACrC,IACE,UAAU,KAAK,OAAO;oBACtB,OAAO,CAAC,UAAU,CAAC,WAAW,KAAK,SAAS,EAC5C;oBACA,SAAS;iBACV;gBAED,0CAA0C;gBAC1C,MAAM,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;gBAE/C,wBAAwB;gBACxB,IAAI,MAAM,IAAI,MAAM,CAAC,OAAO,EAAE;oBAC5B,MAAM,CAAC,OAAO,CAAC,MAAM,GAAG,IAAA,8BAAsB,EAC5C,MAAM,CAAC,OAAO,CAAC,MAAkB,CAClC,CAAC;iBACH;aACF;SACF;IACH,CAAC,CAAC,CAAC;AACP,CAAC;AAzBD,4EAyBC"}
1
+ {"version":3,"file":"apply-skyux-stylesheets-to-workspace.js","sourceRoot":"","sources":["../../../../../../../libs/components/packages/src/schematics/rules/apply-skyux-stylesheets-to-workspace.ts"],"names":[],"mappings":";;;AAEA,4CAA0D;AAC1D,oDAAuD;AAEvD,SAAgB,gCAAgC,CAAC,WAAmB;IAClE,OAAO,IAAA,2BAAe,EAAC,CAAC,SAAS,EAAE,EAAE;QACnC,MAAM,OAAO,GAAG,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;QAEpD,0BAA0B;QAC1B,IAAI,CAAC,OAAO,EAAE;YACZ,OAAO;SACR;QAED,KAAK,MAAM,UAAU,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,EAAE;YAC1C,qCAAqC;YACrC,IACE,UAAU,KAAK,OAAO;gBACtB,OAAO,CAAC,UAAU,CAAC,WAAW,KAAK,SAAS,EAC5C;gBACA,SAAS;aACV;YAED,0CAA0C;YAC1C,MAAM,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;YAE/C,wBAAwB;YACxB,IAAI,MAAM,IAAI,MAAM,CAAC,OAAO,EAAE;gBAC5B,MAAM,CAAC,OAAO,CAAC,MAAM,GAAG,IAAA,8BAAsB,EAC5C,MAAM,CAAC,OAAO,CAAC,MAAkB,CAClC,CAAC;aACH;SACF;IACH,CAAC,CAAC,CAAC;AACL,CAAC;AA7BD,4EA6BC"}
@@ -1,6 +1,6 @@
1
1
  import { Rule } from '@angular-devkit/schematics';
2
2
  import { NodeDependencyType } from '@schematics/angular/utility/dependencies';
3
- declare type PackageDetails = {
3
+ type PackageDetails = {
4
4
  name: string;
5
5
  version: string;
6
6
  type: NodeDependencyType;
@@ -0,0 +1,2 @@
1
+ import { Rule } from '@angular-devkit/schematics';
2
+ export declare function modifyTsConfig(): Rule;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.modifyTsConfig = void 0;
4
+ const json_file_1 = require("../utility/json-file");
5
+ function modifyTsConfig() {
6
+ return (tree) => {
7
+ const filePath = '/tsconfig.json';
8
+ const tsConfig = new json_file_1.JsonFile(tree, filePath);
9
+ // Allow importing JSON files.
10
+ tsConfig.modify(['compilerOptions', 'esModuleInterop'], true);
11
+ };
12
+ }
13
+ exports.modifyTsConfig = modifyTsConfig;
14
+ //# sourceMappingURL=modify-tsconfig.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"modify-tsconfig.js","sourceRoot":"","sources":["../../../../../../../libs/components/packages/src/schematics/rules/modify-tsconfig.ts"],"names":[],"mappings":";;;AAEA,oDAAgD;AAEhD,SAAgB,cAAc;IAC5B,OAAO,CAAC,IAAI,EAAE,EAAE;QACd,MAAM,QAAQ,GAAG,gBAAgB,CAAC;QAClC,MAAM,QAAQ,GAAG,IAAI,oBAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;QAE9C,8BAA8B;QAC9B,QAAQ,CAAC,MAAM,CAAC,CAAC,iBAAiB,EAAE,iBAAiB,CAAC,EAAE,IAAI,CAAC,CAAC;IAChE,CAAC,CAAC;AACJ,CAAC;AARD,wCAQC"}
@@ -0,0 +1,5 @@
1
+ import { UnitTestTree } from '@angular-devkit/schematics/testing';
2
+ /**
3
+ * Returns JSON contents with a typeof 'any'.
4
+ */
5
+ export declare function readJson(tree: UnitTestTree, filePath: string): any;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.readJson = void 0;
4
+ /**
5
+ * Returns JSON contents with a typeof 'any'.
6
+ */
7
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
8
+ function readJson(tree, filePath) {
9
+ return tree.readJson(filePath);
10
+ }
11
+ exports.readJson = readJson;
12
+ //# sourceMappingURL=tree.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tree.js","sourceRoot":"","sources":["../../../../../../../libs/components/packages/src/schematics/testing/tree.ts"],"names":[],"mappings":";;;AAEA;;GAEG;AACH,8DAA8D;AAC9D,SAAgB,QAAQ,CAAC,IAAkB,EAAE,QAAgB;IAC3D,OAAO,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;AACjC,CAAC;AAFD,4BAEC"}
@@ -4,8 +4,8 @@
4
4
  */
5
5
  import { JsonValue } from '@angular-devkit/core';
6
6
  import { Tree } from '@angular-devkit/schematics';
7
- export declare type InsertionIndex = (properties: string[]) => number;
8
- export declare type JsonPath = (string | number)[];
7
+ export type InsertionIndex = (properties: string[]) => number;
8
+ export type JsonPath = (string | number)[];
9
9
  /**
10
10
  * Handles JSONC files (JSON files that include comments).
11
11
  * @internal
@@ -8,6 +8,9 @@ const jsonc_parser_1 = require("jsonc-parser");
8
8
  * @internal
9
9
  */
10
10
  class JsonFile {
11
+ #jsonAst;
12
+ #host;
13
+ #path;
11
14
  constructor(host, path) {
12
15
  this.#host = host;
13
16
  this.#path = path;
@@ -19,9 +22,6 @@ class JsonFile {
19
22
  throw new Error(`Could not read '${path}'.`);
20
23
  }
21
24
  }
22
- #jsonAst;
23
- #host;
24
- #path;
25
25
  get(jsonPath) {
26
26
  const jsonAstNode = this.#getJsonAst();
27
27
  if (!jsonAstNode) {
@@ -1 +1 @@
1
- {"version":3,"file":"json-file.js","sourceRoot":"","sources":["../../../../../../../libs/components/packages/src/schematics/utility/json-file.ts"],"names":[],"mappings":";AAAA,0BAA0B;;;AAS1B,+CASsB;AAKtB;;;GAGG;AACH,MAAa,QAAQ;IAQnB,YAAY,IAAU,EAAE,IAAY;QAClC,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QAClB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QAClB,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC/B,IAAI,MAAM,EAAE;YACV,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,QAAQ,EAAE,CAAC;SAClC;aAAM;YACL,MAAM,IAAI,KAAK,CAAC,mBAAmB,IAAI,IAAI,CAAC,CAAC;SAC9C;IACH,CAAC;IAdD,QAAQ,CAAmB;IAE3B,KAAK,CAAO;IACZ,KAAK,CAAS;IAaP,GAAG,CAAC,QAAkB;QAC3B,MAAM,WAAW,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;QACvC,IAAI,CAAC,WAAW,EAAE;YAChB,OAAO,SAAS,CAAC;SAClB;QAED,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE;YACzB,OAAO,IAAA,2BAAY,EAAC,WAAW,CAAC,CAAC;SAClC;QAED,MAAM,IAAI,GAAG,IAAA,iCAAkB,EAAC,WAAW,EAAE,QAAQ,CAAC,CAAC;QAEvD,OAAO,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAA,2BAAY,EAAC,IAAI,CAAC,CAAC;IAC7D,CAAC;IAEM,MAAM,CACX,QAAkB,EAClB,KAA4B,EAC5B,aAAsC;QAEtC,IAAI,iBAA6C,CAAC;Q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kBAAkB,EAAE,IAAI;SACzB,CAAC,CAAC;QACH,IAAI,MAAM,CAAC,MAAM,EAAE;YACjB,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;YACpC,MAAM,IAAI,KAAK,CACb,oBACE,IAAI,CAAC,KACP,yBAAyB,IAAA,kCAAmB,EAC1C,KAAK,CACN,iBAAiB,MAAM,GAAG,CAC5B,CAAC;SACH;QAED,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;CACF;AAzFD,4BAyFC"}
1
+ {"version":3,"file":"json-file.js","sourceRoot":"","sources":["../../../../../../../libs/components/packages/src/schematics/utility/json-file.ts"],"names":[],"mappings":";AAAA,0BAA0B;;;AAS1B,+CASsB;AAKtB;;;GAGG;AACH,MAAa,QAAQ;IAGnB,QAAQ,CAAmB;IAE3B,KAAK,CAAO;IACZ,KAAK,CAAS;IAEd,YAAY,IAAU,EAAE,IAAY;QAClC,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QAClB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QAClB,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC/B,IAAI,MAAM,EAAE;YACV,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,QAAQ,EAAE,CAAC;SAClC;aAAM;YACL,MAAM,IAAI,KAAK,CAAC,mBAAmB,IAAI,IAAI,CAAC,CAAC;SAC9C;IACH,CAAC;IAEM,GAAG,CAAC,QAAkB;QAC3B,MAAM,WAAW,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;QACvC,IAAI,CAAC,WAAW,EAAE;YAChB,OAAO,SAAS,CAAC;SAClB;QAED,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE;YACzB,OAAO,IAAA,2BAAY,EAAC,WAAW,CAAC,CAAC;SAClC;QAED,MAAM,IAAI,GAAG,IAAA,iCAAkB,EAAC,WAAW,EAAE,QAAQ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ED,WAAW;QACT,IAAI,IAAI,CAAC,QAAQ,EAAE;YACjB,OAAO,IAAI,CAAC,QAAQ,CAAC;SACtB;QAED,MAAM,MAAM,GAAiB,EAAE,CAAC;QAChC,IAAI,CAAC,QAAQ,GAAG,IAAA,wBAAS,EAAC,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE;YAC9C,kBAAkB,EAAE,IAAI;SACzB,CAAC,CAAC;QACH,IAAI,MAAM,CAAC,MAAM,EAAE;YACjB,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;YACpC,MAAM,IAAI,KAAK,CACb,oBACE,IAAI,CAAC,KACP,yBAAyB,IAAA,kCAAmB,EAC1C,KAAK,CACN,iBAAiB,MAAM,GAAG,CAC5B,CAAC;SACH;QAED,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;CACF;AAzFD,4BAyFC"}
@@ -1,17 +1,25 @@
1
- import { workspaces } from '@angular-devkit/core';
1
+ import { ProjectDefinition, WorkspaceDefinition, WorkspaceHost } from '@angular-devkit/core/src/workspace';
2
2
  import { Rule, Tree } from '@angular-devkit/schematics';
3
3
  /**
4
4
  * Returns the workspace host and project config (angular.json).
5
5
  */
6
6
  export declare function getWorkspace(tree: Tree): Promise<{
7
- host: workspaces.WorkspaceHost;
8
- workspace: workspaces.WorkspaceDefinition;
7
+ host: WorkspaceHost;
8
+ workspace: WorkspaceDefinition;
9
9
  }>;
10
- export declare function getProject(workspace: workspaces.WorkspaceDefinition, projectName: string): Promise<{
11
- project: workspaces.ProjectDefinition;
10
+ export declare function getProject(workspace: WorkspaceDefinition, projectName: string): Promise<{
11
+ project: ProjectDefinition;
12
12
  projectName: string;
13
13
  }>;
14
14
  /**
15
15
  * Allows updates to the Angular project config (angular.json).
16
16
  */
17
- export declare function updateWorkspace(updater: (workspace: workspaces.WorkspaceDefinition) => void | Promise<void>): Rule;
17
+ export declare function updateWorkspace(updater: (workspace: WorkspaceDefinition) => void | Promise<void>): Rule;
18
+ /**
19
+ * Returns the project definition corresponding to the provided name, or throws an
20
+ * error if the project is not found.
21
+ */
22
+ export declare function getRequiredProject(tree: Tree, projectName: string | undefined): Promise<{
23
+ projectName: string;
24
+ project: ProjectDefinition;
25
+ }>;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.updateWorkspace = exports.getProject = exports.getWorkspace = void 0;
4
- const core_1 = require("@angular-devkit/core");
3
+ exports.getRequiredProject = exports.updateWorkspace = exports.getProject = exports.getWorkspace = void 0;
4
+ const workspace_1 = require("@angular-devkit/core/src/workspace");
5
5
  const schematics_1 = require("@angular-devkit/schematics");
6
6
  const tree_1 = require("./tree");
7
7
  /**
@@ -32,7 +32,7 @@ function createHost(tree) {
32
32
  */
33
33
  async function getWorkspace(tree) {
34
34
  const host = createHost(tree);
35
- const { workspace } = await core_1.workspaces.readWorkspace('/', host);
35
+ const { workspace } = await (0, workspace_1.readWorkspace)('/', host);
36
36
  return { host, workspace };
37
37
  }
38
38
  exports.getWorkspace = getWorkspace;
@@ -53,8 +53,24 @@ function updateWorkspace(updater) {
53
53
  // Send the workspace to the callback to allow it to be modified.
54
54
  await updater(workspace);
55
55
  // Update the workspace config with any changes.
56
- await core_1.workspaces.writeWorkspace(workspace, host);
56
+ await (0, workspace_1.writeWorkspace)(workspace, host);
57
57
  };
58
58
  }
59
59
  exports.updateWorkspace = updateWorkspace;
60
+ /**
61
+ * Returns the project definition corresponding to the provided name, or throws an
62
+ * error if the project is not found.
63
+ */
64
+ async function getRequiredProject(tree, projectName) {
65
+ if (!projectName) {
66
+ throw new Error('A project name is required.');
67
+ }
68
+ const { workspace } = await getWorkspace(tree);
69
+ const project = workspace.projects.get(projectName);
70
+ if (!project) {
71
+ throw new Error(`The project '${projectName}' was not found in the workspace configuration.`);
72
+ }
73
+ return { projectName, project };
74
+ }
75
+ exports.getRequiredProject = getRequiredProject;
60
76
  //# sourceMappingURL=workspace.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"workspace.js","sourceRoot":"","sources":["../../../../../../../libs/components/packages/src/schematics/utility/workspace.ts"],"names":[],"mappings":";;;AAAA,+CAAkD;AAClD,2DAA6E;AAE7E,iCAA0C;AAE1C;;;GAGG;AACH,SAAS,UAAU,CAAC,IAAU;IAC5B,OAAO;QACL,0BAA0B;QAC1B,KAAK,CAAC,QAAQ,CAAC,IAAY;YACzB,OAAO,IAAA,uBAAgB,EAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QACtC,CAAC;QACD,0BAA0B;QAC1B,KAAK,CAAC,SAAS,CAAC,IAAY,EAAE,IAAY;YACxC,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QACpC,CAAC;QACD,KAAK,CAAC,WAAW,CAAC,IAAY;YAC5B,gCAAgC;YAChC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC;QACrE,CAAC;QACD,KAAK,CAAC,MAAM,CAAC,IAAY;YACvB,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAC3B,CAAC;KACF,CAAC;AACJ,CAAC;AAED;;GAEG;AACI,KAAK,UAAU,YAAY,CAAC,IAAU;IAI3C,MAAM,IAAI,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC;IAC9B,MAAM,EAAE,SAAS,EAAE,GAAG,MAAM,iBAAU,CAAC,aAAa,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;IAChE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;AAC7B,CAAC;AAPD,oCAOC;AAEM,KAAK,UAAU,UAAU,CAC9B,SAAyC,EACzC,WAAmB;IAEnB,MAAM,OAAO,GAAG,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;IACpD,IAAI,CAAC,OAAO,EAAE;QACZ,MAAM,IAAI,gCAAmB,CAC3B,QAAQ,WAAW,yEAAyE,CAC7F,CAAC;KACH;IAED,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,CAAC;AAClC,CAAC;AAZD,gCAYC;AAED;;GAEG;AACH,SAAgB,eAAe,CAC7B,OAA4E;IAE5E,OAAO,KAAK,EAAE,IAAI,EAAE,EAAE;QACpB,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,MAAM,YAAY,CAAC,IAAI,CAAC,CAAC;QAErD,iEAAiE;QACjE,MAAM,OAAO,CAAC,SAAS,CAAC,CAAC;QAEzB,gDAAgD;QAChD,MAAM,iBAAU,CAAC,cAAc,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;IACnD,CAAC,CAAC;AACJ,CAAC;AAZD,0CAYC"}
1
+ {"version":3,"file":"workspace.js","sourceRoot":"","sources":["../../../../../../../libs/components/packages/src/schematics/utility/workspace.ts"],"names":[],"mappings":";;;AAAA,kEAM4C;AAC5C,2DAA6E;AAE7E,iCAA0C;AAE1C;;;GAGG;AACH,SAAS,UAAU,CAAC,IAAU;IAC5B,OAAO;QACL,0BAA0B;QAC1B,KAAK,CAAC,QAAQ,CAAC,IAAY;YACzB,OAAO,IAAA,uBAAgB,EAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QACtC,CAAC;QACD,0BAA0B;QAC1B,KAAK,CAAC,SAAS,CAAC,IAAY,EAAE,IAAY;YACxC,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QACpC,CAAC;QACD,KAAK,CAAC,WAAW,CAAC,IAAY;YAC5B,gCAAgC;YAChC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC;QACrE,CAAC;QACD,KAAK,CAAC,MAAM,CAAC,IAAY;YACvB,OAA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C/C,MAAM,OAAO,GAAG,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;IAEpD,IAAI,CAAC,OAAO,EAAE;QACZ,MAAM,IAAI,KAAK,CACb,gBAAgB,WAAW,iDAAiD,CAC7E,CAAC;KACH;IAED,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,CAAC;AAClC,CAAC;AAlBD,gDAkBC"}
File without changes
@@ -1 +0,0 @@
1
- {"version":3,"file":"polyfills.js","sourceRoot":"","sources":["../../../../../libs/components/packages/src/polyfills.ts"],"names":[],"mappings":""}
@@ -1,7 +0,0 @@
1
- {
2
- "$schema": "http://json-schema.org/schema",
3
- "$id": "UpdatePolyfill",
4
- "title": "Update polyfill to switch to config",
5
- "description": "Remove code from polyfills.ts/test.ts and add @skyux/packages/polyfills to workspace config.",
6
- "type": "object"
7
- }
@@ -1,9 +0,0 @@
1
- import { Rule } from '@angular-devkit/schematics';
2
- /**
3
- * Calls a replacer function on every import statement of every TypeScript file in the tree.
4
- * If changes are made to the import statements, you may call the `beforeFileUpdate` callback
5
- * to make any changes to the file's contents before the file is updated on the file system.
6
- * @param importStatementReplacer Returns the updated import statement.
7
- * @param beforeFileUpdate Returns the updated file contents.
8
- */
9
- export declare function replaceTypeScriptImports(importStatementReplacer: (importStatement: string, importPath: string, fileContents: string) => string, beforeFileUpdate?: (fileContents: string) => string): Rule;
@@ -1,32 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.replaceTypeScriptImports = void 0;
4
- const core_1 = require("@angular-devkit/core");
5
- const tree_1 = require("../utility/tree");
6
- /**
7
- * Calls a replacer function on every import statement of every TypeScript file in the tree.
8
- * If changes are made to the import statements, you may call the `beforeFileUpdate` callback
9
- * to make any changes to the file's contents before the file is updated on the file system.
10
- * @param importStatementReplacer Returns the updated import statement.
11
- * @param beforeFileUpdate Returns the updated file contents.
12
- */
13
- function replaceTypeScriptImports(importStatementReplacer, beforeFileUpdate = (content) => content) {
14
- return (tree) => {
15
- const visitor = (filePath) => {
16
- const extension = (0, core_1.extname)(filePath);
17
- if (extension === '.ts') {
18
- const contents = (0, tree_1.readRequiredFile)(tree, filePath);
19
- const migratedContents = contents.replace(/import +{?[\w,\s]+}? +from +['"](.*)['"];?/g, (importStatement, importPath) => {
20
- return importStatementReplacer(importStatement, importPath, contents);
21
- });
22
- if (contents !== migratedContents) {
23
- tree.overwrite(filePath, beforeFileUpdate(migratedContents));
24
- }
25
- }
26
- };
27
- tree.getDir('projects').visit(visitor);
28
- tree.getDir('src').visit(visitor);
29
- };
30
- }
31
- exports.replaceTypeScriptImports = replaceTypeScriptImports;
32
- //# sourceMappingURL=replace-typescript-imports.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"replace-typescript-imports.js","sourceRoot":"","sources":["../../../../../../../libs/components/packages/src/schematics/rules/replace-typescript-imports.ts"],"names":[],"mappings":";;;AAAA,+CAA+C;AAG/C,0CAAmD;AAEnD;;;;;;GAMG;AACH,SAAgB,wBAAwB,CACtC,uBAIW,EACX,mBAAqD,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO;IAEzE,OAAO,CAAC,IAAI,EAAE,EAAE;QACd,MAAM,OAAO,GAAgB,CAAC,QAAQ,EAAE,EAAE;YACxC,MAAM,SAAS,GAAG,IAAA,cAAO,EAAC,QAAQ,CAAC,CAAC;YACpC,IAAI,SAAS,KAAK,KAAK,EAAE;gBACvB,MAAM,QAAQ,GAAG,IAAA,uBAAgB,EAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;gBAElD,MAAM,gBAAgB,GAAG,QAAQ,CAAC,OAAO,CACvC,6CAA6C,EAC7C,CAAC,eAAe,EAAE,UAAU,EAAE,EAAE;oBAC9B,OAAO,uBAAuB,CAC5B,eAAe,EACf,UAAU,EACV,QAAQ,CACT,CAAC;gBACJ,CAAC,CACF,CAAC;gBAEF,IAAI,QAAQ,KAAK,gBAAgB,EAAE;oBACjC,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,gBAAgB,CAAC,gBAAgB,CAAC,CAAC,CAAC;iBAC9D;aACF;QACH,CAAC,CAAC;QAEF,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QACvC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IACpC,CAAC,CAAC;AACJ,CAAC;AAlCD,4DAkCC"}