@nstudio/xplat 12.6.0-rc.0 → 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 +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 +20 -20
- 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 +15 -15
- 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.d.ts +6 -0
- package/src/utils/xplat.js +90 -70
@@ -7,7 +7,7 @@ const workspace_1 = require("@nrwl/workspace");
|
|
7
7
|
const xplat_1 = require("@nstudio/xplat");
|
8
8
|
const xplat_utils_1 = require("@nstudio/xplat-utils");
|
9
9
|
const angularVersion = '^12.0.0';
|
10
|
-
const typescriptVersion = '~4.
|
10
|
+
const typescriptVersion = '~4.3.5';
|
11
11
|
const nsWebpackVersion = 'beta';
|
12
12
|
const ngxTranslateVersion = '~13.0.0';
|
13
13
|
const nsNgScopedVersion = '^12.0.0';
|
@@ -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,
|
@@ -0,0 +1,299 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
const schematics_1 = require("@angular-devkit/schematics");
|
4
|
+
const workspace_1 = require("@nrwl/workspace");
|
5
|
+
const xplat_1 = require("@nstudio/xplat");
|
6
|
+
const xplat_utils_1 = require("@nstudio/xplat-utils");
|
7
|
+
const angularVersion = '^12.2.0';
|
8
|
+
const nsWebpackVersion = '~5.0.0';
|
9
|
+
const ngxTranslateVersion = '~13.0.0';
|
10
|
+
const nsNgScopedVersion = '^12.2.0';
|
11
|
+
const nsCoreVersion = '~8.1.0';
|
12
|
+
let hasNativeScriptApps = false;
|
13
|
+
function updateNativeScriptApps(tree, context) {
|
14
|
+
const nativeScriptAppsPaths = (0, xplat_utils_1.getAppPaths)(tree, 'nativescript');
|
15
|
+
const npmScope = (0, xplat_utils_1.getNpmScope)();
|
16
|
+
const appsNames = [];
|
17
|
+
// update {N} apps and configs
|
18
|
+
for (const dirPath of nativeScriptAppsPaths) {
|
19
|
+
hasNativeScriptApps = true;
|
20
|
+
appsNames.push(dirPath);
|
21
|
+
// console.log(dir);
|
22
|
+
// console.log('{N} appDir:', dirPath);
|
23
|
+
const relativePath = dirPath
|
24
|
+
.split('/')
|
25
|
+
.filter((p) => !!p)
|
26
|
+
.map((p) => '..')
|
27
|
+
.join('/');
|
28
|
+
// update {N} app deps
|
29
|
+
const packagePath = `${dirPath}/package.json`;
|
30
|
+
const packageJson = (0, xplat_utils_1.getJsonFromFile)(tree, packagePath);
|
31
|
+
if (packageJson) {
|
32
|
+
packageJson.main = './src/main.ts';
|
33
|
+
packageJson.scripts = packageJson.scripts || {};
|
34
|
+
if (!packageJson.scripts.postinstall) {
|
35
|
+
packageJson.scripts = Object.assign(Object.assign({}, packageJson.scripts), { postinstall: 'node ./tools/xplat-postinstall.js' });
|
36
|
+
}
|
37
|
+
packageJson.dependencies = packageJson.dependencies || {};
|
38
|
+
packageJson.dependencies = Object.assign(Object.assign({}, packageJson.dependencies), { '@nativescript/core': '*' });
|
39
|
+
delete packageJson.dependencies['@nativescript/angular'];
|
40
|
+
delete packageJson.dependencies['nativescript-angular'];
|
41
|
+
delete packageJson.dependencies['tns-core-modules'];
|
42
|
+
delete packageJson.dependencies['@ngx-translate/core'];
|
43
|
+
delete packageJson.dependencies['rxjs'];
|
44
|
+
delete packageJson.dependencies['tslib'];
|
45
|
+
delete packageJson.dependencies['reflect-metadata'];
|
46
|
+
delete packageJson.dependencies['zone.js'];
|
47
|
+
// clear out angular deps
|
48
|
+
for (const key in packageJson.dependencies) {
|
49
|
+
if (key.indexOf('@angular/') > -1) {
|
50
|
+
delete packageJson.dependencies[key];
|
51
|
+
}
|
52
|
+
if (key.indexOf('@ngrx/') > -1) {
|
53
|
+
delete packageJson.dependencies[key];
|
54
|
+
}
|
55
|
+
if (key.indexOf(`@${npmScope}/`) > -1) {
|
56
|
+
delete packageJson.dependencies[key];
|
57
|
+
}
|
58
|
+
}
|
59
|
+
packageJson.devDependencies = packageJson.devDependencies || {};
|
60
|
+
packageJson.devDependencies = {
|
61
|
+
'@nativescript/android': '~8.1.1',
|
62
|
+
'@nativescript/ios': '~8.1.0',
|
63
|
+
};
|
64
|
+
// console.log('path:',path);
|
65
|
+
// console.log('packageJson overwrite:', JSON.stringify(packageJson));
|
66
|
+
tree = (0, xplat_utils_1.updateJsonFile)(tree, packagePath, packageJson);
|
67
|
+
}
|
68
|
+
if (tree.exists(`${dirPath}/tsconfig.env.json`)) {
|
69
|
+
tree.delete(`${dirPath}/tsconfig.env.json`);
|
70
|
+
}
|
71
|
+
if (tree.exists(`${dirPath}/tsconfig.tns.json`)) {
|
72
|
+
tree.delete(`${dirPath}/tsconfig.tns.json`);
|
73
|
+
}
|
74
|
+
(0, workspace_1.createOrUpdate)(tree, `${dirPath}/tools/xplat-postinstall.js`, `//#!/usr/bin/env node
|
75
|
+
|
76
|
+
const fs = require('fs-extra');
|
77
|
+
const path = require('path');
|
78
|
+
const childProcess = require('child_process');
|
79
|
+
|
80
|
+
// Copy potential hooks from root dependencies to app
|
81
|
+
const hooksSrc = '${relativePath}/hooks';
|
82
|
+
const hooksDest = 'hooks';
|
83
|
+
console.info('Copying ' + hooksSrc + ' -> ' + hooksDest);
|
84
|
+
try {
|
85
|
+
fs.copySync(hooksSrc, hooksDest);
|
86
|
+
} catch (err) {
|
87
|
+
// ignore
|
88
|
+
}
|
89
|
+
|
90
|
+
// Helpful to trigger ngcc after an install to ensure all has processed properly
|
91
|
+
const ngccPath = require.resolve('@angular/compiler-cli/ngcc/main-ngcc.js');
|
92
|
+
const child = childProcess.spawn(
|
93
|
+
ngccPath,
|
94
|
+
[
|
95
|
+
'--tsconfig',
|
96
|
+
'tsconfig.app.json',
|
97
|
+
'--properties',
|
98
|
+
'es2015',
|
99
|
+
'module',
|
100
|
+
'main',
|
101
|
+
'--first-only',
|
102
|
+
],
|
103
|
+
{
|
104
|
+
cwd: process.cwd(),
|
105
|
+
shell: process.platform == 'win32',
|
106
|
+
}
|
107
|
+
);
|
108
|
+
child.stdout.setEncoding('utf8');
|
109
|
+
child.stdout.on('data', function (data) {
|
110
|
+
console.log(data);
|
111
|
+
});
|
112
|
+
|
113
|
+
`);
|
114
|
+
(0, workspace_1.createOrUpdate)(tree, `${dirPath}/tsconfig.app.json`, `{
|
115
|
+
"extends": "./tsconfig.json",
|
116
|
+
"compilerOptions": {
|
117
|
+
"outDir": "${relativePath}/dist/out-tsc",
|
118
|
+
"types": []
|
119
|
+
},
|
120
|
+
"include": [
|
121
|
+
"${relativePath}/libs/xplat/core/src/lib/environments/base/*.ts",
|
122
|
+
"./src/environments/environment.*.ts"
|
123
|
+
],
|
124
|
+
"files": [
|
125
|
+
"./references.d.ts",
|
126
|
+
"./src/main.ts",
|
127
|
+
"./src/polyfills.ts"
|
128
|
+
]
|
129
|
+
}`);
|
130
|
+
(0, workspace_1.createOrUpdate)(tree, `${dirPath}/tsconfig.editor.json`, `{
|
131
|
+
"extends": "./tsconfig.json",
|
132
|
+
"include": ["**/*.ts"],
|
133
|
+
"compilerOptions": {
|
134
|
+
"types": ["jest", "node"]
|
135
|
+
}
|
136
|
+
}
|
137
|
+
`);
|
138
|
+
(0, workspace_1.createOrUpdate)(tree, `${dirPath}/tsconfig.json`, `{
|
139
|
+
"extends": "${relativePath}/tsconfig.base.json",
|
140
|
+
"files": [],
|
141
|
+
"include": [],
|
142
|
+
"references": [
|
143
|
+
{
|
144
|
+
"path": "./tsconfig.app.json"
|
145
|
+
},
|
146
|
+
{
|
147
|
+
"path": "./tsconfig.spec.json"
|
148
|
+
},
|
149
|
+
{
|
150
|
+
"path": "./tsconfig.editor.json"
|
151
|
+
}
|
152
|
+
]
|
153
|
+
}
|
154
|
+
`);
|
155
|
+
(0, workspace_1.createOrUpdate)(tree, `${dirPath}/tsconfig.spec.json`, `{
|
156
|
+
"extends": "./tsconfig.json",
|
157
|
+
"compilerOptions": {
|
158
|
+
"outDir": "${relativePath}/dist/out-tsc",
|
159
|
+
"module": "commonjs",
|
160
|
+
"types": ["jest", "node"]
|
161
|
+
},
|
162
|
+
"files": ["src/test-setup.ts"],
|
163
|
+
"include": ["**/*.spec.ts", "**/*.d.ts"]
|
164
|
+
}
|
165
|
+
`);
|
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
|
+
* NativeScript Polyfills
|
169
|
+
*/
|
170
|
+
|
171
|
+
// Install @nativescript/core polyfills (XHR, setTimeout, requestAnimationFrame)
|
172
|
+
import '@nativescript/core/globals';
|
173
|
+
// Install @nativescript/angular specific polyfills
|
174
|
+
import '@nativescript/angular/polyfills';
|
175
|
+
|
176
|
+
/**
|
177
|
+
* Zone.js and patches
|
178
|
+
*/
|
179
|
+
// Add pre-zone.js patches needed for the NativeScript platform
|
180
|
+
import '@nativescript/zone-js/dist/pre-zone-polyfills';
|
181
|
+
|
182
|
+
// Zone JS is required by default for Angular itself
|
183
|
+
import 'zone.js';
|
184
|
+
|
185
|
+
// Add NativeScript specific Zone JS patches
|
186
|
+
import '@nativescript/zone-js';
|
187
|
+
`);
|
188
|
+
(0, workspace_1.createOrUpdate)(tree, `${dirPath}/.eslintrc.json`, `{
|
189
|
+
"extends": "${relativePath}/.eslintrc.json",
|
190
|
+
"ignorePatterns": [
|
191
|
+
"!**/*"
|
192
|
+
],
|
193
|
+
"overrides": [
|
194
|
+
{
|
195
|
+
"files": [
|
196
|
+
"*.ts"
|
197
|
+
],
|
198
|
+
"extends": [
|
199
|
+
"plugin:@nrwl/nx/angular",
|
200
|
+
"plugin:@angular-eslint/template/process-inline-templates"
|
201
|
+
],
|
202
|
+
"parserOptions": {
|
203
|
+
"project": [
|
204
|
+
"${dirPath}/tsconfig.*?.json"
|
205
|
+
]
|
206
|
+
},
|
207
|
+
"rules": {
|
208
|
+
"@angular-eslint/directive-selector": [
|
209
|
+
"error",
|
210
|
+
{
|
211
|
+
"type": "attribute",
|
212
|
+
"prefix": "${(0, xplat_utils_1.getPrefix)()}",
|
213
|
+
"style": "camelCase"
|
214
|
+
}
|
215
|
+
],
|
216
|
+
"@angular-eslint/component-selector": [
|
217
|
+
"error",
|
218
|
+
{
|
219
|
+
"type": "element",
|
220
|
+
"prefix": "${(0, xplat_utils_1.getPrefix)()}",
|
221
|
+
"style": "kebab-case"
|
222
|
+
}
|
223
|
+
]
|
224
|
+
}
|
225
|
+
},
|
226
|
+
{
|
227
|
+
"files": [
|
228
|
+
"*.html"
|
229
|
+
],
|
230
|
+
"extends": [
|
231
|
+
"plugin:@nrwl/nx/angular-template"
|
232
|
+
],
|
233
|
+
"rules": {}
|
234
|
+
}
|
235
|
+
]
|
236
|
+
}
|
237
|
+
`);
|
238
|
+
}
|
239
|
+
if (hasNativeScriptApps) {
|
240
|
+
xplat_1.output.log({
|
241
|
+
title: 'Migration Note:',
|
242
|
+
bodyLines: [
|
243
|
+
`Please ensure you have the latest NativeScript cli installed: npm i -g nativescript`,
|
244
|
+
`The following NativeScript apps have been updated: ${appsNames}.`,
|
245
|
+
`Please note that you may still need to update some project imports. Build your app and work through any TypeScript errors one at a time to clear the remaining.`,
|
246
|
+
`Be sure to check your git changeset to retain any changes to other files that were updated before committing. There may be some changes you want to keep that had been replaced in the update.`,
|
247
|
+
],
|
248
|
+
});
|
249
|
+
}
|
250
|
+
return tree;
|
251
|
+
}
|
252
|
+
function updateRootPackage(tree, context) {
|
253
|
+
return (0, workspace_1.updateJsonInTree)('package.json', (json) => {
|
254
|
+
json.scripts = json.scripts || {};
|
255
|
+
const nativeScriptDeps = {
|
256
|
+
'@nativescript/angular': nsNgScopedVersion,
|
257
|
+
'@nativescript/core': nsCoreVersion,
|
258
|
+
};
|
259
|
+
const nativeScriptDevDeps = {
|
260
|
+
'@nativescript/types': nsCoreVersion,
|
261
|
+
'@nativescript/webpack': nsWebpackVersion,
|
262
|
+
};
|
263
|
+
json.dependencies = json.dependencies || {};
|
264
|
+
json.dependencies = Object.assign(Object.assign(Object.assign({}, json.dependencies), (hasNativeScriptApps ? nativeScriptDeps : {})), { '@ngx-translate/core': ngxTranslateVersion });
|
265
|
+
let ngToolsDeps = {
|
266
|
+
'@ngtools/webpack': angularVersion
|
267
|
+
};
|
268
|
+
if (json.dependencies['@angular/core']) {
|
269
|
+
// make sure in sync with current angular versions
|
270
|
+
ngToolsDeps['@ngtools/webpack'] = json.dependencies['@angular/core'];
|
271
|
+
}
|
272
|
+
else {
|
273
|
+
ngToolsDeps = null;
|
274
|
+
}
|
275
|
+
delete json.dependencies['nativescript-angular'];
|
276
|
+
delete json.dependencies['tns-core-modules'];
|
277
|
+
delete json.devDependencies['tns-core-modules'];
|
278
|
+
delete json.dependencies['tns-platform-declarations'];
|
279
|
+
delete json.devDependencies['tns-platform-declarations'];
|
280
|
+
json.devDependencies = json.devDependencies || {};
|
281
|
+
json.devDependencies = Object.assign(Object.assign(Object.assign({}, json.devDependencies), (hasNativeScriptApps ? nativeScriptDevDeps : {})), (ngToolsDeps ? ngToolsDeps : {}));
|
282
|
+
return json;
|
283
|
+
})(tree, context);
|
284
|
+
}
|
285
|
+
function default_1() {
|
286
|
+
return (0, schematics_1.chain)([
|
287
|
+
(0, xplat_utils_1.prerun)({
|
288
|
+
framework: 'angular',
|
289
|
+
}, true),
|
290
|
+
updateNativeScriptApps,
|
291
|
+
updateRootPackage,
|
292
|
+
(tree) => {
|
293
|
+
return (0, schematics_1.externalSchematic)('@nrwl/workspace', 'convert-to-nx-project', {
|
294
|
+
all: true
|
295
|
+
});
|
296
|
+
},
|
297
|
+
]);
|
298
|
+
}
|
299
|
+
exports.default = default_1;
|
package/migrations.json
CHANGED
@@ -29,6 +29,11 @@
|
|
29
29
|
"version": "12.4.3",
|
30
30
|
"description": "Migrate workspace to 12.4.3",
|
31
31
|
"factory": "./migrations/update-12-4-3/update-12-4-3"
|
32
|
+
},
|
33
|
+
"update-to-13.0.1": {
|
34
|
+
"version": "13.0.1",
|
35
|
+
"description": "Migrate workspace to 13.0.1",
|
36
|
+
"factory": "./migrations/update-13-0-0/update-13-0-0"
|
32
37
|
}
|
33
38
|
},
|
34
39
|
"packageJsonUpdates": {
|
@@ -113,6 +118,47 @@
|
|
113
118
|
"alwaysAddToPackageJson": false
|
114
119
|
}
|
115
120
|
}
|
121
|
+
},
|
122
|
+
"13.0.1": {
|
123
|
+
"version": "13.0.1",
|
124
|
+
"packages": {
|
125
|
+
"@nstudio/angular": {
|
126
|
+
"version": "13.0.1",
|
127
|
+
"alwaysAddToPackageJson": false
|
128
|
+
},
|
129
|
+
"@nstudio/electron": {
|
130
|
+
"version": "13.0.1",
|
131
|
+
"alwaysAddToPackageJson": false
|
132
|
+
},
|
133
|
+
"@nstudio/electron-angular": {
|
134
|
+
"version": "13.0.1",
|
135
|
+
"alwaysAddToPackageJson": false
|
136
|
+
},
|
137
|
+
"@nstudio/ionic": {
|
138
|
+
"version": "13.0.1",
|
139
|
+
"alwaysAddToPackageJson": false
|
140
|
+
},
|
141
|
+
"@nstudio/ionic-angular": {
|
142
|
+
"version": "13.0.1",
|
143
|
+
"alwaysAddToPackageJson": false
|
144
|
+
},
|
145
|
+
"@nstudio/nativescript": {
|
146
|
+
"version": "13.0.1",
|
147
|
+
"alwaysAddToPackageJson": false
|
148
|
+
},
|
149
|
+
"@nstudio/nativescript-angular": {
|
150
|
+
"version": "13.0.1",
|
151
|
+
"alwaysAddToPackageJson": false
|
152
|
+
},
|
153
|
+
"@nstudio/web": {
|
154
|
+
"version": "13.0.1",
|
155
|
+
"alwaysAddToPackageJson": false
|
156
|
+
},
|
157
|
+
"@nstudio/web-angular": {
|
158
|
+
"version": "13.0.1",
|
159
|
+
"alwaysAddToPackageJson": false
|
160
|
+
}
|
161
|
+
}
|
116
162
|
}
|
117
163
|
}
|
118
164
|
}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@nstudio/xplat",
|
3
|
-
"version": "
|
3
|
+
"version": "13.4.0",
|
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": "
|
45
|
-
"@nstudio/xplat-utils": "
|
44
|
+
"@nstudio/focus": "13.4.0",
|
45
|
+
"@nstudio/xplat-utils": "13.4.0"
|
46
46
|
},
|
47
47
|
"author": "Nathan Walker",
|
48
48
|
"license": "MIT",
|
@@ -81,10 +81,6 @@
|
|
81
81
|
{
|
82
82
|
"name": "Mathieu Brunot",
|
83
83
|
"url": "https://github.com/madmath03"
|
84
|
-
},
|
85
|
-
{
|
86
|
-
"name": "Emerson Jair",
|
87
|
-
"url": "https://github.com/dungahk"
|
88
84
|
}
|
89
85
|
]
|
90
86
|
}
|
@@ -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;
|