@nstudio/angular 15.0.4-rc.0 → 16.2.0-beta.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 +19 -13
- package/collection.json +1 -1
- package/package.json +3 -3
- package/src/schematics/application/index.js +2 -2
- package/src/schematics/component/index.js +1 -1
- package/src/schematics/elements/index.js +2 -2
- package/src/schematics/feature/index.js +1 -1
- package/src/schematics/helpers/index.js +1 -1
- package/src/schematics/ngrx/_files/__name__.effects.spec.ts__tmpl__ +1 -1
- package/src/schematics/xplat/index.js +1 -1
- package/src/utils/ast.d.ts +3 -3
- package/src/utils/ast.js +6 -10
- package/src/utils/generator.d.ts +1 -1
- package/src/utils/generator.js +37 -22
- package/src/utils/testing.js +2 -2
- package/src/utils/versions.d.ts +3 -3
- package/src/utils/versions.js +4 -4
- package/src/utils/xplat.js +4 -4
package/README.md
CHANGED
@@ -24,13 +24,19 @@
|
|
24
24
|
|
25
25
|
```
|
26
26
|
npx create-nx-workspace@latest
|
27
|
-
```
|
28
27
|
|
29
|
-
|
28
|
+
// Choose "Integrated monorepo" at the prompt:
|
29
|
+
|
30
|
+
? Choose what to create …
|
31
|
+
> Integrated monorepo: Nx configures your favorite frameworks and lets you focus on shipping features.
|
30
32
|
|
31
|
-
|
33
|
+
// Choose "apps" at the prompt:
|
34
|
+
|
35
|
+
? What to create in the new workspace …
|
36
|
+
> apps [an empty monorepo with no plugins with a layout that works best for building apps]
|
37
|
+
```
|
32
38
|
|
33
|
-
|
39
|
+
Install the tools:
|
34
40
|
|
35
41
|
```
|
36
42
|
npm i @nstudio/xplat -D
|
@@ -39,7 +45,7 @@ npm i @nstudio/xplat -D
|
|
39
45
|
You are now ready to create apps:
|
40
46
|
|
41
47
|
```
|
42
|
-
nx g app
|
48
|
+
npx nx g @nstudio/xplat:app
|
43
49
|
```
|
44
50
|
|
45
51
|
**NOTE:** If you encounter any issue, you can try creating an Nx workspace with version specified, for example:
|
@@ -59,7 +65,7 @@ Electron app generator can use any web app in the workspace as it's target.
|
|
59
65
|
If you don't have a web app yet, create one first:
|
60
66
|
|
61
67
|
```
|
62
|
-
nx g app sample
|
68
|
+
npx nx g @nstudio/xplat:app sample
|
63
69
|
```
|
64
70
|
|
65
71
|
> choose `web`
|
@@ -67,7 +73,7 @@ nx g app sample
|
|
67
73
|
You can now use the web app as the Electron target:
|
68
74
|
|
69
75
|
```
|
70
|
-
nx g app desktop --target=web-sample
|
76
|
+
npx nx g @nstudio/xplat:app desktop --target=web-sample
|
71
77
|
```
|
72
78
|
|
73
79
|
> choose `electron`
|
@@ -81,7 +87,7 @@ npm run start.electron.desktop
|
|
81
87
|
### Ionic
|
82
88
|
|
83
89
|
```
|
84
|
-
nx g app sample
|
90
|
+
npx nx g @nstudio/xplat:app sample
|
85
91
|
```
|
86
92
|
|
87
93
|
> choose `ionic`
|
@@ -89,13 +95,13 @@ nx g app sample
|
|
89
95
|
Develop in browser with:
|
90
96
|
|
91
97
|
```
|
92
|
-
nx serve ionic-sample
|
98
|
+
npx nx serve ionic-sample
|
93
99
|
```
|
94
100
|
|
95
101
|
Build Ionic app:
|
96
102
|
|
97
103
|
```
|
98
|
-
nx build ionic-sample
|
104
|
+
npx nx build ionic-sample
|
99
105
|
```
|
100
106
|
|
101
107
|
A. **Capacitor iOS** - Prepare for development
|
@@ -125,7 +131,7 @@ npm run open.ionic.sample.android
|
|
125
131
|
### NativeScript
|
126
132
|
|
127
133
|
```
|
128
|
-
nx g app mobile
|
134
|
+
nx g @nstudio/xplat:app mobile
|
129
135
|
```
|
130
136
|
|
131
137
|
> choose `nativescript`
|
@@ -133,13 +139,13 @@ nx g app mobile
|
|
133
139
|
A. **iOS**
|
134
140
|
|
135
141
|
```
|
136
|
-
nx run nativescript-mobile:ios
|
142
|
+
npx nx run nativescript-mobile:ios
|
137
143
|
```
|
138
144
|
|
139
145
|
B. **Android**
|
140
146
|
|
141
147
|
```
|
142
|
-
nx run nativescript-mobile:android
|
148
|
+
npx nx run nativescript-mobile:android
|
143
149
|
```
|
144
150
|
|
145
151
|
## Documentation
|
package/collection.json
CHANGED
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@nstudio/angular",
|
3
|
-
"version": "
|
3
|
+
"version": "16.2.0-beta.0",
|
4
4
|
"description": "Angular Plugin for xplat",
|
5
5
|
"homepage": "https://nstudio.io/xplat",
|
6
6
|
"repository": {
|
@@ -29,9 +29,9 @@
|
|
29
29
|
"migrations": "./migrations.json"
|
30
30
|
},
|
31
31
|
"dependencies": {
|
32
|
-
"@
|
32
|
+
"@nx/angular": "^16.0.0"
|
33
33
|
},
|
34
34
|
"peerDependencies": {
|
35
|
-
"@nstudio/xplat": "
|
35
|
+
"@nstudio/xplat": "16.2.0-beta.0"
|
36
36
|
}
|
37
37
|
}
|
@@ -10,7 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
10
10
|
};
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
12
12
|
const schematics_1 = require("@angular-devkit/schematics");
|
13
|
-
const workspace_1 = require("@
|
13
|
+
const workspace_1 = require("@nx/workspace");
|
14
14
|
const xplat_1 = require("@nstudio/xplat");
|
15
15
|
const xplat_utils_1 = require("@nstudio/xplat-utils");
|
16
16
|
function default_1(options) {
|
@@ -53,7 +53,7 @@ function default_1(options) {
|
|
53
53
|
// interactive: false
|
54
54
|
// };
|
55
55
|
}
|
56
|
-
return (0, schematics_1.externalSchematic)('@
|
56
|
+
return (0, schematics_1.externalSchematic)('@nx/angular', 'app', nrwlWebOptions, executionOptions)(tree, context);
|
57
57
|
},
|
58
58
|
(tree, context) => addHeadlessE2e(options)(tree, context),
|
59
59
|
options.useXplat
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const schematics_1 = require("@angular-devkit/schematics");
|
4
4
|
const xplat_1 = require("@nstudio/xplat");
|
5
5
|
const xplat_utils_1 = require("@nstudio/xplat-utils");
|
6
|
-
const workspace_1 = require("@
|
6
|
+
const workspace_1 = require("@nx/workspace");
|
7
7
|
const angular_1 = require("@nstudio/angular");
|
8
8
|
let componentSettings;
|
9
9
|
function default_1(options) {
|
@@ -1,7 +1,7 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
const schematics_1 = require("@angular-devkit/schematics");
|
4
|
-
const workspace_1 = require("@
|
4
|
+
const workspace_1 = require("@nx/workspace");
|
5
5
|
const xplat_1 = require("@nstudio/xplat");
|
6
6
|
const xplat_utils_1 = require("@nstudio/xplat-utils");
|
7
7
|
let customElementList;
|
@@ -177,7 +177,7 @@ function updateWorkspaceSupport(options, tree, context) {
|
|
177
177
|
const angularVersion = json.dependencies['@angular/core'];
|
178
178
|
json.dependencies = Object.assign(Object.assign({}, json.dependencies), { '@angular/elements': angularVersion, '@webcomponents/webcomponentsjs': '^2.6.0' });
|
179
179
|
json.devDependencies = json.devDependencies || {};
|
180
|
-
json.devDependencies = Object.assign(Object.assign({}, json.devDependencies), { 'http-server': '^14.1.1', 'ngx-build-plus': '^
|
180
|
+
json.devDependencies = Object.assign(Object.assign({}, json.devDependencies), { 'http-server': '^14.1.1', 'ngx-build-plus': '^16.0.0' });
|
181
181
|
return (0, xplat_utils_1.updateJsonFile)(tree, packagePath, json);
|
182
182
|
}
|
183
183
|
function createCustomElementList(componentSymbols) {
|
@@ -1,7 +1,7 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
const schematics_1 = require("@angular-devkit/schematics");
|
4
|
-
const workspace_1 = require("@
|
4
|
+
const workspace_1 = require("@nx/workspace");
|
5
5
|
const xplat_1 = require("@nstudio/xplat");
|
6
6
|
const xplat_utils_1 = require("@nstudio/xplat-utils");
|
7
7
|
function default_1(options) {
|
@@ -4,7 +4,7 @@ const xplat_1 = require("@nstudio/xplat");
|
|
4
4
|
const xplat_utils_1 = require("@nstudio/xplat-utils");
|
5
5
|
const applitools_1 = require("./applitools");
|
6
6
|
const schematics_1 = require("@angular-devkit/schematics");
|
7
|
-
const workspace_1 = require("@
|
7
|
+
const workspace_1 = require("@nx/workspace");
|
8
8
|
const supportedHelpers = {
|
9
9
|
applitools: applitools_1.config,
|
10
10
|
};
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { TestBed } from '@angular/core/testing';
|
2
2
|
import { provideMockStore } from '@ngrx/store/testing';
|
3
3
|
import { provideMockActions } from '@ngrx/effects/testing';
|
4
|
-
import { hot } from '@
|
4
|
+
import { hot } from '@nx/angular/testing';
|
5
5
|
|
6
6
|
import { <%= utils.classify(name) %>Effects } from './<%= name %>.effects';
|
7
7
|
import { <%= utils.classify(name) %>Actions } from './<%= name %>.actions';
|
@@ -1,7 +1,7 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
const schematics_1 = require("@angular-devkit/schematics");
|
4
|
-
const workspace_1 = require("@
|
4
|
+
const workspace_1 = require("@nx/workspace");
|
5
5
|
const xplat_1 = require("@nstudio/xplat");
|
6
6
|
const xplat_utils_1 = require("@nstudio/xplat-utils");
|
7
7
|
const xplat_2 = require("../../utils/xplat");
|
package/src/utils/ast.d.ts
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
import * as ts from 'typescript';
|
2
|
-
import { Tree } from '@
|
3
|
-
|
4
|
-
export declare function addToCollection(tree: Tree, source: ts.SourceFile, barrelIndexPath: string, symbolName: string, insertSpaces?: string): ts.SourceFile
|
2
|
+
import { Tree } from '@nx/devkit';
|
3
|
+
type DecoratorName = 'Component' | 'Directive' | 'NgModule' | 'Pipe';
|
4
|
+
export declare function addToCollection(tree: Tree, source: ts.SourceFile, barrelIndexPath: string, symbolName: string, insertSpaces?: string): ts.SourceFile;
|
5
5
|
/**
|
6
6
|
* Check if the Component, Directive or Pipe is standalone
|
7
7
|
* @param sourceFile TS Source File containing the token to check
|
package/src/utils/ast.js
CHANGED
@@ -1,29 +1,25 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.getTsSourceFile = exports.getDecoratorPropertyValueNode = exports.readBootstrapInfo = exports.addEntryComponents = exports.addDeclarationToModule = exports.addProviderToComponent = exports.addProviderToModule = exports.addProviderToBootstrapApplication = exports.addRouteToNgModule = exports.getBootstrapComponent = exports.replaceIntoToTestBed = exports.addDeclarationsToTestBed = exports.addImportToTestBed = exports.addImportToModule = exports.addImportToPipe = exports.addImportToDirective = exports.addImportToComponent = exports.removeFromNgModule = exports._addSymbolToNgModuleMetadata = exports.getDecoratorMetadata = exports.isStandalone = exports.addToCollection = void 0;
|
4
|
-
const ensure_typescript_1 = require("@
|
4
|
+
const ensure_typescript_1 = require("@nx/js/src/utils/typescript/ensure-typescript");
|
5
5
|
const typescript_1 = require("nx/src/utils/typescript");
|
6
6
|
const ts = require("typescript");
|
7
|
-
const js_1 = require("@
|
7
|
+
const js_1 = require("@nx/js");
|
8
8
|
const path_1 = require("path");
|
9
|
-
const devkit_1 = require("@
|
9
|
+
const devkit_1 = require("@nx/devkit");
|
10
10
|
let tsModule;
|
11
11
|
function addToCollection(tree, source, barrelIndexPath, symbolName, insertSpaces = '') {
|
12
12
|
const collection = getCollection(source);
|
13
13
|
if (!collection)
|
14
|
-
return
|
14
|
+
return source;
|
15
15
|
// if (!collection) return [new NoopChange()];
|
16
16
|
// return [new NoopChange()];
|
17
17
|
console.log('collection.hasTrailingComma:', collection.hasTrailingComma);
|
18
18
|
if (collection.hasTrailingComma || collection.length === 0) {
|
19
|
-
return
|
20
|
-
(0, js_1.insertChange)(tree, source, barrelIndexPath, collection.end, symbolName),
|
21
|
-
];
|
19
|
+
return (0, js_1.insertChange)(tree, source, barrelIndexPath, collection.end, symbolName);
|
22
20
|
}
|
23
21
|
else {
|
24
|
-
return
|
25
|
-
(0, js_1.insertChange)(tree, source, barrelIndexPath, collection.end, `,\n${insertSpaces}${symbolName}`),
|
26
|
-
];
|
22
|
+
return (0, js_1.insertChange)(tree, source, barrelIndexPath, collection.end, `,\n${insertSpaces}${symbolName}`);
|
27
23
|
}
|
28
24
|
}
|
29
25
|
exports.addToCollection = addToCollection;
|
package/src/utils/generator.d.ts
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
import { Tree, Rule } from '@angular-devkit/schematics';
|
2
2
|
import { XplatFeatureHelpers } from '@nstudio/xplat';
|
3
3
|
import { PlatformTypes } from '@nstudio/xplat-utils';
|
4
|
-
export
|
4
|
+
export type IGenerateType = 'component' | 'directive' | 'pipe' | 'service' | 'state';
|
5
5
|
export interface IGenerateOptions {
|
6
6
|
name: string;
|
7
7
|
feature?: string;
|
package/src/utils/generator.js
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.adjustSandbox = exports.adjustRouting = exports.adjustFeatureModuleForState = exports.adjustFeatureModule = exports.adjustModule = exports.adjustBarrelIndexForType = exports.adjustBarrelIndex = exports.adjustBarrel = exports.shouldTargetCoreBarrel = exports.isFeatureInGeneralBarrel = exports.addToFeature = exports.getNxFeaturePath = exports.getFeatureName = exports.generate = void 0;
|
4
4
|
const schematics_1 = require("@angular-devkit/schematics");
|
5
|
-
const workspace_1 = require("@
|
5
|
+
const workspace_1 = require("@nx/workspace");
|
6
6
|
const xplat_1 = require("@nstudio/xplat");
|
7
7
|
const xplat_utils_1 = require("@nstudio/xplat-utils");
|
8
8
|
const ast_1 = require("./ast");
|
@@ -337,7 +337,7 @@ function adjustBarrelIndex(type, options, indexFilePath, inSubFolder, isBase, im
|
|
337
337
|
// console.log('host.exists(indexFilePath):', host.exists(indexFilePath));
|
338
338
|
if (host.exists(indexFilePath)) {
|
339
339
|
const indexSource = host.read(indexFilePath).toString('utf-8');
|
340
|
-
|
340
|
+
let indexSourceFile = ts.createSourceFile(indexFilePath, indexSource, ts.ScriptTarget.Latest, true);
|
341
341
|
const changes = [];
|
342
342
|
const name = options.name.toLowerCase();
|
343
343
|
if (!isBase && type !== 'service') {
|
@@ -347,21 +347,27 @@ function adjustBarrelIndex(type, options, indexFilePath, inSubFolder, isBase, im
|
|
347
347
|
const symbolName = `${xplat_1.stringUtils
|
348
348
|
.sanitize(options.subFolder)
|
349
349
|
.toUpperCase()}_${type.toUpperCase()}S`;
|
350
|
-
|
350
|
+
indexSourceFile = (0, xplat_1.addGlobal)(devKitTree, indexSourceFile, indexFilePath, `import { ${symbolName} } from './${options.subFolder}';`, false);
|
351
|
+
indexSourceFile = (0, ast_1.addToCollection)(devKitTree, indexSourceFile, indexFilePath, `...${symbolName}`, ' ');
|
352
|
+
changes.push(indexSourceFile);
|
351
353
|
}
|
352
354
|
else {
|
353
355
|
const symbolName = `${xplat_1.stringUtils.classify(name)}${xplat_1.stringUtils.capitalize(type)}`;
|
354
|
-
|
356
|
+
indexSourceFile = (0, xplat_1.addGlobal)(devKitTree, indexSourceFile, indexFilePath, `import { ${symbolName} } from './${inSubFolder ? `${name}/` : ''}${name}.${type}';`);
|
357
|
+
indexSourceFile = (0, ast_1.addToCollection)(devKitTree, indexSourceFile, indexFilePath, symbolName, ' ');
|
358
|
+
changes.push(indexSourceFile);
|
355
359
|
}
|
356
360
|
}
|
357
361
|
if (type === 'component' || type === 'service' || type === 'pipe') {
|
358
362
|
// export symbol from barrel
|
359
363
|
if ((isBase || importIfSubFolder) && options.subFolder) {
|
360
|
-
|
364
|
+
indexSourceFile = (0, xplat_1.addGlobal)(devKitTree, indexSourceFile, indexFilePath, `export * from './${options.subFolder}';`, true);
|
365
|
+
changes.push(indexSourceFile);
|
361
366
|
}
|
362
367
|
else {
|
363
368
|
const subFolder = inSubFolder ? `${name}/` : '';
|
364
|
-
|
369
|
+
indexSourceFile = (0, xplat_1.addGlobal)(devKitTree, indexSourceFile, indexFilePath, `export * from './${subFolder}${name}.${isBase ? 'base-' : ''}${type}';`, true);
|
370
|
+
changes.push(indexSourceFile);
|
365
371
|
}
|
366
372
|
}
|
367
373
|
// insert(devKitTree.tree, indexFilePath, changes);
|
@@ -380,7 +386,7 @@ function adjustBarrelIndexForType(type, options, indexFilePath) {
|
|
380
386
|
const indexSource = host.read(indexFilePath).toString('utf-8');
|
381
387
|
const indexSourceFile = ts.createSourceFile(indexFilePath, indexSource, ts.ScriptTarget.Latest, true);
|
382
388
|
const changes = [];
|
383
|
-
changes.push(
|
389
|
+
changes.push((0, xplat_1.addGlobal)(devKitTree, indexSourceFile, indexFilePath, `export * from './${type}';`, true));
|
384
390
|
// insert(devKitTree.tree, indexFilePath, changes);
|
385
391
|
}
|
386
392
|
else {
|
@@ -466,8 +472,7 @@ function adjustFeatureModule(type, options, modulePath) {
|
|
466
472
|
else {
|
467
473
|
if (type !== 'service') {
|
468
474
|
// add to module
|
469
|
-
changes.push(
|
470
|
-
changes.push((0, ast_1.addDeclarationToModule)(devKitTree, moduleSourceFile, modulePath, `...${collectionName}`), (0, ast_1._addSymbolToNgModuleMetadata)(devKitTree, moduleSourceFile, modulePath, 'exports', `...${collectionName}`));
|
475
|
+
changes.push((0, ast_1._addSymbolToNgModuleMetadata)(devKitTree, (0, ast_1.addDeclarationToModule)(devKitTree, (0, xplat_1.addGlobal)(devKitTree, moduleSourceFile, modulePath, `import { ${collectionName} } from './${type}s';`), modulePath, `...${collectionName}`), modulePath, 'exports', `...${collectionName}`));
|
471
476
|
}
|
472
477
|
// insert(devKitTree.tree, modulePath, changes);
|
473
478
|
}
|
@@ -482,35 +487,45 @@ function adjustFeatureModuleForState(options, modulePath) {
|
|
482
487
|
// console.log('adjustFeatureModuleForState:', modulePath);
|
483
488
|
if (host.exists(modulePath)) {
|
484
489
|
const moduleSource = host.read(modulePath).toString('utf-8');
|
485
|
-
|
490
|
+
let moduleSourceFile = ts.createSourceFile(modulePath, moduleSource, ts.ScriptTarget.Latest, true);
|
486
491
|
// console.log('moduleSource:', moduleSource);
|
487
492
|
const isInLibs = modulePath.indexOf('libs/xplat/core') === 0;
|
488
493
|
const name = options.name.toLowerCase();
|
489
494
|
const changes = [];
|
490
495
|
if (moduleSource.indexOf('StoreModule') === -1) {
|
491
|
-
|
496
|
+
moduleSourceFile = (0, xplat_1.addGlobal)(devKitTree, moduleSourceFile, modulePath, `import { StoreModule } from '@ngrx/store';`);
|
497
|
+
changes.push(moduleSourceFile);
|
492
498
|
}
|
493
499
|
if (moduleSource.indexOf('EffectsModule') === -1) {
|
494
|
-
|
500
|
+
moduleSourceFile = (0, xplat_1.addGlobal)(devKitTree, moduleSourceFile, modulePath, `import { EffectsModule } from '@ngrx/effects';`);
|
501
|
+
changes.push(moduleSourceFile);
|
495
502
|
}
|
496
|
-
|
503
|
+
moduleSourceFile = (0, xplat_1.addGlobal)(devKitTree, moduleSourceFile, modulePath, `import { ${xplat_1.stringUtils.classify(name)}Effects } from './state/${name}.effects';`);
|
504
|
+
moduleSourceFile = (0, xplat_1.addGlobal)(devKitTree, moduleSourceFile, modulePath, `import { ${xplat_1.stringUtils.camelize(name)}Reducer } from './state/${name}.reducer';`);
|
505
|
+
moduleSourceFile = (0, xplat_1.addGlobal)(devKitTree, moduleSourceFile, modulePath, `import { ${xplat_1.stringUtils.classify(name)}State } from './state/${name}.state';`);
|
506
|
+
changes.push(moduleSourceFile);
|
497
507
|
if (options.root) {
|
498
508
|
if (moduleSource.indexOf('environments/environment') === -1) {
|
499
509
|
const envFrom = isInLibs
|
500
510
|
? './environments/environment'
|
501
511
|
: `@${(0, xplat_utils_1.getNpmScope)()}/xplat/core`;
|
502
|
-
|
512
|
+
moduleSourceFile = (0, xplat_1.addGlobal)(devKitTree, moduleSourceFile, modulePath, `import { environment } from '${envFrom}';`);
|
513
|
+
changes.push(moduleSourceFile);
|
503
514
|
}
|
504
|
-
|
505
|
-
|
506
|
-
|
507
|
-
|
508
|
-
|
509
|
-
|
515
|
+
moduleSourceFile = (0, ast_1.addImportToModule)(devKitTree, moduleSourceFile, modulePath, `StoreModule.forRoot(
|
516
|
+
{ ${xplat_1.stringUtils.camelize(name)}: ${xplat_1.stringUtils.camelize(name)}Reducer },
|
517
|
+
{
|
518
|
+
initialState: { ${xplat_1.stringUtils.camelize(name)}: ${xplat_1.stringUtils.classify(name)}State.initialState }
|
519
|
+
}
|
520
|
+
), EffectsModule.forRoot([${xplat_1.stringUtils.classify(name)}Effects])`);
|
521
|
+
moduleSourceFile = (0, ast_1.addProviderToModule)(devKitTree, moduleSourceFile, modulePath, `${xplat_1.stringUtils.classify(name)}Effects`);
|
522
|
+
changes.push(moduleSourceFile);
|
510
523
|
}
|
511
524
|
else {
|
525
|
+
moduleSourceFile = (0, ast_1.addImportToModule)(devKitTree, moduleSourceFile, modulePath, `StoreModule.forFeature('${xplat_1.stringUtils.camelize(name)}', ${xplat_1.stringUtils.camelize(name)}Reducer, { initialState: ${xplat_1.stringUtils.classify(name)}State.initialState }), EffectsModule.forFeature([${xplat_1.stringUtils.classify(name)}Effects])`);
|
526
|
+
moduleSourceFile = (0, ast_1.addProviderToModule)(devKitTree, moduleSourceFile, modulePath, `${xplat_1.stringUtils.classify(name)}Effects`);
|
512
527
|
// feature state
|
513
|
-
changes.push(
|
528
|
+
changes.push(moduleSourceFile);
|
514
529
|
}
|
515
530
|
// insert(devKitTree.tree, modulePath, changes);
|
516
531
|
}
|
@@ -538,7 +553,7 @@ function adjustRouting(options, routingModulePaths, platform) {
|
|
538
553
|
const routingSourceFile = ts.createSourceFile(routingModulePath, routingSource, ts.ScriptTarget.Latest, true);
|
539
554
|
const changes = [];
|
540
555
|
// add component to route config
|
541
|
-
changes.push(
|
556
|
+
changes.push((0, ast_1.addToCollection)(devKitTree, routingSourceFile, routingModulePath, `{
|
542
557
|
path: '${featureName}',
|
543
558
|
loadChildren: () => import('./features/${options.directory ? options.directory + '/' : ''}${featureName}/${featureName}.module').then(m => m.${xplat_1.stringUtils.classify(featureName)}Module)
|
544
559
|
}`));
|
package/src/utils/testing.js
CHANGED
@@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getLibConfig = exports.getAppConfig = exports.callRule = exports.runSchematic = void 0;
|
4
4
|
const path_1 = require("path");
|
5
5
|
const testing_1 = require("@angular-devkit/schematics/testing");
|
6
|
-
// import { createApp, createLib } from '@
|
7
|
-
// import { names, toFileName } from '@
|
6
|
+
// import { createApp, createLib } from '@nx/angular/testing';
|
7
|
+
// import { names, toFileName } from '@nx/workspace';
|
8
8
|
const testRunner = new testing_1.SchematicTestRunner('@nstudio/angular', (0, path_1.join)(__dirname, '../../collection.json'));
|
9
9
|
function runSchematic(schematicName, options, tree) {
|
10
10
|
return testRunner.runSchematicAsync(schematicName, options, tree).toPromise();
|
package/src/utils/versions.d.ts
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
export declare const xplatVersion = "*";
|
2
|
-
export declare const nxVersion = "^
|
3
|
-
export declare const angularVersion = "^
|
4
|
-
export declare const angularDevkitVersion = "^
|
2
|
+
export declare const nxVersion = "^16.2.0";
|
3
|
+
export declare const angularVersion = "^16.0.0";
|
4
|
+
export declare const angularDevkitVersion = "^16.0.0";
|
5
5
|
export declare const ngxTranslateVersion = "~14.0.0";
|
6
6
|
export declare const ngxTranslateHttpVersion = "~7.0.0";
|
7
7
|
export declare const rxjsVersion = "^7.5.0";
|
package/src/utils/versions.js
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.typesJest = exports.jestPresetAngular = exports.zonejsVersion = exports.rxjsVersion = exports.ngxTranslateHttpVersion = exports.ngxTranslateVersion = exports.angularDevkitVersion = exports.angularVersion = exports.nxVersion = exports.xplatVersion = void 0;
|
4
|
-
exports.xplatVersion = '
|
5
|
-
exports.nxVersion = '^
|
6
|
-
exports.angularVersion = '^
|
7
|
-
exports.angularDevkitVersion = '^
|
4
|
+
exports.xplatVersion = '16.2.0-beta.0';
|
5
|
+
exports.nxVersion = '^16.2.0';
|
6
|
+
exports.angularVersion = '^16.0.0';
|
7
|
+
exports.angularDevkitVersion = '^16.0.0';
|
8
8
|
exports.ngxTranslateVersion = '~14.0.0';
|
9
9
|
exports.ngxTranslateHttpVersion = '~7.0.0';
|
10
10
|
exports.rxjsVersion = '^7.5.0';
|
package/src/utils/xplat.js
CHANGED
@@ -107,11 +107,11 @@ var XplatAngularHelpers;
|
|
107
107
|
devDependencies[`@angular/compiler-cli`] = ngVersion;
|
108
108
|
devDependencies[`@angular/language-service`] = ngVersion;
|
109
109
|
}
|
110
|
-
if (!packageJson.devDependencies['@
|
111
|
-
packageJson.devDependencies['@
|
110
|
+
if (!packageJson.devDependencies['@nx/angular']) {
|
111
|
+
packageJson.devDependencies['@nx/angular'] = versions_1.nxVersion;
|
112
112
|
}
|
113
|
-
if (!packageJson.devDependencies['@
|
114
|
-
packageJson.devDependencies['@
|
113
|
+
if (!packageJson.devDependencies['@nx/jest']) {
|
114
|
+
packageJson.devDependencies['@nx/jest'] = versions_1.nxVersion;
|
115
115
|
}
|
116
116
|
if (!packageJson.devDependencies['@nstudio/web']) {
|
117
117
|
packageJson.devDependencies['@nstudio/web'] = versions_1.xplatVersion;
|