@nstudio/xplat 13.0.1 → 13.4.2-rc.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 +2 -2
- 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 +45 -45
- package/migrations/update-11-0-0/update-to-11-env-base.js +22 -22
- 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.js +18 -18
- package/package.json +3 -3
- 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 +13 -13
- package/src/schematics/init/index.spec.js +8 -8
- 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.js +10 -10
- package/src/utils/helpers.js +1 -1
- package/src/utils/postinstall.js +3 -3
- package/src/utils/testing-utils.js +2 -2
- package/src/utils/testing.js +2 -2
- package/src/utils/versions.js +1 -1
- package/src/utils/xplat.js +65 -65
@@ -29,8 +29,8 @@ function updateNativeScriptApps(tree, context) {
|
|
29
29
|
const appsDir = tree.getDir('apps');
|
30
30
|
const appFolders = appsDir.subdirs;
|
31
31
|
const cwd = process.cwd();
|
32
|
-
const nativeScriptAppsPaths = xplat_utils_1.getAppPaths(tree, 'nativescript');
|
33
|
-
const npmScope = xplat_utils_1.getNpmScope();
|
32
|
+
const nativeScriptAppsPaths = (0, xplat_utils_1.getAppPaths)(tree, 'nativescript');
|
33
|
+
const npmScope = (0, xplat_utils_1.getNpmScope)();
|
34
34
|
const appsNames = [];
|
35
35
|
// update {N} apps and configs
|
36
36
|
for (const dirPath of nativeScriptAppsPaths) {
|
@@ -49,17 +49,17 @@ function updateNativeScriptApps(tree, context) {
|
|
49
49
|
.map((p) => '..')
|
50
50
|
.join('\\');
|
51
51
|
const cwd = process.cwd();
|
52
|
-
const webpackConfigPath = path_1.join(cwd, 'node_modules/@nstudio/nativescript-angular/src/schematics/application/_files/webpack.config.js');
|
52
|
+
const webpackConfigPath = (0, path_1.join)(cwd, 'node_modules/@nstudio/nativescript-angular/src/schematics/application/_files/webpack.config.js');
|
53
53
|
// console.log('webpackConfigPath:', webpackConfigPath);
|
54
54
|
const webpackConfig = fs.readFileSync(webpackConfigPath, {
|
55
55
|
encoding: 'utf-8',
|
56
56
|
});
|
57
|
-
workspace_1.createOrUpdate(tree, `${dirPath}/webpack.config.js`, webpackConfig
|
57
|
+
(0, workspace_1.createOrUpdate)(tree, `${dirPath}/webpack.config.js`, webpackConfig
|
58
58
|
.replace(/<%= pathOffset %>/gi, relativePath + '/')
|
59
59
|
.replace(/<%= npmScope %>/gi, npmScope));
|
60
60
|
// update {N} app deps
|
61
61
|
const packagePath = `${dirPath}/package.json`;
|
62
|
-
const packageJson = xplat_utils_1.getJsonFromFile(tree, packagePath);
|
62
|
+
const packageJson = (0, xplat_utils_1.getJsonFromFile)(tree, packagePath);
|
63
63
|
if (packageJson) {
|
64
64
|
packageJson.main = './src/main.ts';
|
65
65
|
packageJson.scripts = packageJson.scripts || {};
|
@@ -93,7 +93,7 @@ function updateNativeScriptApps(tree, context) {
|
|
93
93
|
};
|
94
94
|
// console.log('path:',path);
|
95
95
|
// console.log('packageJson overwrite:', JSON.stringify(packageJson));
|
96
|
-
tree = xplat_utils_1.updateJsonFile(tree, packagePath, packageJson);
|
96
|
+
tree = (0, xplat_utils_1.updateJsonFile)(tree, packagePath, packageJson);
|
97
97
|
}
|
98
98
|
if (tree.exists(`${dirPath}/tsconfig.env.json`)) {
|
99
99
|
tree.delete(`${dirPath}/tsconfig.env.json`);
|
@@ -101,7 +101,7 @@ function updateNativeScriptApps(tree, context) {
|
|
101
101
|
if (tree.exists(`${dirPath}/tsconfig.tns.json`)) {
|
102
102
|
tree.delete(`${dirPath}/tsconfig.tns.json`);
|
103
103
|
}
|
104
|
-
workspace_1.createOrUpdate(tree, `${dirPath}/tools/xplat-postinstall.js`, `//#!/usr/bin/env node
|
104
|
+
(0, workspace_1.createOrUpdate)(tree, `${dirPath}/tools/xplat-postinstall.js`, `//#!/usr/bin/env node
|
105
105
|
|
106
106
|
const fs = require('fs-extra');
|
107
107
|
const path = require('path');
|
@@ -125,7 +125,7 @@ child.on('close', (code) => {
|
|
125
125
|
|
126
126
|
});
|
127
127
|
`);
|
128
|
-
workspace_1.createOrUpdate(tree, `${dirPath}/tsconfig.app.json`, `{
|
128
|
+
(0, workspace_1.createOrUpdate)(tree, `${dirPath}/tsconfig.app.json`, `{
|
129
129
|
"extends": "./tsconfig.json",
|
130
130
|
"compilerOptions": {
|
131
131
|
"outDir": "${relativePath}/dist/out-tsc",
|
@@ -141,7 +141,7 @@ child.on('close', (code) => {
|
|
141
141
|
"./src/polyfills.ts"
|
142
142
|
]
|
143
143
|
}`);
|
144
|
-
workspace_1.createOrUpdate(tree, `${dirPath}/tsconfig.editor.json`, `{
|
144
|
+
(0, workspace_1.createOrUpdate)(tree, `${dirPath}/tsconfig.editor.json`, `{
|
145
145
|
"extends": "./tsconfig.json",
|
146
146
|
"include": ["**/*.ts"],
|
147
147
|
"compilerOptions": {
|
@@ -149,7 +149,7 @@ child.on('close', (code) => {
|
|
149
149
|
}
|
150
150
|
}
|
151
151
|
`);
|
152
|
-
workspace_1.createOrUpdate(tree, `${dirPath}/tsconfig.json`, `{
|
152
|
+
(0, workspace_1.createOrUpdate)(tree, `${dirPath}/tsconfig.json`, `{
|
153
153
|
"extends": "${relativePath}/tsconfig.base.json",
|
154
154
|
"files": [],
|
155
155
|
"include": [],
|
@@ -166,7 +166,7 @@ child.on('close', (code) => {
|
|
166
166
|
]
|
167
167
|
}
|
168
168
|
`);
|
169
|
-
workspace_1.createOrUpdate(tree, `${dirPath}/tsconfig.spec.json`, `{
|
169
|
+
(0, workspace_1.createOrUpdate)(tree, `${dirPath}/tsconfig.spec.json`, `{
|
170
170
|
"extends": "./tsconfig.json",
|
171
171
|
"compilerOptions": {
|
172
172
|
"outDir": "${relativePath}/dist/out-tsc",
|
@@ -177,8 +177,8 @@ child.on('close', (code) => {
|
|
177
177
|
"include": ["**/*.spec.ts", "**/*.d.ts"]
|
178
178
|
}
|
179
179
|
`);
|
180
|
-
workspace_1.createOrUpdate(tree, `${dirPath}/src/test-setup.ts`, `import 'jest-preset-angular';`);
|
181
|
-
workspace_1.createOrUpdate(tree, `${dirPath}/src/polyfills.ts`, `/**
|
180
|
+
(0, workspace_1.createOrUpdate)(tree, `${dirPath}/src/test-setup.ts`, `import 'jest-preset-angular';`);
|
181
|
+
(0, workspace_1.createOrUpdate)(tree, `${dirPath}/src/polyfills.ts`, `/**
|
182
182
|
* NativeScript Polyfills
|
183
183
|
*/
|
184
184
|
|
@@ -199,7 +199,7 @@ import 'zone.js';
|
|
199
199
|
// Add NativeScript specific Zone JS patches
|
200
200
|
import '@nativescript/zone-js';
|
201
201
|
`);
|
202
|
-
workspace_1.createOrUpdate(tree, `${dirPath}/.eslintrc.json`, `{
|
202
|
+
(0, workspace_1.createOrUpdate)(tree, `${dirPath}/.eslintrc.json`, `{
|
203
203
|
"extends": "${relativePath}/.eslintrc.json",
|
204
204
|
"ignorePatterns": [
|
205
205
|
"!**/*"
|
@@ -223,7 +223,7 @@ import '@nativescript/zone-js';
|
|
223
223
|
"error",
|
224
224
|
{
|
225
225
|
"type": "attribute",
|
226
|
-
"prefix": "${xplat_utils_1.getPrefix()}",
|
226
|
+
"prefix": "${(0, xplat_utils_1.getPrefix)()}",
|
227
227
|
"style": "camelCase"
|
228
228
|
}
|
229
229
|
],
|
@@ -231,7 +231,7 @@ import '@nativescript/zone-js';
|
|
231
231
|
"error",
|
232
232
|
{
|
233
233
|
"type": "element",
|
234
|
-
"prefix": "${xplat_utils_1.getPrefix()}",
|
234
|
+
"prefix": "${(0, xplat_utils_1.getPrefix)()}",
|
235
235
|
"style": "kebab-case"
|
236
236
|
}
|
237
237
|
]
|
@@ -264,7 +264,7 @@ import '@nativescript/zone-js';
|
|
264
264
|
return tree;
|
265
265
|
}
|
266
266
|
function updateRootPackage(tree, context) {
|
267
|
-
return workspace_1.updateJsonInTree('package.json', (json) => {
|
267
|
+
return (0, workspace_1.updateJsonInTree)('package.json', (json) => {
|
268
268
|
json.scripts = json.scripts || {};
|
269
269
|
const nativeScriptDeps = {
|
270
270
|
'@nativescript/angular': nsNgScopedVersion,
|
@@ -289,8 +289,8 @@ function updateRootPackage(tree, context) {
|
|
289
289
|
})(tree, context);
|
290
290
|
}
|
291
291
|
function default_1() {
|
292
|
-
return schematics_1.chain([
|
293
|
-
xplat_utils_1.prerun({
|
292
|
+
return (0, schematics_1.chain)([
|
293
|
+
(0, xplat_utils_1.prerun)({
|
294
294
|
framework: 'angular',
|
295
295
|
}, true),
|
296
296
|
updateNativeScriptApps,
|
@@ -11,8 +11,8 @@ const nsNgScopedVersion = '^12.2.0';
|
|
11
11
|
const nsCoreVersion = '~8.1.0';
|
12
12
|
let hasNativeScriptApps = false;
|
13
13
|
function updateNativeScriptApps(tree, context) {
|
14
|
-
const nativeScriptAppsPaths = xplat_utils_1.getAppPaths(tree, 'nativescript');
|
15
|
-
const npmScope = xplat_utils_1.getNpmScope();
|
14
|
+
const nativeScriptAppsPaths = (0, xplat_utils_1.getAppPaths)(tree, 'nativescript');
|
15
|
+
const npmScope = (0, xplat_utils_1.getNpmScope)();
|
16
16
|
const appsNames = [];
|
17
17
|
// update {N} apps and configs
|
18
18
|
for (const dirPath of nativeScriptAppsPaths) {
|
@@ -27,7 +27,7 @@ function updateNativeScriptApps(tree, context) {
|
|
27
27
|
.join('/');
|
28
28
|
// update {N} app deps
|
29
29
|
const packagePath = `${dirPath}/package.json`;
|
30
|
-
const packageJson = xplat_utils_1.getJsonFromFile(tree, packagePath);
|
30
|
+
const packageJson = (0, xplat_utils_1.getJsonFromFile)(tree, packagePath);
|
31
31
|
if (packageJson) {
|
32
32
|
packageJson.main = './src/main.ts';
|
33
33
|
packageJson.scripts = packageJson.scripts || {};
|
@@ -63,7 +63,7 @@ function updateNativeScriptApps(tree, context) {
|
|
63
63
|
};
|
64
64
|
// console.log('path:',path);
|
65
65
|
// console.log('packageJson overwrite:', JSON.stringify(packageJson));
|
66
|
-
tree = xplat_utils_1.updateJsonFile(tree, packagePath, packageJson);
|
66
|
+
tree = (0, xplat_utils_1.updateJsonFile)(tree, packagePath, packageJson);
|
67
67
|
}
|
68
68
|
if (tree.exists(`${dirPath}/tsconfig.env.json`)) {
|
69
69
|
tree.delete(`${dirPath}/tsconfig.env.json`);
|
@@ -71,7 +71,7 @@ function updateNativeScriptApps(tree, context) {
|
|
71
71
|
if (tree.exists(`${dirPath}/tsconfig.tns.json`)) {
|
72
72
|
tree.delete(`${dirPath}/tsconfig.tns.json`);
|
73
73
|
}
|
74
|
-
workspace_1.createOrUpdate(tree, `${dirPath}/tools/xplat-postinstall.js`, `//#!/usr/bin/env node
|
74
|
+
(0, workspace_1.createOrUpdate)(tree, `${dirPath}/tools/xplat-postinstall.js`, `//#!/usr/bin/env node
|
75
75
|
|
76
76
|
const fs = require('fs-extra');
|
77
77
|
const path = require('path');
|
@@ -111,7 +111,7 @@ child.stdout.on('data', function (data) {
|
|
111
111
|
});
|
112
112
|
|
113
113
|
`);
|
114
|
-
workspace_1.createOrUpdate(tree, `${dirPath}/tsconfig.app.json`, `{
|
114
|
+
(0, workspace_1.createOrUpdate)(tree, `${dirPath}/tsconfig.app.json`, `{
|
115
115
|
"extends": "./tsconfig.json",
|
116
116
|
"compilerOptions": {
|
117
117
|
"outDir": "${relativePath}/dist/out-tsc",
|
@@ -127,7 +127,7 @@ child.stdout.on('data', function (data) {
|
|
127
127
|
"./src/polyfills.ts"
|
128
128
|
]
|
129
129
|
}`);
|
130
|
-
workspace_1.createOrUpdate(tree, `${dirPath}/tsconfig.editor.json`, `{
|
130
|
+
(0, workspace_1.createOrUpdate)(tree, `${dirPath}/tsconfig.editor.json`, `{
|
131
131
|
"extends": "./tsconfig.json",
|
132
132
|
"include": ["**/*.ts"],
|
133
133
|
"compilerOptions": {
|
@@ -135,7 +135,7 @@ child.stdout.on('data', function (data) {
|
|
135
135
|
}
|
136
136
|
}
|
137
137
|
`);
|
138
|
-
workspace_1.createOrUpdate(tree, `${dirPath}/tsconfig.json`, `{
|
138
|
+
(0, workspace_1.createOrUpdate)(tree, `${dirPath}/tsconfig.json`, `{
|
139
139
|
"extends": "${relativePath}/tsconfig.base.json",
|
140
140
|
"files": [],
|
141
141
|
"include": [],
|
@@ -152,7 +152,7 @@ child.stdout.on('data', function (data) {
|
|
152
152
|
]
|
153
153
|
}
|
154
154
|
`);
|
155
|
-
workspace_1.createOrUpdate(tree, `${dirPath}/tsconfig.spec.json`, `{
|
155
|
+
(0, workspace_1.createOrUpdate)(tree, `${dirPath}/tsconfig.spec.json`, `{
|
156
156
|
"extends": "./tsconfig.json",
|
157
157
|
"compilerOptions": {
|
158
158
|
"outDir": "${relativePath}/dist/out-tsc",
|
@@ -163,8 +163,8 @@ child.stdout.on('data', function (data) {
|
|
163
163
|
"include": ["**/*.spec.ts", "**/*.d.ts"]
|
164
164
|
}
|
165
165
|
`);
|
166
|
-
workspace_1.createOrUpdate(tree, `${dirPath}/src/test-setup.ts`, `import 'jest-preset-angular/setup-jest';`);
|
167
|
-
workspace_1.createOrUpdate(tree, `${dirPath}/src/polyfills.ts`, `/**
|
166
|
+
(0, workspace_1.createOrUpdate)(tree, `${dirPath}/src/test-setup.ts`, `import 'jest-preset-angular/setup-jest';`);
|
167
|
+
(0, workspace_1.createOrUpdate)(tree, `${dirPath}/src/polyfills.ts`, `/**
|
168
168
|
* NativeScript Polyfills
|
169
169
|
*/
|
170
170
|
|
@@ -185,7 +185,7 @@ import 'zone.js';
|
|
185
185
|
// Add NativeScript specific Zone JS patches
|
186
186
|
import '@nativescript/zone-js';
|
187
187
|
`);
|
188
|
-
workspace_1.createOrUpdate(tree, `${dirPath}/.eslintrc.json`, `{
|
188
|
+
(0, workspace_1.createOrUpdate)(tree, `${dirPath}/.eslintrc.json`, `{
|
189
189
|
"extends": "${relativePath}/.eslintrc.json",
|
190
190
|
"ignorePatterns": [
|
191
191
|
"!**/*"
|
@@ -209,7 +209,7 @@ import '@nativescript/zone-js';
|
|
209
209
|
"error",
|
210
210
|
{
|
211
211
|
"type": "attribute",
|
212
|
-
"prefix": "${xplat_utils_1.getPrefix()}",
|
212
|
+
"prefix": "${(0, xplat_utils_1.getPrefix)()}",
|
213
213
|
"style": "camelCase"
|
214
214
|
}
|
215
215
|
],
|
@@ -217,7 +217,7 @@ import '@nativescript/zone-js';
|
|
217
217
|
"error",
|
218
218
|
{
|
219
219
|
"type": "element",
|
220
|
-
"prefix": "${xplat_utils_1.getPrefix()}",
|
220
|
+
"prefix": "${(0, xplat_utils_1.getPrefix)()}",
|
221
221
|
"style": "kebab-case"
|
222
222
|
}
|
223
223
|
]
|
@@ -250,7 +250,7 @@ import '@nativescript/zone-js';
|
|
250
250
|
return tree;
|
251
251
|
}
|
252
252
|
function updateRootPackage(tree, context) {
|
253
|
-
return workspace_1.updateJsonInTree('package.json', (json) => {
|
253
|
+
return (0, workspace_1.updateJsonInTree)('package.json', (json) => {
|
254
254
|
json.scripts = json.scripts || {};
|
255
255
|
const nativeScriptDeps = {
|
256
256
|
'@nativescript/angular': nsNgScopedVersion,
|
@@ -283,14 +283,14 @@ function updateRootPackage(tree, context) {
|
|
283
283
|
})(tree, context);
|
284
284
|
}
|
285
285
|
function default_1() {
|
286
|
-
return schematics_1.chain([
|
287
|
-
xplat_utils_1.prerun({
|
286
|
+
return (0, schematics_1.chain)([
|
287
|
+
(0, xplat_utils_1.prerun)({
|
288
288
|
framework: 'angular',
|
289
289
|
}, true),
|
290
290
|
updateNativeScriptApps,
|
291
291
|
updateRootPackage,
|
292
292
|
(tree) => {
|
293
|
-
return schematics_1.externalSchematic('@nrwl/workspace', 'convert-to-nx-project', {
|
293
|
+
return (0, schematics_1.externalSchematic)('@nrwl/workspace', 'convert-to-nx-project', {
|
294
294
|
all: true
|
295
295
|
});
|
296
296
|
},
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@nstudio/xplat",
|
3
|
-
"version": "13.
|
3
|
+
"version": "13.4.2-rc.1",
|
4
4
|
"description": "Cross-platform (xplat) tools for Nx workspaces.",
|
5
5
|
"homepage": "https://nstudio.io/xplat",
|
6
6
|
"repository": {
|
@@ -41,8 +41,8 @@
|
|
41
41
|
"postinstall": "node src/utils/postinstall.js"
|
42
42
|
},
|
43
43
|
"dependencies": {
|
44
|
-
"@nstudio/focus": "13.
|
45
|
-
"@nstudio/xplat-utils": "13.
|
44
|
+
"@nstudio/focus": "13.4.2-rc.1",
|
45
|
+
"@nstudio/xplat-utils": "13.4.2-rc.1"
|
46
46
|
},
|
47
47
|
"author": "Nathan Walker",
|
48
48
|
"license": "MIT",
|
@@ -6,9 +6,9 @@ const xplat_utils_1 = require("@nstudio/xplat-utils");
|
|
6
6
|
let packagesToRunXplat = [];
|
7
7
|
function default_1(options) {
|
8
8
|
const externalChains = utils_1.XplatHelpers.getExternalChainsForGenerator(options, 'app', 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;
|
@@ -6,6 +6,6 @@ const utils_1 = require("../../utils");
|
|
6
6
|
let packagesToRun = [];
|
7
7
|
function default_1(options) {
|
8
8
|
const externalChains = utils_1.XplatHelpers.getExternalChainsForApplication(options, 'app', packagesToRun);
|
9
|
-
return schematics_1.chain([xplat_utils_1.prerun(options, true), (tree) => schematics_1.chain(externalChains)]);
|
9
|
+
return (0, schematics_1.chain)([(0, xplat_utils_1.prerun)(options, true), (tree) => (0, schematics_1.chain)(externalChains)]);
|
10
10
|
}
|
11
11
|
exports.default = default_1;
|
@@ -14,7 +14,7 @@ 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
16
|
const testing_3 = require("@nrwl/workspace/testing");
|
17
|
-
xplat_utils_1.setTest();
|
17
|
+
(0, xplat_utils_1.setTest)();
|
18
18
|
describe('xplat schematic', () => {
|
19
19
|
let appTree;
|
20
20
|
const defaultOptions = {
|
@@ -24,13 +24,13 @@ describe('xplat schematic', () => {
|
|
24
24
|
};
|
25
25
|
beforeEach(() => {
|
26
26
|
appTree = schematics_1.Tree.empty();
|
27
|
-
appTree = testing_1.createEmptyWorkspace(appTree);
|
27
|
+
appTree = (0, testing_1.createEmptyWorkspace)(appTree);
|
28
28
|
});
|
29
29
|
it('should create web angular app', () => __awaiter(void 0, void 0, void 0, function* () {
|
30
30
|
const options = Object.assign({}, defaultOptions);
|
31
31
|
options.platforms = 'web';
|
32
32
|
options.framework = 'angular';
|
33
|
-
const tree = yield testing_2.runSchematic('app', options, appTree);
|
33
|
+
const tree = yield (0, testing_2.runSchematic)('app', options, appTree);
|
34
34
|
const files = tree.files;
|
35
35
|
// console.log('files:', files);
|
36
36
|
expect(tree.exists('/apps/web-sample/tsconfig.json')).toBeTruthy();
|
@@ -43,7 +43,7 @@ describe('xplat schematic', () => {
|
|
43
43
|
const options = Object.assign({}, defaultOptions);
|
44
44
|
options.platforms = 'nativescript';
|
45
45
|
options.framework = 'angular';
|
46
|
-
const tree = yield testing_2.runSchematic('app', options, appTree);
|
46
|
+
const tree = yield (0, testing_2.runSchematic)('app', options, appTree);
|
47
47
|
const files = tree.files;
|
48
48
|
// console.log('files:', files);
|
49
49
|
expect(tree.exists('/apps/nativescript-sample/nativescript.config.ts')).toBeTruthy();
|
@@ -54,44 +54,44 @@ describe('xplat schematic', () => {
|
|
54
54
|
describe('Nx app generators supporte via proxy xplat app generator', () => {
|
55
55
|
it('should create Nx express', () => __awaiter(void 0, void 0, void 0, function* () {
|
56
56
|
appTree = schematics_1.Tree.empty();
|
57
|
-
appTree = testing_1.createEmptyWorkspace(appTree);
|
57
|
+
appTree = (0, testing_1.createEmptyWorkspace)(appTree);
|
58
58
|
const options = Object.assign({}, defaultOptions);
|
59
59
|
options.platforms = 'express';
|
60
|
-
const tree = yield testing_2.runSchematic('app', options, appTree);
|
60
|
+
const tree = yield (0, testing_2.runSchematic)('app', options, appTree);
|
61
61
|
const files = tree.files;
|
62
62
|
// console.log('files:', files);
|
63
63
|
expect(tree.exists('/apps/express-sample/src/main.ts')).toBeTruthy();
|
64
|
-
let fileContent = testing_3.getFileContent(tree, '/apps/express-sample/src/main.ts');
|
64
|
+
let fileContent = (0, testing_3.getFileContent)(tree, '/apps/express-sample/src/main.ts');
|
65
65
|
// console.log(fileContent);
|
66
66
|
expect(fileContent.indexOf(`from 'express'`)).toBeGreaterThan(0);
|
67
67
|
}));
|
68
68
|
xit('should create Nx nest', () => __awaiter(void 0, void 0, void 0, function* () {
|
69
69
|
appTree = schematics_1.Tree.empty();
|
70
|
-
appTree = testing_1.createEmptyWorkspace(appTree);
|
70
|
+
appTree = (0, testing_1.createEmptyWorkspace)(appTree);
|
71
71
|
const options = Object.assign({}, defaultOptions);
|
72
72
|
options.platforms = 'nest';
|
73
73
|
delete options.prefix;
|
74
74
|
delete options.isTesting;
|
75
|
-
const tree = yield testing_2.runSchematic('app', options, appTree);
|
75
|
+
const tree = yield (0, testing_2.runSchematic)('app', options, appTree);
|
76
76
|
const files = tree.files;
|
77
77
|
// console.log('files:', files);
|
78
78
|
expect(tree.exists('/apps/nest-sample/src/main.ts')).toBeTruthy();
|
79
|
-
let fileContent = testing_3.getFileContent(tree, '/apps/nest-sample/src/main.ts');
|
79
|
+
let fileContent = (0, testing_3.getFileContent)(tree, '/apps/nest-sample/src/main.ts');
|
80
80
|
// console.log(fileContent);
|
81
81
|
expect(fileContent.indexOf(`from '@nestjs/core'`)).toBeGreaterThan(0);
|
82
82
|
}));
|
83
83
|
xit('should create Nx node', () => __awaiter(void 0, void 0, void 0, function* () {
|
84
84
|
appTree = schematics_1.Tree.empty();
|
85
|
-
appTree = testing_1.createEmptyWorkspace(appTree);
|
85
|
+
appTree = (0, testing_1.createEmptyWorkspace)(appTree);
|
86
86
|
const options = Object.assign({}, defaultOptions);
|
87
87
|
options.platforms = 'node';
|
88
88
|
delete options.prefix;
|
89
89
|
delete options.isTesting;
|
90
|
-
const tree = yield testing_2.runSchematic('app', options, appTree);
|
90
|
+
const tree = yield (0, testing_2.runSchematic)('app', options, appTree);
|
91
91
|
const files = tree.files;
|
92
92
|
// console.log('files:', files);
|
93
93
|
expect(tree.exists('/apps/node-sample/src/main.ts')).toBeTruthy();
|
94
|
-
let fileContent = testing_3.getFileContent(tree, '/apps/node-sample/src/main.ts');
|
94
|
+
let fileContent = (0, testing_3.getFileContent)(tree, '/apps/node-sample/src/main.ts');
|
95
95
|
// console.log(fileContent);
|
96
96
|
expect(fileContent.indexOf(`console.log('Hello World!')`)).toBeGreaterThanOrEqual(0);
|
97
97
|
}));
|
@@ -6,6 +6,6 @@ const utils_1 = require("../../utils");
|
|
6
6
|
let packagesToRunXplat = [];
|
7
7
|
function default_1(options) {
|
8
8
|
const externalChains = utils_1.XplatHelpers.getExternalChainsForGenerator(options, 'component', packagesToRunXplat);
|
9
|
-
return schematics_1.chain([xplat_utils_1.prerun(options, true), (tree) => schematics_1.chain(externalChains)]);
|
9
|
+
return (0, schematics_1.chain)([(0, xplat_utils_1.prerun)(options, true), (tree) => (0, schematics_1.chain)(externalChains)]);
|
10
10
|
}
|
11
11
|
exports.default = default_1;
|
@@ -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;
|