@magic-xpa/cli 4.1201.0-dev4121.306 → 4.1201.0-dev4121.308
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.js.map +1 -1
- package/index.ts +1 -1
- package/package.json +1 -1
- package/src/collection.json +75 -75
- package/src/public_api.js.map +1 -1
- package/src/public_api.ts +5 -5
- package/src/schematics/magic-utils/config.js +2 -2
- 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.js +6 -5
- package/src/schematics/magic-utils/env.js.map +1 -1
- package/src/schematics/magic-utils/env.ts +51 -50
- 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.js +1 -1
- 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/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.js.map +1 -1
- package/src/schematics/magic-utils/rules/init-add-modules.rule.ts +360 -360
- 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/magic-option.scheme.js.map +1 -1
- package/src/schematics/magic-utils/rules/magic-option.scheme.ts +24 -24
- 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.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 → app.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/magic-styles.css +131 -131
- package/src/schematics/mg-add/index.js +123 -9
- package/src/schematics/mg-add/index.js.map +1 -1
- package/src/schematics/mg-add/index.ts +160 -27
- package/src/schematics/mg-add/schema.json +29 -29
- 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.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.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.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.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-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/schema.json +14 -14
- package/src/schematics/mg-single-control/schema.json +24 -24
- 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.js.map +1 -1
- package/src/schematics/utils/devkit-utils/ast-utils.ts +570 -570
- 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.js.map +1 -1
- package/src/schematics/utils/devkit-utils/change.ts +127 -127
- 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.js.map +1 -1
- package/src/schematics/utils/devkit-utils/config.ts +120 -120
- 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.js.map +1 -1
- package/src/schematics/utils/devkit-utils/ng-ast-utils.ts +84 -84
- 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.js.map +1 -1
- package/src/schematics/utils/devkit-utils/route-utils.ts +180 -180
- package/src/schematics/utils/devkit-utils/validation.js +1 -1
- 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.js.map +1 -1
- package/src/schematics/utils/html.ts +63 -63
- package/src/schematics/utils/lib-versions.js.map +1 -1
- package/src/schematics/utils/lib-versions.ts +3 -3
- package/src/schematics/utils/package.js.map +1 -1
- package/src/schematics/utils/package.ts +22 -22
- package/src/schematics/utils/testing.js.map +1 -1
- package/src/schematics/utils/testing.ts +25 -25
- 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.js.map +1 -1
- package/src/types/enums/generated-file-types.enum.ts +6 -6
- 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.js.map +1 -1
- package/src/types/enums/themes.enum.ts +6 -6
- package/src/types/index.js.map +1 -1
- package/src/types/index.ts +8 -8
- package/src/types/interfaces/app.js.map +1 -1
- package/src/types/interfaces/app.ts +89 -89
- package/src/types/interfaces/control.js.map +1 -1
- package/src/types/interfaces/control.ts +106 -106
- 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 → app.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.module.ts → app-module.ts} +70 -70
- package/templates/angular/src/app.routes.ts +73 -73
- package/templates/angular/src/{app.component.ts → app.ts} +16 -16
- 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 +136 -136
- package/templates/themes/basicHTML/Code/theme.module.ts +10 -10
- package/templates/themes/basicHTML/combobox.ejs +40 -37
- package/templates/themes/basicHTML/edit.ejs +179 -169
- package/templates/themes/basicHTML/form.ejs +4 -4
- package/templates/themes/basicHTML/group.ejs +4 -4
- package/templates/themes/basicHTML/image.ejs +7 -6
- package/templates/themes/basicHTML/label.ejs +11 -11
- package/templates/themes/basicHTML/listbox.ejs +20 -21
- package/templates/themes/basicHTML/push-button.ejs +27 -28
- package/templates/themes/basicHTML/radio.ejs +21 -20
- package/templates/themes/basicHTML/subform.ejs +6 -6
- package/templates/themes/basicHTML/tab.ejs +33 -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 +18 -17
- package/templates/themes/basicHiddenHTML/tab.ejs +13 -13
- package/templates/themes/basicHiddenHTML/table.ejs +22 -18
- package/templates/themes/basicHiddenHTML/tabpage.ejs +2 -2
- package/templates/themes/container.ejs +37 -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/combobox.ejs +60 -58
- package/templates/themes/material/edit.ejs +208 -204
- package/templates/themes/material/group.ejs +3 -3
- package/templates/themes/material/listbox.ejs +21 -22
- package/templates/themes/material/push-button.ejs +27 -28
- package/templates/themes/material/radio.ejs +22 -22
- package/templates/themes/material/subform.ejs +8 -8
- package/templates/themes/material/tab.ejs +21 -19
- package/templates/themes/router_outlet.ejs +5 -5
- package/templates/themes/table/HTMLTable/table.ejs +41 -37
- package/templates/themes/table/grid/additionalComponentCode.ejs +26 -26
- package/templates/themes/table/grid/additionalIncludes.ejs +1 -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 +32 -28
- package/templates/themes/tableTypeSelector.ejs +21 -21
- package/tsconfig.json +36 -36
|
@@ -15,7 +15,7 @@ import { LogLn } from "../magic-utils/Util";
|
|
|
15
15
|
import { generate } from "../magic-utils/rules/generate.rule";
|
|
16
16
|
import { GeneratedFileTypes } from "../../types/enums/generated-file-types.enum";
|
|
17
17
|
import { MagicOptionScheme } from "../magic-utils/rules/magic-option.scheme";
|
|
18
|
-
import {addProviderToModule, insertImport} from "../utils/devkit-utils/ast-utils";
|
|
18
|
+
import {addProviderToModule, getDecoratorMetadata, insertImport} from "../utils/devkit-utils/ast-utils";
|
|
19
19
|
import * as ts from 'typescript';
|
|
20
20
|
import {InsertChange} from "../utils/devkit-utils/change";
|
|
21
21
|
export function mgAdd(options:MagicOptionScheme): Rule {
|
|
@@ -32,7 +32,9 @@ export function mgAdd(options:MagicOptionScheme): Rule {
|
|
|
32
32
|
updateTsConfigAppJson (options),
|
|
33
33
|
|
|
34
34
|
addLazyLoadProvider(),
|
|
35
|
-
|
|
35
|
+
|
|
36
|
+
addZoneChangeDetectionProviderRule(),
|
|
37
|
+
//handel app.html
|
|
36
38
|
//updateAppComponentHtmlFiles (options),
|
|
37
39
|
|
|
38
40
|
//handel package.Json
|
|
@@ -42,8 +44,8 @@ export function mgAdd(options:MagicOptionScheme): Rule {
|
|
|
42
44
|
|
|
43
45
|
function updateAppComponentHtmlFiles(options:MagicOptionScheme): Rule {
|
|
44
46
|
return generate({
|
|
45
|
-
template : "./templates/angular/src/app/app.
|
|
46
|
-
name : "app.
|
|
47
|
+
template : "./templates/angular/src/app/app.html.ejs",
|
|
48
|
+
name : "app.html",
|
|
47
49
|
destination : env.metadata.paths.rootMagicGenFolder,
|
|
48
50
|
type :GeneratedFileTypes.HTML,
|
|
49
51
|
data : {
|
|
@@ -51,32 +53,75 @@ function updateAppComponentHtmlFiles(options:MagicOptionScheme): Rule {
|
|
|
51
53
|
}
|
|
52
54
|
},options)
|
|
53
55
|
}
|
|
54
|
-
function updateAngularJsonWithMagicStyle(options:MagicOptionScheme): Rule {
|
|
55
|
-
return (host: Tree, context: SchematicContext) => {
|
|
56
|
-
const project = env.project;
|
|
57
|
-
let isDirty = false;
|
|
56
|
+
function updateAngularJsonWithMagicStyle(options:MagicOptionScheme): Rule {
|
|
57
|
+
return (host: Tree, context: SchematicContext) => {
|
|
58
|
+
const project = env.project;
|
|
59
|
+
let isDirty = false;
|
|
58
60
|
|
|
59
61
|
let fullPathmagicStylePath = env.metadata.paths.magicStylePath;
|
|
60
|
-
if (!project.architect.test.options.styles.includes(fullPathmagicStylePath)) {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
if (!project.architect.build.options.styles.includes(fullPathmagicStylePath)) {
|
|
67
|
-
context.logger.info(` [>]add file ${fullPathmagicStylePath} to build`);
|
|
68
|
-
project.architect.build.options.styles.push(fullPathmagicStylePath);
|
|
69
|
-
isDirty = true;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
62
|
+
// if (!project.architect.test.options.styles.includes(fullPathmagicStylePath)) {
|
|
63
|
+
// context.logger.info(` [>]add file ${fullPathmagicStylePath} to test`);
|
|
64
|
+
// project.architect.test.options.styles.push(fullPathmagicStylePath);
|
|
65
|
+
// isDirty = true;
|
|
66
|
+
// }
|
|
67
|
+
|
|
68
|
+
if (!project.architect.build.options.styles.includes(fullPathmagicStylePath)) {
|
|
69
|
+
context.logger.info(` [>]add file ${fullPathmagicStylePath} to build`);
|
|
70
|
+
project.architect.build.options.styles.push(fullPathmagicStylePath);
|
|
71
|
+
isDirty = true;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
const buildOptions = project?.architect?.build?.options;
|
|
75
|
+
const testOptions = project?.architect?.test?.options;
|
|
76
|
+
|
|
77
|
+
if (buildOptions) {
|
|
78
|
+
const changed = ensurePolyfills(buildOptions, ['zone.js']);
|
|
79
|
+
if (changed) {
|
|
80
|
+
context.logger.info(` [>]add polyfill zone.js to build`);
|
|
81
|
+
isDirty = true;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
if (testOptions) {
|
|
86
|
+
const changed = ensurePolyfills(testOptions, ['zone.js', 'zone.js/testing']);
|
|
87
|
+
if (changed) {
|
|
88
|
+
context.logger.info(` [>]add polyfills zone.js, zone.js/testing to test`);
|
|
89
|
+
isDirty = true;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
if(isDirty){
|
|
94
|
+
let fullPath = env.metadata.paths.angularJsonPath;
|
|
95
|
+
host.overwrite(fullPath, JSON.stringify(env.workspace, null, 2));
|
|
96
|
+
}
|
|
76
97
|
|
|
77
98
|
return host;
|
|
78
|
-
};
|
|
79
|
-
}
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
function ensurePolyfills(options: any, requiredPolyfills: string[]): boolean {
|
|
103
|
+
let polyfills: any[] = [];
|
|
104
|
+
|
|
105
|
+
if (Array.isArray(options.polyfills)) {
|
|
106
|
+
polyfills = [...options.polyfills];
|
|
107
|
+
} else if (typeof options.polyfills === 'string' && options.polyfills.trim()) {
|
|
108
|
+
polyfills = [options.polyfills];
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
let changed = !Array.isArray(options.polyfills);
|
|
112
|
+
for (const entry of requiredPolyfills) {
|
|
113
|
+
if (!polyfills.includes(entry)) {
|
|
114
|
+
polyfills.push(entry);
|
|
115
|
+
changed = true;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
if (changed) {
|
|
120
|
+
options.polyfills = polyfills;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
return changed;
|
|
124
|
+
}
|
|
80
125
|
|
|
81
126
|
// Angular 10 , does not include .ts file for compilation
|
|
82
127
|
// So to avoid compilation error , add *.module.ts in includes section
|
|
@@ -179,7 +224,7 @@ function addMagicModuleToAppModule(options: MagicOptionScheme) : Rule {
|
|
|
179
224
|
|
|
180
225
|
function addLazyLoadProvider(): Rule {
|
|
181
226
|
return (host: Tree) => {
|
|
182
|
-
const appmodule = env.metadata.paths.rootMagicGenFolder + '/app
|
|
227
|
+
const appmodule = env.metadata.paths.rootMagicGenFolder + '/app-module.ts';
|
|
183
228
|
|
|
184
229
|
const lazyLoaderService = 'LazyLoaderService';
|
|
185
230
|
const lazyLoaderServicePath = './magic/lazy-loader.service';
|
|
@@ -198,6 +243,8 @@ function addLazyLoadProvider(): Rule {
|
|
|
198
243
|
}
|
|
199
244
|
host.commitUpdate(providerRecorder);
|
|
200
245
|
|
|
246
|
+
sourceText = host.read(appmodule).toString('utf-8');
|
|
247
|
+
source = ts.createSourceFile(appmodule, sourceText, ts.ScriptTarget.Latest, true);
|
|
201
248
|
const lazyLoaderServiceImport = insertImport(source, appmodule, lazyLoaderService, lazyLoaderServicePath, false);
|
|
202
249
|
const lazyLoaderServiceChangesRecorder = host.beginUpdate(appmodule);
|
|
203
250
|
if (lazyLoaderServiceImport instanceof InsertChange)
|
|
@@ -205,6 +252,8 @@ function addLazyLoadProvider(): Rule {
|
|
|
205
252
|
host.commitUpdate(lazyLoaderServiceChangesRecorder);
|
|
206
253
|
|
|
207
254
|
// add import for MagicLazyLoaderService
|
|
255
|
+
sourceText = host.read(appmodule).toString('utf-8');
|
|
256
|
+
source = ts.createSourceFile(appmodule, sourceText, ts.ScriptTarget.Latest, true);
|
|
208
257
|
const magicLazyLoaderServiceImportChanges: InsertChange = <InsertChange>insertImport(source, appmodule, 'MagicLazyLoaderService', '@magic-xpa/angular', false);
|
|
209
258
|
const magicImportChangesRecorder = host.beginUpdate(appmodule);
|
|
210
259
|
magicImportChangesRecorder.insertLeft(magicLazyLoaderServiceImportChanges.pos, magicLazyLoaderServiceImportChanges.toAdd)
|
|
@@ -212,3 +261,87 @@ function addLazyLoadProvider(): Rule {
|
|
|
212
261
|
}
|
|
213
262
|
}
|
|
214
263
|
|
|
264
|
+
function addZoneChangeDetectionProviderRule(): Rule {
|
|
265
|
+
return (host: Tree) => {
|
|
266
|
+
// Resolve the generated root module path (src/app/app-module.ts in this project layout).
|
|
267
|
+
const appmodule = env.metadata.paths.rootMagicGenFolder + '/app-module.ts';
|
|
268
|
+
|
|
269
|
+
// Append provideZoneChangeDetection() to NgModule.providers if it does not already exist.
|
|
270
|
+
addZoneChangeDetectionProvider(host, appmodule);
|
|
271
|
+
|
|
272
|
+
// Re-parse from disk after provider update so import insertion uses fresh AST positions.
|
|
273
|
+
const sourceText = host.read(appmodule).toString('utf-8');
|
|
274
|
+
const source = ts.createSourceFile(appmodule, sourceText, ts.ScriptTarget.Latest, true);
|
|
275
|
+
|
|
276
|
+
// Ensure the symbol import exists; insertImport is idempotent and avoids duplicates.
|
|
277
|
+
const zoneChangeDetectionImport = insertImport(source, appmodule, 'provideZoneChangeDetection', '@angular/core', false);
|
|
278
|
+
const zoneChangeDetectionImportChangesRecorder = host.beginUpdate(appmodule);
|
|
279
|
+
if (zoneChangeDetectionImport instanceof InsertChange)
|
|
280
|
+
zoneChangeDetectionImportChangesRecorder.insertLeft(zoneChangeDetectionImport.pos, zoneChangeDetectionImport.toAdd);
|
|
281
|
+
host.commitUpdate(zoneChangeDetectionImportChangesRecorder);
|
|
282
|
+
};
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
function addZoneChangeDetectionProvider(host: Tree, appmodule: string): void {
|
|
286
|
+
const zoneProvider = 'provideZoneChangeDetection()';
|
|
287
|
+
const sourceText = host.read(appmodule).toString('utf-8');
|
|
288
|
+
const source = ts.createSourceFile(appmodule, sourceText, ts.ScriptTarget.Latest, true);
|
|
289
|
+
|
|
290
|
+
// Locate the first @NgModule({...}) metadata object in app-module.ts.
|
|
291
|
+
const ngModules = getDecoratorMetadata(source, 'NgModule', '@angular/core');
|
|
292
|
+
|
|
293
|
+
if (!ngModules.length) {
|
|
294
|
+
return;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
const ngModuleMetadata = ngModules[0] as ts.ObjectLiteralExpression;
|
|
298
|
+
// Find the `providers` property assignment inside @NgModule metadata.
|
|
299
|
+
const providersProperty = ngModuleMetadata.properties
|
|
300
|
+
.filter(ts.isPropertyAssignment)
|
|
301
|
+
.find((prop: ts.PropertyAssignment) => {
|
|
302
|
+
if (ts.isIdentifier(prop.name)) {
|
|
303
|
+
return prop.name.text === 'providers';
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
return ts.isStringLiteral(prop.name) && prop.name.text === 'providers';
|
|
307
|
+
});
|
|
308
|
+
|
|
309
|
+
if (!providersProperty || !ts.isArrayLiteralExpression(providersProperty.initializer)) {
|
|
310
|
+
return;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
const providersArray = providersProperty.initializer;
|
|
314
|
+
// Keep this operation idempotent: do nothing if provider already exists.
|
|
315
|
+
const hasZoneProvider = providersArray.elements.some((el: ts.Expression) => {
|
|
316
|
+
return el.getText(source).replace(/\s+/g, '') === zoneProvider;
|
|
317
|
+
});
|
|
318
|
+
|
|
319
|
+
if (hasZoneProvider) {
|
|
320
|
+
return;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
let insertPos: number;
|
|
324
|
+
let toAdd: string;
|
|
325
|
+
if (providersArray.elements.length === 0) {
|
|
326
|
+
// Empty providers: inject the item directly between [].
|
|
327
|
+
insertPos = providersArray.getEnd() - 1;
|
|
328
|
+
toAdd = zoneProvider;
|
|
329
|
+
} else {
|
|
330
|
+
// Non-empty providers: append after last provider, preserving line formatting when possible.
|
|
331
|
+
const lastProvider = providersArray.elements[providersArray.elements.length - 1];
|
|
332
|
+
insertPos = lastProvider.getEnd();
|
|
333
|
+
const lastProviderText = lastProvider.getFullText(source);
|
|
334
|
+
const newLineMatch = lastProviderText.match(/^\r?\n(\r?)\s+/);
|
|
335
|
+
if (newLineMatch) {
|
|
336
|
+
toAdd = `,${newLineMatch[0]}${zoneProvider}`;
|
|
337
|
+
} else {
|
|
338
|
+
toAdd = `, ${zoneProvider}`;
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
// Apply the computed insertion at the exact Abstract Syntax Tree-derived position.
|
|
343
|
+
const recorder = host.beginUpdate(appmodule);
|
|
344
|
+
recorder.insertLeft(insertPos, toAdd);
|
|
345
|
+
host.commitUpdate(recorder);
|
|
346
|
+
}
|
|
347
|
+
|
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "http://json-schema.org/schema",
|
|
3
|
-
"$id": "SchematicsMagicAdd",
|
|
4
|
-
"title": "Magic Options Schema",
|
|
5
|
-
"type": "object",
|
|
6
|
-
"properties": {
|
|
7
|
-
"skipInstall": {
|
|
8
|
-
"type": "boolean",
|
|
9
|
-
"default": false,
|
|
10
|
-
"description": "Do not install the new packages (e.g., --skipInstall)"
|
|
11
|
-
},
|
|
12
|
-
"skipPackageJson": {
|
|
13
|
-
"type": "boolean",
|
|
14
|
-
"default": false,
|
|
15
|
-
"description": "Do not add magic dependencies to package.json (e.g., --skipPackageJson)"
|
|
16
|
-
},
|
|
17
|
-
"skipHelp": {
|
|
18
|
-
"type": "boolean",
|
|
19
|
-
"default": false,
|
|
20
|
-
"description": "Whether to create Startup Welcome Pag (e.g., --skipHelp)"
|
|
21
|
-
},
|
|
22
|
-
"project":{
|
|
23
|
-
"type": "string",
|
|
24
|
-
"description": "The name of the project",
|
|
25
|
-
"aliases" : ["p"]
|
|
26
|
-
}
|
|
27
|
-
},
|
|
28
|
-
"required": []
|
|
29
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/schema",
|
|
3
|
+
"$id": "SchematicsMagicAdd",
|
|
4
|
+
"title": "Magic Options Schema",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"skipInstall": {
|
|
8
|
+
"type": "boolean",
|
|
9
|
+
"default": false,
|
|
10
|
+
"description": "Do not install the new packages (e.g., --skipInstall)"
|
|
11
|
+
},
|
|
12
|
+
"skipPackageJson": {
|
|
13
|
+
"type": "boolean",
|
|
14
|
+
"default": false,
|
|
15
|
+
"description": "Do not add magic dependencies to package.json (e.g., --skipPackageJson)"
|
|
16
|
+
},
|
|
17
|
+
"skipHelp": {
|
|
18
|
+
"type": "boolean",
|
|
19
|
+
"default": false,
|
|
20
|
+
"description": "Whether to create Startup Welcome Pag (e.g., --skipHelp)"
|
|
21
|
+
},
|
|
22
|
+
"project":{
|
|
23
|
+
"type": "string",
|
|
24
|
+
"description": "The name of the project",
|
|
25
|
+
"aliases" : ["p"]
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
"required": []
|
|
29
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add-declaration-to-root-module.js","sourceRoot":"","sources":["add-declaration-to-root-module.ts"],"names":[],"mappings":";;AAKA,gEAMC;AAXD,yCAA8C;AAC9C,kEAA0E;AAE1E,+CAA+C;AAE/C,SAAgB,0BAA0B,CAAC,IAAU,EAAE,UAAkB,EAAE,SAAiB;IAC3F,IACC,IAAI,GAAK,uBAAuB,EAChC,MAAM,GAAG,IAAA,mBAAa,EAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAEpC,IAAA,kCAAsB,EAAC,MAAM,EAAE,IAAA,gBAAS,EAAC,IAAI,CAAC,EAAE,UAAU,EAAE,SAAS,CAAC,CAAC;AACxE,CAAC","sourcesContent":["import {getSourceFile} from '../../utils/ast';\
|
|
1
|
+
{"version":3,"file":"add-declaration-to-root-module.js","sourceRoot":"","sources":["add-declaration-to-root-module.ts"],"names":[],"mappings":";;AAKA,gEAMC;AAXD,yCAA8C;AAC9C,kEAA0E;AAE1E,+CAA+C;AAE/C,SAAgB,0BAA0B,CAAC,IAAU,EAAE,UAAkB,EAAE,SAAiB;IAC3F,IACC,IAAI,GAAK,uBAAuB,EAChC,MAAM,GAAG,IAAA,mBAAa,EAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAEpC,IAAA,kCAAsB,EAAC,MAAM,EAAE,IAAA,gBAAS,EAAC,IAAI,CAAC,EAAE,UAAU,EAAE,SAAS,CAAC,CAAC;AACxE,CAAC","sourcesContent":["import {getSourceFile} from '../../utils/ast';\nimport {addDeclarationToModule} from '../../utils/devkit-utils/ast-utils';\nimport {Tree} from '@angular-devkit/schematics';\nimport {normalize} from '@angular-devkit/core';\n\nexport function addDeclarationToRootModule(host: Tree, moduleName: string, importSrc: string) {\n\tlet\n\t\tpath = `src/app/app.module.ts`,\n\t\tsource = getSourceFile(host, path);\n\t\n\taddDeclarationToModule(source, normalize(path), moduleName, importSrc);\n}\n"]}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {getSourceFile} from '../../utils/ast';
|
|
2
|
-
import {addDeclarationToModule} from '../../utils/devkit-utils/ast-utils';
|
|
3
|
-
import {Tree} from '@angular-devkit/schematics';
|
|
4
|
-
import {normalize} from '@angular-devkit/core';
|
|
5
|
-
|
|
6
|
-
export function addDeclarationToRootModule(host: Tree, moduleName: string, importSrc: string) {
|
|
7
|
-
let
|
|
8
|
-
path = `src/app/app.module.ts`,
|
|
9
|
-
source = getSourceFile(host, path);
|
|
10
|
-
|
|
11
|
-
addDeclarationToModule(source, normalize(path), moduleName, importSrc);
|
|
12
|
-
}
|
|
1
|
+
import {getSourceFile} from '../../utils/ast';
|
|
2
|
+
import {addDeclarationToModule} from '../../utils/devkit-utils/ast-utils';
|
|
3
|
+
import {Tree} from '@angular-devkit/schematics';
|
|
4
|
+
import {normalize} from '@angular-devkit/core';
|
|
5
|
+
|
|
6
|
+
export function addDeclarationToRootModule(host: Tree, moduleName: string, importSrc: string) {
|
|
7
|
+
let
|
|
8
|
+
path = `src/app/app.module.ts`,
|
|
9
|
+
source = getSourceFile(host, path);
|
|
10
|
+
|
|
11
|
+
addDeclarationToModule(source, normalize(path), moduleName, importSrc);
|
|
12
|
+
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import {Routes, RouterModule} from '@angular/router';
|
|
2
|
-
import { NgModule } from "@angular/core";
|
|
3
|
-
import { CommonModule } from "@angular/common";
|
|
4
|
-
|
|
5
|
-
export const routes: Routes = [
|
|
6
|
-
|
|
7
|
-
];
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
@NgModule({
|
|
11
|
-
imports: [CommonModule,RouterModule.forChild(routes)],
|
|
12
|
-
exports: [RouterModule]
|
|
13
|
-
})
|
|
14
|
-
export class MagicRoutingModule { }
|
|
1
|
+
import {Routes, RouterModule} from '@angular/router';
|
|
2
|
+
import { NgModule } from "@angular/core";
|
|
3
|
+
import { CommonModule } from "@angular/common";
|
|
4
|
+
|
|
5
|
+
export const routes: Routes = [
|
|
6
|
+
|
|
7
|
+
];
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
@NgModule({
|
|
11
|
+
imports: [CommonModule,RouterModule.forChild(routes)],
|
|
12
|
+
exports: [RouterModule]
|
|
13
|
+
})
|
|
14
|
+
export class MagicRoutingModule { }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;AAMA,gCA4CC;AAjDD,4DAA4F;AAE5F,4CAAkF;AAGlF,SAAgB,UAAU,CAAC,OAAyB;IAClD,OAAO,CAAC,IAAS,EAAE,OAAwB,EAAC,EAAE;QAE5C,OAAO,CAAC,GAAG,CAAC,yDAAyD,GAAG,OAAO,CAAC,UAAU,CAAE,CAAC;QAC7F,qBAAe,CAAC,IAAI,CAAC,IAAI,mBAAa,CAAC,gBAAgB,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC;QAE9E,8BAA8B;QAC9B,MAAM,cAAc,GAAG,OAAO,CAAC,OAAO,CACpC,IAAI,wBAAgB,CAAC,YAAY,EAAE;YACjC,WAAW,EAAO,KAAK;YACvB,eAAe,EAAG,KAAK;YACvB,YAAY,EAAM,EAAE;YACpB,eAAe,EAAG,qBAAe;SAClC,CAAC,CACH,CAAC;QAIF,OAAO,CAAC,GAAG,CAAC,6DAA6D,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;QACpG,kBAAY,CAAC,IAAI,CAAC,IAAI,mBAAa,CAAC,oBAAoB,EAAE,OAAO,CAAC,cAAc,CAAE,CAAC,CAAC;QAEpF,2BAA2B;QAC3B,MAAM,mBAAmB,GAAG,OAAO,CAAC,OAAO,CACzC,IAAI,wBAAgB,CAAC,YAAY,EAAE;YACjC,WAAW,EAAO,OAAO,CAAC,WAAW;YACrC,eAAe,EAAG,OAAO,CAAC,eAAe;YACzC,YAAY,EAAM,kBAAY;YAC9B,eAAe,EAAG,EAAE;SACrB,CAAC,EACF,CAAC,cAAc,CAAC,CACjB,CAAC;QAGF,MAAM,eAAe,GAAG,OAAO,CAAC,OAAO,CACrC,IAAI,wBAAgB,CAAC,cAAc,EAAE,OAAO,CAAC,EAC7C,CAAC,cAAc,EAAC,mBAAmB,CAAC,CACrC,CAAC;QAEF,MAAM,SAAS,GAAG,OAAO,CAAC,OAAO,CAC/B,IAAI,wBAAgB,CAAC,QAAQ,EAAE,OAAO,CAAC,EACvC,CAAC,cAAc,EAAE,mBAAmB,EAAE,eAAe,CAAC,CACvD,CAAC;IAEJ,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import { Rule,Tree,SchematicContext } from \"@angular-devkit/schematics\";\
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;AAMA,gCA4CC;AAjDD,4DAA4F;AAE5F,4CAAkF;AAGlF,SAAgB,UAAU,CAAC,OAAyB;IAClD,OAAO,CAAC,IAAS,EAAE,OAAwB,EAAC,EAAE;QAE5C,OAAO,CAAC,GAAG,CAAC,yDAAyD,GAAG,OAAO,CAAC,UAAU,CAAE,CAAC;QAC7F,qBAAe,CAAC,IAAI,CAAC,IAAI,mBAAa,CAAC,gBAAgB,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC;QAE9E,8BAA8B;QAC9B,MAAM,cAAc,GAAG,OAAO,CAAC,OAAO,CACpC,IAAI,wBAAgB,CAAC,YAAY,EAAE;YACjC,WAAW,EAAO,KAAK;YACvB,eAAe,EAAG,KAAK;YACvB,YAAY,EAAM,EAAE;YACpB,eAAe,EAAG,qBAAe;SAClC,CAAC,CACH,CAAC;QAIF,OAAO,CAAC,GAAG,CAAC,6DAA6D,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;QACpG,kBAAY,CAAC,IAAI,CAAC,IAAI,mBAAa,CAAC,oBAAoB,EAAE,OAAO,CAAC,cAAc,CAAE,CAAC,CAAC;QAEpF,2BAA2B;QAC3B,MAAM,mBAAmB,GAAG,OAAO,CAAC,OAAO,CACzC,IAAI,wBAAgB,CAAC,YAAY,EAAE;YACjC,WAAW,EAAO,OAAO,CAAC,WAAW;YACrC,eAAe,EAAG,OAAO,CAAC,eAAe;YACzC,YAAY,EAAM,kBAAY;YAC9B,eAAe,EAAG,EAAE;SACrB,CAAC,EACF,CAAC,cAAc,CAAC,CACjB,CAAC;QAGF,MAAM,eAAe,GAAG,OAAO,CAAC,OAAO,CACrC,IAAI,wBAAgB,CAAC,cAAc,EAAE,OAAO,CAAC,EAC7C,CAAC,cAAc,EAAC,mBAAmB,CAAC,CACrC,CAAC;QAEF,MAAM,SAAS,GAAG,OAAO,CAAC,OAAO,CAC/B,IAAI,wBAAgB,CAAC,QAAQ,EAAE,OAAO,CAAC,EACvC,CAAC,cAAc,EAAE,mBAAmB,EAAE,eAAe,CAAC,CACvD,CAAC;IAEJ,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import { Rule,Tree,SchematicContext } from \"@angular-devkit/schematics\";\nimport { NodePackageInstallTask, RunSchematicTask } from \"@angular-devkit/schematics/tasks\";\nimport { addPackageToPackageJson } from \"../utils/package\";\nimport { dependencies, devDependencies, Idependencies } from \"../magic-utils/env\";\nimport { MagicOptionScheme } from \"../magic-utils/rules/magic-option.scheme\";\n\nexport function mgAddTasks(options:MagicOptionScheme): Rule {\n return (host:Tree, context:SchematicContext)=>{\n\n console.log(\" [V - add install dependencies !] options.cliVersion=\" + options.cliVersion );\n devDependencies.push(new Idependencies(\"@magic-xpa/cli\", options.cliVersion));\n\n // install the devDependencies\n const devInstallTask = context.addTask(\n new RunSchematicTask('mg-install', {\n skipInstall : false,\n skipPackageJson : false,\n dependencies : [],\n devDependencies : devDependencies\n })\n );\n\n\n\n console.log(\" [V - add install dependencies !] options.angularVersion=\" + options.angularVersion);\n dependencies.push(new Idependencies(\"@magic-xpa/angular\", options.angularVersion ));\n\n // install the dependencies\n const packagesInstallTask = context.addTask(\n new RunSchematicTask('mg-install', {\n skipInstall : options.skipInstall,\n skipPackageJson : options.skipPackageJson,\n dependencies : dependencies,\n devDependencies : []\n }),\n [devInstallTask]\n );\n\n\n const deleteFilesTask = context.addTask(\n new RunSchematicTask('delete-files', options),\n [devInstallTask,packagesInstallTask]\n );\n\n const ngAddTask = context.addTask(\n new RunSchematicTask('mg-add', options),\n [devInstallTask, packagesInstallTask, deleteFilesTask]\n );\n\n };\n}\n\n\n"]}
|
|
@@ -1,53 +1,53 @@
|
|
|
1
|
-
import { Rule,Tree,SchematicContext } from "@angular-devkit/schematics";
|
|
2
|
-
import { NodePackageInstallTask, RunSchematicTask } from "@angular-devkit/schematics/tasks";
|
|
3
|
-
import { addPackageToPackageJson } from "../utils/package";
|
|
4
|
-
import { dependencies, devDependencies, Idependencies } from "../magic-utils/env";
|
|
5
|
-
import { MagicOptionScheme } from "../magic-utils/rules/magic-option.scheme";
|
|
6
|
-
|
|
7
|
-
export function mgAddTasks(options:MagicOptionScheme): Rule {
|
|
8
|
-
return (host:Tree, context:SchematicContext)=>{
|
|
9
|
-
|
|
10
|
-
console.log(" [V - add install dependencies !] options.cliVersion=" + options.cliVersion );
|
|
11
|
-
devDependencies.push(new Idependencies("@magic-xpa/cli", options.cliVersion));
|
|
12
|
-
|
|
13
|
-
// install the devDependencies
|
|
14
|
-
const devInstallTask = context.addTask(
|
|
15
|
-
new RunSchematicTask('mg-install', {
|
|
16
|
-
skipInstall : false,
|
|
17
|
-
skipPackageJson : false,
|
|
18
|
-
dependencies : [],
|
|
19
|
-
devDependencies : devDependencies
|
|
20
|
-
})
|
|
21
|
-
);
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
console.log(" [V - add install dependencies !] options.angularVersion=" + options.angularVersion);
|
|
26
|
-
dependencies.push(new Idependencies("@magic-xpa/angular", options.angularVersion ));
|
|
27
|
-
|
|
28
|
-
// install the dependencies
|
|
29
|
-
const packagesInstallTask = context.addTask(
|
|
30
|
-
new RunSchematicTask('mg-install', {
|
|
31
|
-
skipInstall : options.skipInstall,
|
|
32
|
-
skipPackageJson : options.skipPackageJson,
|
|
33
|
-
dependencies : dependencies,
|
|
34
|
-
devDependencies : []
|
|
35
|
-
}),
|
|
36
|
-
[devInstallTask]
|
|
37
|
-
);
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
const deleteFilesTask = context.addTask(
|
|
41
|
-
new RunSchematicTask('delete-files', options),
|
|
42
|
-
[devInstallTask,packagesInstallTask]
|
|
43
|
-
);
|
|
44
|
-
|
|
45
|
-
const ngAddTask = context.addTask(
|
|
46
|
-
new RunSchematicTask('mg-add', options),
|
|
47
|
-
[devInstallTask, packagesInstallTask, deleteFilesTask]
|
|
48
|
-
);
|
|
49
|
-
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
|
|
1
|
+
import { Rule,Tree,SchematicContext } from "@angular-devkit/schematics";
|
|
2
|
+
import { NodePackageInstallTask, RunSchematicTask } from "@angular-devkit/schematics/tasks";
|
|
3
|
+
import { addPackageToPackageJson } from "../utils/package";
|
|
4
|
+
import { dependencies, devDependencies, Idependencies } from "../magic-utils/env";
|
|
5
|
+
import { MagicOptionScheme } from "../magic-utils/rules/magic-option.scheme";
|
|
6
|
+
|
|
7
|
+
export function mgAddTasks(options:MagicOptionScheme): Rule {
|
|
8
|
+
return (host:Tree, context:SchematicContext)=>{
|
|
9
|
+
|
|
10
|
+
console.log(" [V - add install dependencies !] options.cliVersion=" + options.cliVersion );
|
|
11
|
+
devDependencies.push(new Idependencies("@magic-xpa/cli", options.cliVersion));
|
|
12
|
+
|
|
13
|
+
// install the devDependencies
|
|
14
|
+
const devInstallTask = context.addTask(
|
|
15
|
+
new RunSchematicTask('mg-install', {
|
|
16
|
+
skipInstall : false,
|
|
17
|
+
skipPackageJson : false,
|
|
18
|
+
dependencies : [],
|
|
19
|
+
devDependencies : devDependencies
|
|
20
|
+
})
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
console.log(" [V - add install dependencies !] options.angularVersion=" + options.angularVersion);
|
|
26
|
+
dependencies.push(new Idependencies("@magic-xpa/angular", options.angularVersion ));
|
|
27
|
+
|
|
28
|
+
// install the dependencies
|
|
29
|
+
const packagesInstallTask = context.addTask(
|
|
30
|
+
new RunSchematicTask('mg-install', {
|
|
31
|
+
skipInstall : options.skipInstall,
|
|
32
|
+
skipPackageJson : options.skipPackageJson,
|
|
33
|
+
dependencies : dependencies,
|
|
34
|
+
devDependencies : []
|
|
35
|
+
}),
|
|
36
|
+
[devInstallTask]
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
const deleteFilesTask = context.addTask(
|
|
41
|
+
new RunSchematicTask('delete-files', options),
|
|
42
|
+
[devInstallTask,packagesInstallTask]
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
const ngAddTask = context.addTask(
|
|
46
|
+
new RunSchematicTask('mg-add', options),
|
|
47
|
+
[devInstallTask, packagesInstallTask, deleteFilesTask]
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
|
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "http://json-schema.org/schema",
|
|
3
|
-
"$id": "SchematicsMagicAddTasks",
|
|
4
|
-
"title": "Magic Options Schema",
|
|
5
|
-
"type": "object",
|
|
6
|
-
"properties": {
|
|
7
|
-
"skipInstall": {
|
|
8
|
-
"type": "boolean",
|
|
9
|
-
"default": false,
|
|
10
|
-
"description": "Do not install the new packages (e.g., --skipInstall)"
|
|
11
|
-
},
|
|
12
|
-
"skipPackageJson": {
|
|
13
|
-
"type": "boolean",
|
|
14
|
-
"default": false,
|
|
15
|
-
"description": "Do not add magic dependencies to package.json (e.g., --skipPackageJson)"
|
|
16
|
-
},
|
|
17
|
-
"skipHelp": {
|
|
18
|
-
"type": "boolean",
|
|
19
|
-
"default": false,
|
|
20
|
-
"description": "Whether to create Startup Welcome Pag (e.g., --skipHelp)"
|
|
21
|
-
},
|
|
22
|
-
"project":{
|
|
23
|
-
"type": "string",
|
|
24
|
-
"description": "The name of the project",
|
|
25
|
-
"aliases" : ["p"]
|
|
26
|
-
},
|
|
27
|
-
"cliVersion":{
|
|
28
|
-
"type": "string",
|
|
29
|
-
"default": "*",
|
|
30
|
-
"description": "The cli version ",
|
|
31
|
-
"aliases" : ["c"]
|
|
32
|
-
},
|
|
33
|
-
"angularVersion":{
|
|
34
|
-
"type": "string",
|
|
35
|
-
"default": "*",
|
|
36
|
-
"description": "The angular version ",
|
|
37
|
-
"aliases" : ["a"]
|
|
38
|
-
}
|
|
39
|
-
},
|
|
40
|
-
"required": []
|
|
41
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/schema",
|
|
3
|
+
"$id": "SchematicsMagicAddTasks",
|
|
4
|
+
"title": "Magic Options Schema",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"skipInstall": {
|
|
8
|
+
"type": "boolean",
|
|
9
|
+
"default": false,
|
|
10
|
+
"description": "Do not install the new packages (e.g., --skipInstall)"
|
|
11
|
+
},
|
|
12
|
+
"skipPackageJson": {
|
|
13
|
+
"type": "boolean",
|
|
14
|
+
"default": false,
|
|
15
|
+
"description": "Do not add magic dependencies to package.json (e.g., --skipPackageJson)"
|
|
16
|
+
},
|
|
17
|
+
"skipHelp": {
|
|
18
|
+
"type": "boolean",
|
|
19
|
+
"default": false,
|
|
20
|
+
"description": "Whether to create Startup Welcome Pag (e.g., --skipHelp)"
|
|
21
|
+
},
|
|
22
|
+
"project":{
|
|
23
|
+
"type": "string",
|
|
24
|
+
"description": "The name of the project",
|
|
25
|
+
"aliases" : ["p"]
|
|
26
|
+
},
|
|
27
|
+
"cliVersion":{
|
|
28
|
+
"type": "string",
|
|
29
|
+
"default": "*",
|
|
30
|
+
"description": "The cli version ",
|
|
31
|
+
"aliases" : ["c"]
|
|
32
|
+
},
|
|
33
|
+
"angularVersion":{
|
|
34
|
+
"type": "string",
|
|
35
|
+
"default": "*",
|
|
36
|
+
"description": "The angular version ",
|
|
37
|
+
"aliases" : ["a"]
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
"required": []
|
|
41
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;AAKA,sCAKC;AAVD,2DAAsD;AACtD,4FAAmF;AACnF,gDAAuD;AAGvD,SAAgB,aAAa,CAAC,OAAyB;IACrD,OAAO,IAAA,kBAAK,EAAC;QACX,IAAA,4CAAiB,EAAE,OAAO,CAAC;QAC3B,IAAA,wBAAgB,EAAG,OAAO,CAAC;KAC5B,CAAC,CAAC;AACL,CAAC","sourcesContent":["import {chain,Rule} from \"@angular-devkit/schematics\";\
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;AAKA,sCAKC;AAVD,2DAAsD;AACtD,4FAAmF;AACnF,gDAAuD;AAGvD,SAAgB,aAAa,CAAC,OAAyB;IACrD,OAAO,IAAA,kBAAK,EAAC;QACX,IAAA,4CAAiB,EAAE,OAAO,CAAC;QAC3B,IAAA,wBAAgB,EAAG,OAAO,CAAC;KAC5B,CAAC,CAAC;AACL,CAAC","sourcesContent":["import {chain,Rule} from \"@angular-devkit/schematics\";\nimport { initMagicMetadata} from \"../magic-utils/rules/init-magic-metadata.rule\";\nimport { deleteMagicFiles} from \"../magic-utils/utils\";\nimport { MagicOptionScheme } from \"../magic-utils/rules/magic-option.scheme\";\n\nexport function mgDeleteFiles(options:MagicOptionScheme): Rule {\n return chain([\n initMagicMetadata (options),\n deleteMagicFiles (options),\n ]);\n}\n\n"]}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {chain,Rule} from "@angular-devkit/schematics";
|
|
2
|
-
import { initMagicMetadata} from "../magic-utils/rules/init-magic-metadata.rule";
|
|
3
|
-
import { deleteMagicFiles} from "../magic-utils/utils";
|
|
4
|
-
import { MagicOptionScheme } from "../magic-utils/rules/magic-option.scheme";
|
|
5
|
-
|
|
6
|
-
export function mgDeleteFiles(options:MagicOptionScheme): Rule {
|
|
7
|
-
return chain([
|
|
8
|
-
initMagicMetadata (options),
|
|
9
|
-
deleteMagicFiles (options),
|
|
10
|
-
]);
|
|
11
|
-
}
|
|
12
|
-
|
|
1
|
+
import {chain,Rule} from "@angular-devkit/schematics";
|
|
2
|
+
import { initMagicMetadata} from "../magic-utils/rules/init-magic-metadata.rule";
|
|
3
|
+
import { deleteMagicFiles} from "../magic-utils/utils";
|
|
4
|
+
import { MagicOptionScheme } from "../magic-utils/rules/magic-option.scheme";
|
|
5
|
+
|
|
6
|
+
export function mgDeleteFiles(options:MagicOptionScheme): Rule {
|
|
7
|
+
return chain([
|
|
8
|
+
initMagicMetadata (options),
|
|
9
|
+
deleteMagicFiles (options),
|
|
10
|
+
]);
|
|
11
|
+
}
|
|
12
|
+
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "http://json-schema.org/schema",
|
|
3
|
-
"$id": "SchematicsMagicDeleteFiles",
|
|
4
|
-
"title": "Magic Options Schema",
|
|
5
|
-
"type": "object",
|
|
6
|
-
"properties": {
|
|
7
|
-
"project":{
|
|
8
|
-
"type": "string",
|
|
9
|
-
"description": "The name of the project",
|
|
10
|
-
"aliases" : ["p"]
|
|
11
|
-
}
|
|
12
|
-
},
|
|
13
|
-
"required": []
|
|
14
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/schema",
|
|
3
|
+
"$id": "SchematicsMagicDeleteFiles",
|
|
4
|
+
"title": "Magic Options Schema",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"project":{
|
|
8
|
+
"type": "string",
|
|
9
|
+
"description": "The name of the project",
|
|
10
|
+
"aliases" : ["p"]
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
"required": []
|
|
14
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;AAKA,kCAQC;AAbD,2DAAyD;AACzD,4FAAmF;AAEnF,sFAAgG;AAEhG,SAAgB,WAAW,CAAC,OAAyB;IACnD,OAAO,IAAA,kBAAK,EAAC;QACX,IAAA,4CAAiB,EAAE,OAAO,CAAC;QAE3B,4CAA4C;QAC5C,IAAA,sCAAc,EAAE,OAAO,CAAC;QACxB,IAAA,0CAAkB,EAAC,OAAO,CAAC;KAC5B,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { chain, Rule } from \"@angular-devkit/schematics\";\
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;AAKA,kCAQC;AAbD,2DAAyD;AACzD,4FAAmF;AAEnF,sFAAgG;AAEhG,SAAgB,WAAW,CAAC,OAAyB;IACnD,OAAO,IAAA,kBAAK,EAAC;QACX,IAAA,4CAAiB,EAAE,OAAO,CAAC;QAE3B,4CAA4C;QAC5C,IAAA,sCAAc,EAAE,OAAO,CAAC;QACxB,IAAA,0CAAkB,EAAC,OAAO,CAAC;KAC5B,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { chain, Rule } from \"@angular-devkit/schematics\";\nimport { initMagicMetadata} from \"../magic-utils/rules/init-magic-metadata.rule\";\nimport { MagicOptionScheme } from \"../magic-utils/rules/magic-option.scheme\";\nimport { generateWebModules, initGenModules } from \"../magic-utils/rules/init-add-modules.rule\";\n\nexport function mgGenModule(options:MagicOptionScheme): Rule {\n return chain([\n initMagicMetadata (options),\n\n // ** generate the modules in the project **\n initGenModules (options),\n generateWebModules(options)\n ]);\n}\n"]}
|