@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.
Files changed (35) hide show
  1. package/README.md +5 -5
  2. package/migrations/update-10-2-0/update-10-2-0.js +2 -2
  3. package/migrations/update-11-0-0/clean-old-dirs.js +2 -2
  4. package/migrations/update-11-0-0/update-11-0-0.js +48 -46
  5. package/migrations/update-11-0-0/update-to-11-env-base.js +33 -27
  6. package/migrations/update-11-0-0/update-to-11-imports.js +5 -5
  7. package/migrations/update-12-4-3/update-12-4-3.js +20 -20
  8. package/migrations/update-13-0-0/update-13-0-0.d.ts +2 -0
  9. package/migrations/update-13-0-0/update-13-0-0.js +299 -0
  10. package/migrations.json +46 -0
  11. package/package.json +3 -7
  12. package/src/schematics/app-generate/index.js +3 -3
  13. package/src/schematics/application/index.js +1 -1
  14. package/src/schematics/application/index.spec.js +15 -15
  15. package/src/schematics/component/index.js +1 -1
  16. package/src/schematics/component/index.spec.js +22 -22
  17. package/src/schematics/feature/index.js +3 -3
  18. package/src/schematics/feature/index.spec.js +37 -37
  19. package/src/schematics/helpers/index.js +7 -7
  20. package/src/schematics/helpers/index.spec.js +4 -4
  21. package/src/schematics/init/index.js +15 -14
  22. package/src/schematics/init/index.spec.js +8 -9
  23. package/src/schematics/mode/index.js +3 -3
  24. package/src/schematics/ng-add/index.js +3 -3
  25. package/src/utils/ast.js +1 -1
  26. package/src/utils/general.d.ts +0 -1
  27. package/src/utils/general.js +11 -19
  28. package/src/utils/helpers.js +1 -1
  29. package/src/utils/postinstall.js +9 -9
  30. package/src/utils/testing-utils.js +2 -2
  31. package/src/utils/testing.js +2 -2
  32. package/src/utils/versions.d.ts +1 -1
  33. package/src/utils/versions.js +2 -2
  34. package/src/utils/xplat.d.ts +6 -0
  35. package/src/utils/xplat.js +90 -70
package/README.md CHANGED
@@ -28,9 +28,9 @@ npx create-nx-workspace@latest
28
28
 
29
29
  At the prompts:
30
30
 
31
- > provide a name
31
+ > What to create in the new workspace
32
32
 
33
- > choose `empty`
33
+ > choose `apps`
34
34
 
