@nstudio/xplat 13.0.1 → 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.
@@ -25,12 +25,12 @@ xdescribe('feature schematic', () => {
25
25
  };
26
26
  beforeEach(() => {
27
27
  appTree = schematics_1.Tree.empty();
28
- appTree = testing_utils_1.createXplatWithNativeScriptWeb(appTree, null, 'angular');
28
+ appTree = (0, testing_utils_1.createXplatWithNativeScriptWeb)(appTree, null, 'angular');
29
29
  });
30
30
  it('should create feature module with a single starting component', () => __awaiter(void 0, void 0, void 0, function* () {
31
31
  const options = Object.assign({}, defaultOptions);
32
32
  // console.log('appTree:', appTree);
33
- let tree = yield testing_1.runSchematic('feature', options, appTree);
33
+ let tree = yield (0, testing_1.runSchematic)('feature', options, appTree);
34
34
  const files = tree.files;
35
35
  // console.log(files);//.slice(85,files.length));
36
36
  expect(files.indexOf('/apps/nativescript-viewer/package.json')).toBeGreaterThanOrEqual(0);
@@ -62,25 +62,25 @@ xdescribe('feature schematic', () => {
62
62
  expect(files.indexOf('/apps/web-viewer/src/app/features/foo/components/foo/foo.component.ts')).toBeGreaterThanOrEqual(-1);
63
63
  // file content
64
64
  let modulePath = '/libs/xplat/nativescript/features/src/lib/foo/foo.module.ts';
65
- let featureModule = testing_utils_1.getFileContent(tree, modulePath);
65
+ let featureModule = (0, testing_utils_1.getFileContent)(tree, modulePath);
66
66
  // console.log(modulePath + ':');
67
67
  // console.log(featureModule);
68
- expect(featureModule).toMatch(testing_utils_1.isInModuleMetadata('FooModule', 'imports', `UIModule`, true));
68
+ expect(featureModule).toMatch((0, testing_utils_1.isInModuleMetadata)('FooModule', 'imports', `UIModule`, true));
69
69
  expect(featureModule).toMatch(`import { UIModule } from \'../ui/ui.module\'`);
70
70
  modulePath = '/libs/xplat/web/features/src/lib/foo/foo.module.ts';
71
- featureModule = testing_utils_1.getFileContent(tree, modulePath);
71
+ featureModule = (0, testing_utils_1.getFileContent)(tree, modulePath);
72
72
  // console.log(modulePath + ':');
73
73
  // console.log(featureModule);
74
- expect(featureModule).toMatch(testing_utils_1.isInModuleMetadata('FooModule', 'imports', `UIModule`, true));
74
+ expect(featureModule).toMatch((0, testing_utils_1.isInModuleMetadata)('FooModule', 'imports', `UIModule`, true));
75
75
  expect(featureModule).toMatch(`import { UIModule } from \'../ui/ui.module\'`);
76
76
  }));
77
77
  it('should create feature module with a single starting component with framework suffix for xplat when no default is set', () => __awaiter(void 0, void 0, void 0, function* () {
78
78
  appTree = schematics_1.Tree.empty();
79
- appTree = testing_utils_1.createXplatWithNativeScriptWeb(appTree);
79
+ appTree = (0, testing_utils_1.createXplatWithNativeScriptWeb)(appTree);
80
80
  const options = Object.assign({}, defaultOptions);
81
81
  delete options.framework;
82
82
  // console.log('appTree:', appTree);
83
- let tree = yield testing_1.runSchematic('feature', options, appTree);
83
+ let tree = yield (0, testing_1.runSchematic)('feature', options, appTree);
84
84
  const files = tree.files;
85
85
  // console.log(files.slice(85,files.length));
86
86
  expect(files.indexOf('/apps/nativescript-viewer/package.json')).toBeGreaterThanOrEqual(0);
@@ -112,23 +112,23 @@ xdescribe('feature schematic', () => {
112
112
  expect(files.indexOf('/apps/web-viewer/src/app/features/foo/components/foo/foo.component.ts')).toBeGreaterThanOrEqual(-1);
113
113
  // file content
114
114
  let modulePath = '/libs/xplat/nativescript-angular/features/src/lib/foo/foo.module.ts';
115
- let featureModule = testing_utils_1.getFileContent(tree, modulePath);
115
+ let featureModule = (0, testing_utils_1.getFileContent)(tree, modulePath);
116
116
  // console.log(modulePath + ':');
117
117
  // console.log(featureModule);
118
- expect(featureModule).toMatch(testing_utils_1.isInModuleMetadata('FooModule', 'imports', `UIModule`, true));
118
+ expect(featureModule).toMatch((0, testing_utils_1.isInModuleMetadata)('FooModule', 'imports', `UIModule`, true));
119
119
  expect(featureModule).toMatch(`import { UIModule } from \'../ui/ui.module\'`);
120
120
  modulePath = '/libs/xplat/web-angular/features/src/lib/foo/foo.module.ts';
121
- featureModule = testing_utils_1.getFileContent(tree, modulePath);
121
+ featureModule = (0, testing_utils_1.getFileContent)(tree, modulePath);
122
122
  // console.log(modulePath + ':');
123
123
  // console.log(featureModule);
124
- expect(featureModule).toMatch(testing_utils_1.isInModuleMetadata('FooModule', 'imports', `UIModule`, true));
124
+ expect(featureModule).toMatch((0, testing_utils_1.isInModuleMetadata)('FooModule', 'imports', `UIModule`, true));
125
125
  expect(featureModule).toMatch(`import { UIModule } from \'../ui/ui.module\'`);
126
126
  }));
127
127
  it('should create feature module WITHOUT a single starting component when using onlyModule', () => __awaiter(void 0, void 0, void 0, function* () {
128
128
  // console.log('appTree:', appTree);
129
129
  const options = Object.assign({}, defaultOptions);
130
130
  options.onlyModule = true;
131
- let tree = yield testing_1.runSchematic('feature', options, appTree);
131
+ let tree = yield (0, testing_1.runSchematic)('feature', options, appTree);
132
132
  const files = tree.files;
133
133
  // console.log(files.slice(85,files.length));
134
134
  expect(files.indexOf('/apps/nativescript-viewer/package.json')).toBeGreaterThanOrEqual(0);
@@ -151,18 +151,18 @@ xdescribe('feature schematic', () => {
151
151
  expect(files.indexOf('/libs/xplat/web/features/src/lib/foo/components/foo/foo.component.ts')).toBe(-1);
152
152
  // file content
153
153
  let modulePath = '/libs/xplat/nativescript/features/src/lib/foo/foo.module.ts';
154
- let featureModule = testing_utils_1.getFileContent(tree, modulePath);
154
+ let featureModule = (0, testing_utils_1.getFileContent)(tree, modulePath);
155
155
  // console.log(modulePath + ':');
156
156
  // console.log(featureModule);
157
- expect(featureModule).toMatch(testing_utils_1.isInModuleMetadata('FooModule', 'imports', `UIModule`, true));
157
+ expect(featureModule).toMatch((0, testing_utils_1.isInModuleMetadata)('FooModule', 'imports', `UIModule`, true));
158
158
  expect(featureModule).toMatch(`import { UIModule } from \'../ui/ui.module\'`);
159
159
  expect(featureModule.indexOf('FOO_COMPONENTS')).toBe(-1);
160
160
  expect(featureModule.indexOf('declarations')).toBe(-1);
161
161
  modulePath = '/libs/xplat/nativescript/features/src/lib/foo/foo.module.ts';
162
- featureModule = testing_utils_1.getFileContent(tree, modulePath);
162
+ featureModule = (0, testing_utils_1.getFileContent)(tree, modulePath);
163
163
  // console.log(modulePath + ':');
164
164
  // console.log(featureModule);
165
- expect(featureModule).toMatch(testing_utils_1.isInModuleMetadata('FooModule', 'imports', `UIModule`, true));
165
+ expect(featureModule).toMatch((0, testing_utils_1.isInModuleMetadata)('FooModule', 'imports', `UIModule`, true));
166
166
  expect(featureModule).toMatch(`import { UIModule } from \'../ui/ui.module\'`);
167
167
  }));
168
168
  it('should create feature module WITH a single starting component BUT IGNORE creating matching base component', () => __awaiter(void 0, void 0, void 0, function* () {
@@ -171,7 +171,7 @@ xdescribe('feature schematic', () => {
171
171
  name: 'foo',
172
172
  platforms: 'web',
173
173
  };
174
- let tree = yield testing_1.runSchematic('feature', options, appTree);
174
+ let tree = yield (0, testing_1.runSchematic)('feature', options, appTree);
175
175
  const files = tree.files;
176
176
  // console.log(files.slice(85,files.length));
177
177
  // shared code defaults
@@ -192,15 +192,15 @@ xdescribe('feature schematic', () => {
192
192
  expect(files.indexOf('/libs/xplat/web/features/src/lib/foo/components/foo/foo.component.ts')).toBeGreaterThanOrEqual(0);
193
193
  // file content
194
194
  let modulePath = '/libs/xplat/web/features/src/lib/foo/foo.module.ts';
195
- let featureModule = testing_utils_1.getFileContent(tree, modulePath);
195
+ let featureModule = (0, testing_utils_1.getFileContent)(tree, modulePath);
196
196
  // console.log(modulePath + ':');
197
197
  // console.log(featureModule);
198
- expect(featureModule).toMatch(testing_utils_1.isInModuleMetadata('FooModule', 'imports', `UIModule`, true));
198
+ expect(featureModule).toMatch((0, testing_utils_1.isInModuleMetadata)('FooModule', 'imports', `UIModule`, true));
199
199
  expect(featureModule).toMatch(`import { UIModule } from \'../ui/ui.module\'`);
200
200
  expect(featureModule.indexOf('FOO_COMPONENTS')).toBeGreaterThanOrEqual(0);
201
201
  expect(featureModule.indexOf('declarations')).toBeGreaterThanOrEqual(0);
202
202
  let compPath = '/libs/xplat/web/features/src/lib/foo/components/foo/foo.component.ts';
203
- let compContent = testing_utils_1.getFileContent(tree, compPath);
203
+ let compContent = (0, testing_utils_1.getFileContent)(tree, compPath);
204
204
  // console.log(compPath + ':');
205
205
  // console.log(compContent);
206
206
  expect(compContent.indexOf('extends BaseComponent')).toBeGreaterThanOrEqual(0);
@@ -209,7 +209,7 @@ xdescribe('feature schematic', () => {
209
209
  const options = Object.assign({}, defaultOptions);
210
210
  // console.log('appTree:', appTree);
211
211
  options.onlyProject = true;
212
- let tree = yield testing_1.runSchematic('feature', options, appTree);
212
+ let tree = yield (0, testing_1.runSchematic)('feature', options, appTree);
213
213
  const files = tree.files;
214
214
  // console.log(files.slice(85,files.length));
215
215
  // feature should not be in shared code
@@ -239,33 +239,33 @@ xdescribe('feature schematic', () => {
239
239
  expect(files.indexOf('/libs/xplat/web/features/src/lib/foo/components/foo/foo.component.ts')).toBeGreaterThanOrEqual(-1);
240
240
  // file content
241
241
  let modulePath = '/apps/nativescript-viewer/src/features/foo/foo.module.ts';
242
- let featureModule = testing_utils_1.getFileContent(tree, modulePath);
242
+ let featureModule = (0, testing_utils_1.getFileContent)(tree, modulePath);
243
243
  // console.log(modulePath + ':');
244
244
  // console.log(featureModule);
245
- expect(featureModule).toMatch(testing_utils_1.isInModuleMetadata('FooModule', 'imports', `SharedModule`, true));
245
+ expect(featureModule).toMatch((0, testing_utils_1.isInModuleMetadata)('FooModule', 'imports', `SharedModule`, true));
246
246
  expect(featureModule).toMatch(`import { SharedModule } from \'../shared/shared.module\'`);
247
247
  modulePath = '/apps/web-viewer/src/app/features/foo/foo.module.ts';
248
- featureModule = testing_utils_1.getFileContent(tree, modulePath);
248
+ featureModule = (0, testing_utils_1.getFileContent)(tree, modulePath);
249
249
  // console.log(modulePath + ':');
250
250
  // console.log(featureModule);
251
- expect(featureModule).toMatch(testing_utils_1.isInModuleMetadata('FooModule', 'imports', `SharedModule`, true));
251
+ expect(featureModule).toMatch((0, testing_utils_1.isInModuleMetadata)('FooModule', 'imports', `SharedModule`, true));
252
252
  expect(featureModule).toMatch(`import { SharedModule } from \'../shared/shared.module\'`);
253
253
  }));
254
254
  it('Temporary: should error if routing is used without onlyProject', () => __awaiter(void 0, void 0, void 0, function* () {
255
255
  const options = Object.assign({}, defaultOptions);
256
256
  // console.log('appTree:', appTree);
257
257
  options.routing = true;
258
- yield expect(testing_1.runSchematic('feature', options, appTree)).rejects.toThrow('When generating a feature with the --routing option, please also specify --onlyProject. Support for shared code routing is under development.');
258
+ yield expect((0, testing_1.runSchematic)('feature', options, appTree)).rejects.toThrow('When generating a feature with the --routing option, please also specify --onlyProject. Support for shared code routing is under development.');
259
259
  }));
260
260
  it('should create feature module (with dashes in name) for specified projects WITH Routing', () => __awaiter(void 0, void 0, void 0, function* () {
261
261
  appTree = schematics_1.Tree.empty();
262
- appTree = testing_utils_1.createXplatWithNativeScriptWeb(appTree, true);
262
+ appTree = (0, testing_utils_1.createXplatWithNativeScriptWeb)(appTree, true);
263
263
  const options = Object.assign({}, defaultOptions);
264
264
  // console.log('appTree:', appTree);
265
265
  options.onlyProject = true;
266
266
  options.routing = true;
267
267
  options.name = 'foo-with-dash';
268
- let tree = yield testing_1.runSchematic('feature', options, appTree);
268
+ let tree = yield (0, testing_1.runSchematic)('feature', options, appTree);
269
269
  const files = tree.files;
270
270
  // console.log(files.slice(85,files.length));
271
271
  // feature should not be in shared code
@@ -283,7 +283,7 @@ xdescribe('feature schematic', () => {
283
283
  expect(files.indexOf('/apps/web-viewer/src/app/features/foo-with-dash/components/foo-with-dash/foo-with-dash.component.ts')).toBeGreaterThanOrEqual(0);
284
284
  // file content
285
285
  let modulePath = '/apps/nativescript-viewer/src/features/foo-with-dash/foo-with-dash.module.ts';
286
- let featureModule = testing_utils_1.getFileContent(tree, modulePath);
286
+ let featureModule = (0, testing_utils_1.getFileContent)(tree, modulePath);
287
287
  // console.log(modulePath + ':');
288
288
  // console.log(featureModule);
289
289
  expect(featureModule).toMatch(`import { NativeScriptRouterModule } from \'nativescript-angular/router\'`);
@@ -292,7 +292,7 @@ xdescribe('feature schematic', () => {
292
292
  expect(featureModule).toMatch(`NativeScriptRouterModule.forChild`);
293
293
  modulePath =
294
294
  '/apps/web-viewer/src/app/features/foo-with-dash/foo-with-dash.module.ts';
295
- featureModule = testing_utils_1.getFileContent(tree, modulePath);
295
+ featureModule = (0, testing_utils_1.getFileContent)(tree, modulePath);
296
296
  // console.log(modulePath + ':');
297
297
  // console.log(featureModule);
298
298
  expect(featureModule).toMatch(`import { RouterModule, Routes } from \'@angular/router\'`);
@@ -301,14 +301,14 @@ xdescribe('feature schematic', () => {
301
301
  expect(featureModule).toMatch(`RouterModule.forChild`);
302
302
  // check if there was a root app.routing.ts module modified
303
303
  modulePath = '/apps/web-viewer/src/app/app.routing.ts';
304
- featureModule = testing_utils_1.getFileContent(tree, modulePath);
304
+ featureModule = (0, testing_utils_1.getFileContent)(tree, modulePath);
305
305
  // console.log(modulePath + ':');
306
306
  // console.log(featureModule);
307
307
  expect(featureModule).toMatch(`import { RouterModule, Routes } from \'@angular/router\'`);
308
308
  expect(featureModule).toMatch(`loadChildren: () =>`);
309
309
  expect(featureModule).toMatch(`'./features/foo-with-dash/foo-with-dash.module'`);
310
310
  modulePath = '/apps/nativescript-viewer/src/app.routing.ts';
311
- featureModule = testing_utils_1.getFileContent(tree, modulePath);
311
+ featureModule = (0, testing_utils_1.getFileContent)(tree, modulePath);
312
312
  // console.log(modulePath + ':');
313
313
  // console.log(featureModule);
314
314
  expect(featureModule).toMatch(`loadChildren: () =>`);
@@ -316,7 +316,7 @@ xdescribe('feature schematic', () => {
316
316
  // check that name with dash was handled right
317
317
  modulePath =
318
318
  '/apps/web-viewer/src/app/features/foo-with-dash/components/index.ts';
319
- featureModule = testing_utils_1.getFileContent(tree, modulePath);
319
+ featureModule = (0, testing_utils_1.getFileContent)(tree, modulePath);
320
320
  // console.log(modulePath + ':');
321
321
  // console.log(featureModule);
322
322
  expect(featureModule).toMatch(`export const FOOWITHDASH_COMPONENTS`);
@@ -324,16 +324,16 @@ xdescribe('feature schematic', () => {
324
324
  it('should create feature module for specified project WITH Routing and adjustSandbox', () => __awaiter(void 0, void 0, void 0, function* () {
325
325
  const options = Object.assign(Object.assign({}, defaultOptions), { projects: 'nativescript-viewer' });
326
326
  appTree = schematics_1.Tree.empty();
327
- appTree = testing_utils_1.createXplatWithNativeScriptWeb(appTree, true);
327
+ appTree = (0, testing_utils_1.createXplatWithNativeScriptWeb)(appTree, true);
328
328
  // manually update home.component to prep for sandobx
329
329
  const homeCmpPath = `/apps/nativescript-viewer/src/features/home/components/home.component.html`;
330
- workspace_1.createOrUpdate(appTree, homeCmpPath, sandboxHomeSetup());
330
+ (0, workspace_1.createOrUpdate)(appTree, homeCmpPath, sandboxHomeSetup());
331
331
  // console.log('homecmp:', getFileContent(tree, homeCmpPath));
332
332
  options.onlyProject = true;
333
333
  options.adjustSandbox = true;
334
334
  options.routing = true;
335
335
  options.name = 'foo-with-dash';
336
- let tree = yield testing_1.runSchematic('feature', options, appTree);
336
+ let tree = yield (0, testing_1.runSchematic)('feature', options, appTree);
337
337
  // console.log('---------')
338
338
  // console.log('homecmp:', getFileContent(tree, homeCmpPath));
339
339
  }));
@@ -9,9 +9,9 @@ const platformToPackage = {
9
9
  };
10
10
  function default_1(options) {
11
11
  if (!options.name) {
12
- throw new schematics_1.SchematicsException(xplat_1.missingArgument('name', `Provide a comma delimited list of helpers to generate like this for 'applitools'.`, 'nx g @nstudio/xplat:helpers applitools --target=web-myapp'));
12
+ throw new schematics_1.SchematicsException((0, xplat_1.missingArgument)('name', `Provide a comma delimited list of helpers to generate like this for 'applitools'.`, 'nx g @nstudio/xplat:helpers applitools --target=web-myapp'));
13
13
  }
14
- const platforms = (xplat_utils_1.sanitizeCommaDelimitedArg(options.platforms));
14
+ const platforms = ((0, xplat_utils_1.sanitizeCommaDelimitedArg)(options.platforms));
15
15
  const helperChains = [];
16
16
  const processHelpers = (platform) => {
17
17
  // get helper support config
@@ -30,9 +30,9 @@ function default_1(options) {
30
30
  }
31
31
  // if platform is still falsey, error out
32
32
  if (!platform) {
33
- throw new schematics_1.SchematicsException(xplat_1.helperMissingPlatforms());
33
+ throw new schematics_1.SchematicsException((0, xplat_1.helperMissingPlatforms)());
34
34
  }
35
- helperChains.push(schematics_1.externalSchematic(platformToPackage[platform], 'helpers', {
35
+ helperChains.push((0, schematics_1.externalSchematic)(platformToPackage[platform], 'helpers', {
36
36
  name: options.name,
37
37
  target: options.target,
38
38
  }));
@@ -43,15 +43,15 @@ function default_1(options) {
43
43
  processHelpers(platform);
44
44
  }
45
45
  else {
46
- throw new schematics_1.SchematicsException(xplat_1.unsupportedPlatformError(platform));
46
+ throw new schematics_1.SchematicsException((0, xplat_1.unsupportedPlatformError)(platform));
47
47
  }
48
48
  }
49
49
  }
50
50
  else {
51
51
  processHelpers();
52
52
  }
53
- return schematics_1.chain([
54
- xplat_utils_1.prerun(),
53
+ return (0, schematics_1.chain)([
54
+ (0, xplat_utils_1.prerun)(),
55
55
  // add helper chains
56
56
  ...helperChains,
57
57
  ]);
@@ -13,12 +13,12 @@ const schematics_1 = require("@angular-devkit/schematics");
13
13
  const xplat_utils_1 = require("@nstudio/xplat-utils");
14
14
  const testing_1 = require("@nstudio/xplat/testing");
15
15
  const testing_2 = require("../../utils/testing");
16
- xplat_utils_1.setTest();
16
+ (0, xplat_utils_1.setTest)();
17
17
  describe('xplat-helper schematic', () => {
18
18
  let appTree;
19
19
  beforeEach(() => {
20
20
  appTree = schematics_1.Tree.empty();
21
- appTree = testing_1.createEmptyWorkspace(appTree);
21
+ appTree = (0, testing_1.createEmptyWorkspace)(appTree);
22
22
  });
23
23
  it('generating helper for a platform where the helper is not supported should not do anything', () => __awaiter(void 0, void 0, void 0, function* () {
24
24
  const optionsXplat = {
@@ -26,13 +26,13 @@ describe('xplat-helper schematic', () => {
26
26
  prefix: 'tt',
27
27
  platforms: 'web,nativescript',
28
28
  };
29
- appTree = yield testing_2.runSchematic('init', optionsXplat, appTree);
29
+ appTree = yield (0, testing_2.runSchematic)('init', optionsXplat, appTree);
30
30
  const options = {
31
31
  name: 'imports',
32
32
  platforms: 'web',
33
33
  };
34
34
  // console.log('appTree:', appTree);
35
- const tree = yield testing_2.runSchematic('helpers', options, appTree);
35
+ const tree = yield (0, testing_2.runSchematic)('helpers', options, appTree);
36
36
  const files = tree.files;
37
37
  // console.log(files);
38
38
  // xplat helpers
@@ -37,7 +37,7 @@ function default_1(options) {
37
37
  }
38
38
  }
39
39
  else {
40
- throw new schematics_1.SchematicsException(utils_1.unsupportedFrameworkError(framework));
40
+ throw new schematics_1.SchematicsException((0, utils_1.unsupportedFrameworkError)(framework));
41
41
  }
42
42
  }
43
43
  }
@@ -50,7 +50,7 @@ function default_1(options) {
50
50
  }
51
51
  }
52
52
  else {
53
- const platforms = xplat_utils_1.sanitizeCommaDelimitedArg(platformArg);
53
+ const platforms = (0, xplat_utils_1.sanitizeCommaDelimitedArg)(platformArg);
54
54
  if (frameworks.length) {
55
55
  for (const framework of frameworks) {
56
56
  if (xplat_utils_1.supportedFrameworks.includes(framework)) {
@@ -65,12 +65,12 @@ function default_1(options) {
65
65
  versions_1.xplatVersion;
66
66
  }
67
67
  else if (xplat_utils_1.supportedPlatformsWithNx.includes(platform)) {
68
- throw new schematics_1.SchematicsException(utils_1.unsupportedPlatformErrorWithNxNote(platform, 'xplat'));
68
+ throw new schematics_1.SchematicsException((0, utils_1.unsupportedPlatformErrorWithNxNote)(platform, 'xplat'));
69
69
  }
70
70
  }
71
71
  }
72
72
  else {
73
- throw new schematics_1.SchematicsException(utils_1.unsupportedFrameworkError(framework));
73
+ throw new schematics_1.SchematicsException((0, utils_1.unsupportedFrameworkError)(framework));
74
74
  }
75
75
  }
76
76
  }
@@ -82,10 +82,10 @@ function default_1(options) {
82
82
  packagesToRunXplat.push(packageName);
83
83
  }
84
84
  else if (xplat_utils_1.supportedPlatformsWithNx.includes(platform)) {
85
- throw new schematics_1.SchematicsException(utils_1.unsupportedPlatformErrorWithNxNote(platform, 'xplat'));
85
+ throw new schematics_1.SchematicsException((0, utils_1.unsupportedPlatformErrorWithNxNote)(platform, 'xplat'));
86
86
  }
87
87
  else {
88
- throw new schematics_1.SchematicsException(xplat_1.unsupportedPlatformError(platform));
88
+ throw new schematics_1.SchematicsException((0, xplat_1.unsupportedPlatformError)(platform));
89
89
  }
90
90
  }
91
91
  }
@@ -93,7 +93,7 @@ function default_1(options) {
93
93
  externalChains.push((tree, context) => {
94
94
  // check if other nstudio or nrwl dependencies are needed
95
95
  // check user's package for current version
96
- const packageJson = xplat_utils_1.getJsonFromFile(tree, 'package.json');
96
+ const packageJson = (0, xplat_utils_1.getJsonFromFile)(tree, 'package.json');
97
97
  if (packageJson) {
98
98
  for (const packageName in devDependencies) {
99
99
  if (utils_1.packageInnerDependencies[packageName]) {
@@ -128,7 +128,7 @@ function default_1(options) {
128
128
  // necessary to unit test the appropriately
129
129
  if (packagesToRunXplat.length) {
130
130
  for (const packageName of packagesToRunXplat) {
131
- externalChains.push(schematics_1.externalSchematic(packageName, 'xplat', options, {
131
+ externalChains.push((0, schematics_1.externalSchematic)(packageName, 'xplat', options, {
132
132
  interactive: false,
133
133
  }));
134
134
  }
@@ -150,17 +150,17 @@ function default_1(options) {
150
150
  }
151
151
  }
152
152
  else {
153
- return schematics_1.noop()(tree, context);
153
+ return (0, schematics_1.noop)()(tree, context);
154
154
  }
155
155
  });
156
156
  }
157
- return schematics_1.chain([
158
- xplat_utils_1.prerun(options, true),
159
- (tree) => schematics_1.chain(externalChains),
157
+ return (0, schematics_1.chain)([
158
+ (0, xplat_utils_1.prerun)(options, true),
159
+ (tree) => (0, schematics_1.chain)(externalChains),
160
160
  // addInstallTask(),
161
161
  focus_1.FocusHelpers.updateIDESettings(options),
162
162
  // after initializing new platforms always reset dev mode to fullstack to ensure user sees it
163
- schematics_1.externalSchematic('@nstudio/xplat', 'mode', {
163
+ (0, schematics_1.externalSchematic)('@nstudio/xplat', 'mode', {
164
164
  name: 'fullstack',
165
165
  }),
166
166
  ]);
@@ -15,7 +15,7 @@ const testing_1 = require("@nstudio/xplat/testing");
15
15
  const testing_2 = require("../../utils/testing");
16
16
  const utils_1 = require("../../utils");
17
17
  const testing_3 = require("@nrwl/workspace/testing");
18
- xplat_utils_1.setTest();
18
+ (0, xplat_utils_1.setTest)();
19
19
  describe('xplat init', () => {
20
20
  let appTree;
21
21
  const defaultOptions = {
@@ -24,16 +24,16 @@ describe('xplat init', () => {
24
24
  isTesting: true,
25
25
  };
26
26
  beforeEach(() => {
27
- appTree = testing_1.createEmptyWorkspace(schematics_1.Tree.empty());
27
+ appTree = (0, testing_1.createEmptyWorkspace)(schematics_1.Tree.empty());
28
28
  });
29
29
  it('should init default xplat deps', () => __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('init', options, appTree);
33
+ const tree = yield (0, testing_2.runSchematic)('init', options, appTree);
34
34
  const files = tree.files;
35
35
  // console.log('files:', files);
36
- let packageJson = JSON.parse(testing_3.getFileContent(tree, 'package.json'));
36
+ let packageJson = JSON.parse((0, testing_3.getFileContent)(tree, 'package.json'));
37
37
  // console.log(packageJson);
38
38
  const devDeps = [
39
39
  '@nrwl/angular',
@@ -53,28 +53,28 @@ describe('xplat init', () => {
53
53
  const options = Object.assign({}, defaultOptions);
54
54
  options.platforms = 'web,nativescript';
55
55
  options.framework = 'angular';
56
- const tree = yield testing_2.runSchematic('init', options, appTree);
56
+ const tree = yield (0, testing_2.runSchematic)('init', options, appTree);
57
57
  // const files = tree.files;
58
58
  // console.log('files:', files);
59
59
  expect(tree.exists('/libs/xplat/web/core/src/lib/index.ts')).toBeTruthy();
60
60
  expect(tree.exists('/libs/xplat/nativescript/core/src/lib/index.ts')).toBeTruthy();
61
61
  expect(tree.exists('/libs/xplat/web-angular/core/src/lib/index.ts')).toBeFalsy();
62
62
  expect(tree.exists('/libs/xplat/nativescript-angular/core/src/lib/index.ts')).toBeFalsy();
63
- let packageJson = JSON.parse(testing_3.getFileContent(tree, 'package.json'));
63
+ let packageJson = JSON.parse((0, testing_3.getFileContent)(tree, 'package.json'));
64
64
  // console.log(packageJson);
65
65
  expect(packageJson.xplat.framework).toBe('angular');
66
66
  }));
67
67
  it('should NOT create unsupported platform xplat option and throw', () => __awaiter(void 0, void 0, void 0, function* () {
68
68
  const options = Object.assign({}, defaultOptions);
69
69
  options.platforms = 'desktop';
70
- yield expect(testing_2.runSchematic('init', options, appTree)).rejects.toThrow(`desktop is currently not a supported platform. Supported at the moment: ${xplat_utils_1.supportedPlatforms}. Please request support for this platform if you'd like and/or submit a PR which we would greatly appreciate.`);
70
+ yield expect((0, testing_2.runSchematic)('init', options, appTree)).rejects.toThrow(`desktop is currently not a supported platform. Supported at the moment: ${xplat_utils_1.supportedPlatforms}. Please request support for this platform if you'd like and/or submit a PR which we would greatly appreciate.`);
71
71
  }));
72
72
  it('should NOT create unsupported framework xplat option and throw', () => __awaiter(void 0, void 0, void 0, function* () {
73
73
  const options = Object.assign({}, defaultOptions);
74
74
  options.platforms = 'web';
75
75
  options.framework = 'blah';
76
76
  let tree;
77
- yield expect(testing_2.runSchematic('init', options, appTree)).rejects.toThrow(`blah is currently not a supported framework. Supported at the moment: ${xplat_utils_1.supportedFrameworks.map((f) => utils_1.stringUtils.capitalize(f))}. Please request support for this framework if you'd like and/or submit a PR which we would greatly appreciate.`);
77
+ yield expect((0, testing_2.runSchematic)('init', options, appTree)).rejects.toThrow(`blah is currently not a supported framework. Supported at the moment: ${xplat_utils_1.supportedFrameworks.map((f) => utils_1.stringUtils.capitalize(f))}. Please request support for this framework if you'd like and/or submit a PR which we would greatly appreciate.`);
78
78
  }));
79
79
  /**
80
80
  * TODO: This passes when run with "fdescribe" only
@@ -3,9 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const schematics_1 = require("@angular-devkit/schematics");
4
4
  const xplat_utils_1 = require("@nstudio/xplat-utils");
5
5
  function default_1(options) {
6
- return schematics_1.chain([
7
- xplat_utils_1.prerun(options, true),
8
- (tree, context) => schematics_1.externalSchematic('@nstudio/focus', 'mode', options),
6
+ return (0, schematics_1.chain)([
7
+ (0, xplat_utils_1.prerun)(options, true),
8
+ (tree, context) => (0, schematics_1.externalSchematic)('@nstudio/focus', 'mode', options),
9
9
  ]);
10
10
  }
11
11
  exports.default = default_1;
@@ -3,9 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const schematics_1 = require("@angular-devkit/schematics");
4
4
  const xplat_utils_1 = require("@nstudio/xplat-utils");
5
5
  function default_1(options) {
6
- return schematics_1.chain([
7
- xplat_utils_1.prerun(options, true),
8
- (tree, context) => schematics_1.externalSchematic('@nstudio/xplat', 'init', options),
6
+ return (0, schematics_1.chain)([
7
+ (0, xplat_utils_1.prerun)(options, true),
8
+ (tree, context) => (0, schematics_1.externalSchematic)('@nstudio/xplat', 'init', options),
9
9
  ]);
10
10
  }
11
11
  exports.default = default_1;
package/src/utils/ast.js CHANGED
@@ -283,7 +283,7 @@ function insert(host, modulePath, changes) {
283
283
  }
284
284
  exports.insert = insert;
285
285
  function getProjectConfig(tree, name) {
286
- const workspaceJson = general_1.readWorkspaceJson(tree);
286
+ const workspaceJson = (0, general_1.readWorkspaceJson)(tree);
287
287
  const projectConfig = workspaceJson.projects[name];
288
288
  if (!projectConfig) {
289
289
  throw new Error(`Cannot find project '${name}'`);
@@ -35,7 +35,7 @@ function hasWebPlatform(targetPlatforms) {
35
35
  exports.hasWebPlatform = hasWebPlatform;
36
36
  function updatePackageForNgrx(tree, packagePath = 'package.json') {
37
37
  if (tree.exists(packagePath)) {
38
- const packageJson = xplat_utils_1.getJsonFromFile(tree, packagePath);
38
+ const packageJson = (0, xplat_utils_1.getJsonFromFile)(tree, packagePath);
39
39
  if (packageJson) {
40
40
  // sync version with what user has store set at
41
41
  let rootNgrxVersion = packageJson.dependencies
@@ -47,7 +47,7 @@ function updatePackageForNgrx(tree, packagePath = 'package.json') {
47
47
  };
48
48
  packageJson.dependencies = Object.assign(Object.assign({}, (packageJson.dependencies || {})), dependencies);
49
49
  packageJson.devDependencies = Object.assign(Object.assign({}, (packageJson.devDependencies || {})), devDependencies);
50
- return xplat_utils_1.updateJsonFile(tree, packagePath, packageJson);
50
+ return (0, xplat_utils_1.updateJsonFile)(tree, packagePath, packageJson);
51
51
  }
52
52
  }
53
53
  return tree;
@@ -69,25 +69,25 @@ function updateTsConfig(tree, callback, targetSuffix = '', prefixPath = '') {
69
69
  }
70
70
  }
71
71
  // console.log('tsConfigPath:', tsConfigPath)
72
- const tsConfig = xplat_utils_1.getJsonFromFile(tree, tsConfigPath);
72
+ const tsConfig = (0, xplat_utils_1.getJsonFromFile)(tree, tsConfigPath);
73
73
  callback(tsConfig);
74
- return xplat_utils_1.updateJsonFile(tree, tsConfigPath, tsConfig);
74
+ return (0, xplat_utils_1.updateJsonFile)(tree, tsConfigPath, tsConfig);
75
75
  }
76
76
  exports.updateTsConfig = updateTsConfig;
77
77
  function updatePackageScripts(tree, scripts) {
78
78
  const path = 'package.json';
79
- const packageJson = xplat_utils_1.getJsonFromFile(tree, path);
79
+ const packageJson = (0, xplat_utils_1.getJsonFromFile)(tree, path);
80
80
  const scriptsMap = Object.assign({}, packageJson.scripts);
81
81
  packageJson.scripts = Object.assign(scriptsMap, scripts);
82
- return xplat_utils_1.updateJsonFile(tree, path, packageJson);
82
+ return (0, xplat_utils_1.updateJsonFile)(tree, path, packageJson);
83
83
  }
84
84
  exports.updatePackageScripts = updatePackageScripts;
85
85
  function readWorkspaceJson(tree) {
86
- return workspace_1.readJsonInTree(tree, workspace_1.getWorkspacePath(tree));
86
+ return (0, workspace_1.readJsonInTree)(tree, (0, workspace_1.getWorkspacePath)(tree));
87
87
  }
88
88
  exports.readWorkspaceJson = readWorkspaceJson;
89
89
  function updateWorkspace(updates) {
90
- return workspace_1.updateWorkspaceInTree((json) => {
90
+ return (0, workspace_1.updateWorkspaceInTree)((json) => {
91
91
  for (const key in updates) {
92
92
  json[key] = Object.assign(Object.assign({}, (json[key] || {})), updates[key]);
93
93
  }
@@ -111,8 +111,8 @@ function getDefaultTemplateOptions() {
111
111
  return {
112
112
  tmpl: '',
113
113
  utils: exports.stringUtils,
114
- npmScope: xplat_utils_1.getNpmScope(),
115
- prefix: xplat_utils_1.getPrefix(),
114
+ npmScope: (0, xplat_utils_1.getNpmScope)(),
115
+ prefix: (0, xplat_utils_1.getPrefix)(),
116
116
  dot: '.',
117
117
  };
118
118
  }
@@ -6,7 +6,7 @@ const errors_1 = require("./errors");
6
6
  function buildHelperChain(helper, options, config, helperChain) {
7
7
  // throw if target required and it's missing
8
8
  if (config.requiresTarget && !options.target) {
9
- throw new schematics_1.SchematicsException(errors_1.helperTargetError(helper));
9
+ throw new schematics_1.SchematicsException((0, errors_1.helperTargetError)(helper));
10
10
  }
11
11
  if (config.addHelperFiles) {
12
12
  // add files for the helper
@@ -13,9 +13,9 @@ exports.updateConfig = void 0;
13
13
  const fs = require("fs");
14
14
  const path = require("path");
15
15
  const util_1 = require("util");
16
- const fsExists = util_1.promisify(fs.exists);
17
- const fsWriteFile = util_1.promisify(fs.writeFile);
18
- const fsReadFile = util_1.promisify(fs.readFile);
16
+ const fsExists = (0, util_1.promisify)(fs.exists);
17
+ const fsWriteFile = (0, util_1.promisify)(fs.writeFile);
18
+ const fsReadFile = (0, util_1.promisify)(fs.readFile);
19
19
  function updateConfig() {
20
20
  return __awaiter(this, void 0, void 0, function* () {
21
21
  const cwd = process.cwd();
@@ -353,9 +353,9 @@ function createNativeScriptAngularApp(tree, withRouting) {
353
353
  }
354
354
  }
355
355
  exports.createNativeScriptAngularApp = createNativeScriptAngularApp;
356
- const isInModuleMetadata = (moduleName, property, value, inArray) => exports.isInDecoratorMetadata(moduleName, property, value, 'NgModule', inArray);
356
+ const isInModuleMetadata = (moduleName, property, value, inArray) => (0, exports.isInDecoratorMetadata)(moduleName, property, value, 'NgModule', inArray);
357
357
  exports.isInModuleMetadata = isInModuleMetadata;
358
- const isInComponentMetadata = (componentName, property, value, inArray) => exports.isInDecoratorMetadata(componentName, property, value, 'Component', inArray);
358
+ const isInComponentMetadata = (componentName, property, value, inArray) => (0, exports.isInDecoratorMetadata)(componentName, property, value, 'Component', inArray);
359
359
  exports.isInComponentMetadata = isInComponentMetadata;
360
360
  const isInDecoratorMetadata = (moduleName, property, value, decoratorName, inArray) => new RegExp(`@${decoratorName}\\(\\{([^}]*)` +
361
361
  objectContaining(property, value, inArray) +
@@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.runMigration = exports.callRule = exports.runSchematic = void 0;
4
4
  const path_1 = require("path");
5
5
  const testing_1 = require("@angular-devkit/schematics/testing");
6
- const testRunner = new testing_1.SchematicTestRunner('@nstudio/xplat', path_1.join(__dirname, '../../collection.json'));
7
- const migrationTestRunner = new testing_1.SchematicTestRunner('@nstudio/xplat/migrations', path_1.join(__dirname, '../../migrations.json'));
6
+ const testRunner = new testing_1.SchematicTestRunner('@nstudio/xplat', (0, path_1.join)(__dirname, '../../collection.json'));
7
+ const migrationTestRunner = new testing_1.SchematicTestRunner('@nstudio/xplat/migrations', (0, path_1.join)(__dirname, '../../migrations.json'));
8
8
  function runSchematic(schematicName, options, tree) {
9
9
  return testRunner.runSchematicAsync(schematicName, options, tree).toPromise();
10
10
  }
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.nxVersion = exports.xplatVersion = void 0;
4
- exports.xplatVersion = '13.0.1';
4
+ exports.xplatVersion = '13.4.0';
5
5
  exports.nxVersion = '^13.0.0';