devextreme-schematics 1.2.23 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- package/LICENSE +21 -21
- package/package.json +7 -7
- package/src/add-app-template/index.d.ts +2 -2
- package/src/add-app-template/index.js +26 -26
- package/src/add-app-template/index_spec.d.ts +1 -1
- package/src/add-app-template/index_spec.js +70 -69
- package/src/add-app-template/index_spec.js.map +1 -1
- package/src/add-app-template/schema.json +2 -2
- package/src/add-layout/files/devextreme.json +1 -1
- package/src/add-layout/files/src/app/shared/services/screen.service.ts +1 -1
- package/src/add-layout/files/src/dx-styles.scss +4 -0
- package/src/add-layout/index.d.ts +2 -2
- package/src/add-layout/index.js +277 -266
- package/src/add-layout/index.js.map +1 -1
- package/src/add-layout/index.ts +28 -30
- package/src/add-layout/index_spec.d.ts +1 -1
- package/src/add-layout/index_spec.js +251 -250
- package/src/add-layout/index_spec.js.map +1 -1
- package/src/add-layout/index_spec.ts +2 -2
- package/src/add-layout/schema.json +2 -2
- package/src/add-sample-views/index.d.ts +2 -2
- package/src/add-sample-views/index.js +97 -88
- package/src/add-sample-views/index.js.map +1 -1
- package/src/add-sample-views/index.ts +3 -3
- package/src/add-sample-views/index_spec.d.ts +1 -1
- package/src/add-sample-views/index_spec.js +53 -52
- package/src/add-sample-views/index_spec.js.map +1 -1
- package/src/add-sample-views/index_spec.ts +1 -1
- package/src/add-sample-views/schema.json +1 -1
- package/src/add-view/index.d.ts +3 -3
- package/src/add-view/index.js +125 -113
- package/src/add-view/index.js.map +1 -1
- package/src/add-view/index.ts +14 -13
- package/src/add-view/index_spec.d.ts +1 -1
- package/src/add-view/index_spec.js +109 -108
- package/src/add-view/index_spec.js.map +1 -1
- package/src/add-view/schema.json +1 -1
- package/src/install/index.d.ts +2 -2
- package/src/install/index.js +76 -63
- package/src/install/index.js.map +1 -1
- package/src/install/index.ts +4 -2
- package/src/install/index_spec.d.ts +1 -1
- package/src/install/index_spec.js +96 -95
- package/src/install/index_spec.js.map +1 -1
- package/src/install/index_spec.ts +1 -1
- package/src/install/schema.json +1 -1
- package/src/utility/array.d.ts +1 -1
- package/src/utility/array.js +7 -6
- package/src/utility/array.js.map +1 -1
- package/src/utility/change.d.ts +7 -7
- package/src/utility/change.js +49 -48
- package/src/utility/change.js.map +1 -1
- package/src/utility/latest-versions.d.ts +5 -5
- package/src/utility/latest-versions.js +9 -8
- package/src/utility/latest-versions.js.map +1 -1
- package/src/utility/modify-json-file.d.ts +3 -2
- package/src/utility/modify-json-file.js +15 -11
- package/src/utility/modify-json-file.js.map +1 -1
- package/src/utility/modify-json-file.ts +6 -3
- package/src/utility/project.d.ts +5 -5
- package/src/utility/project.js +48 -25
- package/src/utility/project.js.map +1 -1
- package/src/utility/project.ts +19 -14
- package/src/utility/routing.d.ts +4 -4
- package/src/utility/routing.js +32 -31
- package/src/utility/routing.js.map +1 -1
- package/src/utility/source.d.ts +3 -3
- package/src/utility/source.js +13 -12
- package/src/utility/source.js.map +1 -1
- package/src/utility/string.d.ts +1 -1
- package/src/utility/string.js +8 -7
- package/src/utility/string.js.map +1 -1
- package/src/utility/styles.d.ts +1 -2
- package/src/utility/styles.js +29 -30
- package/src/utility/styles.js.map +1 -1
- package/src/utility/styles.ts +2 -5
@@ -210,8 +210,8 @@ describe('layout', () => {
|
|
210
210
|
const budgets = angularContent.projects.testApp.architect.build.configurations.production.budgets;
|
211
211
|
const defaultBudget = {
|
212
212
|
type: 'initial',
|
213
|
-
maximumWarning: '
|
214
|
-
maximumError: '
|
213
|
+
maximumWarning: '500kb',
|
214
|
+
maximumError: '1mb'
|
215
215
|
};
|
216
216
|
|
217
217
|
expect(budgets.length).toBe(2);
|
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"$schema": "http://json-schema.org/schema",
|
3
|
-
"id": "SchematicsDevextremeAddLayout",
|
3
|
+
"$id": "SchematicsDevextremeAddLayout",
|
4
4
|
"title": "Add a DevExtreme layout to a DevExtreme Angular application",
|
5
5
|
"type": "object",
|
6
6
|
"properties": {
|
@@ -49,7 +49,7 @@
|
|
49
49
|
},
|
50
50
|
"globalNgCliVersion": {
|
51
51
|
"type":"string",
|
52
|
-
"default": "^
|
52
|
+
"default": "^12.0.0"
|
53
53
|
}
|
54
54
|
}
|
55
55
|
}
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import { Rule } from '@angular-devkit/schematics';
|
2
|
-
export default function (options: any): Rule;
|
1
|
+
import { Rule } from '@angular-devkit/schematics';
|
2
|
+
export default function (options: any): Rule;
|
@@ -1,42 +1,51 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
componentName: '
|
31
|
-
relativePath: '
|
32
|
-
}
|
33
|
-
];
|
34
|
-
const
|
1
|
+
"use strict";
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
9
|
+
});
|
10
|
+
};
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
12
|
+
const schematics_1 = require("@angular-devkit/schematics");
|
13
|
+
const ast_utils_1 = require("@schematics/angular/utility/ast-utils");
|
14
|
+
const add_view_1 = require("../add-view");
|
15
|
+
const project_1 = require("../utility/project");
|
16
|
+
const string_1 = require("../utility/string");
|
17
|
+
const change_1 = require("../utility/change");
|
18
|
+
const source_1 = require("../utility/source");
|
19
|
+
const sampleViewOptions = [
|
20
|
+
{
|
21
|
+
name: 'home',
|
22
|
+
componentName: 'HomeComponent',
|
23
|
+
relativePath: './pages/home/home.component'
|
24
|
+
}, {
|
25
|
+
name: 'profile',
|
26
|
+
componentName: 'ProfileComponent',
|
27
|
+
relativePath: './pages/profile/profile.component'
|
28
|
+
}, {
|
29
|
+
name: 'tasks',
|
30
|
+
componentName: 'TasksComponent',
|
31
|
+
relativePath: './pages/tasks/tasks.component'
|
32
|
+
}
|
33
|
+
];
|
34
|
+
const devextremeOptions = [
|
35
|
+
{
|
36
|
+
componentName: 'DxDataGridModule',
|
37
|
+
relativePath: 'devextreme-angular'
|
38
|
+
}, {
|
39
|
+
componentName: 'DxFormModule',
|
40
|
+
relativePath: 'devextreme-angular'
|
41
|
+
}
|
42
|
+
];
|
43
|
+
const navigations = [
|
35
44
|
` {
|
36
45
|
text: 'Home',
|
37
46
|
path: '/home',
|
38
47
|
icon: 'home'
|
39
|
-
}`,
|
48
|
+
}`,
|
40
49
|
` {
|
41
50
|
text: 'Examples',
|
42
51
|
icon: 'folder',
|
@@ -50,57 +59,57 @@ const navigations = [
|
|
50
59
|
path: '/tasks'
|
51
60
|
}
|
52
61
|
]
|
53
|
-
}`
|
54
|
-
];
|
55
|
-
function addImportsToRoutingModule(isView, routingPath, options) {
|
56
|
-
return (host) => {
|
57
|
-
const source = source_1.getSourceFile(host, routingPath);
|
58
|
-
if (!source) {
|
59
|
-
return host;
|
60
|
-
}
|
61
|
-
let changes;
|
62
|
-
if (isView) {
|
63
|
-
changes = ast_utils_1.addDeclarationToModule(source, routingPath, options.componentName, options.relativePath);
|
64
|
-
}
|
65
|
-
else {
|
66
|
-
changes = ast_utils_1.addImportToModule(source, routingPath, options.componentName, options.relativePath);
|
67
|
-
}
|
68
|
-
return change_1.applyChanges(host, changes, routingPath);
|
69
|
-
};
|
70
|
-
}
|
71
|
-
function addDefaultNavigation(rootPath) {
|
72
|
-
return (host) => {
|
73
|
-
const navigationPath = rootPath + 'app-navigation.ts';
|
74
|
-
navigations.forEach((navigation) => {
|
75
|
-
const navigationSource = source_1.getSourceFile(host, navigationPath);
|
76
|
-
change_1.insertItemToArray(host, navigationPath, navigationSource, navigation, { location: 'end' });
|
77
|
-
});
|
78
|
-
return host;
|
79
|
-
};
|
80
|
-
}
|
81
|
-
function default_1(options) {
|
82
|
-
return (host) => {
|
83
|
-
const project = project_1.getProjectName(host, options.project);
|
84
|
-
const rootPath = project_1.getApplicationPath(host, project);
|
85
|
-
const routingPath = rootPath + 'app-routing.module.ts';
|
86
|
-
const rules = [];
|
87
|
-
const templateSource = schematics_1.apply(schematics_1.url('./files'), [
|
88
|
-
schematics_1.template({
|
89
|
-
project: string_1.humanize(project)
|
90
|
-
}),
|
91
|
-
schematics_1.move(rootPath)
|
92
|
-
]);
|
93
|
-
rules.push(schematics_1.mergeWith(templateSource));
|
94
|
-
sampleViewOptions.forEach((viewOptions) => {
|
95
|
-
rules.push(add_view_1.addViewToRouting({ name: viewOptions.name, project, module: 'app-routing' }));
|
96
|
-
rules.push(addImportsToRoutingModule(true, routingPath, viewOptions));
|
97
|
-
});
|
98
|
-
devextremeOptions.forEach((moduleOptions) => {
|
99
|
-
rules.push(addImportsToRoutingModule(false, routingPath, moduleOptions));
|
100
|
-
});
|
101
|
-
rules.push(addDefaultNavigation(rootPath));
|
102
|
-
return schematics_1.chain(rules);
|
103
|
-
};
|
104
|
-
}
|
105
|
-
exports.default = default_1;
|
62
|
+
}`
|
63
|
+
];
|
64
|
+
function addImportsToRoutingModule(isView, routingPath, options) {
|
65
|
+
return (host) => {
|
66
|
+
const source = source_1.getSourceFile(host, routingPath);
|
67
|
+
if (!source) {
|
68
|
+
return host;
|
69
|
+
}
|
70
|
+
let changes;
|
71
|
+
if (isView) {
|
72
|
+
changes = ast_utils_1.addDeclarationToModule(source, routingPath, options.componentName, options.relativePath);
|
73
|
+
}
|
74
|
+
else {
|
75
|
+
changes = ast_utils_1.addImportToModule(source, routingPath, options.componentName, options.relativePath);
|
76
|
+
}
|
77
|
+
return change_1.applyChanges(host, changes, routingPath);
|
78
|
+
};
|
79
|
+
}
|
80
|
+
function addDefaultNavigation(rootPath) {
|
81
|
+
return (host) => {
|
82
|
+
const navigationPath = rootPath + 'app-navigation.ts';
|
83
|
+
navigations.forEach((navigation) => {
|
84
|
+
const navigationSource = source_1.getSourceFile(host, navigationPath);
|
85
|
+
change_1.insertItemToArray(host, navigationPath, navigationSource, navigation, { location: 'end' });
|
86
|
+
});
|
87
|
+
return host;
|
88
|
+
};
|
89
|
+
}
|
90
|
+
function default_1(options) {
|
91
|
+
return (host) => __awaiter(this, void 0, void 0, function* () {
|
92
|
+
const project = yield project_1.getProjectName(host, options.project);
|
93
|
+
const rootPath = yield project_1.getApplicationPath(host, project);
|
94
|
+
const routingPath = rootPath + 'app-routing.module.ts';
|
95
|
+
const rules = [];
|
96
|
+
const templateSource = schematics_1.apply(schematics_1.url('./files'), [
|
97
|
+
schematics_1.template({
|
98
|
+
project: string_1.humanize(project)
|
99
|
+
}),
|
100
|
+
schematics_1.move(rootPath)
|
101
|
+
]);
|
102
|
+
rules.push(schematics_1.mergeWith(templateSource));
|
103
|
+
sampleViewOptions.forEach((viewOptions) => {
|
104
|
+
rules.push(add_view_1.addViewToRouting({ name: viewOptions.name, project, module: 'app-routing' }));
|
105
|
+
rules.push(addImportsToRoutingModule(true, routingPath, viewOptions));
|
106
|
+
});
|
107
|
+
devextremeOptions.forEach((moduleOptions) => {
|
108
|
+
rules.push(addImportsToRoutingModule(false, routingPath, moduleOptions));
|
109
|
+
});
|
110
|
+
rules.push(addDefaultNavigation(rootPath));
|
111
|
+
return schematics_1.chain(rules);
|
112
|
+
});
|
113
|
+
}
|
114
|
+
exports.default = default_1;
|
106
115
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"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"}
|
@@ -110,9 +110,9 @@ function addDefaultNavigation(rootPath: string) {
|
|
110
110
|
}
|
111
111
|
|
112
112
|
export default function(options: any): Rule {
|
113
|
-
return (host: Tree) => {
|
114
|
-
const project = getProjectName(host, options.project);
|
115
|
-
const rootPath = getApplicationPath(host, project);
|
113
|
+
return async (host: Tree) => {
|
114
|
+
const project = await getProjectName(host, options.project);
|
115
|
+
const rootPath = await getApplicationPath(host, project);
|
116
116
|
const routingPath = rootPath + 'app-routing.module.ts';
|
117
117
|
const rules: any[] = [];
|
118
118
|
|
@@ -1 +1 @@
|
|
1
|
-
export {};
|
1
|
+
export {};
|
@@ -1,52 +1,53 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
3
|
-
return
|
4
|
-
|
5
|
-
function
|
6
|
-
function
|
7
|
-
step(
|
8
|
-
|
9
|
-
};
|
10
|
-
|
11
|
-
|
12
|
-
const
|
13
|
-
const
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
const
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
appTree = yield schematicRunner.runSchematicAsync('
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
tree = yield runner.runSchematicAsync('add-
|
43
|
-
|
44
|
-
|
45
|
-
expect(moduleContent).toMatch(/
|
46
|
-
expect(moduleContent).toMatch(/
|
47
|
-
expect(moduleContent).toMatch(/
|
48
|
-
|
49
|
-
|
1
|
+
"use strict";
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
9
|
+
});
|
10
|
+
};
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
12
|
+
const testing_1 = require("@angular-devkit/schematics/testing");
|
13
|
+
const path = require("path");
|
14
|
+
const collectionPath = path.join(__dirname, '../collection.json');
|
15
|
+
describe('sample views', () => {
|
16
|
+
const appOptions = {
|
17
|
+
name: 'testApp',
|
18
|
+
projectRoot: '',
|
19
|
+
inlineStyle: false,
|
20
|
+
inlineTemplate: false,
|
21
|
+
routing: true,
|
22
|
+
style: 'css',
|
23
|
+
skipTests: false,
|
24
|
+
skipPackageJson: false
|
25
|
+
};
|
26
|
+
const workspaceOptions = {
|
27
|
+
name: 'workspace',
|
28
|
+
version: '6.0.0'
|
29
|
+
};
|
30
|
+
const sampleViewsOptions = {
|
31
|
+
project: 'testApp'
|
32
|
+
};
|
33
|
+
const angularSchematicsCollection = require.resolve('../../node_modules/@schematics/angular/collection.json');
|
34
|
+
const schematicRunner = new testing_1.SchematicTestRunner('@schematics/angular', angularSchematicsCollection);
|
35
|
+
let appTree;
|
36
|
+
beforeEach(() => __awaiter(void 0, void 0, void 0, function* () {
|
37
|
+
appTree = yield schematicRunner.runSchematicAsync('workspace', workspaceOptions).toPromise();
|
38
|
+
appTree = yield schematicRunner.runSchematicAsync('application', appOptions, appTree).toPromise();
|
39
|
+
}));
|
40
|
+
it('should add sample views', () => __awaiter(void 0, void 0, void 0, function* () {
|
41
|
+
const runner = new testing_1.SchematicTestRunner('schematics', collectionPath);
|
42
|
+
let tree = yield runner.runSchematicAsync('add-layout', { layout: 'side-nav-outer-toolbar' }, appTree).toPromise();
|
43
|
+
tree = yield runner.runSchematicAsync('add-sample-views', sampleViewsOptions, tree).toPromise();
|
44
|
+
const moduleContent = tree.readContent('/src/app/app-routing.module.ts');
|
45
|
+
expect(moduleContent).toMatch(/component: HomeComponent/);
|
46
|
+
expect(moduleContent).toMatch(/path: 'home'/);
|
47
|
+
expect(moduleContent).toMatch(/import { HomeComponent } from /);
|
48
|
+
expect(moduleContent).toMatch(/declarations:\s\[\n*\s*HomeComponent/);
|
49
|
+
const navigationContent = tree.readContent('/src/app/app-navigation.ts');
|
50
|
+
expect(navigationContent).toMatch(/text: 'Home'/);
|
50
51
|
expect(navigationContent).toContain(`export const navigation = [
|
51
52
|
{
|
52
53
|
text: 'Home',
|
@@ -67,7 +68,7 @@ describe('sample views', () => {
|
|
67
68
|
}
|
68
69
|
]
|
69
70
|
}
|
70
|
-
];`);
|
71
|
-
}));
|
72
|
-
});
|
71
|
+
];`);
|
72
|
+
}));
|
73
|
+
});
|
73
74
|
//# sourceMappingURL=index_spec.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index_spec.js","sourceRoot":"","sources":["index_spec.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"index_spec.js","sourceRoot":"","sources":["index_spec.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,gEAAuF;AAEvF,6BAA6B;AAE7B,MAAM,cAAc,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,oBAAoB,CAAC,CAAC;AAElE,QAAQ,CAAC,cAAc,EAAE,GAAG,EAAE;IAC5B,MAAM,UAAU,GAAQ;QACtB,IAAI,EAAE,SAAS;QACf,WAAW,EAAE,EAAE;QACf,WAAW,EAAE,KAAK;QAClB,cAAc,EAAE,KAAK;QACrB,OAAO,EAAE,IAAI;QACb,KAAK,EAAE,KAAK;QACZ,SAAS,EAAE,KAAK;QAChB,eAAe,EAAE,KAAK;KACvB,CAAC;IAEF,MAAM,gBAAgB,GAAqB;QACzC,IAAI,EAAE,WAAW;QACjB,OAAO,EAAE,OAAO;KACjB,CAAC;IAEF,MAAM,kBAAkB,GAAQ;QAC9B,OAAO,EAAE,SAAS;KACnB,CAAC;IAEF,MAAM,2BAA2B,GAAG,OAAO,CAAC,OAAO,CAAC,wDAAwD,CAAC,CAAC;IAC9G,MAAM,eAAe,GAAG,IAAI,6BAAmB,CAAC,qBAAqB,EAAE,2BAA2B,CAAC,CAAC;IACpG,IAAI,OAAqB,CAAC;IAE1B,UAAU,CAAC,GAAS,EAAE;QACpB,OAAO,GAAI,MAAM,eAAe,CAAC,iBAAiB,CAAC,WAAW,EAAE,gBAAgB,CAAC,CAAC,SAAS,EAAE,CAAC;QAC9F,OAAO,GAAG,MAAM,eAAe,CAAC,iBAAiB,CAAC,aAAa,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC,SAAS,EAAE,CAAC;IACpG,CAAC,CAAA,CAAC,CAAC;IAEH,EAAE,CAAC,yBAAyB,EAAE,GAAS,EAAE;QACvC,MAAM,MAAM,GAAG,IAAI,6BAAmB,CAAC,YAAY,EAAE,cAAc,CAAC,CAAC;QACrE,IAAI,IAAI,GAAG,MAAM,MAAM,CAAC,iBAAiB,CAAC,YAAY,EAAE,EAAE,MAAM,EAAE,wBAAwB,EAAE,EAAE,OAAO,CAAC,CAAC,SAAS,EAAE,CAAC;QACnH,IAAI,GAAG,MAAM,MAAM,CAAC,iBAAiB,CAAC,kBAAkB,EAAE,kBAAkB,EAAE,IAAI,CAAC,CAAC,SAAS,EAAE,CAAC;QAEhG,MAAM,aAAa,GAAG,IAAI,CAAC,WAAW,CAAC,gCAAgC,CAAC,CAAC;QAEzE,MAAM,CAAC,aAAa,CAAC,CAAC,OAAO,CAAC,0BAA0B,CAAC,CAAC;QAC1D,MAAM,CAAC,aAAa,CAAC,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;QAE9C,MAAM,CAAC,aAAa,CAAC,CAAC,OAAO,CAAC,gCAAgC,CAAC,CAAC;QAChE,MAAM,CAAC,aAAa,CAAC,CAAC,OAAO,CAAC,sCAAsC,CAAC,CAAC;QAEtE,MAAM,iBAAiB,GAAG,IAAI,CAAC,WAAW,CAAC,4BAA4B,CAAC,CAAC;QACzE,MAAM,CAAC,iBAAiB,CAAC,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;QAClD,MAAM,CAAC,iBAAiB,CAAC,CAAC,SAAS,CAAC;;;;;;;;;;;;;;;;;;;;GAoBrC,CAAC,CAAC;IACH,CAAC,CAAA,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
@@ -45,7 +45,7 @@ describe('sample views', () => {
|
|
45
45
|
expect(moduleContent).toMatch(/path: 'home'/);
|
46
46
|
|
47
47
|
expect(moduleContent).toMatch(/import { HomeComponent } from /);
|
48
|
-
expect(moduleContent).toMatch(/declarations
|
48
|
+
expect(moduleContent).toMatch(/declarations:\s\[\n*\s*HomeComponent/);
|
49
49
|
|
50
50
|
const navigationContent = tree.readContent('/src/app/app-navigation.ts');
|
51
51
|
expect(navigationContent).toMatch(/text: 'Home'/);
|
package/src/add-view/index.d.ts
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
import { Rule } from '@angular-devkit/schematics';
|
2
|
-
export declare function addViewToRouting(options: any): (host:
|
3
|
-
export default function (options: any): Rule;
|
1
|
+
import { Rule, Tree } from '@angular-devkit/schematics';
|
2
|
+
export declare function addViewToRouting(options: any): (host: Tree) => Promise<import("@angular-devkit/schematics/src/tree/interface").Tree>;
|
3
|
+
export default function (options: any): Rule;
|