35
35
  ```
36
36
  npm i @nstudio/xplat -D
@@ -187,9 +187,9 @@ nx run nativescript-mobile:android
187
187
 
188
188
  Please see our [guidelines for contributing](https://github.com/nstudio/xplat/blob/master/CONTRIBUTING.md).
189
189
 
190
- | [<img alt="NathanWalker" src="https://avatars.githubusercontent.com/u/457187?v=4&s=117" width="117">](https://github.com/NathanWalker) | [<img alt="dungahk" src="https://avatars.githubusercontent.com/u/10074819?v=4&s=117" width="117">](https://github.com/dungahk) | [<img alt="pegaltier" src="https://avatars.githubusercontent.com/u/2479323?v=4&s=117" width="117">](https://github.com/pegaltier) | [<img alt="m-abs" src="https://avatars.githubusercontent.com/u/1348705?v=4&s=117" width="117">](https://github.com/m-abs) | [<img alt="sr3dna" src="https://avatars.githubusercontent.com/u/15936818?v=4&s=117" width="117">](https://github.com/sr3dna) | [<img alt="mbaljeetsingh" src="https://avatars.githubusercontent.com/u/872762?v=4&s=117" width="117">](https://github.com/mbaljeetsingh) |
191
- | :------------------------------------------------------------------------------------------------------------------------------------: | :----------------------------------------------------------------------------------------------------------------------------: | :-------------------------------------------------------------------------------------------------------------------------------: | :-----------------------------------------------------------------------------------------------------------------------: | :--------------------------------------------------------------------------------------------------------------------------: | :--------------------------------------------------------------------------------------------------------------------------------------: |
192
- | [NathanWalker](https://github.com/NathanWalker) | [dungahk](https://github.com/dungahk) | [pegaltier](https://github.com/pegaltier) | [m-abs](https://github.com/m-abs) | [sr3dna](https://github.com/sr3dna) | [mbaljeetsingh](https://github.com/mbaljeetsingh) |
190
+ | [<img alt="NathanWalker" src="https://avatars.githubusercontent.com/u/457187?v=4&s=117" width="117">](https://github.com/NathanWalker) | [<img alt="pegaltier" src="https://avatars.githubusercontent.com/u/2479323?v=4&s=117" width="117">](https://github.com/pegaltier) | [<img alt="m-abs" src="https://avatars.githubusercontent.com/u/1348705?v=4&s=117" width="117">](https://github.com/m-abs) | [<img alt="sr3dna" src="https://avatars.githubusercontent.com/u/15936818?v=4&s=117" width="117">](https://github.com/sr3dna) | [<img alt="mbaljeetsingh" src="https://avatars.githubusercontent.com/u/872762?v=4&s=117" width="117">](https://github.com/mbaljeetsingh) |
191
+ | :------------------------------------------------------------------------------------------------------------------------------------: | :-------------------------------------------------------------------------------------------------------------------------------: | :-----------------------------------------------------------------------------------------------------------------------: | :--------------------------------------------------------------------------------------------------------------------------: | :--------------------------------------------------------------------------------------------------------------------------------------: |
192
+ | [NathanWalker](https://github.com/NathanWalker) | [pegaltier](https://github.com/pegaltier) | [m-abs](https://github.com/m-abs) | [sr3dna](https://github.com/sr3dna) | [mbaljeetsingh](https://github.com/mbaljeetsingh) |
193
193
 
194
194
  | [<img alt="dopsonbr" src="https://avatars.githubusercontent.com/u/5340660?v=4&s=117" width="117">](https://github.com/dopsonbr) | [<img alt="AgentEnder" src="https://avatars.githubusercontent.com/u/6933928?v=4&s=117" width="117">](https://github.com/AgentEnder) | [<img alt="davecoffin" src="https://avatars.githubusercontent.com/u/1245462?v=4&s=117" width="117">](https://github.com/davecoffin) | [<img alt="dmitryr117" src="https://avatars.githubusercontent.com/u/5959314?v=4&s=117" width="117">](https://github.com/dmitryr117) | [<img alt="kamilmysliwiec" src="https://avatars.githubusercontent.com/u/23244943?v=4&s=117" width="117">](https://github.com/kamilmysliwiec) | [<img alt="madmath03" src="https://avatars.githubusercontent.com/u/6967675?v=4&s=117" width="117">](https://github.com/madmath03) |
195
195
  | :-----------------------------------------------------------------------------------------------------------------------------: | :---------------------------------------------------------------------------------------------------------------------------------: | :---------------------------------------------------------------------------------------------------------------------------------: | :---------------------------------------------------------------------------------------------------------------------------------: | :------------------------------------------------------------------------------------------------------------------------------------------: | :-------------------------------------------------------------------------------------------------------------------------------: |
@@ -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,13 +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
- const webpackConfig = fs.readFileSync(webpackConfigPath, { encoding: 'utf-8' });
266
- workspace_1.createOrUpdate(tree, `${dirPath}/webpack.config.js`, webpackConfig.replace('<%= pathOffset %>', relativePath));
265
+ const webpackConfig = fs.readFileSync(webpackConfigPath, {
266
+ encoding: 'utf-8',
267
+ });
268
+ (0, workspace_1.createOrUpdate)(tree, `${dirPath}/webpack.config.js`, webpackConfig.replace('<%= pathOffset %>', relativePath));
267
269
  // update {N} app deps
268
270
  const packagePath = `${dirPath}/package.json`;
269
- const packageJson = xplat_utils_1.getJsonFromFile(tree, packagePath);
271
+ const packageJson = (0, xplat_utils_1.getJsonFromFile)(tree, packagePath);
270
272
  if (packageJson) {
271
273
  packageJson.dependencies = packageJson.dependencies || {};
272
274
  delete packageJson.dependencies[`@${npmScope}/scss`];
@@ -285,7 +287,7 @@ function updateAppConfigs() {
285
287
  }
286
288
  // console.log('path:',path);
287
289
  // console.log('packageJson overwrite:', JSON.stringify(packageJson));
288
- tree = xplat_utils_1.updateJsonFile(tree, packagePath, packageJson);
290
+ tree = (0, xplat_utils_1.updateJsonFile)(tree, packagePath, packageJson);
289
291
  }
290
292
  const gitIgnorePath = `${dirPath}/.gitignore`;
291
293
  let gitIgnore = tree.get(gitIgnorePath).content.toString();
@@ -298,19 +300,19 @@ function updateAppConfigs() {
298
300
  .read(`${dirPath}/src/app.android.scss`)
299
301
  .toString('utf-8');
300
302
  scssUpdate = scssUpdate.replace('/nativescript-scss', '/xplat-nativescript-scss');
301
- workspace_1.createOrUpdate(tree, `${dirPath}/src/app.android.scss`, scssUpdate);
303
+ (0, workspace_1.createOrUpdate)(tree, `${dirPath}/src/app.android.scss`, scssUpdate);
302
304
  }
303
305
  if (tree.exists(`${dirPath}/src/app.ios.scss`)) {
304
306
  let scssUpdate = tree
305
307
  .read(`${dirPath}/src/app.ios.scss`)
306
308
  .toString('utf-8');
307
309
  scssUpdate = scssUpdate.replace('/nativescript-scss', '/xplat-nativescript-scss');
308
- workspace_1.createOrUpdate(tree, `${dirPath}/src/app.ios.scss`, scssUpdate);
310
+ (0, workspace_1.createOrUpdate)(tree, `${dirPath}/src/app.ios.scss`, scssUpdate);
309
311
  }
310
312
  if (tree.exists(`${dirPath}/tsconfig.env.json`)) {
311
313
  tree.delete(`${dirPath}/tsconfig.env.json`);
312
314
  }
313
- workspace_1.createOrUpdate(tree, `${dirPath}/tsconfig.app.json`, `{
315
+ (0, workspace_1.createOrUpdate)(tree, `${dirPath}/tsconfig.app.json`, `{
314
316
  "extends": "./tsconfig.json",
315
317
  "compilerOptions": {
316
318
  "outDir": "${relativePath}/dist/out-tsc",
@@ -321,7 +323,7 @@ function updateAppConfigs() {
321
323
  "./src/main.ts"
322
324
  ]
323
325
  }`);
324
- workspace_1.createOrUpdate(tree, `${dirPath}/tsconfig.editor.json`, `{
326
+ (0, workspace_1.createOrUpdate)(tree, `${dirPath}/tsconfig.editor.json`, `{
325
327
  "extends": "./tsconfig.json",
326
328
  "include": ["**/*.ts"],
327
329
  "compilerOptions": {
@@ -329,7 +331,7 @@ function updateAppConfigs() {
329
331
  }
330
332
  }
331
333
  `);
332
- workspace_1.createOrUpdate(tree, `${dirPath}/tsconfig.json`, `{
334
+ (0, workspace_1.createOrUpdate)(tree, `${dirPath}/tsconfig.json`, `{
333
335
  "extends": "${relativePath}/tsconfig.base.json",
334
336
  "files": [],
335
337
  "include": [],
@@ -346,7 +348,7 @@ function updateAppConfigs() {
346
348
  ]
347
349
  }
348
350
  `);
349
- workspace_1.createOrUpdate(tree, `${dirPath}/tsconfig.spec.json`, `{
351
+ (0, workspace_1.createOrUpdate)(tree, `${dirPath}/tsconfig.spec.json`, `{
350
352
  "extends": "./tsconfig.json",
351
353
  "compilerOptions": {
352
354
  "outDir": "${relativePath}/dist/out-tsc",
@@ -357,9 +359,9 @@ function updateAppConfigs() {
357
359
  "include": ["**/*.spec.ts", "**/*.d.ts"]
358
360
  }
359
361
  `);
360
- workspace_1.createOrUpdate(tree, `${dirPath}/src/test-setup.ts`, `import 'jest-preset-angular';`);
361
- workspace_1.createOrUpdate(tree, `${dirPath}/references.d.ts`, `/// <reference path="${relativePath}/references.d.ts" />`);
362
- 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 = {
363
365
  preset: '${relativePath}/jest.preset.js',
364
366
  setupFilesAfterEnv: ['<rootDir>/src/test-setup.ts'],
365
367
  globals: {
@@ -381,7 +383,7 @@ function updateAppConfigs() {
381
383
  displayName: '${dirPath.split('/').pop()}'
382
384
  };
383
385
  `);
384
- workspace_1.createOrUpdate(tree, `${dirPath}/.eslintrc.json`, `{
386
+ (0, workspace_1.createOrUpdate)(tree, `${dirPath}/.eslintrc.json`, `{
385
387
  "extends": "${relativePath}/.eslintrc.json",
386
388
  "ignorePatterns": [
387
389
  "!**/*"
@@ -454,14 +456,14 @@ function cleanupGitIgnore() {
454
456
  gitIgnore = gitIgnore.replace('xplat/**/*.ngfactory.ts', '');
455
457
  gitIgnore = gitIgnore.replace('xplat/**/*.ngsummary.json', '');
456
458
  }
457
- return xplat_utils_1.updateFile(tree, gitIgnorePath, gitIgnore);
459
+ return (0, xplat_utils_1.updateFile)(tree, gitIgnorePath, gitIgnore);
458
460
  };
459
461
  }
460
462
  function getCurrentlyUsedPlatforms(tree) {
461
463
  const platforms = [];
462
464
  if (tree.exists('/libs/core/index.ts') &&
463
465
  tree.exists('/libs/features/index.ts')) {
464
- const npmScope = xplat_utils_1.getNpmScope();
466
+ const npmScope = (0, xplat_utils_1.getNpmScope)();
465
467
  if (!oldDirectoriesToMove.includes('/libs/core')) {
466
468
  oldDirectoriesToMove.push('/libs/core');
467
469
  newDirectoriesToEmpty.push('/libs/xplat/core/src/lib');
@@ -473,7 +475,7 @@ function getCurrentlyUsedPlatforms(tree) {
473
475
  if (!oldDirectoriesToMove.includes('/libs/scss')) {
474
476
  oldDirectoriesToMove.push('/libs/scss');
475
477
  newDirectoriesToEmpty.push('/libs/xplat/scss/src');
476
- workspace_1.createOrUpdate(tree, `/libs/scss/package.json`, `{
478
+ (0, workspace_1.createOrUpdate)(tree, `/libs/scss/package.json`, `{
477
479
  "name": "@${npmScope}/xplat-scss",
478
480
  "version": "1.0.0"
479
481
  }`);
@@ -507,7 +509,7 @@ function getCurrentlyUsedPlatforms(tree) {
507
509
  if (!oldDirectoriesToMove.includes('/xplat/ionic/scss')) {
508
510
  oldDirectoriesToMove.push('/xplat/ionic/scss');
509
511
  newDirectoriesToEmpty.push('/libs/xplat/ionic/scss/src');
510
- workspace_1.createOrUpdate(tree, `/xplat/ionic/scss/package.json`, `{
512
+ (0, workspace_1.createOrUpdate)(tree, `/xplat/ionic/scss/package.json`, `{
511
513
  "name": "@${npmScope}/xplat-ionic-scss",
512
514
  "version": "1.0.0"
513
515
  }`);
@@ -516,7 +518,7 @@ function getCurrentlyUsedPlatforms(tree) {
516
518
  .read(`/xplat/ionic/scss/_index.scss`)
517
519
  .toString('utf-8');
518
520
  scssUpdate = scssUpdate.replace(`@${npmScope}/scss/index`, `@${npmScope}/xplat-scss/index`);
519
- workspace_1.createOrUpdate(tree, `/xplat/ionic/scss/_index.scss`, scssUpdate);
521
+ (0, workspace_1.createOrUpdate)(tree, `/xplat/ionic/scss/_index.scss`, scssUpdate);
520
522
  }
521
523
  }
522
524
  }
@@ -538,7 +540,7 @@ function getCurrentlyUsedPlatforms(tree) {
538
540
  if (!oldDirectoriesToMove.includes('/xplat/nativescript/scss')) {
539
541
  oldDirectoriesToMove.push('/xplat/nativescript/scss');
540
542
  newDirectoriesToEmpty.push('/libs/xplat/nativescript/scss/src');
541
- workspace_1.createOrUpdate(tree, `/xplat/nativescript/scss/package.json`, `{
543
+ (0, workspace_1.createOrUpdate)(tree, `/xplat/nativescript/scss/package.json`, `{
542
544
  "name": "@${npmScope}/xplat-nativescript-scss",
543
545
  "version": "1.0.0"
544
546
  }`);
@@ -547,7 +549,7 @@ function getCurrentlyUsedPlatforms(tree) {
547
549
  .read(`/xplat/nativescript/scss/_common.scss`)
548
550
  .toString('utf-8');
549
551
  scssUpdate = scssUpdate.replace(`@${npmScope}/scss/index`, `@${npmScope}/xplat-scss/index`);
550
- workspace_1.createOrUpdate(tree, `/xplat/nativescript/scss/_common.scss`, scssUpdate);
552
+ (0, workspace_1.createOrUpdate)(tree, `/xplat/nativescript/scss/_common.scss`, scssUpdate);
551
553
  }
552
554
  }
553
555
  if (!oldDirectoriesToMove.includes('/xplat/nativescript/utils')) {
@@ -573,7 +575,7 @@ function getCurrentlyUsedPlatforms(tree) {
573
575
  if (!oldDirectoriesToMove.includes('/xplat/web/scss')) {
574
576
  oldDirectoriesToMove.push('/xplat/web/scss');
575
577
  newDirectoriesToEmpty.push('/libs/xplat/web/scss/src');
576
- workspace_1.createOrUpdate(tree, `/xplat/web/scss/package.json`, `{
578
+ (0, workspace_1.createOrUpdate)(tree, `/xplat/web/scss/package.json`, `{
577
579
  "name": "@${npmScope}/xplat-web-scss",
578
580
  "version": "1.0.0"
579
581
  }`);
@@ -582,7 +584,7 @@ function getCurrentlyUsedPlatforms(tree) {
582
584
  .read(`/xplat/web/scss/_index.scss`)
583
585
  .toString('utf-8');
584
586
  scssUpdate = scssUpdate.replace(`@${npmScope}/scss/index`, `@${npmScope}/xplat-scss/index`);
585
- workspace_1.createOrUpdate(tree, `/xplat/web/scss/_index.scss`, scssUpdate);
587
+ (0, workspace_1.createOrUpdate)(tree, `/xplat/web/scss/_index.scss`, scssUpdate);
586
588
  }
587
589
  }
588
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,12 +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
- let webpackConfig = fs.readFileSync(webpackConfigPath, { encoding: 'utf-8' });
132
+ let webpackConfig = fs.readFileSync(webpackConfigPath, {
133
+ encoding: 'utf-8',
134
+ });
133
135
  webpackConfig = webpackConfig.replace('if (isXplatWorkspace) {', `// opt in when ready to use in your workspace\n const xplatEnvBaseEnabled = false;\n if (xplatEnvBaseEnabled && isXplatWorkspace) {`);
134
- workspace_1.createOrUpdate(tree, `${dirPath}/webpack.config.js`, webpackConfig.replace('<%= pathOffset %>', relativePath));
135
- 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';
136
138
  import { deepMerge } from '@${npmScope}/xplat/utils';
137
139
 
138
140
  export const environmentBase = function (baseWorkspaceEnv: IEnvironment, appEnvironmentCustom: IEnvironment = {}) {
@@ -148,7 +150,7 @@ function updateEnvsForNativeScript() {
148
150
  return deepMerge(baseWorkspaceEnv, appEnvironment);
149
151
  };
150
152
  `);
151
- 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';
152
154
  import { IEnvironment } from '@${npmScope}/xplat/core';
153
155
  import { environmentDev } from '@${npmScope}/xplat/environments';
154
156
 
@@ -156,7 +158,7 @@ function updateEnvsForNativeScript() {
156
158
  // app level customizations here...
157
159
  });
158
160
  `);
159
- 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';
160
162
  import { IEnvironment } from '@${npmScope}/xplat/core';
161
163
  import { environmentProd } from '@${npmScope}/xplat/environments';
162
164
 
@@ -170,8 +172,8 @@ function updateEnvsForNativeScript() {
170
172
  exports.updateEnvsForNativeScript = updateEnvsForNativeScript;
171
173
  function updateWorkspaceFileReplacements() {
172
174
  return (tree, _context) => {
173
- const workspacePath = workspace_1.getWorkspacePath(tree);
174
- 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);
175
177
  if (workspaceJson && workspaceJson.projects) {
176
178
  const projectNames = Object.keys(workspaceJson.projects);
177
179
  for (const name of projectNames) {
@@ -221,7 +223,8 @@ function updateWorkspaceFileReplacements() {
221
223
  if (!updatedFileReplace) {
222
224
  updatedFileReplace = replaceOption;
223
225
  }
224
- updatedFileReplace.replace = updatedFileReplace.replace.replace('libs/core', 'libs/xplat/core/src/lib');
226
+ updatedFileReplace.replace =
227
+ updatedFileReplace.replace.replace('libs/core', 'libs/xplat/core/src/lib');
225
228
  }
226
229
  if (replaceOption.with &&
227
230
  replaceOption.with.indexOf('libs/core') > -1) {
@@ -231,7 +234,8 @@ function updateWorkspaceFileReplacements() {
231
234
  updatedFileReplace.with = updatedFileReplace.with.replace('libs/core', 'libs/xplat/core/src/lib');
232
235
  }
233
236
  if (updatedFileReplace) {
234
- workspaceJson.projects[name][targetProp].build.configurations[configKey].fileReplacements[i] = updatedFileReplace;
237
+ workspaceJson.projects[name][targetProp].build.configurations[configKey].fileReplacements[i] =
238
+ updatedFileReplace;
235
239
  }
236
240
  }
237
241
  }
@@ -255,7 +259,8 @@ function updateWorkspaceFileReplacements() {
255
259
  if (!updatedFileReplace) {
256
260
  updatedFileReplace = replaceOption;
257
261
  }
258
- updatedFileReplace.replace = updatedFileReplace.replace.replace('libs/core', 'libs/xplat/core/src/lib');
262
+ updatedFileReplace.replace =
263
+ updatedFileReplace.replace.replace('libs/core', 'libs/xplat/core/src/lib');
259
264
  }
260
265
  if (replaceOption.with &&
261
266
  replaceOption.with.indexOf('libs/core') > -1) {
@@ -265,7 +270,8 @@ function updateWorkspaceFileReplacements() {
265
270
  updatedFileReplace.with = updatedFileReplace.with.replace('libs/core', 'libs/xplat/core/src/lib');
266
271
  }
267
272
  if (updatedFileReplace) {
268
- workspaceJson.projects[name][targetProp].default.configurations[configKey].fileReplacements[i] = updatedFileReplace;
273
+ workspaceJson.projects[name][targetProp].default.configurations[configKey].fileReplacements[i] =
274
+ updatedFileReplace;
269
275
  }
270
276
  }
271
277
  }
@@ -273,10 +279,10 @@ function updateWorkspaceFileReplacements() {
273
279
  }
274
280
  }
275
281
  }
276
- return xplat_utils_1.updateJsonFile(tree, workspacePath, workspaceJson);
282
+ return (0, xplat_utils_1.updateJsonFile)(tree, workspacePath, workspaceJson);
277
283
  }
278
284
  else {
279
- return schematics_1.noop();
285
+ return (0, schematics_1.noop)();
280
286
  }
281
287
  };
282
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
  });