@nstudio/angular 12.7.0 → 13.4.1
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 +5 -5
- package/package.json +3 -3
- package/src/schematics/application/index.js +33 -23
- package/src/schematics/application/index.spec.js +8 -33
- package/src/schematics/application/schema.json +1 -28
- package/src/schematics/component/index.js +16 -16
- package/src/schematics/component/index.spec.js +22 -22
- package/src/schematics/directive/index.js +1 -1
- package/src/schematics/directive/index.spec.js +23 -23
- package/src/schematics/elements/index.js +18 -18
- package/src/schematics/elements/index.spec.js +21 -21
- package/src/schematics/feature/index.js +10 -10
- package/src/schematics/feature/index.spec.js +37 -37
- package/src/schematics/helpers/applitools/index.js +8 -8
- package/src/schematics/helpers/index.js +4 -4
- package/src/schematics/helpers/index.spec.js +15 -15
- package/src/schematics/ng-add/index.js +4 -4
- package/src/schematics/ngrx/index.js +1 -1
- package/src/schematics/ngrx/index.spec.js +16 -16
- package/src/schematics/pipe/index.js +1 -1
- package/src/schematics/pipe/index.spec.js +20 -20
- package/src/schematics/service/index.js +1 -1
- package/src/schematics/service/index.spec.js +20 -20
- package/src/schematics/xplat/index.js +7 -7
- package/src/schematics/xplat/index.spec.js +13 -13
- package/src/utils/ast.js +8 -8
- package/src/utils/generator.js +48 -48
- package/src/utils/testing.js +1 -1
- package/src/utils/versions.d.ts +9 -11
- package/src/utils/versions.js +11 -13
- package/src/utils/xplat.js +24 -23
@@ -19,111 +19,111 @@ describe('directive schematic', () => {
|
|
19
19
|
};
|
20
20
|
beforeEach(() => {
|
21
21
|
appTree = schematics_1.Tree.empty();
|
22
|
-
appTree = testing_1.createXplatWithNativeScriptWeb(appTree, null, 'angular');
|
22
|
+
appTree = (0, testing_1.createXplatWithNativeScriptWeb)(appTree, null, 'angular');
|
23
23
|
});
|
24
24
|
it('should create directive in libs by default for use across any platform and apps', () => __awaiter(void 0, void 0, void 0, function* () {
|
25
25
|
// console.log('appTree:', appTree);
|
26
|
-
let tree = yield testing_2.runSchematic('feature', {
|
26
|
+
let tree = yield (0, testing_2.runSchematic)('feature', {
|
27
27
|
name: 'foo',
|
28
28
|
platforms: 'nativescript,web',
|
29
29
|
}, appTree);
|
30
30
|
let options = Object.assign({}, defaultOptions);
|
31
31
|
// Directives without the feature option are added to the ui-feature
|
32
|
-
tree = yield testing_2.runSchematic('directive', options, tree);
|
32
|
+
tree = yield (0, testing_2.runSchematic)('directive', options, tree);
|
33
33
|
let files = tree.files;
|
34
34
|
// console.log(files.slice(91,files.length));
|
35
35
|
// component
|
36
36
|
expect(files.indexOf('/libs/xplat/features/src/lib/ui/directives/active-link.directive.ts')).toBeGreaterThanOrEqual(0);
|
37
37
|
// file content
|
38
|
-
let content = testing_1.getFileContent(tree, '/libs/xplat/features/src/lib/ui/directives/active-link.directive.ts');
|
38
|
+
let content = (0, testing_1.getFileContent)(tree, '/libs/xplat/features/src/lib/ui/directives/active-link.directive.ts');
|
39
39
|
// console.log(content);
|
40
40
|
expect(content.indexOf(`@Directive({`)).toBeGreaterThanOrEqual(0);
|
41
41
|
expect(content.indexOf(`selector: '[active-link]'`)).toBeGreaterThanOrEqual(0);
|
42
42
|
let modulePath = '/libs/xplat/features/src/lib/ui/ui.module.ts';
|
43
|
-
let moduleContent = testing_1.getFileContent(tree, modulePath);
|
43
|
+
let moduleContent = (0, testing_1.getFileContent)(tree, modulePath);
|
44
44
|
// console.log(modulePath + ':');
|
45
45
|
// console.log(moduleContent);
|
46
46
|
expect(moduleContent.indexOf(`...UI_DIRECTIVES`)).toBeGreaterThanOrEqual(0);
|
47
47
|
// Directives added to the foo-feature
|
48
48
|
options = Object.assign(Object.assign({}, defaultOptions), { feature: 'foo' });
|
49
|
-
tree = yield testing_2.runSchematic('directive', options, tree);
|
49
|
+
tree = yield (0, testing_2.runSchematic)('directive', options, tree);
|
50
50
|
files = tree.files;
|
51
51
|
// console.log(files.slice(91,files.length));
|
52
52
|
expect(files.indexOf('/libs/xplat/features/src/lib/foo/directives/active-link.directive.ts')).toBeGreaterThanOrEqual(0);
|
53
53
|
// file content
|
54
|
-
content = testing_1.getFileContent(tree, '/libs/xplat/features/src/lib/foo/directives/active-link.directive.ts');
|
54
|
+
content = (0, testing_1.getFileContent)(tree, '/libs/xplat/features/src/lib/foo/directives/active-link.directive.ts');
|
55
55
|
// console.log(content);
|
56
56
|
expect(content.indexOf(`@Directive({`)).toBeGreaterThanOrEqual(0);
|
57
57
|
expect(content.indexOf(`selector: '[active-link]'`)).toBeGreaterThanOrEqual(0);
|
58
58
|
modulePath = '/libs/xplat/features/src/lib/foo/foo.module.ts';
|
59
|
-
moduleContent = testing_1.getFileContent(tree, modulePath);
|
59
|
+
moduleContent = (0, testing_1.getFileContent)(tree, modulePath);
|
60
60
|
// console.log(modulePath + ':');
|
61
61
|
// console.log(moduleContent);
|
62
62
|
expect(moduleContent.indexOf(`...FOO_DIRECTIVES`)).toBeGreaterThanOrEqual(0);
|
63
63
|
}));
|
64
64
|
it('should create directive across various xplat folders with platforms specified', () => __awaiter(void 0, void 0, void 0, function* () {
|
65
65
|
// console.log('appTree:', appTree);
|
66
|
-
let tree = yield testing_2.runSchematic('feature', {
|
66
|
+
let tree = yield (0, testing_2.runSchematic)('feature', {
|
67
67
|
name: 'foo',
|
68
68
|
platforms: 'nativescript,web',
|
69
69
|
}, appTree);
|
70
70
|
let options = Object.assign({}, defaultOptions);
|
71
71
|
options.platforms = 'nativescript,web';
|
72
72
|
// Directives without the feature option are added to the ui-feature
|
73
|
-
tree = yield testing_2.runSchematic('directive', options, tree);
|
73
|
+
tree = yield (0, testing_2.runSchematic)('directive', options, tree);
|
74
74
|
let files = tree.files;
|
75
75
|
// console.log(files.slice(91,files.length));
|
76
76
|
expect(tree.exists('/libs/xplat/features/src/lib/ui/directives/active-link.directive.ts')).toBeFalsy();
|
77
77
|
expect(tree.exists('/libs/xplat/web/features/src/lib/ui/directives/active-link.directive.ts')).toBeTruthy();
|
78
78
|
expect(tree.exists('/libs/xplat/nativescript/features/src/lib/ui/directives/active-link.directive.ts')).toBeTruthy();
|
79
79
|
// file content
|
80
|
-
let content = testing_1.getFileContent(tree, '/libs/xplat/web/features/src/lib/ui/directives/active-link.directive.ts');
|
80
|
+
let content = (0, testing_1.getFileContent)(tree, '/libs/xplat/web/features/src/lib/ui/directives/active-link.directive.ts');
|
81
81
|
// console.log(content);
|
82
82
|
expect(content.indexOf(`@Directive({`)).toBeGreaterThanOrEqual(0);
|
83
83
|
expect(content.indexOf(`selector: '[active-link]'`)).toBeGreaterThanOrEqual(0);
|
84
|
-
content = testing_1.getFileContent(tree, '/libs/xplat/nativescript/features/src/lib/ui/directives/active-link.directive.ts');
|
84
|
+
content = (0, testing_1.getFileContent)(tree, '/libs/xplat/nativescript/features/src/lib/ui/directives/active-link.directive.ts');
|
85
85
|
// console.log(content);
|
86
86
|
expect(content.indexOf(`@Directive({`)).toBeGreaterThanOrEqual(0);
|
87
87
|
expect(content.indexOf(`selector: '[active-link]'`)).toBeGreaterThanOrEqual(0);
|
88
88
|
let modulePath = '/libs/xplat/web/features/src/lib/ui/ui.module.ts';
|
89
|
-
let moduleContent = testing_1.getFileContent(tree, modulePath);
|
89
|
+
let moduleContent = (0, testing_1.getFileContent)(tree, modulePath);
|
90
90
|
// console.log(modulePath + ':');
|
91
91
|
// console.log(moduleContent);
|
92
92
|
expect(moduleContent.indexOf(`...UI_DIRECTIVES`)).toBeGreaterThanOrEqual(0);
|
93
93
|
modulePath = '/libs/xplat/nativescript/features/src/lib/ui/ui.module.ts';
|
94
|
-
moduleContent = testing_1.getFileContent(tree, modulePath);
|
94
|
+
moduleContent = (0, testing_1.getFileContent)(tree, modulePath);
|
95
95
|
expect(moduleContent.indexOf(`...UI_DIRECTIVES`)).toBeGreaterThanOrEqual(0);
|
96
96
|
// Directives added to the foo-feature
|
97
97
|
options = Object.assign(Object.assign({}, defaultOptions), { feature: 'foo' });
|
98
98
|
options.platforms = 'nativescript,web';
|
99
|
-
tree = yield testing_2.runSchematic('directive', options, tree);
|
99
|
+
tree = yield (0, testing_2.runSchematic)('directive', options, tree);
|
100
100
|
files = tree.files;
|
101
101
|
// console.log(files.slice(91,files.length));
|
102
102
|
expect(tree.exists('/libs/xplat/web/features/src/lib/foo/directives/active-link.directive.ts')).toBeTruthy();
|
103
103
|
expect(tree.exists('/libs/xplat/nativescript/features/src/lib/foo/directives/active-link.directive.ts')).toBeTruthy();
|
104
104
|
// file content
|
105
|
-
content = testing_1.getFileContent(tree, '/libs/xplat/web/features/src/lib/foo/directives/active-link.directive.ts');
|
105
|
+
content = (0, testing_1.getFileContent)(tree, '/libs/xplat/web/features/src/lib/foo/directives/active-link.directive.ts');
|
106
106
|
// console.log(content);
|
107
107
|
expect(content.indexOf(`@Directive({`)).toBeGreaterThanOrEqual(0);
|
108
108
|
expect(content.indexOf(`selector: '[active-link]'`)).toBeGreaterThanOrEqual(0);
|
109
|
-
content = testing_1.getFileContent(tree, '/libs/xplat/nativescript/features/src/lib/foo/directives/active-link.directive.ts');
|
109
|
+
content = (0, testing_1.getFileContent)(tree, '/libs/xplat/nativescript/features/src/lib/foo/directives/active-link.directive.ts');
|
110
110
|
// console.log(content);
|
111
111
|
expect(content.indexOf(`@Directive({`)).toBeGreaterThanOrEqual(0);
|
112
112
|
expect(content.indexOf(`selector: '[active-link]'`)).toBeGreaterThanOrEqual(0);
|
113
113
|
modulePath = '/libs/xplat/web/features/src/lib/foo/foo.module.ts';
|
114
|
-
moduleContent = testing_1.getFileContent(tree, modulePath);
|
114
|
+
moduleContent = (0, testing_1.getFileContent)(tree, modulePath);
|
115
115
|
// console.log(modulePath + ':');
|
116
116
|
// console.log(moduleContent);
|
117
117
|
expect(moduleContent.indexOf(`...FOO_DIRECTIVES`)).toBeGreaterThanOrEqual(0);
|
118
118
|
modulePath = '/libs/xplat/nativescript/features/src/lib/foo/foo.module.ts';
|
119
|
-
moduleContent = testing_1.getFileContent(tree, modulePath);
|
119
|
+
moduleContent = (0, testing_1.getFileContent)(tree, modulePath);
|
120
120
|
// console.log(modulePath + ':');
|
121
121
|
// console.log(moduleContent);
|
122
122
|
expect(moduleContent.indexOf(`...FOO_DIRECTIVES`)).toBeGreaterThanOrEqual(0);
|
123
123
|
}));
|
124
124
|
it('should create directive for specified projects only', () => __awaiter(void 0, void 0, void 0, function* () {
|
125
125
|
// console.log('appTree:', appTree);
|
126
|
-
let tree = yield testing_2.runSchematic('feature', {
|
126
|
+
let tree = yield (0, testing_2.runSchematic)('feature', {
|
127
127
|
name: 'foo',
|
128
128
|
projects: 'nativescript-viewer,web-viewer',
|
129
129
|
onlyProject: true,
|
@@ -133,7 +133,7 @@ describe('directive schematic', () => {
|
|
133
133
|
feature: 'foo',
|
134
134
|
projects: 'nativescript-viewer,web-viewer',
|
135
135
|
};
|
136
|
-
tree = yield testing_2.runSchematic('directive', options, tree);
|
136
|
+
tree = yield (0, testing_2.runSchematic)('directive', options, tree);
|
137
137
|
const files = tree.files;
|
138
138
|
// console.log(files. slice(91,files.length));
|
139
139
|
// directive should not be setup to share
|
@@ -145,13 +145,13 @@ describe('directive schematic', () => {
|
|
145
145
|
expect(files.indexOf('/apps/web-viewer/src/app/features/foo/directives/active-link.directive.ts')).toBeGreaterThanOrEqual(0);
|
146
146
|
// file content
|
147
147
|
let indexPath = '/apps/nativescript-viewer/src/features/foo/directives/index.ts';
|
148
|
-
let index = testing_1.getFileContent(tree, indexPath);
|
148
|
+
let index = (0, testing_1.getFileContent)(tree, indexPath);
|
149
149
|
// console.log(barrelPath + ':');
|
150
150
|
// console.log(barrelIndex);
|
151
151
|
// symbol should be at end of collection
|
152
152
|
expect(index.indexOf(`ActiveLinkDirective`)).toBeGreaterThanOrEqual(0);
|
153
153
|
indexPath = '/apps/web-viewer/src/app/features/foo/directives/index.ts';
|
154
|
-
index = testing_1.getFileContent(tree, indexPath);
|
154
|
+
index = (0, testing_1.getFileContent)(tree, indexPath);
|
155
155
|
// console.log(barrelPath + ':');
|
156
156
|
// console.log(barrelIndex);
|
157
157
|
expect(index.indexOf(`ActiveLinkDirective`)).toBeGreaterThanOrEqual(0);
|
@@ -12,20 +12,20 @@ function default_1(options) {
|
|
12
12
|
if (!options.builderModule) {
|
13
13
|
const example = `nx g @nstudio/angular:elements menu --barrel=@mycompany/ui --components=menu,footer`;
|
14
14
|
if (!options.name) {
|
15
|
-
throw new schematics_1.SchematicsException(xplat_1.missingArgument('name', 'Provide a name for the custom element module.', example));
|
15
|
+
throw new schematics_1.SchematicsException((0, xplat_1.missingArgument)('name', 'Provide a name for the custom element module.', example));
|
16
16
|
}
|
17
17
|
if (!options.barrel) {
|
18
|
-
throw new schematics_1.SchematicsException(xplat_1.missingArgument('barrel', 'Provide the name of the workspace barrel where your components live.', example));
|
18
|
+
throw new schematics_1.SchematicsException((0, xplat_1.missingArgument)('barrel', 'Provide the name of the workspace barrel where your components live.', example));
|
19
19
|
}
|
20
20
|
if (!options.components) {
|
21
|
-
throw new schematics_1.SchematicsException(xplat_1.missingArgument('components', `Provide a comma delimited list of components you'd like to create as custom elements.`, example));
|
21
|
+
throw new schematics_1.SchematicsException((0, xplat_1.missingArgument)('components', `Provide a comma delimited list of components you'd like to create as custom elements.`, example));
|
22
22
|
}
|
23
23
|
}
|
24
|
-
return schematics_1.chain([
|
25
|
-
xplat_utils_1.prerun(options),
|
24
|
+
return (0, schematics_1.chain)([
|
25
|
+
(0, xplat_utils_1.prerun)(options),
|
26
26
|
(tree) => {
|
27
27
|
if (!options.builderModule) {
|
28
|
-
const workspacePrefix = options.prefix || xplat_utils_1.getPrefix() || '';
|
28
|
+
const workspacePrefix = options.prefix || (0, xplat_utils_1.getPrefix)() || '';
|
29
29
|
const htmlElementList = [];
|
30
30
|
componentSymbols = [];
|
31
31
|
// parse component names to standard convention
|
@@ -56,7 +56,7 @@ function default_1(options) {
|
|
56
56
|
},
|
57
57
|
// add custom element module
|
58
58
|
(tree, context) => {
|
59
|
-
return options.builderModule ? schematics_1.noop() : addFiles(options)(tree, context);
|
59
|
+
return options.builderModule ? (0, schematics_1.noop)() : addFiles(options)(tree, context);
|
60
60
|
},
|
61
61
|
// add builder files or update them
|
62
62
|
(tree, context) => {
|
@@ -72,21 +72,21 @@ function default_1(options) {
|
|
72
72
|
// add build scripts
|
73
73
|
(tree) => {
|
74
74
|
if (options.builderModule) {
|
75
|
-
return schematics_1.noop();
|
75
|
+
return (0, schematics_1.noop)();
|
76
76
|
}
|
77
77
|
else {
|
78
78
|
const scripts = {};
|
79
79
|
scripts[`build.web.elements`] = `ng build web-elements --prod --output-hashing=none --single-bundle=true --keep-polyfills=true`;
|
80
80
|
scripts[`preview.web.elements`] = `http-server dist/ngelements`;
|
81
|
-
return xplat_1.updatePackageScripts(tree, scripts);
|
81
|
+
return (0, xplat_1.updatePackageScripts)(tree, scripts);
|
82
82
|
}
|
83
83
|
},
|
84
84
|
(tree, context) => {
|
85
85
|
if (options.builderModule) {
|
86
|
-
return schematics_1.noop()(tree, context);
|
86
|
+
return (0, schematics_1.noop)()(tree, context);
|
87
87
|
}
|
88
88
|
else {
|
89
|
-
return workspace_1.updateWorkspace((workspace) => {
|
89
|
+
return (0, workspace_1.updateWorkspace)((workspace) => {
|
90
90
|
const projectDef = {
|
91
91
|
root: '',
|
92
92
|
sourceRoot: 'libs/xplat/web/elements/builder',
|
@@ -142,7 +142,7 @@ function default_1(options) {
|
|
142
142
|
// update dependencies
|
143
143
|
(tree, context) => {
|
144
144
|
return options.builderModule
|
145
|
-
? schematics_1.noop()
|
145
|
+
? (0, schematics_1.noop)()
|
146
146
|
: updateWorkspaceSupport(options, tree, context);
|
147
147
|
},
|
148
148
|
// update for builderModule if desired
|
@@ -150,27 +150,27 @@ function default_1(options) {
|
|
150
150
|
if (options.builderModule) {
|
151
151
|
}
|
152
152
|
else {
|
153
|
-
return schematics_1.noop();
|
153
|
+
return (0, schematics_1.noop)();
|
154
154
|
}
|
155
155
|
},
|
156
|
-
workspace_1.formatFiles({ skipFormat: options.skipFormat }),
|
156
|
+
(0, workspace_1.formatFiles)({ skipFormat: options.skipFormat }),
|
157
157
|
]);
|
158
158
|
}
|
159
159
|
exports.default = default_1;
|
160
160
|
function addFiles(options, extra = '') {
|
161
161
|
extra = extra ? `${extra}_` : '';
|
162
162
|
const xplatFolderName = xplat_1.XplatHelpers.getXplatFoldername('web', 'angular');
|
163
|
-
return schematics_1.branchAndMerge(schematics_1.mergeWith(schematics_1.apply(schematics_1.url(`./_${extra}files`), [
|
164
|
-
schematics_1.template(Object.assign(Object.assign(Object.assign({}, options), xplat_1.getDefaultTemplateOptions()), { name: options.name.toLowerCase(), xplatFolderName,
|
163
|
+
return (0, schematics_1.branchAndMerge)((0, schematics_1.mergeWith)((0, schematics_1.apply)((0, schematics_1.url)(`./_${extra}files`), [
|
164
|
+
(0, schematics_1.template)(Object.assign(Object.assign(Object.assign({}, options), (0, xplat_1.getDefaultTemplateOptions)()), { name: options.name.toLowerCase(), xplatFolderName,
|
165
165
|
customElementList,
|
166
166
|
componentSymbolList,
|
167
167
|
componentSymbols,
|
168
168
|
htmlElements })),
|
169
|
-
schematics_1.move(`libs/xplat/${xplatFolderName}/elements`),
|
169
|
+
(0, schematics_1.move)(`libs/xplat/${xplatFolderName}/elements`),
|
170
170
|
])));
|
171
171
|
}
|
172
172
|
function updateWorkspaceSupport(options, tree, context) {
|
173
|
-
return workspace_1.updateJsonInTree('package.json', (json) => {
|
173
|
+
return (0, workspace_1.updateJsonInTree)('package.json', (json) => {
|
174
174
|
json.scripts = json.scripts || {};
|
175
175
|
json.dependencies = json.dependencies || {};
|
176
176
|
const angularVersion = json.dependencies['@angular/core'];
|
@@ -21,7 +21,7 @@ describe('elements schematic', () => {
|
|
21
21
|
};
|
22
22
|
beforeEach(() => {
|
23
23
|
appTree = schematics_1.Tree.empty();
|
24
|
-
appTree = testing_1.createXplatWithApps(appTree, 'angular');
|
24
|
+
appTree = (0, testing_1.createXplatWithApps)(appTree, 'angular');
|
25
25
|
});
|
26
26
|
it('should create an elements module that provides the specified components', () => __awaiter(void 0, void 0, void 0, function* () {
|
27
27
|
const options = Object.assign({}, defaultOptions);
|
@@ -30,27 +30,27 @@ describe('elements schematic', () => {
|
|
30
30
|
name: 'menu',
|
31
31
|
platforms: 'web',
|
32
32
|
};
|
33
|
-
let tree = yield testing_2.runSchematic('component', componentOptions, appTree);
|
33
|
+
let tree = yield (0, testing_2.runSchematic)('component', componentOptions, appTree);
|
34
34
|
componentOptions.name = 'footer';
|
35
|
-
tree = yield testing_2.runSchematic('component', componentOptions, tree);
|
35
|
+
tree = yield (0, testing_2.runSchematic)('component', componentOptions, tree);
|
36
36
|
let files = tree.files;
|
37
37
|
// console.log(files.slice(85,files.length));
|
38
38
|
expect(files.indexOf('/libs/xplat/web/features/src/lib/ui/components/menu/menu.component.html')).toBeGreaterThanOrEqual(0);
|
39
39
|
expect(files.indexOf('/libs/xplat/web/features/src/lib/ui/components/menu/menu.component.ts')).toBeGreaterThanOrEqual(0);
|
40
40
|
expect(files.indexOf('/libs/xplat/web/features/src/lib/ui/components/footer/footer.component.html')).toBeGreaterThanOrEqual(0);
|
41
41
|
expect(files.indexOf('/libs/xplat/web/features/src/lib/ui/components/footer/footer.component.ts')).toBeGreaterThanOrEqual(0);
|
42
|
-
tree = yield testing_2.runSchematic('elements', options, tree);
|
42
|
+
tree = yield (0, testing_2.runSchematic)('elements', options, tree);
|
43
43
|
files = tree.files;
|
44
44
|
const elementModulePath = '/libs/xplat/web/elements/ui-kit.module.ts';
|
45
45
|
expect(files.indexOf(elementModulePath)).toBeGreaterThanOrEqual(0);
|
46
|
-
const elementModule = testing_1.getFileContent(tree, elementModulePath);
|
46
|
+
const elementModule = (0, testing_1.getFileContent)(tree, elementModulePath);
|
47
47
|
// console.log(elementModule);
|
48
48
|
expect(elementModule.indexOf(`import { MenuComponent, FooterComponent } from '@mycompany/xplat/web/features';`)).toBeGreaterThanOrEqual(0);
|
49
49
|
expect(elementModule.indexOf(`createCustomElement(MenuComponent`)).toBeGreaterThanOrEqual(0);
|
50
50
|
expect(elementModule.indexOf(`define('tt-menu'`)).toBeGreaterThanOrEqual(0);
|
51
51
|
expect(elementModule.indexOf(`createCustomElement(FooterComponent`)).toBeGreaterThanOrEqual(0);
|
52
52
|
expect(elementModule.indexOf(`define('tt-footer'`)).toBeGreaterThanOrEqual(0);
|
53
|
-
const packageFile = testing_1.getFileContent(tree, 'package.json');
|
53
|
+
const packageFile = (0, testing_1.getFileContent)(tree, 'package.json');
|
54
54
|
// console.log(elementModule);
|
55
55
|
expect(packageFile.indexOf(`build.web.elements`)).toBeGreaterThanOrEqual(0);
|
56
56
|
expect(packageFile.indexOf(`preview.web.elements`)).toBeGreaterThanOrEqual(0);
|
@@ -62,30 +62,30 @@ describe('elements schematic', () => {
|
|
62
62
|
name: 'menu',
|
63
63
|
platforms: 'web',
|
64
64
|
};
|
65
|
-
let tree = yield testing_2.runSchematic('component', componentOptions, appTree);
|
65
|
+
let tree = yield (0, testing_2.runSchematic)('component', componentOptions, appTree);
|
66
66
|
componentOptions.name = 'footer';
|
67
|
-
tree = yield testing_2.runSchematic('component', componentOptions, tree);
|
67
|
+
tree = yield (0, testing_2.runSchematic)('component', componentOptions, tree);
|
68
68
|
let files = tree.files;
|
69
69
|
// console.log(files.slice(85,files.length));
|
70
70
|
expect(files.indexOf('/libs/xplat/web/features/src/lib/ui/components/menu/menu.component.html')).toBeGreaterThanOrEqual(0);
|
71
71
|
expect(files.indexOf('/libs/xplat/web/features/src/lib/ui/components/menu/menu.component.ts')).toBeGreaterThanOrEqual(0);
|
72
72
|
expect(files.indexOf('/libs/xplat/web/features/src/lib/ui/components/footer/footer.component.html')).toBeGreaterThanOrEqual(0);
|
73
73
|
expect(files.indexOf('/libs/xplat/web/features/src/lib/ui/components/footer/footer.component.ts')).toBeGreaterThanOrEqual(0);
|
74
|
-
tree = yield testing_2.runSchematic('elements', options, tree);
|
74
|
+
tree = yield (0, testing_2.runSchematic)('elements', options, tree);
|
75
75
|
files = tree.files;
|
76
76
|
let elementModulePath = '/libs/xplat/web/elements/ui-kit.module.ts';
|
77
77
|
expect(files.indexOf(elementModulePath)).toBeGreaterThanOrEqual(0);
|
78
|
-
let elementModule = testing_1.getFileContent(tree, elementModulePath);
|
78
|
+
let elementModule = (0, testing_1.getFileContent)(tree, elementModulePath);
|
79
79
|
// console.log(elementModule);
|
80
80
|
expect(elementModule.indexOf(`'@mycompany/xplat/web/features';`)).toBeGreaterThanOrEqual(0);
|
81
81
|
let builderPath = '/libs/xplat/web/elements/builder/elements.ts';
|
82
82
|
expect(files.indexOf(builderPath)).toBeGreaterThanOrEqual(0);
|
83
|
-
let builderModule = testing_1.getFileContent(tree, builderPath);
|
83
|
+
let builderModule = (0, testing_1.getFileContent)(tree, builderPath);
|
84
84
|
// console.log(builderModule);
|
85
85
|
expect(builderModule.indexOf(`../ui-kit.module`)).toBeGreaterThanOrEqual(0);
|
86
86
|
let builderIndexPath = '/libs/xplat/web/elements/builder/index.html';
|
87
87
|
expect(files.indexOf(builderPath)).toBeGreaterThanOrEqual(0);
|
88
|
-
let builderIndex = testing_1.getFileContent(tree, builderIndexPath);
|
88
|
+
let builderIndex = (0, testing_1.getFileContent)(tree, builderIndexPath);
|
89
89
|
// console.log(builderIndex);
|
90
90
|
expect(builderIndex.indexOf(`<tt-menu></tt-menu>`)).toBeGreaterThanOrEqual(0);
|
91
91
|
expect(builderIndex.indexOf(`<tt-footer></tt-footer>`)).toBeGreaterThanOrEqual(0);
|
@@ -93,9 +93,9 @@ describe('elements schematic', () => {
|
|
93
93
|
name: 'dropdown',
|
94
94
|
platforms: 'web',
|
95
95
|
};
|
96
|
-
tree = yield testing_2.runSchematic('component', component2Options, tree);
|
96
|
+
tree = yield (0, testing_2.runSchematic)('component', component2Options, tree);
|
97
97
|
component2Options.name = 'link';
|
98
|
-
tree = yield testing_2.runSchematic('component', component2Options, tree);
|
98
|
+
tree = yield (0, testing_2.runSchematic)('component', component2Options, tree);
|
99
99
|
files = tree.files;
|
100
100
|
// console.log(files.slice(85,files.length));
|
101
101
|
expect(files.indexOf('/libs/xplat/web/features/src/lib/ui/components/dropdown/dropdown.component.html')).toBeGreaterThanOrEqual(0);
|
@@ -107,29 +107,29 @@ describe('elements schematic', () => {
|
|
107
107
|
barrel: '@mycompany/xplat/web/features',
|
108
108
|
components: 'dropdown,link',
|
109
109
|
};
|
110
|
-
tree = yield testing_2.runSchematic('elements', newElementOptions, tree);
|
110
|
+
tree = yield (0, testing_2.runSchematic)('elements', newElementOptions, tree);
|
111
111
|
files = tree.files;
|
112
112
|
elementModulePath = '/libs/xplat/web/elements/widgets.module.ts';
|
113
113
|
expect(files.indexOf(elementModulePath)).toBeGreaterThanOrEqual(0);
|
114
|
-
elementModule = testing_1.getFileContent(tree, elementModulePath);
|
114
|
+
elementModule = (0, testing_1.getFileContent)(tree, elementModulePath);
|
115
115
|
// console.log(elementModule);
|
116
116
|
expect(elementModule.indexOf(`'@mycompany/xplat/web/features';`)).toBeGreaterThanOrEqual(0);
|
117
|
-
builderModule = testing_1.getFileContent(tree, builderPath);
|
117
|
+
builderModule = (0, testing_1.getFileContent)(tree, builderPath);
|
118
118
|
// console.log(builderModule);
|
119
119
|
expect(builderModule.indexOf(`../widgets.module`)).toBeGreaterThanOrEqual(0);
|
120
|
-
builderIndex = testing_1.getFileContent(tree, builderIndexPath);
|
120
|
+
builderIndex = (0, testing_1.getFileContent)(tree, builderIndexPath);
|
121
121
|
// console.log(builderIndex);
|
122
122
|
expect(builderIndex.indexOf(`<tt-dropdown></tt-dropdown>`)).toBeGreaterThanOrEqual(0);
|
123
123
|
expect(builderIndex.indexOf(`<tt-link></tt-link>`)).toBeGreaterThanOrEqual(0);
|
124
124
|
const builderOption = {
|
125
125
|
builderModule: 'ui-kit',
|
126
126
|
};
|
127
|
-
tree = yield testing_2.runSchematic('elements', builderOption, tree);
|
127
|
+
tree = yield (0, testing_2.runSchematic)('elements', builderOption, tree);
|
128
128
|
files = tree.files;
|
129
|
-
builderModule = testing_1.getFileContent(tree, builderPath);
|
129
|
+
builderModule = (0, testing_1.getFileContent)(tree, builderPath);
|
130
130
|
// console.log(builderModule);
|
131
131
|
expect(builderModule.indexOf(`../ui-kit.module`)).toBeGreaterThanOrEqual(0);
|
132
|
-
builderIndex = testing_1.getFileContent(tree, builderIndexPath);
|
132
|
+
builderIndex = (0, testing_1.getFileContent)(tree, builderIndexPath);
|
133
133
|
// console.log(builderIndex);
|
134
134
|
expect(builderIndex.indexOf(`<tt-menu></tt-menu>`)).toBeGreaterThanOrEqual(0);
|
135
135
|
expect(builderIndex.indexOf(`<tt-footer></tt-footer>`)).toBeGreaterThanOrEqual(0);
|
@@ -12,35 +12,35 @@ function default_1(options) {
|
|
12
12
|
externalChains.push((tree, context) => {
|
13
13
|
// console.log(`@nstudio/${platform}-angular`);
|
14
14
|
// console.log('angular feature chain getFrontendFramework:', getFrontendFramework());
|
15
|
-
return schematics_1.externalSchematic(`@nstudio/${platform}-angular`, 'feature', options, {
|
15
|
+
return (0, schematics_1.externalSchematic)(`@nstudio/${platform}-angular`, 'feature', options, {
|
16
16
|
interactive: false,
|
17
17
|
})(tree, context);
|
18
18
|
});
|
19
19
|
}
|
20
20
|
else if (xplat_utils_1.supportedNxExtraPlatforms.includes(platform)) {
|
21
|
-
throw new schematics_1.SchematicsException(xplat_1.unsupportedPlatformErrorWithNxNote(platform, 'feature'));
|
21
|
+
throw new schematics_1.SchematicsException((0, xplat_1.unsupportedPlatformErrorWithNxNote)(platform, 'feature'));
|
22
22
|
}
|
23
23
|
else {
|
24
|
-
throw new schematics_1.SchematicsException(xplat_1.unsupportedPlatformError(platform));
|
24
|
+
throw new schematics_1.SchematicsException((0, xplat_1.unsupportedPlatformError)(platform));
|
25
25
|
}
|
26
26
|
}
|
27
|
-
return schematics_1.chain([
|
28
|
-
xplat_utils_1.prerun(),
|
27
|
+
return (0, schematics_1.chain)([
|
28
|
+
(0, xplat_utils_1.prerun)(),
|
29
29
|
// libs
|
30
30
|
(tree, context) => options.onlyProject
|
31
|
-
? schematics_1.noop()(tree, context)
|
31
|
+
? (0, schematics_1.noop)()(tree, context)
|
32
32
|
: xplat_1.XplatFeatureHelpers.addFiles(options)(tree, context),
|
33
33
|
// libs
|
34
34
|
(tree, context) => options.onlyProject || !options.createBase || options.onlyModule
|
35
|
-
? schematics_1.noop()(tree, context)
|
35
|
+
? (0, schematics_1.noop)()(tree, context)
|
36
36
|
: xplat_1.XplatFeatureHelpers.addFiles(options, null, null, '_component')(tree, context),
|
37
37
|
// update libs index
|
38
38
|
(tree, context) => options.onlyProject
|
39
|
-
? schematics_1.noop()(tree, context)
|
39
|
+
? (0, schematics_1.noop)()(tree, context)
|
40
40
|
: xplat_1.XplatFeatureHelpers.adjustBarrelIndex(options, 'libs/xplat/features/src/lib/index.ts')(tree, context),
|
41
41
|
// external schematic handling
|
42
|
-
(tree, context) => schematics_1.chain(externalChains),
|
43
|
-
workspace_1.formatFiles({ skipFormat: options.skipFormat }),
|
42
|
+
(tree, context) => (0, schematics_1.chain)(externalChains),
|
43
|
+
(0, workspace_1.formatFiles)({ skipFormat: options.skipFormat }),
|
44
44
|
]);
|
45
45
|
}
|
46
46
|
exports.default = default_1;
|