@magic-xpa/cli 4.1000.0 → 4.1100.0-dev000.0
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.
- package/README.md +28 -28
- package/index.d.ts +1 -1
- package/index.js +4 -4
- package/index.js.map +1 -1
- package/index.ts +1 -1
- package/package.json +2 -2
- package/src/collection.json +75 -75
- package/src/public_api.d.ts +3 -3
- package/src/public_api.js +6 -6
- package/src/public_api.js.map +1 -1
- package/src/public_api.ts +5 -5
- package/src/schematics/magic-utils/Util.d.ts +6 -6
- package/src/schematics/magic-utils/Util.js +26 -26
- package/src/schematics/magic-utils/Util.js.map +1 -1
- package/src/schematics/magic-utils/config.d.ts +12 -12
- package/src/schematics/magic-utils/config.js +56 -56
- package/src/schematics/magic-utils/config.js.map +1 -1
- package/src/schematics/magic-utils/config.ts +68 -68
- package/src/schematics/magic-utils/env.d.ts +23 -23
- package/src/schematics/magic-utils/env.js +39 -39
- package/src/schematics/magic-utils/env.js.map +1 -1
- package/src/schematics/magic-utils/env.ts +50 -50
- package/src/schematics/magic-utils/manifest.d.ts +11 -11
- package/src/schematics/magic-utils/manifest.js +40 -40
- package/src/schematics/magic-utils/manifest.js.map +1 -1
- package/src/schematics/magic-utils/manifest.ts +46 -46
- package/src/schematics/magic-utils/metadata.class.d.ts +51 -51
- package/src/schematics/magic-utils/metadata.class.js +124 -124
- package/src/schematics/magic-utils/metadata.class.js.map +1 -1
- package/src/schematics/magic-utils/metadata.class.ts +159 -159
- package/src/schematics/magic-utils/process-json.d.ts +2 -2
- package/src/schematics/magic-utils/process-json.js +157 -158
- package/src/schematics/magic-utils/process-json.js.map +1 -1
- package/src/schematics/magic-utils/rules/build-control.rule.d.ts +5 -5
- package/src/schematics/magic-utils/rules/build-control.rule.js +73 -74
- package/src/schematics/magic-utils/rules/build-control.rule.js.map +1 -1
- package/src/schematics/magic-utils/rules/build-view.rule.d.ts +3 -3
- package/src/schematics/magic-utils/rules/build-view.rule.js +82 -80
- package/src/schematics/magic-utils/rules/build-view.rule.js.map +1 -1
- package/src/schematics/magic-utils/rules/build-view.rule.ts +4 -0
- package/src/schematics/magic-utils/rules/component-list.rule.d.ts +3 -3
- package/src/schematics/magic-utils/rules/component-list.rule.js +316 -317
- package/src/schematics/magic-utils/rules/component-list.rule.js.map +1 -1
- package/src/schematics/magic-utils/rules/generate.rule.d.ts +5 -5
- package/src/schematics/magic-utils/rules/generate.rule.js +53 -54
- package/src/schematics/magic-utils/rules/generate.rule.js.map +1 -1
- package/src/schematics/magic-utils/rules/generate.rule.ts +61 -61
- package/src/schematics/magic-utils/rules/init-add-modules.rule.d.ts +12 -12
- package/src/schematics/magic-utils/rules/init-add-modules.rule.js +295 -296
- package/src/schematics/magic-utils/rules/init-add-modules.rule.js.map +1 -1
- package/src/schematics/magic-utils/rules/init-add-modules.rule.ts +360 -360
- package/src/schematics/magic-utils/rules/init-gen-components.rule.d.ts +4 -4
- package/src/schematics/magic-utils/rules/init-gen-components.rule.js +65 -66
- package/src/schematics/magic-utils/rules/init-gen-components.rule.js.map +1 -1
- package/src/schematics/magic-utils/rules/init-magic-metadata.rule.d.ts +3 -3
- package/src/schematics/magic-utils/rules/init-magic-metadata.rule.js +17 -18
- package/src/schematics/magic-utils/rules/init-magic-metadata.rule.js.map +1 -1
- package/src/schematics/magic-utils/rules/init-magic-metadata.rule.ts +19 -19
- package/src/schematics/magic-utils/rules/load-views-gen.rule.d.ts +3 -3
- package/src/schematics/magic-utils/rules/load-views-gen.rule.js +28 -29
- package/src/schematics/magic-utils/rules/load-views-gen.rule.js.map +1 -1
- package/src/schematics/magic-utils/rules/magic-option.scheme.d.ts +22 -21
- package/src/schematics/magic-utils/rules/magic-option.scheme.js +2 -2
- package/src/schematics/magic-utils/rules/magic-option.scheme.js.map +1 -1
- package/src/schematics/magic-utils/rules/magic-option.scheme.ts +24 -23
- package/src/schematics/magic-utils/utils.d.ts +12 -12
- package/src/schematics/magic-utils/utils.js +116 -117
- package/src/schematics/magic-utils/utils.js.map +1 -1
- package/src/schematics/magic-utils/utils.ts +134 -134
- package/src/schematics/mg-Install-prerequisites/index.d.ts +3 -3
- package/src/schematics/mg-Install-prerequisites/index.js +24 -25
- package/src/schematics/mg-Install-prerequisites/index.js.map +1 -1
- package/src/schematics/mg-Install-prerequisites/index.ts +30 -30
- package/src/schematics/mg-Install-prerequisites/schema.json +14 -14
- package/src/schematics/mg-add/files/src/app/app.component.html +17 -17
- package/src/schematics/mg-add/files/src/app/app.routes.ts +14 -14
- package/src/schematics/mg-add/files/src/app/magic/component-list.g.ts +9 -9
- package/src/schematics/mg-add/files/src/app/magic/lazy-loader.service.ts +2 -1
- package/src/schematics/mg-add/files/src/app/magic/magic.gen.lib.module.ts +19 -19
- package/src/schematics/mg-add/files/src/magic-styles.css +131 -131
- package/src/schematics/mg-add/index.d.ts +3 -3
- package/src/schematics/mg-add/index.js +150 -151
- package/src/schematics/mg-add/index.js.map +1 -1
- package/src/schematics/mg-add/schema.json +29 -29
- package/src/schematics/mg-add/utils/add-declaration-to-root-module.d.ts +2 -2
- package/src/schematics/mg-add/utils/add-declaration-to-root-module.js +10 -11
- package/src/schematics/mg-add/utils/add-declaration-to-root-module.js.map +1 -1
- package/src/schematics/mg-add/utils/add-declaration-to-root-module.ts +12 -12
- package/src/schematics/mg-add/webModule/app.routes.ts +14 -14
- package/src/schematics/mg-add-tasks/index.d.ts +3 -3
- package/src/schematics/mg-add-tasks/index.js +29 -30
- package/src/schematics/mg-add-tasks/index.js.map +1 -1
- package/src/schematics/mg-add-tasks/index.ts +53 -53
- package/src/schematics/mg-add-tasks/schema.json +41 -41
- package/src/schematics/mg-delete-files/index.d.ts +3 -3
- package/src/schematics/mg-delete-files/index.js +12 -13
- package/src/schematics/mg-delete-files/index.js.map +1 -1
- package/src/schematics/mg-delete-files/index.ts +12 -12
- package/src/schematics/mg-delete-files/schema.json +14 -14
- package/src/schematics/mg-gen-module/index.d.ts +3 -3
- package/src/schematics/mg-gen-module/index.js +14 -15
- package/src/schematics/mg-gen-module/index.js.map +1 -1
- package/src/schematics/mg-gen-module/index.ts +14 -14
- package/src/schematics/mg-gen-module/schema.json +24 -24
- package/src/schematics/mg-generate/index.d.ts +3 -3
- package/src/schematics/mg-generate/index.js +12 -13
- package/src/schematics/mg-generate/index.js.map +1 -1
- package/src/schematics/mg-generate/index.ts +12 -12
- package/src/schematics/mg-generate/schema.json +34 -34
- package/src/schematics/mg-generate-component/index.d.ts +3 -3
- package/src/schematics/mg-generate-component/index.js +34 -35
- package/src/schematics/mg-generate-component/index.js.map +1 -1
- package/src/schematics/mg-generate-component/schema.json +6 -0
- package/src/schematics/mg-install/index.d.ts +3 -3
- package/src/schematics/mg-install/index.js +29 -30
- package/src/schematics/mg-install/index.js.map +1 -1
- package/src/schematics/mg-install/index.ts +37 -37
- package/src/schematics/mg-install/schema.json +24 -24
- package/src/schematics/mg-routes/index.d.ts +6 -6
- package/src/schematics/mg-routes/index.js +62 -63
- package/src/schematics/mg-routes/index.js.map +1 -1
- package/src/schematics/mg-routes/schema.json +14 -14
- package/src/schematics/mg-single-control/index.d.ts +3 -3
- package/src/schematics/mg-single-control/index.js +28 -29
- package/src/schematics/mg-single-control/index.js.map +1 -1
- package/src/schematics/mg-single-control/schema.json +24 -24
- package/src/schematics/utils/ast.d.ts +21 -21
- package/src/schematics/utils/ast.js +90 -91
- package/src/schematics/utils/ast.js.map +1 -1
- package/src/schematics/utils/ast.ts +103 -103
- package/src/schematics/utils/devkit-utils/README.md +1 -1
- package/src/schematics/utils/devkit-utils/ast-utils.d.ts +87 -87
- package/src/schematics/utils/devkit-utils/ast-utils.js +489 -490
- package/src/schematics/utils/devkit-utils/ast-utils.js.map +1 -1
- package/src/schematics/utils/devkit-utils/ast-utils.ts +570 -570
- package/src/schematics/utils/devkit-utils/ast-utils_old.d.ts +68 -68
- package/src/schematics/utils/devkit-utils/ast-utils_old.js +419 -420
- package/src/schematics/utils/devkit-utils/ast-utils_old.js.map +1 -1
- package/src/schematics/utils/devkit-utils/ast-utils_old.ts +478 -478
- package/src/schematics/utils/devkit-utils/change.d.ts +66 -66
- package/src/schematics/utils/devkit-utils/change.js +94 -94
- package/src/schematics/utils/devkit-utils/change.js.map +1 -1
- package/src/schematics/utils/devkit-utils/change.ts +127 -127
- package/src/schematics/utils/devkit-utils/component.d.ts +2 -2
- package/src/schematics/utils/devkit-utils/component.js +96 -97
- package/src/schematics/utils/devkit-utils/component.js.map +1 -1
- package/src/schematics/utils/devkit-utils/component.ts +136 -136
- package/src/schematics/utils/devkit-utils/config.d.ts +78 -78
- package/src/schematics/utils/devkit-utils/config.js +52 -52
- package/src/schematics/utils/devkit-utils/config.js.map +1 -1
- package/src/schematics/utils/devkit-utils/config.ts +120 -120
- package/src/schematics/utils/devkit-utils/find-module.d.ts +28 -28
- package/src/schematics/utils/devkit-utils/find-module.js +92 -93
- package/src/schematics/utils/devkit-utils/find-module.js.map +1 -1
- package/src/schematics/utils/devkit-utils/find-module.ts +108 -108
- package/src/schematics/utils/devkit-utils/ng-ast-utils.d.ts +5 -5
- package/src/schematics/utils/devkit-utils/ng-ast-utils.js +73 -74
- package/src/schematics/utils/devkit-utils/ng-ast-utils.js.map +1 -1
- package/src/schematics/utils/devkit-utils/ng-ast-utils.ts +84 -84
- package/src/schematics/utils/devkit-utils/parse-name.d.ts +13 -13
- package/src/schematics/utils/devkit-utils/parse-name.js +19 -20
- package/src/schematics/utils/devkit-utils/parse-name.js.map +1 -1
- package/src/schematics/utils/devkit-utils/parse-name.ts +24 -24
- package/src/schematics/utils/devkit-utils/route-utils.d.ts +20 -20
- package/src/schematics/utils/devkit-utils/route-utils.js +133 -134
- package/src/schematics/utils/devkit-utils/route-utils.js.map +1 -1
- package/src/schematics/utils/devkit-utils/route-utils.ts +180 -180
- package/src/schematics/utils/devkit-utils/validation.d.ts +1 -1
- package/src/schematics/utils/devkit-utils/validation.js +18 -19
- package/src/schematics/utils/devkit-utils/validation.js.map +1 -1
- package/src/schematics/utils/devkit-utils/validation.ts +16 -16
- package/src/schematics/utils/html.d.ts +18 -18
- package/src/schematics/utils/html.js +59 -60
- package/src/schematics/utils/html.js.map +1 -1
- package/src/schematics/utils/html.ts +63 -63
- package/src/schematics/utils/lib-versions.d.ts +3 -3
- package/src/schematics/utils/lib-versions.js +6 -6
- package/src/schematics/utils/lib-versions.js.map +1 -1
- package/src/schematics/utils/lib-versions.ts +3 -3
- package/src/schematics/utils/package.d.ts +5 -5
- package/src/schematics/utils/package.js +20 -21
- package/src/schematics/utils/package.js.map +1 -1
- package/src/schematics/utils/package.ts +22 -22
- package/src/schematics/utils/testing.d.ts +5 -5
- package/src/schematics/utils/testing.js +26 -27
- package/src/schematics/utils/testing.js.map +1 -1
- package/src/schematics/utils/testing.ts +25 -25
- package/src/types/enums/Enums.d.ts +1646 -1646
- package/src/types/enums/Enums.js +1862 -1862
- package/src/types/enums/Enums.js.map +1 -1
- package/src/types/enums/Enums.ts +2063 -2063
- package/src/types/enums/generated-file-types.enum.d.ts +6 -6
- package/src/types/enums/generated-file-types.enum.js +10 -10
- package/src/types/enums/generated-file-types.enum.js.map +1 -1
- package/src/types/enums/generated-file-types.enum.ts +6 -6
- package/src/types/enums/horizontal-alignments.enum.d.ts +5 -5
- package/src/types/enums/horizontal-alignments.enum.js +9 -9
- package/src/types/enums/horizontal-alignments.enum.js.map +1 -1
- package/src/types/enums/horizontal-alignments.enum.ts +6 -6
- package/src/types/enums/themes.enum.d.ts +6 -6
- package/src/types/enums/themes.enum.js +10 -10
- package/src/types/enums/themes.enum.js.map +1 -1
- package/src/types/enums/themes.enum.ts +6 -6
- package/src/types/index.d.ts +7 -7
- package/src/types/index.js +10 -10
- package/src/types/index.js.map +1 -1
- package/src/types/index.ts +8 -8
- package/src/types/interfaces/app.d.ts +53 -53
- package/src/types/interfaces/app.js +9 -9
- package/src/types/interfaces/app.js.map +1 -1
- package/src/types/interfaces/app.ts +89 -89
- package/src/types/interfaces/control.d.ts +82 -82
- package/src/types/interfaces/control.js +2 -2
- package/src/types/interfaces/control.js.map +1 -1
- package/src/types/interfaces/control.ts +106 -106
- package/src/types/interfaces/env.interface.d.ts +19 -19
- package/src/types/interfaces/env.interface.js +10 -10
- package/src/types/interfaces/template.config.d.ts +8 -8
- package/src/types/interfaces/template.config.js +2 -2
- package/src/types/interfaces/template.config.js.map +1 -1
- package/src/types/interfaces/template.config.ts +11 -11
- package/templates/angular/src/app/app.component.html.ejs +17 -17
- package/templates/angular/src/app/cmp-array.ejs +3 -3
- package/templates/angular/src/app/cmp-hash.ejs +3 -3
- package/templates/angular/src/app/component-list.g.ts +21 -21
- package/templates/angular/src/app.component.ts +14 -14
- package/templates/angular/src/app.module.ts +70 -70
- package/templates/angular/src/app.routes.ts +73 -73
- package/templates/angular/src/styles/app.css +5 -5
- package/templates/attributes/button_attributes.ejs +2 -2
- package/templates/attributes/common/base/class.ejs +6 -6
- package/templates/attributes/common/base/control_type.ejs +53 -53
- package/templates/attributes/common/base/enabled.ejs +9 -9
- package/templates/attributes/common/base/imageFileName.ejs +3 -3
- package/templates/attributes/common/base/no_control_class.ejs +3 -3
- package/templates/attributes/common/base/rtol.ejs +3 -3
- package/templates/attributes/common/base/tabindex.ejs +11 -11
- package/templates/attributes/common/base/testingId.ejs +8 -8
- package/templates/attributes/common/base/tooltip.ejs +7 -7
- package/templates/attributes/common/base/visible.ejs +6 -6
- package/templates/attributes/common/base/wallpaper.ejs +3 -3
- package/templates/attributes/common/base_attributes.ejs +10 -10
- package/templates/attributes/common/container_attributes.ejs +6 -6
- package/templates/attributes/common/control_attributes.ejs +3 -3
- package/templates/attributes/common/format.ejs +5 -5
- package/templates/attributes/common/input/hint.ejs +13 -13
- package/templates/attributes/common/input/multiline_edit.ejs +3 -3
- package/templates/attributes/common/input/must_input.ejs +8 -8
- package/templates/attributes/common/input/password_edit.ejs +7 -7
- package/templates/attributes/common/input/row_editing_input_attributes.ejs +6 -6
- package/templates/attributes/common/input/validation.ejs +5 -5
- package/templates/attributes/common/input_attributes.ejs +4 -4
- package/templates/attributes/common/no_control_base_attributes.ejs +4 -4
- package/templates/attributes/common/row_editing_button_attributes.ejs +10 -10
- package/templates/component/view.component.html +14 -14
- package/templates/component/view.component.ts +123 -122
- package/templates/themes/basicHTML/Code/theme.module.ts +10 -10
- package/templates/themes/basicHTML/checkbox.ejs +1 -1
- package/templates/themes/basicHTML/combobox.ejs +37 -37
- package/templates/themes/basicHTML/edit.ejs +169 -168
- package/templates/themes/basicHTML/form.ejs +4 -4
- package/templates/themes/basicHTML/group.ejs +4 -4
- package/templates/themes/basicHTML/image.ejs +6 -6
- package/templates/themes/basicHTML/label.ejs +11 -11
- package/templates/themes/basicHTML/listbox.ejs +21 -21
- package/templates/themes/basicHTML/push-button.ejs +28 -28
- package/templates/themes/basicHTML/radio.ejs +20 -20
- package/templates/themes/basicHTML/subform.ejs +6 -6
- package/templates/themes/basicHTML/tab.ejs +31 -31
- package/templates/themes/basicHTML/tabpage.ejs +5 -5
- package/templates/themes/basicHiddenHTML/Code/theme.module.ts +10 -10
- package/templates/themes/basicHiddenHTML/combobox.ejs +5 -5
- package/templates/themes/basicHiddenHTML/form.ejs +3 -3
- package/templates/themes/basicHiddenHTML/group.ejs +2 -2
- package/templates/themes/basicHiddenHTML/image.ejs +4 -4
- package/templates/themes/basicHiddenHTML/label.ejs +1 -1
- package/templates/themes/basicHiddenHTML/listbox.ejs +8 -8
- package/templates/themes/basicHiddenHTML/push-button.ejs +26 -26
- package/templates/themes/basicHiddenHTML/radio.ejs +17 -17
- package/templates/themes/basicHiddenHTML/tab.ejs +13 -13
- package/templates/themes/basicHiddenHTML/table.ejs +18 -18
- package/templates/themes/basicHiddenHTML/tabpage.ejs +2 -2
- package/templates/themes/container.ejs +26 -26
- package/templates/themes/control.ejs +52 -52
- package/templates/themes/editTypeSelector.ejs +1 -1
- package/templates/themes/material/Code/theme.module.ts +68 -68
- package/templates/themes/material/base_attributes_date.ejs +8 -8
- package/templates/themes/material/checkbox.ejs +1 -1
- package/templates/themes/material/combobox.ejs +43 -43
- package/templates/themes/material/edit.ejs +204 -204
- package/templates/themes/material/group.ejs +3 -3
- package/templates/themes/material/listbox.ejs +22 -23
- package/templates/themes/material/push-button.ejs +28 -28
- package/templates/themes/material/radio.ejs +22 -22
- package/templates/themes/material/subform.ejs +8 -8
- package/templates/themes/material/tab.ejs +19 -19
- package/templates/themes/router_outlet.ejs +5 -5
- package/templates/themes/table/HTMLTable/columnHeader.ejs +3 -1
- package/templates/themes/table/HTMLTable/table.ejs +37 -37
- package/templates/themes/table/grid/additionalComponentCode.ejs +26 -26
- package/templates/themes/table/grid/additionalIncludes.ejs +1 -1
- package/templates/themes/table/grid/column.ejs +3 -1
- package/templates/themes/table/grid/table.ejs +37 -37
- package/templates/themes/table/repeatable/column.ejs +11 -11
- package/templates/themes/table/repeatable/table.ejs +28 -28
- package/templates/themes/tableTypeSelector.ejs +21 -21
- package/tsconfig.json +36 -36
|
@@ -1,63 +1,63 @@
|
|
|
1
|
-
import {Tree, SchematicsException} from '@angular-devkit/schematics';
|
|
2
|
-
import * as parse5 from 'parse5';
|
|
3
|
-
import {getIndexHtmlPath} from './ast';
|
|
4
|
-
import {InsertChange} from './devkit-utils/change';
|
|
5
|
-
import {Project} from './devkit-utils/config';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Parses the index.html file to get the HEAD tag position.
|
|
9
|
-
* @param host the tree we are traversing
|
|
10
|
-
* @param src the src path of the html file to parse
|
|
11
|
-
*/
|
|
12
|
-
export function getHeadTag(host: Tree, src: string) {
|
|
13
|
-
const document = parse5.parse(src,
|
|
14
|
-
{locationInfo: true}) as parse5.AST.Default.Document;
|
|
15
|
-
|
|
16
|
-
let head;
|
|
17
|
-
const visit = (nodes: parse5.AST.Default.Node[]) => {
|
|
18
|
-
nodes.forEach(node => {
|
|
19
|
-
const element = <parse5.AST.Default.Element>node;
|
|
20
|
-
if (element.tagName === 'head') {
|
|
21
|
-
head = element;
|
|
22
|
-
} else {
|
|
23
|
-
if (element.childNodes) {
|
|
24
|
-
visit(element.childNodes);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
});
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
visit(document.childNodes);
|
|
31
|
-
|
|
32
|
-
if (!head) {
|
|
33
|
-
throw new SchematicsException('Head element not found!');
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
return {
|
|
37
|
-
position: head.__location.startTag.endOffset
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* Adds a link to the index.html head tag Example:
|
|
43
|
-
* `<link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500" rel="stylesheet">`
|
|
44
|
-
* @param host The tree we are updating
|
|
45
|
-
* @param project The project we're targeting.
|
|
46
|
-
* @param link html element string we are inserting.
|
|
47
|
-
*/
|
|
48
|
-
export function addHeadLink(host: Tree, project: Project, link: string) {
|
|
49
|
-
const indexPath = getIndexHtmlPath(host, project);
|
|
50
|
-
const buffer = host.read(indexPath);
|
|
51
|
-
if (!buffer) {
|
|
52
|
-
throw new SchematicsException(`Could not find file for path: ${indexPath}`);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
const src = buffer.toString();
|
|
56
|
-
if (src.indexOf(link) === -1) {
|
|
57
|
-
const node = getHeadTag(host, src);
|
|
58
|
-
const insertion = new InsertChange(indexPath, node.position, link);
|
|
59
|
-
const recorder = host.beginUpdate(indexPath);
|
|
60
|
-
recorder.insertLeft(insertion.pos, insertion.toAdd);
|
|
61
|
-
host.commitUpdate(recorder);
|
|
62
|
-
}
|
|
63
|
-
}
|
|
1
|
+
import {Tree, SchematicsException} from '@angular-devkit/schematics';
|
|
2
|
+
import * as parse5 from 'parse5';
|
|
3
|
+
import {getIndexHtmlPath} from './ast';
|
|
4
|
+
import {InsertChange} from './devkit-utils/change';
|
|
5
|
+
import {Project} from './devkit-utils/config';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Parses the index.html file to get the HEAD tag position.
|
|
9
|
+
* @param host the tree we are traversing
|
|
10
|
+
* @param src the src path of the html file to parse
|
|
11
|
+
*/
|
|
12
|
+
export function getHeadTag(host: Tree, src: string) {
|
|
13
|
+
const document = parse5.parse(src,
|
|
14
|
+
{locationInfo: true}) as parse5.AST.Default.Document;
|
|
15
|
+
|
|
16
|
+
let head;
|
|
17
|
+
const visit = (nodes: parse5.AST.Default.Node[]) => {
|
|
18
|
+
nodes.forEach(node => {
|
|
19
|
+
const element = <parse5.AST.Default.Element>node;
|
|
20
|
+
if (element.tagName === 'head') {
|
|
21
|
+
head = element;
|
|
22
|
+
} else {
|
|
23
|
+
if (element.childNodes) {
|
|
24
|
+
visit(element.childNodes);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
visit(document.childNodes);
|
|
31
|
+
|
|
32
|
+
if (!head) {
|
|
33
|
+
throw new SchematicsException('Head element not found!');
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
return {
|
|
37
|
+
position: head.__location.startTag.endOffset
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Adds a link to the index.html head tag Example:
|
|
43
|
+
* `<link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500" rel="stylesheet">`
|
|
44
|
+
* @param host The tree we are updating
|
|
45
|
+
* @param project The project we're targeting.
|
|
46
|
+
* @param link html element string we are inserting.
|
|
47
|
+
*/
|
|
48
|
+
export function addHeadLink(host: Tree, project: Project, link: string) {
|
|
49
|
+
const indexPath = getIndexHtmlPath(host, project);
|
|
50
|
+
const buffer = host.read(indexPath);
|
|
51
|
+
if (!buffer) {
|
|
52
|
+
throw new SchematicsException(`Could not find file for path: ${indexPath}`);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const src = buffer.toString();
|
|
56
|
+
if (src.indexOf(link) === -1) {
|
|
57
|
+
const node = getHeadTag(host, src);
|
|
58
|
+
const insertion = new InsertChange(indexPath, node.position, link);
|
|
59
|
+
const recorder = host.beginUpdate(indexPath);
|
|
60
|
+
recorder.insertLeft(insertion.pos, insertion.toAdd);
|
|
61
|
+
host.commitUpdate(recorder);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export declare const materialVersion = "^6.0.0";
|
|
2
|
-
export declare const cdkVersion = "^6.0.0";
|
|
3
|
-
export declare const angularVersion = "^6.0.0";
|
|
1
|
+
export declare const materialVersion = "^6.0.0";
|
|
2
|
+
export declare const cdkVersion = "^6.0.0";
|
|
3
|
+
export declare const angularVersion = "^6.0.0";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.angularVersion = exports.cdkVersion = exports.materialVersion = void 0;
|
|
4
|
-
exports.materialVersion = '^6.0.0';
|
|
5
|
-
exports.cdkVersion = '^6.0.0';
|
|
6
|
-
exports.angularVersion = '^6.0.0';
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.angularVersion = exports.cdkVersion = exports.materialVersion = void 0;
|
|
4
|
+
exports.materialVersion = '^6.0.0';
|
|
5
|
+
exports.cdkVersion = '^6.0.0';
|
|
6
|
+
exports.angularVersion = '^6.0.0';
|
|
7
7
|
//# sourceMappingURL=lib-versions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lib-versions.js","sourceRoot":"","sources":["lib-versions.ts"],"names":[],"mappings":";;;AAAa,QAAA,eAAe,GAAG,QAAQ,CAAC;AAC3B,QAAA,UAAU,GAAG,QAAQ,CAAC;AACtB,QAAA,cAAc,GAAG,QAAQ,CAAC","sourcesContent":["export const materialVersion = '^6.0.0';\nexport const cdkVersion = '^6.0.0';\nexport const angularVersion = '^6.0.0';\n"]}
|
|
1
|
+
{"version":3,"file":"lib-versions.js","sourceRoot":"","sources":["lib-versions.ts"],"names":[],"mappings":";;;AAAa,QAAA,eAAe,GAAG,QAAQ,CAAC;AAC3B,QAAA,UAAU,GAAG,QAAQ,CAAC;AACtB,QAAA,cAAc,GAAG,QAAQ,CAAC","sourcesContent":["export const materialVersion = '^6.0.0';\r\nexport const cdkVersion = '^6.0.0';\r\nexport const angularVersion = '^6.0.0';\r\n"]}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export const materialVersion = '^6.0.0';
|
|
2
|
-
export const cdkVersion = '^6.0.0';
|
|
3
|
-
export const angularVersion = '^6.0.0';
|
|
1
|
+
export const materialVersion = '^6.0.0';
|
|
2
|
+
export const cdkVersion = '^6.0.0';
|
|
3
|
+
export const angularVersion = '^6.0.0';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Tree } from '@angular-devkit/schematics';
|
|
2
|
-
/**
|
|
3
|
-
* Adds a package to the package.json
|
|
4
|
-
*/
|
|
5
|
-
export declare function addPackageToPackageJson(host: Tree, type: string, pkg: string, version: string): Tree;
|
|
1
|
+
import { Tree } from '@angular-devkit/schematics';
|
|
2
|
+
/**
|
|
3
|
+
* Adds a package to the package.json
|
|
4
|
+
*/
|
|
5
|
+
export declare function addPackageToPackageJson(host: Tree, type: string, pkg: string, version: string): Tree;
|
|
@@ -1,22 +1,21 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.addPackageToPackageJson =
|
|
4
|
-
/**
|
|
5
|
-
* Adds a package to the package.json
|
|
6
|
-
*/
|
|
7
|
-
function addPackageToPackageJson(host, type, pkg, version) {
|
|
8
|
-
if (host.exists('package.json')) {
|
|
9
|
-
const sourceText = host.read('package.json').toString('utf-8');
|
|
10
|
-
const json = JSON.parse(sourceText);
|
|
11
|
-
if (!json[type]) {
|
|
12
|
-
json[type] = {};
|
|
13
|
-
}
|
|
14
|
-
if (!json[type][pkg]) {
|
|
15
|
-
json[type][pkg] = version;
|
|
16
|
-
}
|
|
17
|
-
host.overwrite('package.json', JSON.stringify(json, null, 2));
|
|
18
|
-
}
|
|
19
|
-
return host;
|
|
20
|
-
}
|
|
21
|
-
exports.addPackageToPackageJson = addPackageToPackageJson;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.addPackageToPackageJson = addPackageToPackageJson;
|
|
4
|
+
/**
|
|
5
|
+
* Adds a package to the package.json
|
|
6
|
+
*/
|
|
7
|
+
function addPackageToPackageJson(host, type, pkg, version) {
|
|
8
|
+
if (host.exists('package.json')) {
|
|
9
|
+
const sourceText = host.read('package.json').toString('utf-8');
|
|
10
|
+
const json = JSON.parse(sourceText);
|
|
11
|
+
if (!json[type]) {
|
|
12
|
+
json[type] = {};
|
|
13
|
+
}
|
|
14
|
+
if (!json[type][pkg]) {
|
|
15
|
+
json[type][pkg] = version;
|
|
16
|
+
}
|
|
17
|
+
host.overwrite('package.json', JSON.stringify(json, null, 2));
|
|
18
|
+
}
|
|
19
|
+
return host;
|
|
20
|
+
}
|
|
22
21
|
//# sourceMappingURL=package.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"package.js","sourceRoot":"","sources":["package.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"package.js","sourceRoot":"","sources":["package.ts"],"names":[],"mappings":";;AAKA,0DAgBC;AAnBD;;GAEG;AACH,SAAgB,uBAAuB,CAAC,IAAU,EAAE,IAAY,EAAE,GAAW,EAAE,OAAe;IAC5F,IAAI,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,EAAE,CAAC;QAChC,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,cAAc,CAAE,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QAChE,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;QACpC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;YAChB,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC;QAClB,CAAC;QAED,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC;YACrB,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC;QAC5B,CAAC;QAED,IAAI,CAAC,SAAS,CAAC,cAAc,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;IAChE,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["import {Tree} from '@angular-devkit/schematics';\r\n\r\n/**\r\n * Adds a package to the package.json\r\n */\r\nexport function addPackageToPackageJson(host: Tree, type: string, pkg: string, version: string): Tree {\r\n if (host.exists('package.json')) {\r\n const sourceText = host.read('package.json')!.toString('utf-8');\r\n const json = JSON.parse(sourceText);\r\n if (!json[type]) {\r\n json[type] = {};\r\n }\r\n\r\n if (!json[type][pkg]) {\r\n json[type][pkg] = version;\r\n }\r\n\r\n host.overwrite('package.json', JSON.stringify(json, null, 2));\r\n }\r\n\r\n return host;\r\n}\r\n"]}
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import {Tree} from '@angular-devkit/schematics';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Adds a package to the package.json
|
|
5
|
-
*/
|
|
6
|
-
export function addPackageToPackageJson(host: Tree, type: string, pkg: string, version: string): Tree {
|
|
7
|
-
if (host.exists('package.json')) {
|
|
8
|
-
const sourceText = host.read('package.json')!.toString('utf-8');
|
|
9
|
-
const json = JSON.parse(sourceText);
|
|
10
|
-
if (!json[type]) {
|
|
11
|
-
json[type] = {};
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
if (!json[type][pkg]) {
|
|
15
|
-
json[type][pkg] = version;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
host.overwrite('package.json', JSON.stringify(json, null, 2));
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
return host;
|
|
22
|
-
}
|
|
1
|
+
import {Tree} from '@angular-devkit/schematics';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Adds a package to the package.json
|
|
5
|
+
*/
|
|
6
|
+
export function addPackageToPackageJson(host: Tree, type: string, pkg: string, version: string): Tree {
|
|
7
|
+
if (host.exists('package.json')) {
|
|
8
|
+
const sourceText = host.read('package.json')!.toString('utf-8');
|
|
9
|
+
const json = JSON.parse(sourceText);
|
|
10
|
+
if (!json[type]) {
|
|
11
|
+
json[type] = {};
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
if (!json[type][pkg]) {
|
|
15
|
+
json[type][pkg] = version;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
host.overwrite('package.json', JSON.stringify(json, null, 2));
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return host;
|
|
22
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { UnitTestTree } from '@angular-devkit/schematics/testing';
|
|
2
|
-
/**
|
|
3
|
-
* Create a base app used for testing.
|
|
4
|
-
*/
|
|
5
|
-
export declare function createTestApp(): Promise<UnitTestTree>;
|
|
1
|
+
import { UnitTestTree } from '@angular-devkit/schematics/testing';
|
|
2
|
+
/**
|
|
3
|
+
* Create a base app used for testing.
|
|
4
|
+
*/
|
|
5
|
+
export declare function createTestApp(): Promise<UnitTestTree>;
|
|
@@ -1,28 +1,27 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createTestApp =
|
|
4
|
-
const path_1 = require("path");
|
|
5
|
-
const testing_1 = require("@angular-devkit/schematics/testing");
|
|
6
|
-
const collectionPath = (0, path_1.join)('./node_modules/@schematics/angular/collection.json');
|
|
7
|
-
/**
|
|
8
|
-
* Create a base app used for testing.
|
|
9
|
-
*/
|
|
10
|
-
function createTestApp() {
|
|
11
|
-
const baseRunner = new testing_1.SchematicTestRunner('schematics', collectionPath);
|
|
12
|
-
return baseRunner.
|
|
13
|
-
directory: '',
|
|
14
|
-
name: 'app',
|
|
15
|
-
prefix: 'app',
|
|
16
|
-
sourceDir: 'src',
|
|
17
|
-
inlineStyle: false,
|
|
18
|
-
inlineTemplate: false,
|
|
19
|
-
viewEncapsulation: 'None',
|
|
20
|
-
version: '1.2.3',
|
|
21
|
-
routing: true,
|
|
22
|
-
style: 'scss',
|
|
23
|
-
skipTests: false,
|
|
24
|
-
minimal: false,
|
|
25
|
-
})
|
|
26
|
-
}
|
|
27
|
-
exports.createTestApp = createTestApp;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createTestApp = createTestApp;
|
|
4
|
+
const path_1 = require("path");
|
|
5
|
+
const testing_1 = require("@angular-devkit/schematics/testing");
|
|
6
|
+
const collectionPath = (0, path_1.join)('./node_modules/@schematics/angular/collection.json');
|
|
7
|
+
/**
|
|
8
|
+
* Create a base app used for testing.
|
|
9
|
+
*/
|
|
10
|
+
function createTestApp() {
|
|
11
|
+
const baseRunner = new testing_1.SchematicTestRunner('schematics', collectionPath);
|
|
12
|
+
return baseRunner.runSchematic('application', {
|
|
13
|
+
directory: '',
|
|
14
|
+
name: 'app',
|
|
15
|
+
prefix: 'app',
|
|
16
|
+
sourceDir: 'src',
|
|
17
|
+
inlineStyle: false,
|
|
18
|
+
inlineTemplate: false,
|
|
19
|
+
viewEncapsulation: 'None',
|
|
20
|
+
version: '1.2.3',
|
|
21
|
+
routing: true,
|
|
22
|
+
style: 'scss',
|
|
23
|
+
skipTests: false,
|
|
24
|
+
minimal: false,
|
|
25
|
+
});
|
|
26
|
+
}
|
|
28
27
|
//# sourceMappingURL=testing.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testing.js","sourceRoot":"","sources":["testing.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"testing.js","sourceRoot":"","sources":["testing.ts"],"names":[],"mappings":";;AAQA,sCAgBC;AAxBD,+BAA0B;AAC1B,gEAAqF;AAErF,MAAM,cAAc,GAAG,IAAA,WAAI,EAAC,oDAAoD,CAAC,CAAC;AAElF;;GAEG;AACH,SAAgB,aAAa;IAC3B,MAAM,UAAU,GAAG,IAAI,6BAAmB,CAAC,YAAY,EAAE,cAAc,CAAC,CAAC;IACzE,OAAO,UAAU,CAAC,YAAY,CAAC,aAAa,EAAE;QAC5C,SAAS,EAAE,EAAE;QACb,IAAI,EAAE,KAAK;QACX,MAAM,EAAE,KAAK;QACb,SAAS,EAAE,KAAK;QAChB,WAAW,EAAE,KAAK;QAClB,cAAc,EAAE,KAAK;QACrB,iBAAiB,EAAE,MAAM;QACzB,OAAO,EAAE,OAAO;QAChB,OAAO,EAAE,IAAI;QACb,KAAK,EAAE,MAAM;QACb,SAAS,EAAE,KAAK;QAChB,OAAO,EAAE,KAAK;KACf,CAAC,CAAC;AACL,CAAC","sourcesContent":["import {join} from 'path';\r\nimport {SchematicTestRunner, UnitTestTree} from '@angular-devkit/schematics/testing';\r\n\r\nconst collectionPath = join('./node_modules/@schematics/angular/collection.json');\r\n\r\n/**\r\n * Create a base app used for testing.\r\n */\r\nexport function createTestApp() {\r\n const baseRunner = new SchematicTestRunner('schematics', collectionPath);\r\n return baseRunner.runSchematic('application', {\r\n directory: '',\r\n name: 'app',\r\n prefix: 'app',\r\n sourceDir: 'src',\r\n inlineStyle: false,\r\n inlineTemplate: false,\r\n viewEncapsulation: 'None',\r\n version: '1.2.3',\r\n routing: true,\r\n style: 'scss',\r\n skipTests: false,\r\n minimal: false,\r\n });\r\n}\r\n"]}
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import {join} from 'path';
|
|
2
|
-
import {SchematicTestRunner, UnitTestTree} from '@angular-devkit/schematics/testing';
|
|
3
|
-
|
|
4
|
-
const collectionPath = join('./node_modules/@schematics/angular/collection.json');
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Create a base app used for testing.
|
|
8
|
-
*/
|
|
9
|
-
export function createTestApp() {
|
|
10
|
-
const baseRunner = new SchematicTestRunner('schematics', collectionPath);
|
|
11
|
-
return baseRunner.
|
|
12
|
-
directory: '',
|
|
13
|
-
name: 'app',
|
|
14
|
-
prefix: 'app',
|
|
15
|
-
sourceDir: 'src',
|
|
16
|
-
inlineStyle: false,
|
|
17
|
-
inlineTemplate: false,
|
|
18
|
-
viewEncapsulation: 'None',
|
|
19
|
-
version: '1.2.3',
|
|
20
|
-
routing: true,
|
|
21
|
-
style: 'scss',
|
|
22
|
-
skipTests: false,
|
|
23
|
-
minimal: false,
|
|
24
|
-
})
|
|
25
|
-
}
|
|
1
|
+
import {join} from 'path';
|
|
2
|
+
import {SchematicTestRunner, UnitTestTree} from '@angular-devkit/schematics/testing';
|
|
3
|
+
|
|
4
|
+
const collectionPath = join('./node_modules/@schematics/angular/collection.json');
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Create a base app used for testing.
|
|
8
|
+
*/
|
|
9
|
+
export function createTestApp() {
|
|
10
|
+
const baseRunner = new SchematicTestRunner('schematics', collectionPath);
|
|
11
|
+
return baseRunner.runSchematic('application', {
|
|
12
|
+
directory: '',
|
|
13
|
+
name: 'app',
|
|
14
|
+
prefix: 'app',
|
|
15
|
+
sourceDir: 'src',
|
|
16
|
+
inlineStyle: false,
|
|
17
|
+
inlineTemplate: false,
|
|
18
|
+
viewEncapsulation: 'None',
|
|
19
|
+
version: '1.2.3',
|
|
20
|
+
routing: true,
|
|
21
|
+
style: 'scss',
|
|
22
|
+
skipTests: false,
|
|
23
|
+
minimal: false,
|
|
24
|
+
});
|
|
25
|
+
}
|