@nstudio/angular 13.0.1 → 13.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/package.json +2 -2
- package/src/schematics/application/index.js +33 -23
- package/src/schematics/application/index.spec.js +8 -8
- package/src/schematics/application/schema.json +0 -5
- 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 +7 -7
- package/src/utils/versions.js +8 -8
- package/src/utils/xplat.js +21 -21
@@ -23,12 +23,12 @@ describe('feature schematic', () => {
|
|
23
23
|
};
|
24
24
|
beforeEach(() => {
|
25
25
|
appTree = schematics_1.Tree.empty();
|
26
|
-
appTree = testing_1.createXplatWithNativeScriptWeb(appTree, null, 'angular');
|
26
|
+
appTree = (0, testing_1.createXplatWithNativeScriptWeb)(appTree, null, 'angular');
|
27
27
|
});
|
28
28
|
it('should create feature module with a single starting component', () => __awaiter(void 0, void 0, void 0, function* () {
|
29
29
|
const options = Object.assign({}, defaultOptions);
|
30
30
|
// console.log('appTree:', appTree);
|
31
|
-
let tree = yield testing_2.runSchematic('feature', options, appTree);
|
31
|
+
let tree = yield (0, testing_2.runSchematic)('feature', options, appTree);
|
32
32
|
const files = tree.files;
|
33
33
|
// console.log(files.slice(85, files.length));
|
34
34
|
expect(files.indexOf('/apps/nativescript-viewer/package.json')).toBeGreaterThanOrEqual(0);
|
@@ -60,24 +60,24 @@ describe('feature schematic', () => {
|
|
60
60
|
expect(files.indexOf('/apps/web-viewer/src/app/features/foo/components/foo/foo.component.ts')).toBeGreaterThanOrEqual(-1);
|
61
61
|
// file content
|
62
62
|
let modulePath = '/libs/xplat/nativescript/features/src/lib/foo/foo.module.ts';
|
63
|
-
let featureModule = testing_1.getFileContent(tree, modulePath);
|
63
|
+
let featureModule = (0, testing_1.getFileContent)(tree, modulePath);
|
64
64
|
// console.log(modulePath + ':');
|
65
65
|
// console.log(featureModule);
|
66
|
-
expect(featureModule).toMatch(testing_1.isInModuleMetadata('FooModule', 'imports', `UIModule`, true));
|
66
|
+
expect(featureModule).toMatch((0, testing_1.isInModuleMetadata)('FooModule', 'imports', `UIModule`, true));
|
67
67
|
expect(featureModule).toMatch(`import { UIModule } from \'../ui/ui.module\'`);
|
68
68
|
modulePath = '/libs/xplat/web/features/src/lib/foo/foo.module.ts';
|
69
|
-
featureModule = testing_1.getFileContent(tree, modulePath);
|
69
|
+
featureModule = (0, testing_1.getFileContent)(tree, modulePath);
|
70
70
|
// console.log(modulePath + ':');
|
71
71
|
// console.log(featureModule);
|
72
|
-
expect(featureModule).toMatch(testing_1.isInModuleMetadata('FooModule', 'imports', `UIModule`, true));
|
72
|
+
expect(featureModule).toMatch((0, testing_1.isInModuleMetadata)('FooModule', 'imports', `UIModule`, true));
|
73
73
|
expect(featureModule).toMatch(`import { UIModule } from \'../ui/ui.module\'`);
|
74
74
|
}));
|
75
75
|
it('should create feature module with a single starting component with framework suffix for xplat when no default is set', () => __awaiter(void 0, void 0, void 0, function* () {
|
76
76
|
appTree = schematics_1.Tree.empty();
|
77
|
-
appTree = testing_1.createXplatWithNativeScriptWeb(appTree);
|
77
|
+
appTree = (0, testing_1.createXplatWithNativeScriptWeb)(appTree);
|
78
78
|
const options = Object.assign({}, defaultOptions);
|
79
79
|
// console.log('appTree:', appTree);
|
80
|
-
let tree = yield testing_2.runSchematic('feature', options, appTree);
|
80
|
+
let tree = yield (0, testing_2.runSchematic)('feature', options, appTree);
|
81
81
|
const files = tree.files;
|
82
82
|
// console.log(files.slice(85,files.length));
|
83
83
|
expect(files.indexOf('/apps/nativescript-viewer/package.json')).toBeGreaterThanOrEqual(0);
|
@@ -109,23 +109,23 @@ describe('feature schematic', () => {
|
|
109
109
|
expect(files.indexOf('/apps/web-viewer/src/app/features/foo/components/foo/foo.component.ts')).toBeGreaterThanOrEqual(-1);
|
110
110
|
// file content
|
111
111
|
let modulePath = '/libs/xplat/nativescript-angular/features/src/lib/foo/foo.module.ts';
|
112
|
-
let featureModule = testing_1.getFileContent(tree, modulePath);
|
112
|
+
let featureModule = (0, testing_1.getFileContent)(tree, modulePath);
|
113
113
|
// console.log(modulePath + ':');
|
114
114
|
// console.log(featureModule);
|
115
|
-
expect(featureModule).toMatch(testing_1.isInModuleMetadata('FooModule', 'imports', `UIModule`, true));
|
115
|
+
expect(featureModule).toMatch((0, testing_1.isInModuleMetadata)('FooModule', 'imports', `UIModule`, true));
|
116
116
|
expect(featureModule).toMatch(`import { UIModule } from \'../ui/ui.module\'`);
|
117
117
|
modulePath = '/libs/xplat/web-angular/features/src/lib/foo/foo.module.ts';
|
118
|
-
featureModule = testing_1.getFileContent(tree, modulePath);
|
118
|
+
featureModule = (0, testing_1.getFileContent)(tree, modulePath);
|
119
119
|
// console.log(modulePath + ':');
|
120
120
|
// console.log(featureModule);
|
121
|
-
expect(featureModule).toMatch(testing_1.isInModuleMetadata('FooModule', 'imports', `UIModule`, true));
|
121
|
+
expect(featureModule).toMatch((0, testing_1.isInModuleMetadata)('FooModule', 'imports', `UIModule`, true));
|
122
122
|
expect(featureModule).toMatch(`import { UIModule } from \'../ui/ui.module\'`);
|
123
123
|
}));
|
124
124
|
it('should create feature module WITHOUT a single starting component when using onlyModule', () => __awaiter(void 0, void 0, void 0, function* () {
|
125
125
|
// console.log('appTree:', appTree);
|
126
126
|
const options = Object.assign({}, defaultOptions);
|
127
127
|
options.onlyModule = true;
|
128
|
-
let tree = yield testing_2.runSchematic('feature', options, appTree);
|
128
|
+
let tree = yield (0, testing_2.runSchematic)('feature', options, appTree);
|
129
129
|
const files = tree.files;
|
130
130
|
// console.log(files.slice(85,files.length));
|
131
131
|
expect(files.indexOf('/apps/nativescript-viewer/package.json')).toBeGreaterThanOrEqual(0);
|
@@ -148,18 +148,18 @@ describe('feature schematic', () => {
|
|
148
148
|
expect(files.indexOf('/libs/xplat/web/features/src/lib/foo/components/foo/foo.component.ts')).toBe(-1);
|
149
149
|
// file content
|
150
150
|
let modulePath = '/libs/xplat/nativescript/features/src/lib/foo/foo.module.ts';
|
151
|
-
let featureModule = testing_1.getFileContent(tree, modulePath);
|
151
|
+
let featureModule = (0, testing_1.getFileContent)(tree, modulePath);
|
152
152
|
// console.log(modulePath + ':');
|
153
153
|
// console.log(featureModule);
|
154
|
-
expect(featureModule).toMatch(testing_1.isInModuleMetadata('FooModule', 'imports', `UIModule`, true));
|
154
|
+
expect(featureModule).toMatch((0, testing_1.isInModuleMetadata)('FooModule', 'imports', `UIModule`, true));
|
155
155
|
expect(featureModule).toMatch(`import { UIModule } from \'../ui/ui.module\'`);
|
156
156
|
expect(featureModule.indexOf('FOO_COMPONENTS')).toBe(-1);
|
157
157
|
expect(featureModule.indexOf('declarations')).toBe(-1);
|
158
158
|
modulePath = '/libs/xplat/nativescript/features/src/lib/foo/foo.module.ts';
|
159
|
-
featureModule = testing_1.getFileContent(tree, modulePath);
|
159
|
+
featureModule = (0, testing_1.getFileContent)(tree, modulePath);
|
160
160
|
// console.log(modulePath + ':');
|
161
161
|
// console.log(featureModule);
|
162
|
-
expect(featureModule).toMatch(testing_1.isInModuleMetadata('FooModule', 'imports', `UIModule`, true));
|
162
|
+
expect(featureModule).toMatch((0, testing_1.isInModuleMetadata)('FooModule', 'imports', `UIModule`, true));
|
163
163
|
expect(featureModule).toMatch(`import { UIModule } from \'../ui/ui.module\'`);
|
164
164
|
}));
|
165
165
|
it('should create feature module WITH a single starting component BUT IGNORE creating matching base component', () => __awaiter(void 0, void 0, void 0, function* () {
|
@@ -168,7 +168,7 @@ describe('feature schematic', () => {
|
|
168
168
|
name: 'foo',
|
169
169
|
platforms: 'web',
|
170
170
|
};
|
171
|
-
let tree = yield testing_2.runSchematic('feature', options, appTree);
|
171
|
+
let tree = yield (0, testing_2.runSchematic)('feature', options, appTree);
|
172
172
|
const files = tree.files;
|
173
173
|
// console.log(files.slice(85,files.length));
|
174
174
|
// shared code defaults
|
@@ -189,15 +189,15 @@ describe('feature schematic', () => {
|
|
189
189
|
expect(files.indexOf('/libs/xplat/web/features/src/lib/foo/components/foo/foo.component.ts')).toBeGreaterThanOrEqual(0);
|
190
190
|
// file content
|
191
191
|
let modulePath = '/libs/xplat/web/features/src/lib/foo/foo.module.ts';
|
192
|
-
let featureModule = testing_1.getFileContent(tree, modulePath);
|
192
|
+
let featureModule = (0, testing_1.getFileContent)(tree, modulePath);
|
193
193
|
// console.log(modulePath + ':');
|
194
194
|
// console.log(featureModule);
|
195
|
-
expect(featureModule).toMatch(testing_1.isInModuleMetadata('FooModule', 'imports', `UIModule`, true));
|
195
|
+
expect(featureModule).toMatch((0, testing_1.isInModuleMetadata)('FooModule', 'imports', `UIModule`, true));
|
196
196
|
expect(featureModule).toMatch(`import { UIModule } from \'../ui/ui.module\'`);
|
197
197
|
expect(featureModule.indexOf('FOO_COMPONENTS')).toBeGreaterThanOrEqual(0);
|
198
198
|
expect(featureModule.indexOf('declarations')).toBeGreaterThanOrEqual(0);
|
199
199
|
let compPath = '/libs/xplat/web/features/src/lib/foo/components/foo/foo.component.ts';
|
200
|
-
let compContent = testing_1.getFileContent(tree, compPath);
|
200
|
+
let compContent = (0, testing_1.getFileContent)(tree, compPath);
|
201
201
|
// console.log(compPath + ':');
|
202
202
|
// console.log(compContent);
|
203
203
|
expect(compContent.indexOf('extends BaseComponent')).toBeGreaterThanOrEqual(0);
|
@@ -206,7 +206,7 @@ describe('feature schematic', () => {
|
|
206
206
|
const options = Object.assign({}, defaultOptions);
|
207
207
|
// console.log('appTree:', appTree);
|
208
208
|
options.onlyProject = true;
|
209
|
-
let tree = yield testing_2.runSchematic('feature', options, appTree);
|
209
|
+
let tree = yield (0, testing_2.runSchematic)('feature', options, appTree);
|
210
210
|
const files = tree.files;
|
211
211
|
// console.log(files.slice(85,files.length));
|
212
212
|
// feature should not be in shared code
|
@@ -236,33 +236,33 @@ describe('feature schematic', () => {
|
|
236
236
|
expect(files.indexOf('/libs/xplat/web/features/src/lib/foo/components/foo/foo.component.ts')).toBeGreaterThanOrEqual(-1);
|
237
237
|
// file content
|
238
238
|
let modulePath = '/apps/nativescript-viewer/src/features/foo/foo.module.ts';
|
239
|
-
let featureModule = testing_1.getFileContent(tree, modulePath);
|
239
|
+
let featureModule = (0, testing_1.getFileContent)(tree, modulePath);
|
240
240
|
// console.log(modulePath + ':');
|
241
241
|
// console.log(featureModule);
|
242
|
-
expect(featureModule).toMatch(testing_1.isInModuleMetadata('FooModule', 'imports', `SharedModule`, true));
|
242
|
+
expect(featureModule).toMatch((0, testing_1.isInModuleMetadata)('FooModule', 'imports', `SharedModule`, true));
|
243
243
|
expect(featureModule).toMatch(`import { SharedModule } from \'../shared/shared.module\'`);
|
244
244
|
modulePath = '/apps/web-viewer/src/app/features/foo/foo.module.ts';
|
245
|
-
featureModule = testing_1.getFileContent(tree, modulePath);
|
245
|
+
featureModule = (0, testing_1.getFileContent)(tree, modulePath);
|
246
246
|
// console.log(modulePath + ':');
|
247
247
|
// console.log(featureModule);
|
248
|
-
expect(featureModule).toMatch(testing_1.isInModuleMetadata('FooModule', 'imports', `SharedModule`, true));
|
248
|
+
expect(featureModule).toMatch((0, testing_1.isInModuleMetadata)('FooModule', 'imports', `SharedModule`, true));
|
249
249
|
expect(featureModule).toMatch(`import { SharedModule } from \'../shared/shared.module\'`);
|
250
250
|
}));
|
251
251
|
it('Temporary: should error if routing is used without onlyProject', () => __awaiter(void 0, void 0, void 0, function* () {
|
252
252
|
const options = Object.assign({}, defaultOptions);
|
253
253
|
// console.log('appTree:', appTree);
|
254
254
|
options.routing = true;
|
255
|
-
yield expect(() => testing_2.runSchematic('feature', options, appTree)).rejects.toThrow('When generating a feature with the --routing option, please also specify --onlyProject. Support for shared code routing is under development.');
|
255
|
+
yield expect(() => (0, testing_2.runSchematic)('feature', options, appTree)).rejects.toThrow('When generating a feature with the --routing option, please also specify --onlyProject. Support for shared code routing is under development.');
|
256
256
|
}));
|
257
257
|
it('should create feature module (with dashes in name) for specified projects WITH Routing', () => __awaiter(void 0, void 0, void 0, function* () {
|
258
258
|
appTree = schematics_1.Tree.empty();
|
259
|
-
appTree = testing_1.createXplatWithNativeScriptWeb(appTree, true);
|
259
|
+
appTree = (0, testing_1.createXplatWithNativeScriptWeb)(appTree, true);
|
260
260
|
const options = Object.assign({}, defaultOptions);
|
261
261
|
// console.log('appTree:', appTree);
|
262
262
|
options.onlyProject = true;
|
263
263
|
options.routing = true;
|
264
264
|
options.name = 'foo-with-dash';
|
265
|
-
let tree = yield testing_2.runSchematic('feature', options, appTree);
|
265
|
+
let tree = yield (0, testing_2.runSchematic)('feature', options, appTree);
|
266
266
|
const files = tree.files;
|
267
267
|
// console.log(files.slice(85,files.length));
|
268
268
|
// feature should not be in shared code
|
@@ -280,7 +280,7 @@ describe('feature schematic', () => {
|
|
280
280
|
expect(files.indexOf('/apps/web-viewer/src/app/features/foo-with-dash/components/foo-with-dash/foo-with-dash.component.ts')).toBeGreaterThanOrEqual(0);
|
281
281
|
// file content
|
282
282
|
let modulePath = '/apps/nativescript-viewer/src/features/foo-with-dash/foo-with-dash.module.ts';
|
283
|
-
let featureModule = testing_1.getFileContent(tree, modulePath);
|
283
|
+
let featureModule = (0, testing_1.getFileContent)(tree, modulePath);
|
284
284
|
// console.log(modulePath + ':');
|
285
285
|
// console.log(featureModule);
|
286
286
|
expect(featureModule).toMatch(`import { NativeScriptRouterModule } from \'@nativescript/angular\'`);
|
@@ -289,7 +289,7 @@ describe('feature schematic', () => {
|
|
289
289
|
expect(featureModule).toMatch(`NativeScriptRouterModule.forChild`);
|
290
290
|
modulePath =
|
291
291
|
'/apps/web-viewer/src/app/features/foo-with-dash/foo-with-dash.module.ts';
|
292
|
-
featureModule = testing_1.getFileContent(tree, modulePath);
|
292
|
+
featureModule = (0, testing_1.getFileContent)(tree, modulePath);
|
293
293
|
// console.log(modulePath + ':');
|
294
294
|
// console.log(featureModule);
|
295
295
|
expect(featureModule).toMatch(`import { RouterModule, Routes } from \'@angular/router\'`);
|
@@ -298,14 +298,14 @@ describe('feature schematic', () => {
|
|
298
298
|
expect(featureModule).toMatch(`RouterModule.forChild`);
|
299
299
|
// check if there was a root app.routing.ts module modified
|
300
300
|
modulePath = '/apps/web-viewer/src/app/app.routing.ts';
|
301
|
-
featureModule = testing_1.getFileContent(tree, modulePath);
|
301
|
+
featureModule = (0, testing_1.getFileContent)(tree, modulePath);
|
302
302
|
// console.log(modulePath + ':');
|
303
303
|
// console.log(featureModule);
|
304
304
|
expect(featureModule).toMatch(`import { RouterModule, Routes } from \'@angular/router\'`);
|
305
305
|
expect(featureModule).toMatch(`loadChildren: () =>`);
|
306
306
|
expect(featureModule).toMatch(`'./features/foo-with-dash/foo-with-dash.module'`);
|
307
307
|
modulePath = '/apps/nativescript-viewer/src/app.routing.ts';
|
308
|
-
featureModule = testing_1.getFileContent(tree, modulePath);
|
308
|
+
featureModule = (0, testing_1.getFileContent)(tree, modulePath);
|
309
309
|
// console.log(modulePath + ':');
|
310
310
|
// console.log(featureModule);
|
311
311
|
expect(featureModule).toMatch(`loadChildren: () =>`);
|
@@ -313,7 +313,7 @@ describe('feature schematic', () => {
|
|
313
313
|
// check that name with dash was handled right
|
314
314
|
modulePath =
|
315
315
|
'/apps/web-viewer/src/app/features/foo-with-dash/components/index.ts';
|
316
|
-
featureModule = testing_1.getFileContent(tree, modulePath);
|
316
|
+
featureModule = (0, testing_1.getFileContent)(tree, modulePath);
|
317
317
|
// console.log(modulePath + ':');
|
318
318
|
// console.log(featureModule);
|
319
319
|
expect(featureModule).toMatch(`export const FOOWITHDASH_COMPONENTS`);
|
@@ -321,16 +321,16 @@ describe('feature schematic', () => {
|
|
321
321
|
it('should create feature module for specified project WITH Routing and adjustSandbox', () => __awaiter(void 0, void 0, void 0, function* () {
|
322
322
|
const options = Object.assign(Object.assign({}, defaultOptions), { projects: 'nativescript-viewer' });
|
323
323
|
appTree = schematics_1.Tree.empty();
|
324
|
-
appTree = testing_1.createXplatWithNativeScriptWeb(appTree, true);
|
324
|
+
appTree = (0, testing_1.createXplatWithNativeScriptWeb)(appTree, true);
|
325
325
|
// manually update home.component to prep for sandobx
|
326
326
|
const homeCmpPath = `/apps/nativescript-viewer/src/features/home/components/home.component.html`;
|
327
|
-
workspace_1.createOrUpdate(appTree, homeCmpPath, sandboxHomeSetup());
|
327
|
+
(0, workspace_1.createOrUpdate)(appTree, homeCmpPath, sandboxHomeSetup());
|
328
328
|
// console.log('homecmp:', getFileContent(tree, homeCmpPath));
|
329
329
|
options.onlyProject = true;
|
330
330
|
options.adjustSandbox = true;
|
331
331
|
options.routing = true;
|
332
332
|
options.name = 'foo-with-dash';
|
333
|
-
let tree = yield testing_2.runSchematic('feature', options, appTree);
|
333
|
+
let tree = yield (0, testing_2.runSchematic)('feature', options, appTree);
|
334
334
|
// console.log('---------')
|
335
335
|
// console.log('homecmp:', getFileContent(tree, homeCmpPath));
|
336
336
|
}));
|
@@ -11,12 +11,12 @@ exports.config = {
|
|
11
11
|
function applitools(helperChains, options) {
|
12
12
|
return (tree, context) => {
|
13
13
|
// update support index
|
14
|
-
helperChains.push(workspace_1.createOrUpdate(tree, `/apps/${options.target}-e2e/src/support/index.ts`, updateCypressIndex()));
|
14
|
+
helperChains.push((0, workspace_1.createOrUpdate)(tree, `/apps/${options.target}-e2e/src/support/index.ts`, updateCypressIndex()));
|
15
15
|
// update plugin index
|
16
|
-
helperChains.push(workspace_1.createOrUpdate(tree, `/apps/${options.target}-e2e/src/plugins/index.ts`, updateCypressPlugins()));
|
16
|
+
helperChains.push((0, workspace_1.createOrUpdate)(tree, `/apps/${options.target}-e2e/src/plugins/index.ts`, updateCypressPlugins()));
|
17
17
|
// ensure supportFile points to updates
|
18
18
|
const cypressConfigPath = `/apps/${options.target}-e2e/cypress.json`;
|
19
|
-
const cypressConfig = xplat_utils_1.getJsonFromFile(tree, cypressConfigPath);
|
19
|
+
const cypressConfig = (0, xplat_utils_1.getJsonFromFile)(tree, cypressConfigPath);
|
20
20
|
// console.log('cypressConfig:', cypressConfig);
|
21
21
|
// plugin path is always defined so ensure support matches
|
22
22
|
const pluginsFilePath = cypressConfig.pluginsFile;
|
@@ -24,18 +24,18 @@ function applitools(helperChains, options) {
|
|
24
24
|
const outputPath = pluginsFilePath.split('plugins/')[0];
|
25
25
|
cypressConfig.supportFile = `${outputPath}support/index.js`;
|
26
26
|
// console.log('cypressConfig.supportFile:', cypressConfig.supportFile);
|
27
|
-
helperChains.push(xplat_utils_1.updateJsonFile(tree, cypressConfigPath, cypressConfig));
|
27
|
+
helperChains.push((0, xplat_utils_1.updateJsonFile)(tree, cypressConfigPath, cypressConfig));
|
28
28
|
// Add applitools modules
|
29
|
-
const packageJson = xplat_utils_1.getJsonFromFile(tree, 'package.json');
|
29
|
+
const packageJson = (0, xplat_utils_1.getJsonFromFile)(tree, 'package.json');
|
30
30
|
packageJson.devDependencies = packageJson.devDependencies || {};
|
31
31
|
packageJson.devDependencies['@applitools/eyes-cypress'] = '^3.7.1';
|
32
|
-
helperChains.push(xplat_utils_1.updateJsonFile(tree, 'package.json', packageJson));
|
32
|
+
helperChains.push((0, xplat_utils_1.updateJsonFile)(tree, 'package.json', packageJson));
|
33
33
|
// update sample test
|
34
|
-
helperChains.push(workspace_1.createOrUpdate(tree, `/apps/${options.target}-e2e/src/integration/app.spec.ts`, updateSampleTest()));
|
34
|
+
helperChains.push((0, workspace_1.createOrUpdate)(tree, `/apps/${options.target}-e2e/src/integration/app.spec.ts`, updateSampleTest()));
|
35
35
|
};
|
36
36
|
}
|
37
37
|
function note(options) {
|
38
|
-
if (!xplat_utils_1.isTesting()) {
|
38
|
+
if (!(0, xplat_utils_1.isTesting)()) {
|
39
39
|
console.log(`Applitools support added for: ${options.target}`);
|
40
40
|
console.log(`Ensure your APPLITOOLS_API_KEY environment variable is set: https://applitools.com/tutorials/cypress.html#step-by-step-guide-run-the-demo-app`);
|
41
41
|
}
|
@@ -10,18 +10,18 @@ const supportedHelpers = {
|
|
10
10
|
};
|
11
11
|
function default_1(options) {
|
12
12
|
if (!options.name) {
|
13
|
-
throw new schematics_1.SchematicsException(xplat_1.missingArgument('name', 'Provide the name of the helper to generate.', 'nx g @nstudio/angular:helpers applitools --target=web-myapp'));
|
13
|
+
throw new schematics_1.SchematicsException((0, xplat_1.missingArgument)('name', 'Provide the name of the helper to generate.', 'nx g @nstudio/angular:helpers applitools --target=web-myapp'));
|
14
14
|
}
|
15
15
|
const helperChain = [];
|
16
16
|
const helpers = options.name.split(',');
|
17
17
|
for (const helper of helpers) {
|
18
18
|
if (supportedHelpers[helper]) {
|
19
|
-
xplat_1.buildHelperChain(helper, options, supportedHelpers[helper], helperChain);
|
19
|
+
(0, xplat_1.buildHelperChain)(helper, options, supportedHelpers[helper], helperChain);
|
20
20
|
}
|
21
21
|
else {
|
22
|
-
helperChain.push(schematics_1.noop());
|
22
|
+
helperChain.push((0, schematics_1.noop)());
|
23
23
|
}
|
24
24
|
}
|
25
|
-
return schematics_1.chain([xplat_utils_1.prerun(options), ...helperChain, workspace_1.addInstallTask()]);
|
25
|
+
return (0, schematics_1.chain)([(0, xplat_utils_1.prerun)(options), ...helperChain, (0, workspace_1.addInstallTask)()]);
|
26
26
|
}
|
27
27
|
exports.default = default_1;
|
@@ -13,12 +13,12 @@ const schematics_1 = require("@angular-devkit/schematics");
|
|
13
13
|
const xplat_utils_1 = require("@nstudio/xplat-utils");
|
14
14
|
const testing_1 = require("@nstudio/xplat/testing");
|
15
15
|
const testing_2 = require("../../utils/testing");
|
16
|
-
xplat_utils_1.setTest();
|
16
|
+
(0, xplat_utils_1.setTest)();
|
17
17
|
xdescribe('helpers schematic', () => {
|
18
18
|
let appTree;
|
19
19
|
beforeEach(() => {
|
20
20
|
appTree = schematics_1.Tree.empty();
|
21
|
-
appTree = testing_1.createXplatWithApps(appTree);
|
21
|
+
appTree = (0, testing_1.createXplatWithApps)(appTree);
|
22
22
|
});
|
23
23
|
it('applitools: should create all files', () => __awaiter(void 0, void 0, void 0, function* () {
|
24
24
|
// const optionsXplat: XPlatOptions = {
|
@@ -34,36 +34,36 @@ xdescribe('helpers schematic', () => {
|
|
34
34
|
useXplat: false,
|
35
35
|
};
|
36
36
|
// console.log('appTree:', appTree);
|
37
|
-
appTree = yield testing_2.runSchematic('app', appOptions, appTree);
|
37
|
+
appTree = yield (0, testing_2.runSchematic)('app', appOptions, appTree);
|
38
38
|
const cypressJsonPath = '/apps/web-foo-e2e/cypress.json';
|
39
|
-
let fileContent = testing_1.getFileContent(appTree, cypressJsonPath);
|
40
|
-
let cypressJson = xplat_utils_1.jsonParse(fileContent);
|
39
|
+
let fileContent = (0, testing_1.getFileContent)(appTree, cypressJsonPath);
|
40
|
+
let cypressJson = (0, xplat_utils_1.jsonParse)(fileContent);
|
41
41
|
expect(cypressJson.supportFile).toBe(false);
|
42
42
|
const options = {
|
43
43
|
name: 'applitools',
|
44
44
|
target: 'web-foo',
|
45
45
|
};
|
46
46
|
// console.log('appTree:', appTree);
|
47
|
-
const tree = yield testing_2.runSchematic('helpers', options, appTree);
|
47
|
+
const tree = yield (0, testing_2.runSchematic)('helpers', options, appTree);
|
48
48
|
const files = tree.files;
|
49
49
|
// console.log(files);
|
50
50
|
expect(files.indexOf('/apps/web-foo-e2e/src/support/index.ts')).toBeGreaterThanOrEqual(0);
|
51
51
|
expect(files.indexOf('/apps/web-foo-e2e/src/plugins/index.ts')).toBeGreaterThanOrEqual(0);
|
52
52
|
// modified testing files
|
53
53
|
let filePath = '/apps/web-foo-e2e/src/support/index.ts';
|
54
|
-
fileContent = testing_1.getFileContent(tree, filePath);
|
54
|
+
fileContent = (0, testing_1.getFileContent)(tree, filePath);
|
55
55
|
// console.log(fileContent);
|
56
56
|
expect(fileContent.indexOf('@applitools/eyes-cypress/commands')).toBeGreaterThanOrEqual(0);
|
57
57
|
filePath = '/apps/web-foo-e2e/src/plugins/index.ts';
|
58
|
-
fileContent = testing_1.getFileContent(tree, filePath);
|
58
|
+
fileContent = (0, testing_1.getFileContent)(tree, filePath);
|
59
59
|
// console.log(fileContent);
|
60
60
|
expect(fileContent.indexOf(`require('@applitools/eyes-cypress')(module);`)).toBeGreaterThanOrEqual(0);
|
61
|
-
fileContent = testing_1.getFileContent(tree, cypressJsonPath);
|
61
|
+
fileContent = (0, testing_1.getFileContent)(tree, cypressJsonPath);
|
62
62
|
// console.log(fileContent);
|
63
|
-
cypressJson = xplat_utils_1.jsonParse(fileContent);
|
63
|
+
cypressJson = (0, xplat_utils_1.jsonParse)(fileContent);
|
64
64
|
expect(cypressJson.supportFile).toBe(`./src/support/index.js`);
|
65
65
|
filePath = '/apps/web-foo-e2e/src/integration/app.spec.ts';
|
66
|
-
fileContent = testing_1.getFileContent(tree, filePath);
|
66
|
+
fileContent = (0, testing_1.getFileContent)(tree, filePath);
|
67
67
|
// console.log(fileContent);
|
68
68
|
expect(fileContent.indexOf(`eyesOpen`)).toBeGreaterThanOrEqual(0);
|
69
69
|
}));
|
@@ -81,15 +81,15 @@ xdescribe('helpers schematic', () => {
|
|
81
81
|
useXplat: false,
|
82
82
|
};
|
83
83
|
// console.log('appTree:', appTree);
|
84
|
-
appTree = yield testing_2.runSchematic('app', appOptions, appTree);
|
84
|
+
appTree = yield (0, testing_2.runSchematic)('app', appOptions, appTree);
|
85
85
|
const cypressJsonPath = '/apps/web-foo-e2e/cypress.json';
|
86
|
-
let fileContent = testing_1.getFileContent(appTree, cypressJsonPath);
|
87
|
-
let cypressJson = xplat_utils_1.jsonParse(fileContent);
|
86
|
+
let fileContent = (0, testing_1.getFileContent)(appTree, cypressJsonPath);
|
87
|
+
let cypressJson = (0, xplat_utils_1.jsonParse)(fileContent);
|
88
88
|
expect(cypressJson.supportFile).toBe(false);
|
89
89
|
const options = {
|
90
90
|
name: 'applitools',
|
91
91
|
};
|
92
92
|
// console.log('appTree:', appTree);
|
93
|
-
yield expect(testing_2.runSchematic('helpers', options, appTree)).rejects.toThrow(`The helper "applitools" requires the --target flag.`);
|
93
|
+
yield expect((0, testing_2.runSchematic)('helpers', options, appTree)).rejects.toThrow(`The helper "applitools" requires the --target flag.`);
|
94
94
|
}));
|
95
95
|
});
|
@@ -3,11 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const schematics_1 = require("@angular-devkit/schematics");
|
4
4
|
const xplat_utils_1 = require("@nstudio/xplat-utils");
|
5
5
|
function default_1(options) {
|
6
|
-
return schematics_1.chain([
|
7
|
-
xplat_utils_1.prerun(options, true),
|
6
|
+
return (0, schematics_1.chain)([
|
7
|
+
(0, xplat_utils_1.prerun)(options, true),
|
8
8
|
options.platforms
|
9
|
-
? (tree, context) => schematics_1.externalSchematic('@nstudio/angular', 'xplat', options)
|
10
|
-
: schematics_1.noop(),
|
9
|
+
? (tree, context) => (0, schematics_1.externalSchematic)('@nstudio/angular', 'xplat', options)
|
10
|
+
: (0, schematics_1.noop)(),
|
11
11
|
]);
|
12
12
|
}
|
13
13
|
exports.default = default_1;
|
@@ -19,17 +19,17 @@ describe('ngrx 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 root state in libs 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
|
const options = Object.assign({}, defaultOptions);
|
31
31
|
options.root = true;
|
32
|
-
tree = yield testing_2.runSchematic('ngrx', options, tree);
|
32
|
+
tree = yield (0, testing_2.runSchematic)('ngrx', options, tree);
|
33
33
|
const files = tree.files;
|
34
34
|
// console.log(files.slice(91,files.length));
|
35
35
|
expect(files.indexOf('/libs/xplat/core/src/lib/state/auth.actions.ts')).toBeGreaterThanOrEqual(0);
|
@@ -40,22 +40,22 @@ describe('ngrx schematic', () => {
|
|
40
40
|
expect(files.indexOf('/libs/xplat/core/src/lib/state/auth.state.ts')).toBeGreaterThanOrEqual(0);
|
41
41
|
expect(files.indexOf('/libs/xplat/core/src/lib/state/index.ts')).toBeGreaterThanOrEqual(0);
|
42
42
|
// file content
|
43
|
-
let content = testing_1.getFileContent(tree, '/libs/xplat/core/src/lib/state/auth.actions.ts');
|
43
|
+
let content = (0, testing_1.getFileContent)(tree, '/libs/xplat/core/src/lib/state/auth.actions.ts');
|
44
44
|
// console.log(content);
|
45
45
|
expect(content.indexOf(`AuthActions`)).toBeGreaterThanOrEqual(0);
|
46
46
|
expect(content.indexOf(`[@testing/auth] init'`)).toBeGreaterThanOrEqual(0);
|
47
|
-
content = testing_1.getFileContent(tree, '/libs/xplat/core/src/lib/index.ts');
|
47
|
+
content = (0, testing_1.getFileContent)(tree, '/libs/xplat/core/src/lib/index.ts');
|
48
48
|
// console.log('/libs/core/index.ts:', content);
|
49
49
|
expect(content.indexOf(`export * from './state';`)).toBeGreaterThanOrEqual(0);
|
50
50
|
let modulePath = '/libs/xplat/core/src/lib/core.module.ts';
|
51
|
-
let moduleContent = testing_1.getFileContent(tree, modulePath);
|
51
|
+
let moduleContent = (0, testing_1.getFileContent)(tree, modulePath);
|
52
52
|
// console.log(modulePath + ':');
|
53
53
|
// console.log(moduleContent);
|
54
54
|
expect(moduleContent.indexOf(`StoreModule.forRoot`)).toBeGreaterThanOrEqual(0);
|
55
55
|
}));
|
56
56
|
it('should create ngrx state for specified projects only', () => __awaiter(void 0, void 0, void 0, function* () {
|
57
57
|
// console.log('appTree:', appTree);
|
58
|
-
let tree = yield testing_2.runSchematic('feature', {
|
58
|
+
let tree = yield (0, testing_2.runSchematic)('feature', {
|
59
59
|
name: 'foo',
|
60
60
|
projects: 'nativescript-viewer,web-viewer',
|
61
61
|
onlyProject: true,
|
@@ -65,7 +65,7 @@ describe('ngrx schematic', () => {
|
|
65
65
|
feature: 'foo',
|
66
66
|
projects: 'nativescript-viewer,web-viewer',
|
67
67
|
};
|
68
|
-
tree = yield testing_2.runSchematic('ngrx', options, tree);
|
68
|
+
tree = yield (0, testing_2.runSchematic)('ngrx', options, tree);
|
69
69
|
const files = tree.files;
|
70
70
|
// console.log(files. slice(91,files.length));
|
71
71
|
// state should not be setup to share
|
@@ -77,36 +77,36 @@ describe('ngrx schematic', () => {
|
|
77
77
|
expect(files.indexOf('/apps/web-viewer/src/app/features/foo/state/auth.actions.ts')).toBeGreaterThanOrEqual(0);
|
78
78
|
// file content
|
79
79
|
let indexPath = '/apps/nativescript-viewer/src/features/foo/state/auth.actions.ts';
|
80
|
-
let content = testing_1.getFileContent(tree, indexPath);
|
80
|
+
let content = (0, testing_1.getFileContent)(tree, indexPath);
|
81
81
|
// console.log(barrelPath + ':');
|
82
82
|
// console.log(barrelIndex);
|
83
83
|
// symbol should be at end of collection
|
84
84
|
expect(content.indexOf(`AuthActions`)).toBeGreaterThanOrEqual(0);
|
85
85
|
let modulePath = '/apps/nativescript-viewer/src/features/foo/foo.module.ts';
|
86
|
-
content = testing_1.getFileContent(tree, modulePath);
|
86
|
+
content = (0, testing_1.getFileContent)(tree, modulePath);
|
87
87
|
// console.log(modulePath + ':');
|
88
88
|
// console.log(content);
|
89
89
|
// symbol should be at end of collection
|
90
90
|
expect(content.indexOf(`StoreModule.forFeature`)).toBeGreaterThanOrEqual(0);
|
91
91
|
indexPath = '/apps/web-viewer/src/app/features/foo/state/auth.actions.ts';
|
92
|
-
content = testing_1.getFileContent(tree, indexPath);
|
92
|
+
content = (0, testing_1.getFileContent)(tree, indexPath);
|
93
93
|
// console.log(barrelPath + ':');
|
94
94
|
// console.log(barrelIndex);
|
95
95
|
expect(content.indexOf(`AuthActions`)).toBeGreaterThanOrEqual(0);
|
96
96
|
modulePath = '/apps/web-viewer/src/app/features/foo/foo.module.ts';
|
97
|
-
content = testing_1.getFileContent(tree, modulePath);
|
97
|
+
content = (0, testing_1.getFileContent)(tree, modulePath);
|
98
98
|
// console.log('content:', content)
|
99
99
|
expect(content.indexOf(`StoreModule.forFeature`)).toBeGreaterThanOrEqual(0);
|
100
100
|
}));
|
101
101
|
it('should create ngrx state for Nx lib only', () => __awaiter(void 0, void 0, void 0, function* () {
|
102
102
|
// console.log('appTree:', appTree);
|
103
103
|
appTree = schematics_1.Tree.empty();
|
104
|
-
appTree = testing_1.createXplatWithNativeScriptWeb(appTree, null, 'angular', 'sample');
|
104
|
+
appTree = (0, testing_1.createXplatWithNativeScriptWeb)(appTree, null, 'angular', 'sample');
|
105
105
|
const options = {
|
106
106
|
name: 'auth',
|
107
107
|
feature: '@testing/sample',
|
108
108
|
};
|
109
|
-
let tree = yield testing_2.runSchematic('ngrx', options, appTree);
|
109
|
+
let tree = yield (0, testing_2.runSchematic)('ngrx', options, appTree);
|
110
110
|
const files = tree.files;
|
111
111
|
// console.log(files. slice(91,files.length));
|
112
112
|
// state should not be setup in xplat architecture
|
@@ -115,13 +115,13 @@ describe('ngrx schematic', () => {
|
|
115
115
|
expect(files.indexOf(`/libs/sample/src/lib/state/auth.actions.ts`)).toBeGreaterThanOrEqual(0);
|
116
116
|
// file content
|
117
117
|
let indexPath = `/libs/sample/src/lib/state/auth.actions.ts`;
|
118
|
-
let content = testing_1.getFileContent(tree, indexPath);
|
118
|
+
let content = (0, testing_1.getFileContent)(tree, indexPath);
|
119
119
|
// console.log(barrelPath + ':');
|
120
120
|
// console.log(barrelIndex);
|
121
121
|
// symbol should be at end of collection
|
122
122
|
expect(content.indexOf(`AuthActions`)).toBeGreaterThanOrEqual(0);
|
123
123
|
let modulePath = '/libs/sample/src/lib/sample.module.ts';
|
124
|
-
content = testing_1.getFileContent(tree, modulePath);
|
124
|
+
content = (0, testing_1.getFileContent)(tree, modulePath);
|
125
125
|
// console.log(modulePath + ':');
|
126
126
|
// console.log(content);
|
127
127
|
// symbol should be at end of collection
|
@@ -2,6 +2,6 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
const angular_1 = require("@nstudio/angular");
|
4
4
|
function default_1(options) {
|
5
|
-
return angular_1.generate('pipe', options);
|
5
|
+
return (0, angular_1.generate)('pipe', options);
|
6
6
|
}
|
7
7
|
exports.default = default_1;
|