@nstudio/xplat 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/migrations/update-10-2-0/update-10-2-0.js +2 -2
- package/migrations/update-11-0-0/clean-old-dirs.js +2 -2
- package/migrations/update-11-0-0/update-11-0-0.js +48 -46
- package/migrations/update-11-0-0/update-to-11-env-base.js +33 -27
- package/migrations/update-11-0-0/update-to-11-imports.js +5 -5
- package/migrations/update-12-4-3/update-12-4-3.js +19 -19
- package/migrations/update-13-0-0/update-13-0-0.d.ts +2 -0
- package/migrations/update-13-0-0/update-13-0-0.js +299 -0
- package/migrations.json +46 -0
- package/package.json +3 -7
- package/src/schematics/app-generate/index.js +3 -3
- package/src/schematics/application/index.js +1 -1
- package/src/schematics/application/index.spec.js +13 -13
- package/src/schematics/component/index.js +1 -1
- package/src/schematics/component/index.spec.js +22 -22
- package/src/schematics/feature/index.js +3 -3
- package/src/schematics/feature/index.spec.js +37 -37
- package/src/schematics/helpers/index.js +7 -7
- package/src/schematics/helpers/index.spec.js +4 -4
- package/src/schematics/init/index.js +15 -14
- package/src/schematics/init/index.spec.js +8 -9
- package/src/schematics/mode/index.js +3 -3
- package/src/schematics/ng-add/index.js +3 -3
- package/src/utils/ast.js +1 -1
- package/src/utils/general.d.ts +0 -1
- package/src/utils/general.js +11 -19
- package/src/utils/helpers.js +1 -1
- package/src/utils/postinstall.js +9 -9
- package/src/utils/testing-utils.js +2 -2
- package/src/utils/testing.js +2 -2
- package/src/utils/versions.d.ts +1 -1
- package/src/utils/versions.js +2 -2
- package/src/utils/xplat.js +65 -65
@@ -24,18 +24,18 @@ xdescribe('component', () => {
|
|
24
24
|
};
|
25
25
|
beforeEach(() => {
|
26
26
|
appTree = schematics_1.Tree.empty();
|
27
|
-
appTree = testing_1.createXplatWithNativeScriptWeb(appTree, false, 'angular');
|
27
|
+
appTree = (0, testing_1.createXplatWithNativeScriptWeb)(appTree, false, 'angular');
|
28
28
|
});
|
29
29
|
it('should create component for specified platforms', () => __awaiter(void 0, void 0, void 0, function* () {
|
30
30
|
// console.log('appTree:', appTree);
|
31
|
-
let tree = yield testing_2.runSchematic('feature', {
|
31
|
+
let tree = yield (0, testing_2.runSchematic)('feature', {
|
32
32
|
name: 'foo',
|
33
33
|
platforms: 'nativescript,web',
|
34
34
|
framework: 'angular',
|
35
35
|
isTesting: true,
|
36
36
|
}, appTree);
|
37
37
|
const options = Object.assign({}, defaultOptions);
|
38
|
-
tree = yield testing_2.runSchematic('component', options, tree);
|
38
|
+
tree = yield (0, testing_2.runSchematic)('component', options, tree);
|
39
39
|
const files = tree.files;
|
40
40
|
// console.log(files.slice(91,files.length));
|
41
41
|
// component
|
@@ -46,21 +46,21 @@ xdescribe('component', () => {
|
|
46
46
|
expect(tree.exists('/xplat/web/features/foo/components/signup/signup.component.ts')).toBeTruthy();
|
47
47
|
// ensure base index was modified
|
48
48
|
let barrelPath = '/libs/features/foo/base/index.ts';
|
49
|
-
let barrelIndex = testing_1.getFileContent(tree, barrelPath);
|
49
|
+
let barrelIndex = (0, testing_1.getFileContent)(tree, barrelPath);
|
50
50
|
// console.log(barrelPath + ':');
|
51
51
|
// console.log(barrelIndex);
|
52
52
|
// component symbol should be at end of components collection
|
53
53
|
expect(barrelIndex.indexOf(`./signup.base-component`)).toBeGreaterThanOrEqual(0);
|
54
54
|
// file content
|
55
55
|
barrelPath = '/xplat/nativescript/features/foo/components/index.ts';
|
56
|
-
barrelIndex = testing_1.getFileContent(tree, barrelPath);
|
56
|
+
barrelIndex = (0, testing_1.getFileContent)(tree, barrelPath);
|
57
57
|
// console.log(barrelPath + ':');
|
58
58
|
// console.log(barrelIndex);
|
59
59
|
// component symbol should be at end of components collection
|
60
60
|
expect(barrelIndex.indexOf(`SignupComponent];`)).toBeGreaterThanOrEqual(0);
|
61
61
|
expect(barrelIndex.indexOf(`./signup/signup.component`)).toBeGreaterThanOrEqual(0);
|
62
62
|
barrelPath = '/xplat/web/features/foo/components/index.ts';
|
63
|
-
barrelIndex = testing_1.getFileContent(tree, barrelPath);
|
63
|
+
barrelIndex = (0, testing_1.getFileContent)(tree, barrelPath);
|
64
64
|
// console.log(barrelPath + ':');
|
65
65
|
// console.log(barrelIndex);
|
66
66
|
expect(barrelIndex.indexOf(`SignupComponent];`)).toBeGreaterThanOrEqual(0);
|
@@ -68,16 +68,16 @@ xdescribe('component', () => {
|
|
68
68
|
}));
|
69
69
|
it('should create component for specified platforms with framework name when no default is set', () => __awaiter(void 0, void 0, void 0, function* () {
|
70
70
|
appTree = schematics_1.Tree.empty();
|
71
|
-
appTree = testing_1.createXplatWithNativeScriptWeb(appTree);
|
71
|
+
appTree = (0, testing_1.createXplatWithNativeScriptWeb)(appTree);
|
72
72
|
// console.log('appTree:', appTree);
|
73
|
-
let tree = yield testing_2.runSchematic('feature', {
|
73
|
+
let tree = yield (0, testing_2.runSchematic)('feature', {
|
74
74
|
name: 'foo',
|
75
75
|
platforms: 'nativescript,web',
|
76
76
|
isTesting: true,
|
77
77
|
}, appTree);
|
78
78
|
const options = Object.assign({}, defaultOptions);
|
79
79
|
delete options.framework;
|
80
|
-
tree = yield testing_2.runSchematic('component', options, tree);
|
80
|
+
tree = yield (0, testing_2.runSchematic)('component', options, tree);
|
81
81
|
const files = tree.files;
|
82
82
|
// console.log(files);//.slice(91,files.length));
|
83
83
|
// component
|
@@ -89,7 +89,7 @@ xdescribe('component', () => {
|
|
89
89
|
}));
|
90
90
|
it('should create component for specified platforms with subFolder option', () => __awaiter(void 0, void 0, void 0, function* () {
|
91
91
|
// console.log('appTree:', appTree);
|
92
|
-
let tree = yield testing_2.runSchematic('feature', {
|
92
|
+
let tree = yield (0, testing_2.runSchematic)('feature', {
|
93
93
|
name: 'foo',
|
94
94
|
platforms: 'nativescript,web',
|
95
95
|
framework: 'angular',
|
@@ -97,7 +97,7 @@ xdescribe('component', () => {
|
|
97
97
|
}, appTree);
|
98
98
|
const options = Object.assign({}, defaultOptions);
|
99
99
|
options.subFolder = 'registration';
|
100
|
-
tree = yield testing_2.runSchematic('component', options, tree);
|
100
|
+
tree = yield (0, testing_2.runSchematic)('component', options, tree);
|
101
101
|
const files = tree.files;
|
102
102
|
// console.log(files.slice(91,files.length));
|
103
103
|
// component
|
@@ -108,12 +108,12 @@ xdescribe('component', () => {
|
|
108
108
|
expect(tree.exists('/xplat/web/features/foo/components/registration/signup/signup.component.ts')).toBeTruthy();
|
109
109
|
// ensure base index was modified
|
110
110
|
let barrelPath = '/libs/features/foo/base/registration/index.ts';
|
111
|
-
let barrelIndex = testing_1.getFileContent(tree, barrelPath);
|
111
|
+
let barrelIndex = (0, testing_1.getFileContent)(tree, barrelPath);
|
112
112
|
// console.log(barrelPath + ':');
|
113
113
|
// console.log(barrelIndex);
|
114
114
|
expect(barrelIndex.indexOf(`./signup.base-component`)).toBeTruthy();
|
115
115
|
barrelPath = '/libs/features/foo/base/index.ts';
|
116
|
-
barrelIndex = testing_1.getFileContent(tree, barrelPath);
|
116
|
+
barrelIndex = (0, testing_1.getFileContent)(tree, barrelPath);
|
117
117
|
// console.log(barrelPath + ':');
|
118
118
|
// console.log(barrelIndex);
|
119
119
|
// component symbol should be at end of components collection
|
@@ -121,34 +121,34 @@ xdescribe('component', () => {
|
|
121
121
|
// file content
|
122
122
|
barrelPath =
|
123
123
|
'/xplat/nativescript/features/foo/components/registration/index.ts';
|
124
|
-
barrelIndex = testing_1.getFileContent(tree, barrelPath);
|
124
|
+
barrelIndex = (0, testing_1.getFileContent)(tree, barrelPath);
|
125
125
|
// console.log(barrelPath + ':');
|
126
126
|
// console.log(barrelIndex);
|
127
127
|
// component symbol should be at end of components collection
|
128
128
|
expect(barrelIndex.indexOf(`SignupComponent];`)).toBeGreaterThanOrEqual(0);
|
129
129
|
expect(barrelIndex.indexOf(`./signup/signup.component`)).toBeGreaterThanOrEqual(0);
|
130
130
|
barrelPath = '/xplat/web/features/foo/components/registration/index.ts';
|
131
|
-
barrelIndex = testing_1.getFileContent(tree, barrelPath);
|
131
|
+
barrelIndex = (0, testing_1.getFileContent)(tree, barrelPath);
|
132
132
|
// console.log(barrelPath + ':');
|
133
133
|
// console.log(barrelIndex);
|
134
134
|
expect(barrelIndex.indexOf(`SignupComponent];`)).toBeGreaterThanOrEqual(0);
|
135
135
|
expect(barrelIndex.indexOf(`./signup/signup.component`)).toBeGreaterThanOrEqual(0);
|
136
136
|
// file content
|
137
137
|
barrelPath = '/xplat/nativescript/features/foo/components/index.ts';
|
138
|
-
barrelIndex = testing_1.getFileContent(tree, barrelPath);
|
138
|
+
barrelIndex = (0, testing_1.getFileContent)(tree, barrelPath);
|
139
139
|
// console.log(barrelPath + ':');
|
140
140
|
// console.log(barrelIndex);
|
141
141
|
// component symbol should be at end of components collection
|
142
142
|
expect(barrelIndex.indexOf(`REGISTRATION_COMPONENTS`)).toBeGreaterThanOrEqual(0);
|
143
143
|
barrelPath = '/xplat/web/features/foo/components/index.ts';
|
144
|
-
barrelIndex = testing_1.getFileContent(tree, barrelPath);
|
144
|
+
barrelIndex = (0, testing_1.getFileContent)(tree, barrelPath);
|
145
145
|
// console.log(barrelPath + ':');
|
146
146
|
// console.log(barrelIndex);
|
147
147
|
expect(barrelIndex.indexOf(`REGISTRATION_COMPONENTS`)).toBeGreaterThanOrEqual(0);
|
148
148
|
}));
|
149
149
|
it('should create component for specified projects only', () => __awaiter(void 0, void 0, void 0, function* () {
|
150
150
|
// console.log('appTree:', appTree);
|
151
|
-
let tree = yield testing_2.runSchematic('feature', {
|
151
|
+
let tree = yield (0, testing_2.runSchematic)('feature', {
|
152
152
|
name: 'foo',
|
153
153
|
projects: 'nativescript-viewer,web-viewer',
|
154
154
|
onlyProject: true,
|
@@ -161,7 +161,7 @@ xdescribe('component', () => {
|
|
161
161
|
projects: 'nativescript-viewer,web-viewer',
|
162
162
|
framework: 'angular',
|
163
163
|
};
|
164
|
-
tree = yield testing_2.runSchematic('component', options, tree);
|
164
|
+
tree = yield (0, testing_2.runSchematic)('component', options, tree);
|
165
165
|
const files = tree.files;
|
166
166
|
// console.log(files. slice(91,files.length));
|
167
167
|
// component should not be setup to share
|
@@ -177,7 +177,7 @@ xdescribe('component', () => {
|
|
177
177
|
expect(tree.exists('/apps/web-viewer/src/app/features/foo/components/signup/signup.component.ts')).toBeTruthy();
|
178
178
|
// file content
|
179
179
|
let barrelPath = '/apps/nativescript-viewer/src/features/foo/components/index.ts';
|
180
|
-
let barrelIndex = testing_1.getFileContent(tree, barrelPath);
|
180
|
+
let barrelIndex = (0, testing_1.getFileContent)(tree, barrelPath);
|
181
181
|
// console.log(barrelPath + ':');
|
182
182
|
// console.log(barrelIndex);
|
183
183
|
// component symbol should be at end of components collection
|
@@ -190,7 +190,7 @@ xdescribe('component', () => {
|
|
190
190
|
// // component symbol should be at end of components collection
|
191
191
|
// expect(content.indexOf(`./signup/signup.component.ts`)).toBeGreaterThanOrEqual(0);
|
192
192
|
barrelPath = '/apps/web-viewer/src/app/features/foo/components/index.ts';
|
193
|
-
barrelIndex = testing_1.getFileContent(tree, barrelPath);
|
193
|
+
barrelIndex = (0, testing_1.getFileContent)(tree, barrelPath);
|
194
194
|
// console.log(barrelPath + ':');
|
195
195
|
// console.log(barrelIndex);
|
196
196
|
expect(barrelIndex.indexOf(`SignupComponent];`)).toBeGreaterThanOrEqual(0);
|
@@ -204,6 +204,6 @@ xdescribe('component', () => {
|
|
204
204
|
projects: 'nativescript-viewer,web-viewer',
|
205
205
|
framework: 'angular',
|
206
206
|
};
|
207
|
-
yield expect(testing_2.runSchematic('component', options, appTree)).rejects.toThrow(`apps/nativescript-viewer/src/features/foo/foo.module.ts does not exist. Create the feature module first. For example: nx g @nstudio/angular:feature foo --projects=nativescript-viewer --onlyModule`);
|
207
|
+
yield expect((0, testing_2.runSchematic)('component', options, appTree)).rejects.toThrow(`apps/nativescript-viewer/src/features/foo/foo.module.ts does not exist. Create the feature module first. For example: nx g @nstudio/angular:feature foo --projects=nativescript-viewer --onlyModule`);
|
208
208
|
}));
|
209
209
|
});
|
@@ -6,9 +6,9 @@ const utils_1 = require("../../utils");
|
|
6
6
|
let packagesToRunXplat = [];
|
7
7
|
function default_1(options) {
|
8
8
|
const externalChains = utils_1.XplatHelpers.getExternalChainsForGenerator(options, 'feature', packagesToRunXplat);
|
9
|
-
return schematics_1.chain([
|
10
|
-
xplat_utils_1.prerun(options, true),
|
11
|
-
(tree, context) => schematics_1.chain(externalChains),
|
9
|
+
return (0, schematics_1.chain)([
|
10
|
+
(0, xplat_utils_1.prerun)(options, true),
|
11
|
+
(tree, context) => (0, schematics_1.chain)(externalChains),
|
12
12
|
]);
|
13
13
|
}
|
14
14
|
exports.default = default_1;
|
@@ -25,12 +25,12 @@ xdescribe('feature schematic', () => {
|
|
25
25
|
};
|
26
26
|
beforeEach(() => {
|
27
27
|
appTree = schematics_1.Tree.empty();
|
28
|
-
appTree = testing_utils_1.createXplatWithNativeScriptWeb(appTree, null, 'angular');
|
28
|
+
appTree = (0, testing_utils_1.createXplatWithNativeScriptWeb)(appTree, null, 'angular');
|
29
29
|
});
|
30
30
|
it('should create feature module with a single starting component', () => __awaiter(void 0, void 0, void 0, function* () {
|
31
31
|
const options = Object.assign({}, defaultOptions);
|
32
32
|
// console.log('appTree:', appTree);
|
33
|
-
let tree = yield testing_1.runSchematic('feature', options, appTree);
|
33
|
+
let tree = yield (0, testing_1.runSchematic)('feature', options, appTree);
|
34
34
|
const files = tree.files;
|
35
35
|
// console.log(files);//.slice(85,files.length));
|
36
36
|
expect(files.indexOf('/apps/nativescript-viewer/package.json')).toBeGreaterThanOrEqual(0);
|
@@ -62,25 +62,25 @@ xdescribe('feature schematic', () => {
|
|
62
62
|
expect(files.indexOf('/apps/web-viewer/src/app/features/foo/components/foo/foo.component.ts')).toBeGreaterThanOrEqual(-1);
|
63
63
|
// file content
|
64
64
|
let modulePath = '/libs/xplat/nativescript/features/src/lib/foo/foo.module.ts';
|
65
|
-
let featureModule = testing_utils_1.getFileContent(tree, modulePath);
|
65
|
+
let featureModule = (0, testing_utils_1.getFileContent)(tree, modulePath);
|
66
66
|
// console.log(modulePath + ':');
|
67
67
|
// console.log(featureModule);
|
68
|
-
expect(featureModule).toMatch(testing_utils_1.isInModuleMetadata('FooModule', 'imports', `UIModule`, true));
|
68
|
+
expect(featureModule).toMatch((0, testing_utils_1.isInModuleMetadata)('FooModule', 'imports', `UIModule`, true));
|
69
69
|
expect(featureModule).toMatch(`import { UIModule } from \'../ui/ui.module\'`);
|
70
70
|
modulePath = '/libs/xplat/web/features/src/lib/foo/foo.module.ts';
|
71
|
-
featureModule = testing_utils_1.getFileContent(tree, modulePath);
|
71
|
+
featureModule = (0, testing_utils_1.getFileContent)(tree, modulePath);
|
72
72
|
// console.log(modulePath + ':');
|
73
73
|
// console.log(featureModule);
|
74
|
-
expect(featureModule).toMatch(testing_utils_1.isInModuleMetadata('FooModule', 'imports', `UIModule`, true));
|
74
|
+
expect(featureModule).toMatch((0, testing_utils_1.isInModuleMetadata)('FooModule', 'imports', `UIModule`, true));
|
75
75
|
expect(featureModule).toMatch(`import { UIModule } from \'../ui/ui.module\'`);
|
76
76
|
}));
|
77
77
|
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* () {
|
78
78
|
appTree = schematics_1.Tree.empty();
|
79
|
-
appTree = testing_utils_1.createXplatWithNativeScriptWeb(appTree);
|
79
|
+
appTree = (0, testing_utils_1.createXplatWithNativeScriptWeb)(appTree);
|
80
80
|
const options = Object.assign({}, defaultOptions);
|
81
81
|
delete options.framework;
|
82
82
|
// console.log('appTree:', appTree);
|
83
|
-
let tree = yield testing_1.runSchematic('feature', options, appTree);
|
83
|
+
let tree = yield (0, testing_1.runSchematic)('feature', options, appTree);
|
84
84
|
const files = tree.files;
|
85
85
|
// console.log(files.slice(85,files.length));
|
86
86
|
expect(files.indexOf('/apps/nativescript-viewer/package.json')).toBeGreaterThanOrEqual(0);
|
@@ -112,23 +112,23 @@ xdescribe('feature schematic', () => {
|
|
112
112
|
expect(files.indexOf('/apps/web-viewer/src/app/features/foo/components/foo/foo.component.ts')).toBeGreaterThanOrEqual(-1);
|
113
113
|
// file content
|
114
114
|
let modulePath = '/libs/xplat/nativescript-angular/features/src/lib/foo/foo.module.ts';
|
115
|
-
let featureModule = testing_utils_1.getFileContent(tree, modulePath);
|
115
|
+
let featureModule = (0, testing_utils_1.getFileContent)(tree, modulePath);
|
116
116
|
// console.log(modulePath + ':');
|
117
117
|
// console.log(featureModule);
|
118
|
-
expect(featureModule).toMatch(testing_utils_1.isInModuleMetadata('FooModule', 'imports', `UIModule`, true));
|
118
|
+
expect(featureModule).toMatch((0, testing_utils_1.isInModuleMetadata)('FooModule', 'imports', `UIModule`, true));
|
119
119
|
expect(featureModule).toMatch(`import { UIModule } from \'../ui/ui.module\'`);
|
120
120
|
modulePath = '/libs/xplat/web-angular/features/src/lib/foo/foo.module.ts';
|
121
|
-
featureModule = testing_utils_1.getFileContent(tree, modulePath);
|
121
|
+
featureModule = (0, testing_utils_1.getFileContent)(tree, modulePath);
|
122
122
|
// console.log(modulePath + ':');
|
123
123
|
// console.log(featureModule);
|
124
|
-
expect(featureModule).toMatch(testing_utils_1.isInModuleMetadata('FooModule', 'imports', `UIModule`, true));
|
124
|
+
expect(featureModule).toMatch((0, testing_utils_1.isInModuleMetadata)('FooModule', 'imports', `UIModule`, true));
|
125
125
|
expect(featureModule).toMatch(`import { UIModule } from \'../ui/ui.module\'`);
|
126
126
|
}));
|
127
127
|
it('should create feature module WITHOUT a single starting component when using onlyModule', () => __awaiter(void 0, void 0, void 0, function* () {
|
128
128
|
// console.log('appTree:', appTree);
|
129
129
|
const options = Object.assign({}, defaultOptions);
|
130
130
|
options.onlyModule = true;
|
131
|
-
let tree = yield testing_1.runSchematic('feature', options, appTree);
|
131
|
+
let tree = yield (0, testing_1.runSchematic)('feature', options, appTree);
|
132
132
|
const files = tree.files;
|
133
133
|
// console.log(files.slice(85,files.length));
|
134
134
|
expect(files.indexOf('/apps/nativescript-viewer/package.json')).toBeGreaterThanOrEqual(0);
|
@@ -151,18 +151,18 @@ xdescribe('feature schematic', () => {
|
|
151
151
|
expect(files.indexOf('/libs/xplat/web/features/src/lib/foo/components/foo/foo.component.ts')).toBe(-1);
|
152
152
|
// file content
|
153
153
|
let modulePath = '/libs/xplat/nativescript/features/src/lib/foo/foo.module.ts';
|
154
|
-
let featureModule = testing_utils_1.getFileContent(tree, modulePath);
|
154
|
+
let featureModule = (0, testing_utils_1.getFileContent)(tree, modulePath);
|
155
155
|
// console.log(modulePath + ':');
|
156
156
|
// console.log(featureModule);
|
157
|
-
expect(featureModule).toMatch(testing_utils_1.isInModuleMetadata('FooModule', 'imports', `UIModule`, true));
|
157
|
+
expect(featureModule).toMatch((0, testing_utils_1.isInModuleMetadata)('FooModule', 'imports', `UIModule`, true));
|
158
158
|
expect(featureModule).toMatch(`import { UIModule } from \'../ui/ui.module\'`);
|
159
159
|
expect(featureModule.indexOf('FOO_COMPONENTS')).toBe(-1);
|
160
160
|
expect(featureModule.indexOf('declarations')).toBe(-1);
|
161
161
|
modulePath = '/libs/xplat/nativescript/features/src/lib/foo/foo.module.ts';
|
162
|
-
featureModule = testing_utils_1.getFileContent(tree, modulePath);
|
162
|
+
featureModule = (0, testing_utils_1.getFileContent)(tree, modulePath);
|
163
163
|
// console.log(modulePath + ':');
|
164
164
|
// console.log(featureModule);
|
165
|
-
expect(featureModule).toMatch(testing_utils_1.isInModuleMetadata('FooModule', 'imports', `UIModule`, true));
|
165
|
+
expect(featureModule).toMatch((0, testing_utils_1.isInModuleMetadata)('FooModule', 'imports', `UIModule`, true));
|
166
166
|
expect(featureModule).toMatch(`import { UIModule } from \'../ui/ui.module\'`);
|
167
167
|
}));
|
168
168
|
it('should create feature module WITH a single starting component BUT IGNORE creating matching base component', () => __awaiter(void 0, void 0, void 0, function* () {
|
@@ -171,7 +171,7 @@ xdescribe('feature schematic', () => {
|
|
171
171
|
name: 'foo',
|
172
172
|
platforms: 'web',
|
173
173
|
};
|
174
|
-
let tree = yield testing_1.runSchematic('feature', options, appTree);
|
174
|
+
let tree = yield (0, testing_1.runSchematic)('feature', options, appTree);
|
175
175
|
const files = tree.files;
|
176
176
|
// console.log(files.slice(85,files.length));
|
177
177
|
// shared code defaults
|
@@ -192,15 +192,15 @@ xdescribe('feature schematic', () => {
|
|
192
192
|
expect(files.indexOf('/libs/xplat/web/features/src/lib/foo/components/foo/foo.component.ts')).toBeGreaterThanOrEqual(0);
|
193
193
|
// file content
|
194
194
|
let modulePath = '/libs/xplat/web/features/src/lib/foo/foo.module.ts';
|
195
|
-
let featureModule = testing_utils_1.getFileContent(tree, modulePath);
|
195
|
+
let featureModule = (0, testing_utils_1.getFileContent)(tree, modulePath);
|
196
196
|
// console.log(modulePath + ':');
|
197
197
|
// console.log(featureModule);
|
198
|
-
expect(featureModule).toMatch(testing_utils_1.isInModuleMetadata('FooModule', 'imports', `UIModule`, true));
|
198
|
+
expect(featureModule).toMatch((0, testing_utils_1.isInModuleMetadata)('FooModule', 'imports', `UIModule`, true));
|
199
199
|
expect(featureModule).toMatch(`import { UIModule } from \'../ui/ui.module\'`);
|
200
200
|
expect(featureModule.indexOf('FOO_COMPONENTS')).toBeGreaterThanOrEqual(0);
|
201
201
|
expect(featureModule.indexOf('declarations')).toBeGreaterThanOrEqual(0);
|
202
202
|
let compPath = '/libs/xplat/web/features/src/lib/foo/components/foo/foo.component.ts';
|
203
|
-
let compContent = testing_utils_1.getFileContent(tree, compPath);
|
203
|
+
let compContent = (0, testing_utils_1.getFileContent)(tree, compPath);
|
204
204
|
// console.log(compPath + ':');
|
205
205
|
// console.log(compContent);
|
206
206
|
expect(compContent.indexOf('extends BaseComponent')).toBeGreaterThanOrEqual(0);
|
@@ -209,7 +209,7 @@ xdescribe('feature schematic', () => {
|
|
209
209
|
const options = Object.assign({}, defaultOptions);
|
210
210
|
// console.log('appTree:', appTree);
|
211
211
|
options.onlyProject = true;
|
212
|
-
let tree = yield testing_1.runSchematic('feature', options, appTree);
|
212
|
+
let tree = yield (0, testing_1.runSchematic)('feature', options, appTree);
|
213
213
|
const files = tree.files;
|
214
214
|
// console.log(files.slice(85,files.length));
|
215
215
|
// feature should not be in shared code
|
@@ -239,33 +239,33 @@ xdescribe('feature schematic', () => {
|
|
239
239
|
expect(files.indexOf('/libs/xplat/web/features/src/lib/foo/components/foo/foo.component.ts')).toBeGreaterThanOrEqual(-1);
|
240
240
|
// file content
|
241
241
|
let modulePath = '/apps/nativescript-viewer/src/features/foo/foo.module.ts';
|
242
|
-
let featureModule = testing_utils_1.getFileContent(tree, modulePath);
|
242
|
+
let featureModule = (0, testing_utils_1.getFileContent)(tree, modulePath);
|
243
243
|
// console.log(modulePath + ':');
|
244
244
|
// console.log(featureModule);
|
245
|
-
expect(featureModule).toMatch(testing_utils_1.isInModuleMetadata('FooModule', 'imports', `SharedModule`, true));
|
245
|
+
expect(featureModule).toMatch((0, testing_utils_1.isInModuleMetadata)('FooModule', 'imports', `SharedModule`, true));
|
246
246
|
expect(featureModule).toMatch(`import { SharedModule } from \'../shared/shared.module\'`);
|
247
247
|
modulePath = '/apps/web-viewer/src/app/features/foo/foo.module.ts';
|
248
|
-
featureModule = testing_utils_1.getFileContent(tree, modulePath);
|
248
|
+
featureModule = (0, testing_utils_1.getFileContent)(tree, modulePath);
|
249
249
|
// console.log(modulePath + ':');
|
250
250
|
// console.log(featureModule);
|
251
|
-
expect(featureModule).toMatch(testing_utils_1.isInModuleMetadata('FooModule', 'imports', `SharedModule`, true));
|
251
|
+
expect(featureModule).toMatch((0, testing_utils_1.isInModuleMetadata)('FooModule', 'imports', `SharedModule`, true));
|
252
252
|
expect(featureModule).toMatch(`import { SharedModule } from \'../shared/shared.module\'`);
|
253
253
|
}));
|
254
254
|
it('Temporary: should error if routing is used without onlyProject', () => __awaiter(void 0, void 0, void 0, function* () {
|
255
255
|
const options = Object.assign({}, defaultOptions);
|
256
256
|
// console.log('appTree:', appTree);
|
257
257
|
options.routing = true;
|
258
|
-
yield expect(testing_1.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.');
|
258
|
+
yield expect((0, testing_1.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.');
|
259
259
|
}));
|
260
260
|
it('should create feature module (with dashes in name) for specified projects WITH Routing', () => __awaiter(void 0, void 0, void 0, function* () {
|
261
261
|
appTree = schematics_1.Tree.empty();
|
262
|
-
appTree = testing_utils_1.createXplatWithNativeScriptWeb(appTree, true);
|
262
|
+
appTree = (0, testing_utils_1.createXplatWithNativeScriptWeb)(appTree, true);
|
263
263
|
const options = Object.assign({}, defaultOptions);
|
264
264
|
// console.log('appTree:', appTree);
|
265
265
|
options.onlyProject = true;
|
266
266
|
options.routing = true;
|
267
267
|
options.name = 'foo-with-dash';
|
268
|
-
let tree = yield testing_1.runSchematic('feature', options, appTree);
|
268
|
+
let tree = yield (0, testing_1.runSchematic)('feature', options, appTree);
|
269
269
|
const files = tree.files;
|
270
270
|
// console.log(files.slice(85,files.length));
|
271
271
|
// feature should not be in shared code
|
@@ -283,7 +283,7 @@ xdescribe('feature schematic', () => {
|
|
283
283
|
expect(files.indexOf('/apps/web-viewer/src/app/features/foo-with-dash/components/foo-with-dash/foo-with-dash.component.ts')).toBeGreaterThanOrEqual(0);
|
284
284
|
// file content
|
285
285
|
let modulePath = '/apps/nativescript-viewer/src/features/foo-with-dash/foo-with-dash.module.ts';
|
286
|
-
let featureModule = testing_utils_1.getFileContent(tree, modulePath);
|
286
|
+
let featureModule = (0, testing_utils_1.getFileContent)(tree, modulePath);
|
287
287
|
// console.log(modulePath + ':');
|
288
288
|
// console.log(featureModule);
|
289
289
|
expect(featureModule).toMatch(`import { NativeScriptRouterModule } from \'nativescript-angular/router\'`);
|
@@ -292,7 +292,7 @@ xdescribe('feature schematic', () => {
|
|
292
292
|
expect(featureModule).toMatch(`NativeScriptRouterModule.forChild`);
|
293
293
|
modulePath =
|
294
294
|
'/apps/web-viewer/src/app/features/foo-with-dash/foo-with-dash.module.ts';
|
295
|
-
featureModule = testing_utils_1.getFileContent(tree, modulePath);
|
295
|
+
featureModule = (0, testing_utils_1.getFileContent)(tree, modulePath);
|
296
296
|
// console.log(modulePath + ':');
|
297
297
|
// console.log(featureModule);
|
298
298
|
expect(featureModule).toMatch(`import { RouterModule, Routes } from \'@angular/router\'`);
|
@@ -301,14 +301,14 @@ xdescribe('feature schematic', () => {
|
|
301
301
|
expect(featureModule).toMatch(`RouterModule.forChild`);
|
302
302
|
// check if there was a root app.routing.ts module modified
|
303
303
|
modulePath = '/apps/web-viewer/src/app/app.routing.ts';
|
304
|
-
featureModule = testing_utils_1.getFileContent(tree, modulePath);
|
304
|
+
featureModule = (0, testing_utils_1.getFileContent)(tree, modulePath);
|
305
305
|
// console.log(modulePath + ':');
|
306
306
|
// console.log(featureModule);
|
307
307
|
expect(featureModule).toMatch(`import { RouterModule, Routes } from \'@angular/router\'`);
|
308
308
|
expect(featureModule).toMatch(`loadChildren: () =>`);
|
309
309
|
expect(featureModule).toMatch(`'./features/foo-with-dash/foo-with-dash.module'`);
|
310
310
|
modulePath = '/apps/nativescript-viewer/src/app.routing.ts';
|
311
|
-
featureModule = testing_utils_1.getFileContent(tree, modulePath);
|
311
|
+
featureModule = (0, testing_utils_1.getFileContent)(tree, modulePath);
|
312
312
|
// console.log(modulePath + ':');
|
313
313
|
// console.log(featureModule);
|
314
314
|
expect(featureModule).toMatch(`loadChildren: () =>`);
|
@@ -316,7 +316,7 @@ xdescribe('feature schematic', () => {
|
|
316
316
|
// check that name with dash was handled right
|
317
317
|
modulePath =
|
318
318
|
'/apps/web-viewer/src/app/features/foo-with-dash/components/index.ts';
|
319
|
-
featureModule = testing_utils_1.getFileContent(tree, modulePath);
|
319
|
+
featureModule = (0, testing_utils_1.getFileContent)(tree, modulePath);
|
320
320
|
// console.log(modulePath + ':');
|
321
321
|
// console.log(featureModule);
|
322
322
|
expect(featureModule).toMatch(`export const FOOWITHDASH_COMPONENTS`);
|
@@ -324,16 +324,16 @@ xdescribe('feature schematic', () => {
|
|
324
324
|
it('should create feature module for specified project WITH Routing and adjustSandbox', () => __awaiter(void 0, void 0, void 0, function* () {
|
325
325
|
const options = Object.assign(Object.assign({}, defaultOptions), { projects: 'nativescript-viewer' });
|
326
326
|
appTree = schematics_1.Tree.empty();
|
327
|
-
appTree = testing_utils_1.createXplatWithNativeScriptWeb(appTree, true);
|
327
|
+
appTree = (0, testing_utils_1.createXplatWithNativeScriptWeb)(appTree, true);
|
328
328
|
// manually update home.component to prep for sandobx
|
329
329
|
const homeCmpPath = `/apps/nativescript-viewer/src/features/home/components/home.component.html`;
|
330
|
-
workspace_1.createOrUpdate(appTree, homeCmpPath, sandboxHomeSetup());
|
330
|
+
(0, workspace_1.createOrUpdate)(appTree, homeCmpPath, sandboxHomeSetup());
|
331
331
|
// console.log('homecmp:', getFileContent(tree, homeCmpPath));
|
332
332
|
options.onlyProject = true;
|
333
333
|
options.adjustSandbox = true;
|
334
334
|
options.routing = true;
|
335
335
|
options.name = 'foo-with-dash';
|
336
|
-
let tree = yield testing_1.runSchematic('feature', options, appTree);
|
336
|
+
let tree = yield (0, testing_1.runSchematic)('feature', options, appTree);
|
337
337
|
// console.log('---------')
|
338
338
|
// console.log('homecmp:', getFileContent(tree, homeCmpPath));
|
339
339
|
}));
|
@@ -9,9 +9,9 @@ const platformToPackage = {
|
|
9
9
|
};
|
10
10
|
function default_1(options) {
|
11
11
|
if (!options.name) {
|
12
|
-
throw new schematics_1.SchematicsException(xplat_1.missingArgument('name', `Provide a comma delimited list of helpers to generate like this for 'applitools'.`, 'nx g @nstudio/xplat:helpers applitools --target=web-myapp'));
|
12
|
+
throw new schematics_1.SchematicsException((0, xplat_1.missingArgument)('name', `Provide a comma delimited list of helpers to generate like this for 'applitools'.`, 'nx g @nstudio/xplat:helpers applitools --target=web-myapp'));
|
13
13
|
}
|
14
|
-
const platforms = (xplat_utils_1.sanitizeCommaDelimitedArg(options.platforms));
|
14
|
+
const platforms = ((0, xplat_utils_1.sanitizeCommaDelimitedArg)(options.platforms));
|
15
15
|
const helperChains = [];
|
16
16
|
const processHelpers = (platform) => {
|
17
17
|
// get helper support config
|
@@ -30,9 +30,9 @@ function default_1(options) {
|
|
30
30
|
}
|
31
31
|
// if platform is still falsey, error out
|
32
32
|
if (!platform) {
|
33
|
-
throw new schematics_1.SchematicsException(xplat_1.helperMissingPlatforms());
|
33
|
+
throw new schematics_1.SchematicsException((0, xplat_1.helperMissingPlatforms)());
|
34
34
|
}
|
35
|
-
helperChains.push(schematics_1.externalSchematic(platformToPackage[platform], 'helpers', {
|
35
|
+
helperChains.push((0, schematics_1.externalSchematic)(platformToPackage[platform], 'helpers', {
|
36
36
|
name: options.name,
|
37
37
|
target: options.target,
|
38
38
|
}));
|
@@ -43,15 +43,15 @@ function default_1(options) {
|
|
43
43
|
processHelpers(platform);
|
44
44
|
}
|
45
45
|
else {
|
46
|
-
throw new schematics_1.SchematicsException(xplat_1.unsupportedPlatformError(platform));
|
46
|
+
throw new schematics_1.SchematicsException((0, xplat_1.unsupportedPlatformError)(platform));
|
47
47
|
}
|
48
48
|
}
|
49
49
|
}
|
50
50
|
else {
|
51
51
|
processHelpers();
|
52
52
|
}
|
53
|
-
return schematics_1.chain([
|
54
|
-
xplat_utils_1.prerun(),
|
53
|
+
return (0, schematics_1.chain)([
|
54
|
+
(0, xplat_utils_1.prerun)(),
|
55
55
|
// add helper chains
|
56
56
|
...helperChains,
|
57
57
|
]);
|
@@ -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
|
describe('xplat-helper schematic', () => {
|
18
18
|
let appTree;
|
19
19
|
beforeEach(() => {
|
20
20
|
appTree = schematics_1.Tree.empty();
|
21
|
-
appTree = testing_1.createEmptyWorkspace(appTree);
|
21
|
+
appTree = (0, testing_1.createEmptyWorkspace)(appTree);
|
22
22
|
});
|
23
23
|
it('generating helper for a platform where the helper is not supported should not do anything', () => __awaiter(void 0, void 0, void 0, function* () {
|
24
24
|
const optionsXplat = {
|
@@ -26,13 +26,13 @@ describe('xplat-helper schematic', () => {
|
|
26
26
|
prefix: 'tt',
|
27
27
|
platforms: 'web,nativescript',
|
28
28
|
};
|
29
|
-
appTree = yield testing_2.runSchematic('init', optionsXplat, appTree);
|
29
|
+
appTree = yield (0, testing_2.runSchematic)('init', optionsXplat, appTree);
|
30
30
|
const options = {
|
31
31
|
name: 'imports',
|
32
32
|
platforms: 'web',
|
33
33
|
};
|
34
34
|
// console.log('appTree:', appTree);
|
35
|
-
const tree = yield testing_2.runSchematic('helpers', options, appTree);
|
35
|
+
const tree = yield (0, testing_2.runSchematic)('helpers', options, appTree);
|
36
36
|
const files = tree.files;
|
37
37
|
// console.log(files);
|
38
38
|
// xplat helpers
|
@@ -37,7 +37,7 @@ function default_1(options) {
|
|
37
37
|
}
|
38
38
|
}
|
39
39
|
else {
|
40
|
-
throw new schematics_1.SchematicsException(utils_1.unsupportedFrameworkError(framework));
|
40
|
+
throw new schematics_1.SchematicsException((0, utils_1.unsupportedFrameworkError)(framework));
|
41
41
|
}
|
42
42
|
}
|
43
43
|
}
|
@@ -50,7 +50,7 @@ function default_1(options) {
|
|
50
50
|
}
|
51
51
|
}
|
52
52
|
else {
|
53
|
-
const platforms = xplat_utils_1.sanitizeCommaDelimitedArg(platformArg);
|
53
|
+
const platforms = (0, xplat_utils_1.sanitizeCommaDelimitedArg)(platformArg);
|
54
54
|
if (frameworks.length) {
|
55
55
|
for (const framework of frameworks) {
|
56
56
|
if (xplat_utils_1.supportedFrameworks.includes(framework)) {
|
@@ -61,15 +61,16 @@ function default_1(options) {
|
|
61
61
|
// when framework initiates xplat, ensure any platform packages are installed
|
62
62
|
for (const platform of platforms) {
|
63
63
|
if (xplat_utils_1.supportedPlatforms.includes(platform)) {
|
64
|
-
devDependencies[`@nstudio/${platform}-${framework}`] =
|
64
|
+
devDependencies[`@nstudio/${platform}-${framework}`] =
|
65
|
+
versions_1.xplatVersion;
|
65
66
|
}
|
66
67
|
else if (xplat_utils_1.supportedPlatformsWithNx.includes(platform)) {
|
67
|
-
throw new schematics_1.SchematicsException(utils_1.unsupportedPlatformErrorWithNxNote(platform, 'xplat'));
|
68
|
+
throw new schematics_1.SchematicsException((0, utils_1.unsupportedPlatformErrorWithNxNote)(platform, 'xplat'));
|
68
69
|
}
|
69
70
|
}
|
70
71
|
}
|
71
72
|
else {
|
72
|
-
throw new schematics_1.SchematicsException(utils_1.unsupportedFrameworkError(framework));
|
73
|
+
throw new schematics_1.SchematicsException((0, utils_1.unsupportedFrameworkError)(framework));
|
73
74
|
}
|
74
75
|
}
|
75
76
|
}
|
@@ -81,10 +82,10 @@ function default_1(options) {
|
|
81
82
|
packagesToRunXplat.push(packageName);
|
82
83
|
}
|
83
84
|
else if (xplat_utils_1.supportedPlatformsWithNx.includes(platform)) {
|
84
|
-
throw new schematics_1.SchematicsException(utils_1.unsupportedPlatformErrorWithNxNote(platform, 'xplat'));
|
85
|
+
throw new schematics_1.SchematicsException((0, utils_1.unsupportedPlatformErrorWithNxNote)(platform, 'xplat'));
|
85
86
|
}
|
86
87
|
else {
|
87
|
-
throw new schematics_1.SchematicsException(xplat_1.unsupportedPlatformError(platform));
|
88
|
+
throw new schematics_1.SchematicsException((0, xplat_1.unsupportedPlatformError)(platform));
|
88
89
|
}
|
89
90
|
}
|
90
91
|
}
|
@@ -92,7 +93,7 @@ function default_1(options) {
|
|
92
93
|
externalChains.push((tree, context) => {
|
93
94
|
// check if other nstudio or nrwl dependencies are needed
|
94
95
|
// check user's package for current version
|
95
|
-
const packageJson = xplat_utils_1.getJsonFromFile(tree, 'package.json');
|
96
|
+
const packageJson = (0, xplat_utils_1.getJsonFromFile)(tree, 'package.json');
|
96
97
|
if (packageJson) {
|
97
98
|
for (const packageName in devDependencies) {
|
98
99
|
if (utils_1.packageInnerDependencies[packageName]) {
|
@@ -127,7 +128,7 @@ function default_1(options) {
|
|
127
128
|
// necessary to unit test the appropriately
|
128
129
|
if (packagesToRunXplat.length) {
|
129
130
|
for (const packageName of packagesToRunXplat) {
|
130
|
-
externalChains.push(schematics_1.externalSchematic(packageName, 'xplat', options, {
|
131
|
+
externalChains.push((0, schematics_1.externalSchematic)(packageName, 'xplat', options, {
|
131
132
|
interactive: false,
|
132
133
|
}));
|
133
134
|
}
|
@@ -149,17 +150,17 @@ function default_1(options) {
|
|
149
150
|
}
|
150
151
|
}
|
151
152
|
else {
|
152
|
-
return schematics_1.noop()(tree, context);
|
153
|
+
return (0, schematics_1.noop)()(tree, context);
|
153
154
|
}
|
154
155
|
});
|
155
156
|
}
|
156
|
-
return schematics_1.chain([
|
157
|
-
xplat_utils_1.prerun(options, true),
|
158
|
-
(tree) => schematics_1.chain(externalChains),
|
157
|
+
return (0, schematics_1.chain)([
|
158
|
+
(0, xplat_utils_1.prerun)(options, true),
|
159
|
+
(tree) => (0, schematics_1.chain)(externalChains),
|
159
160
|
// addInstallTask(),
|
160
161
|
focus_1.FocusHelpers.updateIDESettings(options),
|
161
162
|
// after initializing new platforms always reset dev mode to fullstack to ensure user sees it
|
162
|
-
schematics_1.externalSchematic('@nstudio/xplat', 'mode', {
|
163
|
+
(0, schematics_1.externalSchematic)('@nstudio/xplat', 'mode', {
|
163
164
|
name: 'fullstack',
|
164
165
|
}),
|
165
166
|
]);
|