@nstudio/xplat 13.0.0 → 13.4.2-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/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/migrations.json +14 -15
- 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
package/README.md
CHANGED
@@ -2,9 +2,9 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
const schematics_1 = require("@angular-devkit/schematics");
|
4
4
|
function default_1() {
|
5
|
-
return schematics_1.chain([
|
5
|
+
return (0, schematics_1.chain)([
|
6
6
|
(tree, context) => {
|
7
|
-
return schematics_1.noop();
|
7
|
+
return (0, schematics_1.noop)();
|
8
8
|
},
|
9
9
|
]);
|
10
10
|
}
|
@@ -4,8 +4,8 @@ const schematics_1 = require("@angular-devkit/schematics");
|
|
4
4
|
const xplat_utils_1 = require("@nstudio/xplat-utils");
|
5
5
|
const xplat_1 = require("@nstudio/xplat");
|
6
6
|
function default_1() {
|
7
|
-
return schematics_1.chain([
|
8
|
-
xplat_utils_1.prerun({
|
7
|
+
return (0, schematics_1.chain)([
|
8
|
+
(0, xplat_utils_1.prerun)({
|
9
9
|
framework: 'angular',
|
10
10
|
}, true),
|
11
11
|
// cleanup old dirs
|
@@ -11,8 +11,8 @@ const oldDirectoriesToMove = [];
|
|
11
11
|
const newDirectoriesToEmpty = [];
|
12
12
|
let platforms;
|
13
13
|
function default_1() {
|
14
|
-
return schematics_1.chain([
|
15
|
-
xplat_utils_1.prerun({
|
14
|
+
return (0, schematics_1.chain)([
|
15
|
+
(0, xplat_utils_1.prerun)({
|
16
16
|
framework: 'angular',
|
17
17
|
}, true),
|
18
18
|
// generate new xplat libs
|
@@ -49,37 +49,37 @@ function default_1() {
|
|
49
49
|
// remove old nx projects
|
50
50
|
(tree) => {
|
51
51
|
const path = 'nx.json';
|
52
|
-
const nxJson = xplat_utils_1.getJsonFromFile(tree, path);
|
52
|
+
const nxJson = (0, xplat_utils_1.getJsonFromFile)(tree, path);
|
53
53
|
if (nxJson && nxJson.projects) {
|
54
54
|
delete nxJson.projects['libs'];
|
55
55
|
delete nxJson.projects['xplat'];
|
56
|
-
return xplat_utils_1.updateJsonFile(tree, path, nxJson);
|
56
|
+
return (0, xplat_utils_1.updateJsonFile)(tree, path, nxJson);
|
57
57
|
}
|
58
58
|
else {
|
59
|
-
return schematics_1.noop();
|
59
|
+
return (0, schematics_1.noop)();
|
60
60
|
}
|
61
61
|
},
|
62
62
|
// remove old workspace projects
|
63
63
|
(tree) => {
|
64
|
-
const workspacePath = workspace_1.getWorkspacePath(tree);
|
65
|
-
const workspaceJson = xplat_utils_1.getJsonFromFile(tree, workspacePath);
|
64
|
+
const workspacePath = (0, workspace_1.getWorkspacePath)(tree);
|
65
|
+
const workspaceJson = (0, xplat_utils_1.getJsonFromFile)(tree, workspacePath);
|
66
66
|
if (workspaceJson && workspaceJson.projects) {
|
67
67
|
delete workspaceJson.projects['libs'];
|
68
68
|
delete workspaceJson.projects['xplat'];
|
69
|
-
return xplat_utils_1.updateJsonFile(tree, workspacePath, workspaceJson);
|
69
|
+
return (0, xplat_utils_1.updateJsonFile)(tree, workspacePath, workspaceJson);
|
70
70
|
}
|
71
71
|
else {
|
72
|
-
return schematics_1.noop();
|
72
|
+
return (0, schematics_1.noop)();
|
73
73
|
}
|
74
74
|
},
|
75
75
|
// remove old tsconfig settings
|
76
76
|
(tree, context) => {
|
77
|
-
return xplat_1.updateTsConfig(tree, (tsConfig) => {
|
77
|
+
return (0, xplat_1.updateTsConfig)(tree, (tsConfig) => {
|
78
78
|
if (tsConfig) {
|
79
79
|
if (!tsConfig.compilerOptions) {
|
80
80
|
tsConfig.compilerOptions = {};
|
81
81
|
}
|
82
|
-
const npmScope = xplat_utils_1.getNpmScope();
|
82
|
+
const npmScope = (0, xplat_utils_1.getNpmScope)();
|
83
83
|
delete tsConfig.compilerOptions.paths[`@${npmScope}/*`];
|
84
84
|
delete tsConfig.compilerOptions.paths[`@${npmScope}/electron`];
|
85
85
|
delete tsConfig.compilerOptions.paths[`@${npmScope}/electron/*`];
|
@@ -160,8 +160,8 @@ function updateRootDeps() {
|
|
160
160
|
tree.delete('tsconfig.json');
|
161
161
|
}
|
162
162
|
const packagePath = 'package.json';
|
163
|
-
const packageJson = xplat_utils_1.getJsonFromFile(tree, packagePath);
|
164
|
-
const npmScope = xplat_utils_1.getNpmScope();
|
163
|
+
const packageJson = (0, xplat_utils_1.getJsonFromFile)(tree, packagePath);
|
164
|
+
const npmScope = (0, xplat_utils_1.getNpmScope)();
|
165
165
|
delete packageJson.dependencies[`@${npmScope}/scss`];
|
166
166
|
packageJson.dependencies[`@${npmScope}/xplat-scss`] =
|
167
167
|
'file:libs/xplat/scss/src';
|
@@ -174,12 +174,12 @@ function updateRootDeps() {
|
|
174
174
|
packageJson.dependencies[packageName] = packageVersion.replace('file:xplat', 'file:libs/xplat');
|
175
175
|
}
|
176
176
|
}
|
177
|
-
return xplat_utils_1.updateJsonFile(tree, packagePath, packageJson);
|
177
|
+
return (0, xplat_utils_1.updateJsonFile)(tree, packagePath, packageJson);
|
178
178
|
};
|
179
179
|
}
|
180
180
|
function updateAppConfigs() {
|
181
181
|
return (tree, context) => {
|
182
|
-
const webAppsPaths = xplat_utils_1.getAppPaths(tree, 'web');
|
182
|
+
const webAppsPaths = (0, xplat_utils_1.getAppPaths)(tree, 'web');
|
183
183
|
for (const dirPath of webAppsPaths) {
|
184
184
|
const relativePath = dirPath
|
185
185
|
.split('/')
|
@@ -188,12 +188,12 @@ function updateAppConfigs() {
|
|
188
188
|
.join('/');
|
189
189
|
let customOptionsAppend = '';
|
190
190
|
if (tree.exists(`${dirPath}/tsconfig.json`)) {
|
191
|
-
const tsConfig = xplat_utils_1.getJsonFromFile(tree, `${dirPath}/tsconfig.json`);
|
191
|
+
const tsConfig = (0, xplat_utils_1.getJsonFromFile)(tree, `${dirPath}/tsconfig.json`);
|
192
192
|
if (tsConfig.angularCompilerOptions) {
|
193
193
|
customOptionsAppend = `,\n"angularCompilerOptions": ${JSON.stringify(tsConfig.angularCompilerOptions)}`;
|
194
194
|
}
|
195
195
|
}
|
196
|
-
workspace_1.createOrUpdate(tree, `${dirPath}/tsconfig.json`, `{
|
196
|
+
(0, workspace_1.createOrUpdate)(tree, `${dirPath}/tsconfig.json`, `{
|
197
197
|
"extends": "${relativePath}/tsconfig.base.json",
|
198
198
|
"files": [],
|
199
199
|
"include": [],
|
@@ -209,7 +209,7 @@ function updateAppConfigs() {
|
|
209
209
|
}
|
210
210
|
]
|
211
211
|
}`);
|
212
|
-
workspace_1.createOrUpdate(tree, `${dirPath}/tsconfig.app.json`, `{
|
212
|
+
(0, workspace_1.createOrUpdate)(tree, `${dirPath}/tsconfig.app.json`, `{
|
213
213
|
"extends": "./tsconfig.json",
|
214
214
|
"compilerOptions": {
|
215
215
|
"outDir": "${relativePath}/dist/out-tsc",
|
@@ -228,7 +228,7 @@ function updateAppConfigs() {
|
|
228
228
|
]${customOptionsAppend}
|
229
229
|
}
|
230
230
|
`);
|
231
|
-
workspace_1.createOrUpdate(tree, `${dirPath}/tsconfig.editor.json`, `{
|
231
|
+
(0, workspace_1.createOrUpdate)(tree, `${dirPath}/tsconfig.editor.json`, `{
|
232
232
|
"extends": "./tsconfig.json",
|
233
233
|
"include": ["**/*.ts"],
|
234
234
|
"compilerOptions": {
|
@@ -236,7 +236,7 @@ function updateAppConfigs() {
|
|
236
236
|
}
|
237
237
|
}
|
238
238
|
`);
|
239
|
-
workspace_1.createOrUpdate(tree, `${dirPath}/tsconfig.spec.json`, `{
|
239
|
+
(0, workspace_1.createOrUpdate)(tree, `${dirPath}/tsconfig.spec.json`, `{
|
240
240
|
"extends": "./tsconfig.json",
|
241
241
|
"compilerOptions": {
|
242
242
|
"outDir": "${relativePath}/dist/out-tsc",
|
@@ -248,8 +248,8 @@ function updateAppConfigs() {
|
|
248
248
|
}
|
249
249
|
`);
|
250
250
|
}
|
251
|
-
const nativeScriptAppsPaths = xplat_utils_1.getAppPaths(tree, 'nativescript');
|
252
|
-
const npmScope = xplat_utils_1.getNpmScope();
|
251
|
+
const nativeScriptAppsPaths = (0, xplat_utils_1.getAppPaths)(tree, 'nativescript');
|
252
|
+
const npmScope = (0, xplat_utils_1.getNpmScope)();
|
253
253
|
// update {N} apps and configs
|
254
254
|
for (const dirPath of nativeScriptAppsPaths) {
|
255
255
|
// console.log(dir);
|
@@ -260,15 +260,15 @@ function updateAppConfigs() {
|
|
260
260
|
.map((p) => '..')
|
261
261
|
.join('/');
|
262
262
|
const cwd = process.cwd();
|
263
|
-
const webpackConfigPath = path_1.join(cwd, 'node_modules/@nstudio/nativescript-angular/src/schematics/application/_files/webpack.config.js');
|
263
|
+
const webpackConfigPath = (0, path_1.join)(cwd, 'node_modules/@nstudio/nativescript-angular/src/schematics/application/_files/webpack.config.js');
|
264
264
|
// console.log('webpackConfigPath:', webpackConfigPath);
|
265
265
|
const webpackConfig = fs.readFileSync(webpackConfigPath, {
|
266
266
|
encoding: 'utf-8',
|
267
267
|
});
|
268
|
-
workspace_1.createOrUpdate(tree, `${dirPath}/webpack.config.js`, webpackConfig.replace('<%= pathOffset %>', relativePath));
|
268
|
+
(0, workspace_1.createOrUpdate)(tree, `${dirPath}/webpack.config.js`, webpackConfig.replace('<%= pathOffset %>', relativePath));
|
269
269
|
// update {N} app deps
|
270
270
|
const packagePath = `${dirPath}/package.json`;
|
271
|
-
const packageJson = xplat_utils_1.getJsonFromFile(tree, packagePath);
|
271
|
+
const packageJson = (0, xplat_utils_1.getJsonFromFile)(tree, packagePath);
|
272
272
|
if (packageJson) {
|
273
273
|
packageJson.dependencies = packageJson.dependencies || {};
|
274
274
|
delete packageJson.dependencies[`@${npmScope}/scss`];
|
@@ -287,7 +287,7 @@ function updateAppConfigs() {
|
|
287
287
|
}
|
288
288
|
// console.log('path:',path);
|
289
289
|
// console.log('packageJson overwrite:', JSON.stringify(packageJson));
|
290
|
-
tree = xplat_utils_1.updateJsonFile(tree, packagePath, packageJson);
|
290
|
+
tree = (0, xplat_utils_1.updateJsonFile)(tree, packagePath, packageJson);
|
291
291
|
}
|
292
292
|
const gitIgnorePath = `${dirPath}/.gitignore`;
|
293
293
|
let gitIgnore = tree.get(gitIgnorePath).content.toString();
|
@@ -300,19 +300,19 @@ function updateAppConfigs() {
|
|
300
300
|
.read(`${dirPath}/src/app.android.scss`)
|
301
301
|
.toString('utf-8');
|
302
302
|
scssUpdate = scssUpdate.replace('/nativescript-scss', '/xplat-nativescript-scss');
|
303
|
-
workspace_1.createOrUpdate(tree, `${dirPath}/src/app.android.scss`, scssUpdate);
|
303
|
+
(0, workspace_1.createOrUpdate)(tree, `${dirPath}/src/app.android.scss`, scssUpdate);
|
304
304
|
}
|
305
305
|
if (tree.exists(`${dirPath}/src/app.ios.scss`)) {
|
306
306
|
let scssUpdate = tree
|
307
307
|
.read(`${dirPath}/src/app.ios.scss`)
|
308
308
|
.toString('utf-8');
|
309
309
|
scssUpdate = scssUpdate.replace('/nativescript-scss', '/xplat-nativescript-scss');
|
310
|
-
workspace_1.createOrUpdate(tree, `${dirPath}/src/app.ios.scss`, scssUpdate);
|
310
|
+
(0, workspace_1.createOrUpdate)(tree, `${dirPath}/src/app.ios.scss`, scssUpdate);
|
311
311
|
}
|
312
312
|
if (tree.exists(`${dirPath}/tsconfig.env.json`)) {
|
313
313
|
tree.delete(`${dirPath}/tsconfig.env.json`);
|
314
314
|
}
|
315
|
-
workspace_1.createOrUpdate(tree, `${dirPath}/tsconfig.app.json`, `{
|
315
|
+
(0, workspace_1.createOrUpdate)(tree, `${dirPath}/tsconfig.app.json`, `{
|
316
316
|
"extends": "./tsconfig.json",
|
317
317
|
"compilerOptions": {
|
318
318
|
"outDir": "${relativePath}/dist/out-tsc",
|
@@ -323,7 +323,7 @@ function updateAppConfigs() {
|
|
323
323
|
"./src/main.ts"
|
324
324
|
]
|
325
325
|
}`);
|
326
|
-
workspace_1.createOrUpdate(tree, `${dirPath}/tsconfig.editor.json`, `{
|
326
|
+
(0, workspace_1.createOrUpdate)(tree, `${dirPath}/tsconfig.editor.json`, `{
|
327
327
|
"extends": "./tsconfig.json",
|
328
328
|
"include": ["**/*.ts"],
|
329
329
|
"compilerOptions": {
|
@@ -331,7 +331,7 @@ function updateAppConfigs() {
|
|
331
331
|
}
|
332
332
|
}
|
333
333
|
`);
|
334
|
-
workspace_1.createOrUpdate(tree, `${dirPath}/tsconfig.json`, `{
|
334
|
+
(0, workspace_1.createOrUpdate)(tree, `${dirPath}/tsconfig.json`, `{
|
335
335
|
"extends": "${relativePath}/tsconfig.base.json",
|
336
336
|
"files": [],
|
337
337
|
"include": [],
|
@@ -348,7 +348,7 @@ function updateAppConfigs() {
|
|
348
348
|
]
|
349
349
|
}
|
350
350
|
`);
|
351
|
-
workspace_1.createOrUpdate(tree, `${dirPath}/tsconfig.spec.json`, `{
|
351
|
+
(0, workspace_1.createOrUpdate)(tree, `${dirPath}/tsconfig.spec.json`, `{
|
352
352
|
"extends": "./tsconfig.json",
|
353
353
|
"compilerOptions": {
|
354
354
|
"outDir": "${relativePath}/dist/out-tsc",
|
@@ -359,9 +359,9 @@ function updateAppConfigs() {
|
|
359
359
|
"include": ["**/*.spec.ts", "**/*.d.ts"]
|
360
360
|
}
|
361
361
|
`);
|
362
|
-
workspace_1.createOrUpdate(tree, `${dirPath}/src/test-setup.ts`, `import 'jest-preset-angular';`);
|
363
|
-
workspace_1.createOrUpdate(tree, `${dirPath}/references.d.ts`, `/// <reference path="${relativePath}/references.d.ts" />`);
|
364
|
-
workspace_1.createOrUpdate(tree, `${dirPath}/jest.config.js`, `module.exports = {
|
362
|
+
(0, workspace_1.createOrUpdate)(tree, `${dirPath}/src/test-setup.ts`, `import 'jest-preset-angular';`);
|
363
|
+
(0, workspace_1.createOrUpdate)(tree, `${dirPath}/references.d.ts`, `/// <reference path="${relativePath}/references.d.ts" />`);
|
364
|
+
(0, workspace_1.createOrUpdate)(tree, `${dirPath}/jest.config.js`, `module.exports = {
|
365
365
|
preset: '${relativePath}/jest.preset.js',
|
366
366
|
setupFilesAfterEnv: ['<rootDir>/src/test-setup.ts'],
|
367
367
|
globals: {
|
@@ -383,7 +383,7 @@ function updateAppConfigs() {
|
|
383
383
|
displayName: '${dirPath.split('/').pop()}'
|
384
384
|
};
|
385
385
|
`);
|
386
|
-
workspace_1.createOrUpdate(tree, `${dirPath}/.eslintrc.json`, `{
|
386
|
+
(0, workspace_1.createOrUpdate)(tree, `${dirPath}/.eslintrc.json`, `{
|
387
387
|
"extends": "${relativePath}/.eslintrc.json",
|
388
388
|
"ignorePatterns": [
|
389
389
|
"!**/*"
|
@@ -456,14 +456,14 @@ function cleanupGitIgnore() {
|
|
456
456
|
gitIgnore = gitIgnore.replace('xplat/**/*.ngfactory.ts', '');
|
457
457
|
gitIgnore = gitIgnore.replace('xplat/**/*.ngsummary.json', '');
|
458
458
|
}
|
459
|
-
return xplat_utils_1.updateFile(tree, gitIgnorePath, gitIgnore);
|
459
|
+
return (0, xplat_utils_1.updateFile)(tree, gitIgnorePath, gitIgnore);
|
460
460
|
};
|
461
461
|
}
|
462
462
|
function getCurrentlyUsedPlatforms(tree) {
|
463
463
|
const platforms = [];
|
464
464
|
if (tree.exists('/libs/core/index.ts') &&
|
465
465
|
tree.exists('/libs/features/index.ts')) {
|
466
|
-
const npmScope = xplat_utils_1.getNpmScope();
|
466
|
+
const npmScope = (0, xplat_utils_1.getNpmScope)();
|
467
467
|
if (!oldDirectoriesToMove.includes('/libs/core')) {
|
468
468
|
oldDirectoriesToMove.push('/libs/core');
|
469
469
|
newDirectoriesToEmpty.push('/libs/xplat/core/src/lib');
|
@@ -475,7 +475,7 @@ function getCurrentlyUsedPlatforms(tree) {
|
|
475
475
|
if (!oldDirectoriesToMove.includes('/libs/scss')) {
|
476
476
|
oldDirectoriesToMove.push('/libs/scss');
|
477
477
|
newDirectoriesToEmpty.push('/libs/xplat/scss/src');
|
478
|
-
workspace_1.createOrUpdate(tree, `/libs/scss/package.json`, `{
|
478
|
+
(0, workspace_1.createOrUpdate)(tree, `/libs/scss/package.json`, `{
|
479
479
|
"name": "@${npmScope}/xplat-scss",
|
480
480
|
"version": "1.0.0"
|
481
481
|
}`);
|
@@ -509,7 +509,7 @@ function getCurrentlyUsedPlatforms(tree) {
|
|
509
509
|
if (!oldDirectoriesToMove.includes('/xplat/ionic/scss')) {
|
510
510
|
oldDirectoriesToMove.push('/xplat/ionic/scss');
|
511
511
|
newDirectoriesToEmpty.push('/libs/xplat/ionic/scss/src');
|
512
|
-
workspace_1.createOrUpdate(tree, `/xplat/ionic/scss/package.json`, `{
|
512
|
+
(0, workspace_1.createOrUpdate)(tree, `/xplat/ionic/scss/package.json`, `{
|
513
513
|
"name": "@${npmScope}/xplat-ionic-scss",
|
514
514
|
"version": "1.0.0"
|
515
515
|
}`);
|
@@ -518,7 +518,7 @@ function getCurrentlyUsedPlatforms(tree) {
|
|
518
518
|
.read(`/xplat/ionic/scss/_index.scss`)
|
519
519
|
.toString('utf-8');
|
520
520
|
scssUpdate = scssUpdate.replace(`@${npmScope}/scss/index`, `@${npmScope}/xplat-scss/index`);
|
521
|
-
workspace_1.createOrUpdate(tree, `/xplat/ionic/scss/_index.scss`, scssUpdate);
|
521
|
+
(0, workspace_1.createOrUpdate)(tree, `/xplat/ionic/scss/_index.scss`, scssUpdate);
|
522
522
|
}
|
523
523
|
}
|
524
524
|
}
|
@@ -540,7 +540,7 @@ function getCurrentlyUsedPlatforms(tree) {
|
|
540
540
|
if (!oldDirectoriesToMove.includes('/xplat/nativescript/scss')) {
|
541
541
|
oldDirectoriesToMove.push('/xplat/nativescript/scss');
|
542
542
|
newDirectoriesToEmpty.push('/libs/xplat/nativescript/scss/src');
|
543
|
-
workspace_1.createOrUpdate(tree, `/xplat/nativescript/scss/package.json`, `{
|
543
|
+
(0, workspace_1.createOrUpdate)(tree, `/xplat/nativescript/scss/package.json`, `{
|
544
544
|
"name": "@${npmScope}/xplat-nativescript-scss",
|
545
545
|
"version": "1.0.0"
|
546
546
|
}`);
|
@@ -549,7 +549,7 @@ function getCurrentlyUsedPlatforms(tree) {
|
|
549
549
|
.read(`/xplat/nativescript/scss/_common.scss`)
|
550
550
|
.toString('utf-8');
|
551
551
|
scssUpdate = scssUpdate.replace(`@${npmScope}/scss/index`, `@${npmScope}/xplat-scss/index`);
|
552
|
-
workspace_1.createOrUpdate(tree, `/xplat/nativescript/scss/_common.scss`, scssUpdate);
|
552
|
+
(0, workspace_1.createOrUpdate)(tree, `/xplat/nativescript/scss/_common.scss`, scssUpdate);
|
553
553
|
}
|
554
554
|
}
|
555
555
|
if (!oldDirectoriesToMove.includes('/xplat/nativescript/utils')) {
|
@@ -575,7 +575,7 @@ function getCurrentlyUsedPlatforms(tree) {
|
|
575
575
|
if (!oldDirectoriesToMove.includes('/xplat/web/scss')) {
|
576
576
|
oldDirectoriesToMove.push('/xplat/web/scss');
|
577
577
|
newDirectoriesToEmpty.push('/libs/xplat/web/scss/src');
|
578
|
-
workspace_1.createOrUpdate(tree, `/xplat/web/scss/package.json`, `{
|
578
|
+
(0, workspace_1.createOrUpdate)(tree, `/xplat/web/scss/package.json`, `{
|
579
579
|
"name": "@${npmScope}/xplat-web-scss",
|
580
580
|
"version": "1.0.0"
|
581
581
|
}`);
|
@@ -584,7 +584,7 @@ function getCurrentlyUsedPlatforms(tree) {
|
|
584
584
|
.read(`/xplat/web/scss/_index.scss`)
|
585
585
|
.toString('utf-8');
|
586
586
|
scssUpdate = scssUpdate.replace(`@${npmScope}/scss/index`, `@${npmScope}/xplat-scss/index`);
|
587
|
-
workspace_1.createOrUpdate(tree, `/xplat/web/scss/_index.scss`, scssUpdate);
|
587
|
+
(0, workspace_1.createOrUpdate)(tree, `/xplat/web/scss/_index.scss`, scssUpdate);
|
588
588
|
}
|
589
589
|
}
|
590
590
|
}
|
@@ -7,8 +7,8 @@ const xplat_utils_1 = require("@nstudio/xplat-utils");
|
|
7
7
|
const path_1 = require("path");
|
8
8
|
const fs = require("fs");
|
9
9
|
function default_1() {
|
10
|
-
return schematics_1.chain([
|
11
|
-
xplat_utils_1.prerun({
|
10
|
+
return (0, schematics_1.chain)([
|
11
|
+
(0, xplat_utils_1.prerun)({
|
12
12
|
framework: 'angular',
|
13
13
|
}, true),
|
14
14
|
// add environment base setup to allow workspaces to start using
|
@@ -22,11 +22,11 @@ function default_1() {
|
|
22
22
|
exports.default = default_1;
|
23
23
|
function addEnvBase() {
|
24
24
|
return (tree, _context) => {
|
25
|
-
const npmScope = xplat_utils_1.getNpmScope();
|
25
|
+
const npmScope = (0, xplat_utils_1.getNpmScope)();
|
26
26
|
const coreIndexPath = `/libs/xplat/core/src/lib/index.ts`;
|
27
27
|
let coreIndex = tree.read(coreIndexPath).toString('utf-8');
|
28
28
|
coreIndex = coreIndex.replace(`./environments/environment`, `./environments`);
|
29
|
-
workspace_1.createOrUpdate(tree, coreIndexPath, coreIndex);
|
29
|
+
(0, workspace_1.createOrUpdate)(tree, coreIndexPath, coreIndex);
|
30
30
|
const envInterfacePath = `/libs/xplat/core/src/lib/environments/environment.interface.ts`;
|
31
31
|
const envInterface = `/**
|
32
32
|
* Workspace shared environment properties
|
@@ -34,11 +34,11 @@ function addEnvBase() {
|
|
34
34
|
export interface IEnvironment {
|
35
35
|
production?: boolean;
|
36
36
|
}`;
|
37
|
-
workspace_1.createOrUpdate(tree, envInterfacePath, envInterface);
|
37
|
+
(0, workspace_1.createOrUpdate)(tree, envInterfacePath, envInterface);
|
38
38
|
const envIndexPath = `/libs/xplat/core/src/lib/environments/index.ts`;
|
39
39
|
const envIndex = `export * from './environment.interface';
|
40
40
|
export * from './environment';`;
|
41
|
-
workspace_1.createOrUpdate(tree, envIndexPath, envIndex);
|
41
|
+
(0, workspace_1.createOrUpdate)(tree, envIndexPath, envIndex);
|
42
42
|
const envBasePath = `/libs/xplat/core/src/lib/environments/base/environment.base.ts`;
|
43
43
|
const envBase = `import { IEnvironment } from '../environment.interface';
|
44
44
|
|
@@ -48,7 +48,7 @@ function addEnvBase() {
|
|
48
48
|
export const environmentBase: IEnvironment = {
|
49
49
|
production: false
|
50
50
|
};`;
|
51
|
-
workspace_1.createOrUpdate(tree, envBasePath, envBase);
|
51
|
+
(0, workspace_1.createOrUpdate)(tree, envBasePath, envBase);
|
52
52
|
const envDevPath = `/libs/xplat/core/src/lib/environments/base/environment.dev.ts`;
|
53
53
|
const envDev = `import { IEnvironment } from '@${npmScope}/xplat/core';
|
54
54
|
import { deepMerge } from '@${npmScope}/xplat/utils';
|
@@ -58,7 +58,7 @@ function addEnvBase() {
|
|
58
58
|
// customizations here...
|
59
59
|
});
|
60
60
|
`;
|
61
|
-
workspace_1.createOrUpdate(tree, envDevPath, envDev);
|
61
|
+
(0, workspace_1.createOrUpdate)(tree, envDevPath, envDev);
|
62
62
|
const envProdPath = `/libs/xplat/core/src/lib/environments/base/environment.prod.ts`;
|
63
63
|
const envProd = `import { IEnvironment } from '@${npmScope}/xplat/core';
|
64
64
|
import { deepMerge } from '@${npmScope}/xplat/utils';
|
@@ -69,13 +69,13 @@ function addEnvBase() {
|
|
69
69
|
// customizations here...
|
70
70
|
});
|
71
71
|
`;
|
72
|
-
workspace_1.createOrUpdate(tree, envProdPath, envProd);
|
72
|
+
(0, workspace_1.createOrUpdate)(tree, envProdPath, envProd);
|
73
73
|
const envBaseIndexPath = `/libs/xplat/core/src/lib/environments/base/index.ts`;
|
74
74
|
const envBaseIndex = `export * from './environment.base';
|
75
75
|
export * from './environment.dev';
|
76
76
|
export * from './environment.prod';
|
77
77
|
`;
|
78
|
-
workspace_1.createOrUpdate(tree, envBaseIndexPath, envBaseIndex);
|
78
|
+
(0, workspace_1.createOrUpdate)(tree, envBaseIndexPath, envBaseIndex);
|
79
79
|
const utilsObjPath = `/libs/xplat/utils/src/lib/objects.ts`;
|
80
80
|
let utilsObj = '';
|
81
81
|
const utilsObjDeepMerge = `\n\nexport function deepMerge<T1, T2>(target: T1, source: T2): T1 & T2 {
|
@@ -108,14 +108,14 @@ function addEnvBase() {
|
|
108
108
|
if (utilsObj.indexOf('deepMerge') === -1) {
|
109
109
|
utilsObj = utilsObj + utilsObjDeepMerge;
|
110
110
|
}
|
111
|
-
workspace_1.createOrUpdate(tree, utilsObjPath, utilsObj);
|
111
|
+
(0, workspace_1.createOrUpdate)(tree, utilsObjPath, utilsObj);
|
112
112
|
};
|
113
113
|
}
|
114
114
|
exports.addEnvBase = addEnvBase;
|
115
115
|
function updateEnvsForNativeScript() {
|
116
116
|
return (tree, _context) => {
|
117
|
-
const nativeScriptAppsPaths = xplat_utils_1.getAppPaths(tree, 'nativescript');
|
118
|
-
const npmScope = xplat_utils_1.getNpmScope();
|
117
|
+
const nativeScriptAppsPaths = (0, xplat_utils_1.getAppPaths)(tree, 'nativescript');
|
118
|
+
const npmScope = (0, xplat_utils_1.getNpmScope)();
|
119
119
|
// update {N} apps and configs
|
120
120
|
for (const dirPath of nativeScriptAppsPaths) {
|
121
121
|
// console.log(dir);
|
@@ -127,14 +127,14 @@ function updateEnvsForNativeScript() {
|
|
127
127
|
.join('/');
|
128
128
|
// disable xplat env base handling to make it opt in when ready
|
129
129
|
const cwd = process.cwd();
|
130
|
-
const webpackConfigPath = path_1.join(cwd, 'node_modules/@nstudio/nativescript-angular/src/schematics/application/_files/webpack.config.js');
|
130
|
+
const webpackConfigPath = (0, path_1.join)(cwd, 'node_modules/@nstudio/nativescript-angular/src/schematics/application/_files/webpack.config.js');
|
131
131
|
// console.log('webpackConfigPath:', webpackConfigPath);
|
132
132
|
let webpackConfig = fs.readFileSync(webpackConfigPath, {
|
133
133
|
encoding: 'utf-8',
|
134
134
|
});
|
135
135
|
webpackConfig = webpackConfig.replace('if (isXplatWorkspace) {', `// opt in when ready to use in your workspace\n const xplatEnvBaseEnabled = false;\n if (xplatEnvBaseEnabled && isXplatWorkspace) {`);
|
136
|
-
workspace_1.createOrUpdate(tree, `${dirPath}/webpack.config.js`, webpackConfig.replace('<%= pathOffset %>', relativePath));
|
137
|
-
workspace_1.createOrUpdate(tree, `${dirPath}/src/environments/environment.base.ts`, `import { IEnvironment } from '@${npmScope}/xplat/core';
|
136
|
+
(0, workspace_1.createOrUpdate)(tree, `${dirPath}/webpack.config.js`, webpackConfig.replace('<%= pathOffset %>', relativePath));
|
137
|
+
(0, workspace_1.createOrUpdate)(tree, `${dirPath}/src/environments/environment.base.ts`, `import { IEnvironment } from '@${npmScope}/xplat/core';
|
138
138
|
import { deepMerge } from '@${npmScope}/xplat/utils';
|
139
139
|
|
140
140
|
export const environmentBase = function (baseWorkspaceEnv: IEnvironment, appEnvironmentCustom: IEnvironment = {}) {
|
@@ -150,7 +150,7 @@ function updateEnvsForNativeScript() {
|
|
150
150
|
return deepMerge(baseWorkspaceEnv, appEnvironment);
|
151
151
|
};
|
152
152
|
`);
|
153
|
-
workspace_1.createOrUpdate(tree, `${dirPath}/src/environments/environment.dev.ts`, `import { environmentBase } from './environment.base';
|
153
|
+
(0, workspace_1.createOrUpdate)(tree, `${dirPath}/src/environments/environment.dev.ts`, `import { environmentBase } from './environment.base';
|
154
154
|
import { IEnvironment } from '@${npmScope}/xplat/core';
|
155
155
|
import { environmentDev } from '@${npmScope}/xplat/environments';
|
156
156
|
|
@@ -158,7 +158,7 @@ function updateEnvsForNativeScript() {
|
|
158
158
|
// app level customizations here...
|
159
159
|
});
|
160
160
|
`);
|
161
|
-
workspace_1.createOrUpdate(tree, `${dirPath}/src/environments/environment.prod.ts`, `import { environmentBase } from './environment.base';
|
161
|
+
(0, workspace_1.createOrUpdate)(tree, `${dirPath}/src/environments/environment.prod.ts`, `import { environmentBase } from './environment.base';
|
162
162
|
import { IEnvironment } from '@${npmScope}/xplat/core';
|
163
163
|
import { environmentProd } from '@${npmScope}/xplat/environments';
|
164
164
|
|
@@ -172,8 +172,8 @@ function updateEnvsForNativeScript() {
|
|
172
172
|
exports.updateEnvsForNativeScript = updateEnvsForNativeScript;
|
173
173
|
function updateWorkspaceFileReplacements() {
|
174
174
|
return (tree, _context) => {
|
175
|
-
const workspacePath = workspace_1.getWorkspacePath(tree);
|
176
|
-
const workspaceJson = xplat_utils_1.getJsonFromFile(tree, workspacePath);
|
175
|
+
const workspacePath = (0, workspace_1.getWorkspacePath)(tree);
|
176
|
+
const workspaceJson = (0, xplat_utils_1.getJsonFromFile)(tree, workspacePath);
|
177
177
|
if (workspaceJson && workspaceJson.projects) {
|
178
178
|
const projectNames = Object.keys(workspaceJson.projects);
|
179
179
|
for (const name of projectNames) {
|
@@ -279,10 +279,10 @@ function updateWorkspaceFileReplacements() {
|
|
279
279
|
}
|
280
280
|
}
|
281
281
|
}
|
282
|
-
return xplat_utils_1.updateJsonFile(tree, workspacePath, workspaceJson);
|
282
|
+
return (0, xplat_utils_1.updateJsonFile)(tree, workspacePath, workspaceJson);
|
283
283
|
}
|
284
284
|
else {
|
285
|
-
return schematics_1.noop();
|
285
|
+
return (0, schematics_1.noop)();
|
286
286
|
}
|
287
287
|
};
|
288
288
|
}
|
@@ -10,8 +10,8 @@ const options = {};
|
|
10
10
|
const importsToUpdateMapping = {};
|
11
11
|
const importsScssToUpdateMapping = {};
|
12
12
|
function default_1() {
|
13
|
-
return schematics_1.chain([
|
14
|
-
xplat_utils_1.prerun({
|
13
|
+
return (0, schematics_1.chain)([
|
14
|
+
(0, xplat_utils_1.prerun)({
|
15
15
|
framework: 'angular',
|
16
16
|
}, true),
|
17
17
|
// update imports throughout old lib architecture and apps
|
@@ -21,7 +21,7 @@ function default_1() {
|
|
21
21
|
exports.default = default_1;
|
22
22
|
function updateImports() {
|
23
23
|
return (tree, _context) => {
|
24
|
-
const npmScope = xplat_utils_1.getNpmScope();
|
24
|
+
const npmScope = (0, xplat_utils_1.getNpmScope)();
|
25
25
|
importsToUpdateMapping[`@${npmScope}/core`] = `@${npmScope}/xplat/core`;
|
26
26
|
importsToUpdateMapping[`@${npmScope}/core/*`] = `@${npmScope}/xplat/core`;
|
27
27
|
importsToUpdateMapping[`@${npmScope}/features`] = `@${npmScope}/xplat/features`;
|
@@ -138,7 +138,7 @@ function updateImports() {
|
|
138
138
|
}
|
139
139
|
}
|
140
140
|
}
|
141
|
-
const nodes = xplat_1.findNodes(astSource, ts.SyntaxKind.ImportDeclaration);
|
141
|
+
const nodes = (0, xplat_1.findNodes)(astSource, ts.SyntaxKind.ImportDeclaration);
|
142
142
|
return nodes
|
143
143
|
.filter((node) => {
|
144
144
|
// remove quotes from module name
|
@@ -162,7 +162,7 @@ function updateImports() {
|
|
162
162
|
// if the reference to packageName was in fact an import statement
|
163
163
|
if (changes.length > 0) {
|
164
164
|
// update the file in the tree
|
165
|
-
xplat_1.insert(tree, file, changes);
|
165
|
+
(0, xplat_1.insert)(tree, file, changes);
|
166
166
|
}
|
167
167
|
}
|
168
168
|
});
|