@nstudio/angular 12.7.0 → 13.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -5
- package/package.json +3 -3
- package/src/schematics/application/index.js +33 -23
- package/src/schematics/application/index.spec.js +8 -33
- package/src/schematics/application/schema.json +1 -28
- package/src/schematics/component/index.js +16 -16
- package/src/schematics/component/index.spec.js +22 -22
- package/src/schematics/directive/index.js +1 -1
- package/src/schematics/directive/index.spec.js +23 -23
- package/src/schematics/elements/index.js +18 -18
- package/src/schematics/elements/index.spec.js +21 -21
- package/src/schematics/feature/index.js +10 -10
- package/src/schematics/feature/index.spec.js +37 -37
- package/src/schematics/helpers/applitools/index.js +8 -8
- package/src/schematics/helpers/index.js +4 -4
- package/src/schematics/helpers/index.spec.js +15 -15
- package/src/schematics/ng-add/index.js +4 -4
- package/src/schematics/ngrx/index.js +1 -1
- package/src/schematics/ngrx/index.spec.js +16 -16
- package/src/schematics/pipe/index.js +1 -1
- package/src/schematics/pipe/index.spec.js +20 -20
- package/src/schematics/service/index.js +1 -1
- package/src/schematics/service/index.spec.js +20 -20
- package/src/schematics/xplat/index.js +7 -7
- package/src/schematics/xplat/index.spec.js +13 -13
- package/src/utils/ast.js +8 -8
- package/src/utils/generator.js +48 -48
- package/src/utils/testing.js +1 -1
- package/src/utils/versions.d.ts +9 -11
- package/src/utils/versions.js +11 -13
- package/src/utils/xplat.js +24 -23
package/README.md
CHANGED
@@ -28,9 +28,9 @@ npx create-nx-workspace@latest
|
|
28
28
|
|
29
29
|
At the prompts:
|
30
30
|
|
31
|
-
>
|
31
|
+
> What to create in the new workspace
|
32
32
|
|
33
|
-
> choose `
|
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="
|
191
|
-
| :------------------------------------------------------------------------------------------------------------------------------------: |
|
192
|
-
| [NathanWalker](https://github.com/NathanWalker) | [
|
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
|
| :-----------------------------------------------------------------------------------------------------------------------------: | :---------------------------------------------------------------------------------------------------------------------------------: | :---------------------------------------------------------------------------------------------------------------------------------: | :---------------------------------------------------------------------------------------------------------------------------------: | :------------------------------------------------------------------------------------------------------------------------------------------: | :-------------------------------------------------------------------------------------------------------------------------------: |
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@nstudio/angular",
|
3
|
-
"version": "
|
3
|
+
"version": "13.4.1",
|
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
|
-
"@nrwl/angular": "^
|
32
|
+
"@nrwl/angular": "^13.0.0"
|
33
33
|
},
|
34
34
|
"peerDependencies": {
|
35
|
-
"@nstudio/xplat": "
|
35
|
+
"@nstudio/xplat": "13.4.1"
|
36
36
|
}
|
37
37
|
}
|
@@ -15,25 +15,35 @@ const xplat_1 = require("@nstudio/xplat");
|
|
15
15
|
const xplat_utils_1 = require("@nstudio/xplat-utils");
|
16
16
|
function default_1(options) {
|
17
17
|
if (!options.name) {
|
18
|
-
throw new schematics_1.SchematicsException(xplat_1.missingArgument('name', 'Provide a name for your app.', 'nx g @nstudio/angular:app my-app'));
|
18
|
+
throw new schematics_1.SchematicsException((0, xplat_1.missingArgument)('name', 'Provide a name for your app.', 'nx g @nstudio/angular:app my-app'));
|
19
19
|
}
|
20
20
|
if (options.useXplat) {
|
21
21
|
// xplat is configured for sass only (at moment)
|
22
22
|
options.style = 'scss';
|
23
23
|
}
|
24
|
-
return schematics_1.chain([
|
25
|
-
xplat_utils_1.prerun(options),
|
24
|
+
return (0, schematics_1.chain)([
|
25
|
+
(0, xplat_utils_1.prerun)(options),
|
26
26
|
// adjust naming convention
|
27
27
|
xplat_1.XplatHelpers.applyAppNamingConvention(options, 'web'),
|
28
28
|
// use xplat or not
|
29
29
|
options.useXplat
|
30
|
-
? schematics_1.externalSchematic('@nstudio/angular', 'xplat', {
|
30
|
+
? (0, schematics_1.externalSchematic)('@nstudio/angular', 'xplat', {
|
31
31
|
platforms: 'web',
|
32
32
|
framework: 'angular',
|
33
33
|
})
|
34
|
-
: schematics_1.noop(),
|
34
|
+
: (0, schematics_1.noop)(),
|
35
35
|
(tree, context) => {
|
36
36
|
const nrwlWebOptions = Object.assign(Object.assign({}, options), { skipInstall: true });
|
37
|
+
// remove non schema validated properties
|
38
|
+
delete nrwlWebOptions.groupByName;
|
39
|
+
delete nrwlWebOptions.useXplat;
|
40
|
+
delete nrwlWebOptions.skipInstall;
|
41
|
+
delete nrwlWebOptions.platforms;
|
42
|
+
delete nrwlWebOptions.framework;
|
43
|
+
delete nrwlWebOptions.isTesting;
|
44
|
+
delete nrwlWebOptions.target;
|
45
|
+
delete nrwlWebOptions.npmScope;
|
46
|
+
delete nrwlWebOptions.setupSandbox;
|
37
47
|
let executionOptions;
|
38
48
|
if (options.useXplat) {
|
39
49
|
// when generating xplat architecture, ensure:
|
@@ -43,20 +53,20 @@ function default_1(options) {
|
|
43
53
|
// interactive: false
|
44
54
|
// };
|
45
55
|
}
|
46
|
-
return schematics_1.externalSchematic('@nrwl/angular', 'app', nrwlWebOptions, executionOptions)(tree, context);
|
56
|
+
return (0, schematics_1.externalSchematic)('@nrwl/angular', 'app', nrwlWebOptions, executionOptions)(tree, context);
|
47
57
|
},
|
48
58
|
(tree, context) => addHeadlessE2e(options)(tree, context),
|
49
59
|
options.useXplat
|
50
60
|
? (tree, context) => addAppFiles(options)(tree, context)
|
51
|
-
: schematics_1.noop(),
|
61
|
+
: (0, schematics_1.noop)(),
|
52
62
|
options.useXplat
|
53
63
|
? (tree, context) => addAppFiles(options, 'routing')(tree, context)
|
54
|
-
: schematics_1.noop(),
|
64
|
+
: (0, schematics_1.noop)(),
|
55
65
|
// adjust app files
|
56
66
|
options.useXplat
|
57
67
|
? (tree, context) => adjustAppFiles(options, tree)
|
58
|
-
: schematics_1.noop(),
|
59
|
-
workspace_1.formatFiles({ skipFormat: options.skipFormat }),
|
68
|
+
: (0, schematics_1.noop)(),
|
69
|
+
(0, workspace_1.formatFiles)({ skipFormat: options.skipFormat }),
|
60
70
|
]);
|
61
71
|
}
|
62
72
|
exports.default = default_1;
|
@@ -80,7 +90,7 @@ exports.config = defaultConfig;
|
|
80
90
|
const e2eProjectName = `${options.name}-e2e`;
|
81
91
|
const confFile = 'protractor.headless.js';
|
82
92
|
tree.create(`/apps/${directory}${e2eProjectName}/${confFile}`, config);
|
83
|
-
return workspace_1.updateWorkspace((workspace) => {
|
93
|
+
return (0, workspace_1.updateWorkspace)((workspace) => {
|
84
94
|
if (workspace.projects.has(e2eProjectName)) {
|
85
95
|
const projectDef = workspace.projects.get(e2eProjectName);
|
86
96
|
const e2eDef = projectDef.targets.get('e2e');
|
@@ -104,15 +114,15 @@ function addHeadlessE2e(options) {
|
|
104
114
|
case 'protractor':
|
105
115
|
return addProtractorCiConfig(options);
|
106
116
|
default:
|
107
|
-
return schematics_1.noop();
|
117
|
+
return (0, schematics_1.noop)();
|
108
118
|
}
|
109
119
|
}
|
110
120
|
function addAppFiles(options, extra = '') {
|
111
121
|
extra = extra ? `${extra}_` : '';
|
112
122
|
const directory = options.directory ? `${options.directory}/` : '';
|
113
|
-
return schematics_1.branchAndMerge(schematics_1.mergeWith(schematics_1.apply(schematics_1.url(`./_${extra}files`), [
|
114
|
-
schematics_1.template(Object.assign(Object.assign(Object.assign({}, options), xplat_1.getDefaultTemplateOptions()), { xplatFolderName: xplat_1.XplatHelpers.getXplatFoldername('web', 'angular') })),
|
115
|
-
schematics_1.move(`apps/${directory}${options.name}`),
|
123
|
+
return (0, schematics_1.branchAndMerge)((0, schematics_1.mergeWith)((0, schematics_1.apply)((0, schematics_1.url)(`./_${extra}files`), [
|
124
|
+
(0, schematics_1.template)(Object.assign(Object.assign(Object.assign({}, options), (0, xplat_1.getDefaultTemplateOptions)()), { xplatFolderName: xplat_1.XplatHelpers.getXplatFoldername('web', 'angular') })),
|
125
|
+
(0, schematics_1.move)(`apps/${directory}${options.name}`),
|
116
126
|
])));
|
117
127
|
}
|
118
128
|
function adjustAppFiles(options, tree) {
|
@@ -132,7 +142,7 @@ function adjustAppFiles(options, tree) {
|
|
132
142
|
tree.overwrite(`/apps/${directory}${options.name}/src/app/app.component.spec.ts`, appCmpSpec());
|
133
143
|
tree.overwrite(`/apps/${directory}${options.name}/src/app/app.module.ts`, appModuleContent(options));
|
134
144
|
// update cli config for shared web specific scss
|
135
|
-
const workspace = yield workspace_1.getWorkspace(tree);
|
145
|
+
const workspace = yield (0, workspace_1.getWorkspace)(tree);
|
136
146
|
const project = workspace.projects.get(options.name);
|
137
147
|
if (project && project.targets) {
|
138
148
|
const buildOptions = project.targets.get('build').options;
|
@@ -143,7 +153,7 @@ function adjustAppFiles(options, tree) {
|
|
143
153
|
];
|
144
154
|
}
|
145
155
|
}
|
146
|
-
return workspace_1.updateWorkspace(workspace);
|
156
|
+
return (0, workspace_1.updateWorkspace)(workspace);
|
147
157
|
});
|
148
158
|
}
|
149
159
|
function indexContent(name) {
|
@@ -151,14 +161,14 @@ function indexContent(name) {
|
|
151
161
|
<html lang="en">
|
152
162
|
<head>
|
153
163
|
<meta charset="utf-8">
|
154
|
-
<title>${xplat_utils_1.getNpmScope()} ${name}</title>
|
164
|
+
<title>${(0, xplat_utils_1.getNpmScope)()} ${name}</title>
|
155
165
|
<base href="/">
|
156
166
|
|
157
167
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
158
168
|
<link rel="icon" type="image/x-icon" href="favicon.ico">
|
159
169
|
</head>
|
160
170
|
<body>
|
161
|
-
<${xplat_utils_1.getPrefix()}-root></${xplat_utils_1.getPrefix()}-root>
|
171
|
+
<${(0, xplat_utils_1.getPrefix)()}-root></${(0, xplat_utils_1.getPrefix)()}-root>
|
162
172
|
</body>
|
163
173
|
</html>`;
|
164
174
|
}
|
@@ -167,7 +177,7 @@ function mainContent() {
|
|
167
177
|
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
168
178
|
|
169
179
|
// libs
|
170
|
-
import { environment } from '@${xplat_utils_1.getNpmScope()}/xplat/core';
|
180
|
+
import { environment } from '@${(0, xplat_utils_1.getNpmScope)()}/xplat/core';
|
171
181
|
|
172
182
|
// app
|
173
183
|
import { AppModule } from './app/app.module';
|
@@ -183,7 +193,7 @@ platformBrowserDynamic()
|
|
183
193
|
}
|
184
194
|
function appCmpHtml(name) {
|
185
195
|
return `<div class="p-x-20">
|
186
|
-
<${xplat_utils_1.getPrefix()}-header title="${name}"></${xplat_utils_1.getPrefix()}-header>
|
196
|
+
<${(0, xplat_utils_1.getPrefix)()}-header title="${name}"></${(0, xplat_utils_1.getPrefix)()}-header>
|
187
197
|
|
188
198
|
<h2>Nx</h2>
|
189
199
|
|
@@ -201,10 +211,10 @@ function appCmpContent() {
|
|
201
211
|
return `import { Component } from '@angular/core';
|
202
212
|
|
203
213
|
// xplat
|
204
|
-
import { AppBaseComponent } from '@${xplat_utils_1.getNpmScope()}/xplat/${xplat_1.XplatHelpers.getXplatFoldername('web', 'angular')}/features';
|
214
|
+
import { AppBaseComponent } from '@${(0, xplat_utils_1.getNpmScope)()}/xplat/${xplat_1.XplatHelpers.getXplatFoldername('web', 'angular')}/features';
|
205
215
|
|
206
216
|
@Component({
|
207
|
-
selector: '${xplat_utils_1.getPrefix()}-root',
|
217
|
+
selector: '${(0, xplat_utils_1.getPrefix)()}-root',
|
208
218
|
templateUrl: './app.component.html'
|
209
219
|
})
|
210
220
|
export class AppComponent extends AppBaseComponent {
|
@@ -21,11 +21,11 @@ describe('app', () => {
|
|
21
21
|
};
|
22
22
|
beforeEach(() => {
|
23
23
|
appTree = schematics_1.Tree.empty();
|
24
|
-
appTree = testing_1.createEmptyWorkspace(appTree);
|
24
|
+
appTree = (0, testing_1.createEmptyWorkspace)(appTree);
|
25
25
|
});
|
26
26
|
it('should create all files for web app', () => __awaiter(void 0, void 0, void 0, function* () {
|
27
27
|
const options = Object.assign({}, defaultOptions);
|
28
|
-
const tree = yield testing_2.runSchematic('app', options, appTree);
|
28
|
+
const tree = yield (0, testing_2.runSchematic)('app', options, appTree);
|
29
29
|
const files = tree.files;
|
30
30
|
// console.log(files);
|
31
31
|
expect(tree.exists('/apps/web-foo/tsconfig.json')).toBeTruthy();
|
@@ -46,12 +46,12 @@ describe('app', () => {
|
|
46
46
|
it('should create all files for web app using groupByName', () => __awaiter(void 0, void 0, void 0, function* () {
|
47
47
|
const options = Object.assign({}, defaultOptions);
|
48
48
|
options.groupByName = true;
|
49
|
-
const tree = yield testing_2.runSchematic('app', options, appTree);
|
49
|
+
const tree = yield (0, testing_2.runSchematic)('app', options, appTree);
|
50
50
|
const files = tree.files;
|
51
51
|
// console.log(files);
|
52
52
|
expect(files.indexOf('/apps/foo-web/tsconfig.json')).toBeGreaterThanOrEqual(0);
|
53
|
-
let checkPath = xplat_utils_1.getRootTsConfigPath();
|
54
|
-
let checkFile = testing_1.getFileContent(tree, checkPath);
|
53
|
+
let checkPath = (0, xplat_utils_1.getRootTsConfigPath)();
|
54
|
+
let checkFile = (0, testing_1.getFileContent)(tree, checkPath);
|
55
55
|
// console.log('tsconfig.base:', checkFile);
|
56
56
|
expect(files.indexOf(checkPath)).toBeGreaterThanOrEqual(0);
|
57
57
|
expect(files.indexOf('/tsconfig.base.json')).toBeGreaterThanOrEqual(0);
|
@@ -65,7 +65,7 @@ describe('app', () => {
|
|
65
65
|
it('should create all files for web app in directory', () => __awaiter(void 0, void 0, void 0, function* () {
|
66
66
|
const options = Object.assign({}, defaultOptions);
|
67
67
|
options.directory = 'frontend';
|
68
|
-
const tree = yield testing_2.runSchematic('app', options, appTree);
|
68
|
+
const tree = yield (0, testing_2.runSchematic)('app', options, appTree);
|
69
69
|
const files = tree.files;
|
70
70
|
// console.log(files);
|
71
71
|
expect(tree.exists('/apps/frontend/web-foo/tsconfig.json')).toBeTruthy();
|
@@ -75,38 +75,13 @@ describe('app', () => {
|
|
75
75
|
it('should create all files for web app in directory and ignore platform naming when directory is a platform', () => __awaiter(void 0, void 0, void 0, function* () {
|
76
76
|
const options = Object.assign({}, defaultOptions);
|
77
77
|
options.directory = 'web';
|
78
|
-
const tree = yield testing_2.runSchematic('app', options, appTree);
|
78
|
+
const tree = yield (0, testing_2.runSchematic)('app', options, appTree);
|
79
79
|
const files = tree.files;
|
80
80
|
// console.log(files);
|
81
81
|
expect(tree.exists('/apps/web/foo/tsconfig.json')).toBeTruthy();
|
82
82
|
expect(tree.exists('/apps/web/foo/src/main.ts')).toBeTruthy();
|
83
83
|
expect(tree.exists('/apps/web/foo/src/app/app.module.ts')).toBeTruthy();
|
84
84
|
}));
|
85
|
-
it('should create all files for web app using addHeadlessE2e', () => __awaiter(void 0, void 0, void 0, function* () {
|
86
|
-
const options = Object.assign(Object.assign({}, defaultOptions), { addHeadlessE2e: true });
|
87
|
-
options.e2eTestRunner = 'protractor';
|
88
|
-
const tree = yield testing_2.runSchematic('app', options, appTree);
|
89
|
-
const files = tree.files;
|
90
|
-
const appName = 'web-foo';
|
91
|
-
// console.log(files);
|
92
|
-
expect(files.indexOf(`/apps/${appName}/tsconfig.json`)).toBeGreaterThanOrEqual(0);
|
93
|
-
expect(files.indexOf(`/apps/${appName}/src/main.ts`)).toBeGreaterThanOrEqual(0);
|
94
|
-
expect(files.indexOf(`/apps/${appName}/src/app/app.module.ts`)).toBeGreaterThanOrEqual(0);
|
95
|
-
expect(files.indexOf(`/apps/${appName}-e2e/protractor.headless.js`)).toBeGreaterThanOrEqual(0);
|
96
|
-
let checkPath = `/apps/${appName}/src/app/app.component.html`;
|
97
|
-
expect(files.indexOf(checkPath)).toBeGreaterThanOrEqual(0);
|
98
|
-
checkPath = '/package.json';
|
99
|
-
expect(files.indexOf(checkPath)).toBeGreaterThanOrEqual(0);
|
100
|
-
let checkFile = testing_1.getFileContent(tree, checkPath);
|
101
|
-
checkPath = '/angular.json';
|
102
|
-
expect(files.indexOf(checkPath)).toBeGreaterThanOrEqual(0);
|
103
|
-
checkFile = testing_1.getFileContent(tree, checkPath);
|
104
|
-
// console.log(checkFile);
|
105
|
-
// const angularJson: any = jsonParse(checkFile);
|
106
|
-
// expect(
|
107
|
-
// angularJson.projects[`${appName}-e2e`].architect.e2e.configurations.ci
|
108
|
-
// ).toBeDefined();
|
109
|
-
}));
|
110
85
|
// it('should create app with --framework flag Ionic', async () => {
|
111
86
|
// const options: Schema = { ...defaultOptions };
|
112
87
|
// const tree = await runSchematic('app', options, appTree);
|
@@ -135,7 +110,7 @@ describe('app', () => {
|
|
135
110
|
const options = Object.assign({}, defaultOptions);
|
136
111
|
options.useXplat = false;
|
137
112
|
// console.log('appTree:', appTree);
|
138
|
-
const tree = yield testing_2.runSchematic('app', options, appTree);
|
113
|
+
const tree = yield (0, testing_2.runSchematic)('app', options, appTree);
|
139
114
|
// const files = tree.files;
|
140
115
|
// console.log(files);
|
141
116
|
expect(tree.exists('/apps/web-foo/src/app/app.component.html')).toBeTruthy();
|
@@ -21,29 +21,7 @@
|
|
21
21
|
"style": {
|
22
22
|
"description": "The file extension to be used for style files.",
|
23
23
|
"type": "string",
|
24
|
-
"default": "
|
25
|
-
"x-prompt": {
|
26
|
-
"message": "Which stylesheet format would you like to use?",
|
27
|
-
"type": "list",
|
28
|
-
"items": [
|
29
|
-
{
|
30
|
-
"value": "css",
|
31
|
-
"label": "CSS"
|
32
|
-
},
|
33
|
-
{
|
34
|
-
"value": "scss",
|
35
|
-
"label": "SASS(.scss) [ http://sass-lang.com ]"
|
36
|
-
},
|
37
|
-
{
|
38
|
-
"value": "styl",
|
39
|
-
"label": "Stylus(.styl)[ http://stylus-lang.com ]"
|
40
|
-
},
|
41
|
-
{
|
42
|
-
"value": "less",
|
43
|
-
"label": "LESS [ http://lesscss.org ]"
|
44
|
-
}
|
45
|
-
]
|
46
|
-
}
|
24
|
+
"default": "scss"
|
47
25
|
},
|
48
26
|
"routing": {
|
49
27
|
"type": "boolean",
|
@@ -68,11 +46,6 @@
|
|
68
46
|
"enum": ["Emulated", "Native", "None"],
|
69
47
|
"type": "string"
|
70
48
|
},
|
71
|
-
"enableIvy": {
|
72
|
-
"description": "Use the Ivy rendering engine.",
|
73
|
-
"type": "boolean",
|
74
|
-
"default": false
|
75
|
-
},
|
76
49
|
"prefix": {
|
77
50
|
"type": "string",
|
78
51
|
"format": "html-selector",
|
@@ -11,43 +11,43 @@ function default_1(options) {
|
|
11
11
|
const externalChains = [];
|
12
12
|
for (const platform of componentSettings.platforms) {
|
13
13
|
if (xplat_utils_1.supportedPlatforms.includes(platform)) {
|
14
|
-
externalChains.push((tree, context) => schematics_1.externalSchematic(`@nstudio/${platform}-angular`, 'component', options, {
|
14
|
+
externalChains.push((tree, context) => (0, schematics_1.externalSchematic)(`@nstudio/${platform}-angular`, 'component', options, {
|
15
15
|
interactive: false,
|
16
16
|
}));
|
17
17
|
}
|
18
18
|
else {
|
19
|
-
throw new Error(xplat_1.unsupportedPlatformError(platform));
|
19
|
+
throw new Error((0, xplat_1.unsupportedPlatformError)(platform));
|
20
20
|
}
|
21
21
|
}
|
22
22
|
// if (externalChains.length === 0) {
|
23
23
|
// // none specified, insert noop
|
24
24
|
// externalChains.push(noop());
|
25
25
|
// }
|
26
|
-
return schematics_1.chain([
|
27
|
-
xplat_utils_1.prerun(),
|
26
|
+
return (0, schematics_1.chain)([
|
27
|
+
(0, xplat_utils_1.prerun)(),
|
28
28
|
// add component for base libs feature
|
29
29
|
(tree, context) => !options.onlyProject && options.createBase
|
30
|
-
? angular_1.addToFeature('', 'component', options, 'libs/xplat', tree, '_base', true)(tree, context)
|
31
|
-
: schematics_1.noop()(tree, context),
|
30
|
+
? (0, angular_1.addToFeature)('', 'component', options, 'libs/xplat', tree, '_base', true)(tree, context)
|
31
|
+
: (0, schematics_1.noop)()(tree, context),
|
32
32
|
// adjust libs barrel for subFolder
|
33
33
|
(tree, context) => options.subFolder && !options.onlyProject && options.createBase
|
34
|
-
? angular_1.adjustBarrelIndex('component', options, `libs/xplat/features/src/lib/${componentSettings.featureName}/base/${options.subFolder}/index.ts`, false, true)(tree, context)
|
35
|
-
: schematics_1.noop()(tree, context),
|
34
|
+
? (0, angular_1.adjustBarrelIndex)('component', options, `libs/xplat/features/src/lib/${componentSettings.featureName}/base/${options.subFolder}/index.ts`, false, true)(tree, context)
|
35
|
+
: (0, schematics_1.noop)()(tree, context),
|
36
36
|
// add index barrel if needed for subFolder
|
37
37
|
(tree, context) => options.needsIndex
|
38
|
-
? angular_1.addToFeature('', 'component', options, 'libs/xplat', tree, '_base_index', true)(tree, context)
|
39
|
-
: schematics_1.noop()(tree, context),
|
38
|
+
? (0, angular_1.addToFeature)('', 'component', options, 'libs/xplat', tree, '_base_index', true)(tree, context)
|
39
|
+
: (0, schematics_1.noop)()(tree, context),
|
40
40
|
// adjust libs barrel
|
41
41
|
(tree, context) => !options.onlyProject && options.createBase
|
42
|
-
? angular_1.adjustBarrelIndex('component', options, `libs/xplat/features/src/lib/${componentSettings.featureName}/base/index.ts`, false, true)(tree, context)
|
43
|
-
: schematics_1.noop()(tree, context),
|
42
|
+
? (0, angular_1.adjustBarrelIndex)('component', options, `libs/xplat/features/src/lib/${componentSettings.featureName}/base/index.ts`, false, true)(tree, context)
|
43
|
+
: (0, schematics_1.noop)()(tree, context),
|
44
44
|
// add index barrel if needed
|
45
45
|
(tree, context) => options.needsIndex
|
46
|
-
? angular_1.addToFeature('', 'component', options, 'libs/xplat', tree, '_base_index')(tree, context)
|
47
|
-
: schematics_1.noop()(tree, context),
|
46
|
+
? (0, angular_1.addToFeature)('', 'component', options, 'libs/xplat', tree, '_base_index')(tree, context)
|
47
|
+
: (0, schematics_1.noop)()(tree, context),
|
48
48
|
// add platform chains
|
49
|
-
(tree, context) => schematics_1.chain(externalChains),
|
50
|
-
workspace_1.formatFiles({ skipFormat: options.skipFormat }),
|
49
|
+
(tree, context) => (0, schematics_1.chain)(externalChains),
|
50
|
+
(0, workspace_1.formatFiles)({ skipFormat: options.skipFormat }),
|
51
51
|
]);
|
52
52
|
}
|
53
53
|
exports.default = default_1;
|
@@ -22,16 +22,16 @@ describe('component schematic', () => {
|
|
22
22
|
};
|
23
23
|
beforeEach(() => {
|
24
24
|
appTree = schematics_1.Tree.empty();
|
25
|
-
appTree = testing_1.createXplatWithNativeScriptWeb(appTree, false, 'angular');
|
25
|
+
appTree = (0, testing_1.createXplatWithNativeScriptWeb)(appTree, false, 'angular');
|
26
26
|
});
|
27
27
|
it('should create component for specified platforms', () => __awaiter(void 0, void 0, void 0, function* () {
|
28
28
|
// console.log('appTree:', appTree);
|
29
|
-
let tree = yield testing_2.runSchematic('feature', {
|
29
|
+
let tree = yield (0, testing_2.runSchematic)('feature', {
|
30
30
|
name: 'foo',
|
31
31
|
platforms: 'nativescript,web',
|
32
32
|
}, appTree);
|
33
33
|
const options = Object.assign({}, defaultOptions);
|
34
|
-
tree = yield testing_2.runSchematic('component', options, tree);
|
34
|
+
tree = yield (0, testing_2.runSchematic)('component', options, tree);
|
35
35
|
const files = tree.files;
|
36
36
|
// console.log(files.slice(91,files.length));
|
37
37
|
// component
|
@@ -42,7 +42,7 @@ describe('component schematic', () => {
|
|
42
42
|
expect(tree.exists('/libs/xplat/web/features/src/lib/foo/components/signup/signup.component.ts')).toBeTruthy();
|
43
43
|
// ensure base index was modified
|
44
44
|
let barrelPath = '/libs/xplat/features/src/lib/foo/base/index.ts';
|
45
|
-
let barrelIndex = testing_1.getFileContent(tree, barrelPath);
|
45
|
+
let barrelIndex = (0, testing_1.getFileContent)(tree, barrelPath);
|
46
46
|
// console.log(barrelPath + ':');
|
47
47
|
// console.log(barrelIndex);
|
48
48
|
// component symbol should be at end of components collection
|
@@ -50,28 +50,28 @@ describe('component schematic', () => {
|
|
50
50
|
// file content
|
51
51
|
barrelPath =
|
52
52
|
'/libs/xplat/nativescript/features/src/lib/foo/components/index.ts';
|
53
|
-
barrelIndex = testing_1.getFileContent(tree, barrelPath);
|
53
|
+
barrelIndex = (0, testing_1.getFileContent)(tree, barrelPath);
|
54
54
|
// console.log(barrelPath + ':');
|
55
55
|
// console.log(barrelIndex);
|
56
56
|
// component symbol should be at end of components collection
|
57
57
|
expect(barrelIndex.indexOf(`SignupComponent];`)).toBeGreaterThanOrEqual(0);
|
58
58
|
expect(barrelIndex.indexOf(`./signup/signup.component`)).toBeGreaterThanOrEqual(0);
|
59
59
|
barrelPath = '/libs/xplat/web/features/src/lib/foo/components/index.ts';
|
60
|
-
barrelIndex = testing_1.getFileContent(tree, barrelPath);
|
60
|
+
barrelIndex = (0, testing_1.getFileContent)(tree, barrelPath);
|
61
61
|
// console.log(barrelPath + ':');
|
62
62
|
// console.log(barrelIndex);
|
63
63
|
expect(barrelIndex.indexOf(`SignupComponent];`)).toBeGreaterThanOrEqual(0);
|
64
64
|
}));
|
65
65
|
it('should create component for specified platforms with framework name when no default is set', () => __awaiter(void 0, void 0, void 0, function* () {
|
66
66
|
appTree = schematics_1.Tree.empty();
|
67
|
-
appTree = testing_1.createXplatWithNativeScriptWeb(appTree);
|
67
|
+
appTree = (0, testing_1.createXplatWithNativeScriptWeb)(appTree);
|
68
68
|
// console.log('appTree:', appTree);
|
69
|
-
let tree = yield testing_2.runSchematic('feature', {
|
69
|
+
let tree = yield (0, testing_2.runSchematic)('feature', {
|
70
70
|
name: 'foo',
|
71
71
|
platforms: 'nativescript,web',
|
72
72
|
}, appTree);
|
73
73
|
const options = Object.assign({}, defaultOptions);
|
74
|
-
tree = yield testing_2.runSchematic('component', options, tree);
|
74
|
+
tree = yield (0, testing_2.runSchematic)('component', options, tree);
|
75
75
|
const files = tree.files;
|
76
76
|
// console.log(files);//.slice(91,files.length));
|
77
77
|
// component
|
@@ -83,13 +83,13 @@ describe('component schematic', () => {
|
|
83
83
|
}));
|
84
84
|
it('should create component for specified platforms with subFolder option', () => __awaiter(void 0, void 0, void 0, function* () {
|
85
85
|
// console.log('appTree:', appTree);
|
86
|
-
let tree = yield testing_2.runSchematic('feature', {
|
86
|
+
let tree = yield (0, testing_2.runSchematic)('feature', {
|
87
87
|
name: 'foo',
|
88
88
|
platforms: 'nativescript,web',
|
89
89
|
}, appTree);
|
90
90
|
const options = Object.assign({}, defaultOptions);
|
91
91
|
options.subFolder = 'registration';
|
92
|
-
tree = yield testing_2.runSchematic('component', options, tree);
|
92
|
+
tree = yield (0, testing_2.runSchematic)('component', options, tree);
|
93
93
|
const files = tree.files;
|
94
94
|
// console.log(files.slice(91,files.length));
|
95
95
|
// component
|
@@ -100,12 +100,12 @@ describe('component schematic', () => {
|
|
100
100
|
expect(tree.exists('/libs/xplat/web/features/src/lib/foo/components/registration/signup/signup.component.ts')).toBeTruthy();
|
101
101
|
// ensure base index was modified
|
102
102
|
let barrelPath = '/libs/xplat/features/src/lib/foo/base/registration/index.ts';
|
103
|
-
let barrelIndex = testing_1.getFileContent(tree, barrelPath);
|
103
|
+
let barrelIndex = (0, testing_1.getFileContent)(tree, barrelPath);
|
104
104
|
// console.log(barrelPath + ':');
|
105
105
|
// console.log(barrelIndex);
|
106
106
|
expect(barrelIndex.indexOf(`./signup.base-component`)).toBeTruthy();
|
107
107
|
barrelPath = '/libs/xplat/features/src/lib/foo/base/index.ts';
|
108
|
-
barrelIndex = testing_1.getFileContent(tree, barrelPath);
|
108
|
+
barrelIndex = (0, testing_1.getFileContent)(tree, barrelPath);
|
109
109
|
// console.log(barrelPath + ':');
|
110
110
|
// console.log(barrelIndex);
|
111
111
|
// component symbol should be at end of components collection
|
@@ -113,34 +113,34 @@ describe('component schematic', () => {
|
|
113
113
|
// file content
|
114
114
|
barrelPath =
|
115
115
|
'/libs/xplat/nativescript/features/src/lib/foo/components/registration/index.ts';
|
116
|
-
barrelIndex = testing_1.getFileContent(tree, barrelPath);
|
116
|
+
barrelIndex = (0, testing_1.getFileContent)(tree, barrelPath);
|
117
117
|
// console.log(barrelPath + ':');
|
118
118
|
// console.log(barrelIndex);
|
119
119
|
// component symbol should be at end of components collection
|
120
120
|
expect(barrelIndex.indexOf(`SignupComponent];`)).toBeGreaterThanOrEqual(0);
|
121
121
|
barrelPath =
|
122
122
|
'/libs/xplat/web/features/src/lib/foo/components/registration/index.ts';
|
123
|
-
barrelIndex = testing_1.getFileContent(tree, barrelPath);
|
123
|
+
barrelIndex = (0, testing_1.getFileContent)(tree, barrelPath);
|
124
124
|
// console.log(barrelPath + ':');
|
125
125
|
// console.log(barrelIndex);
|
126
126
|
expect(barrelIndex.indexOf(`./signup/signup.component`)).toBeGreaterThanOrEqual(0);
|
127
127
|
// file content
|
128
128
|
barrelPath =
|
129
129
|
'/libs/xplat/nativescript/features/src/lib/foo/components/index.ts';
|
130
|
-
barrelIndex = testing_1.getFileContent(tree, barrelPath);
|
130
|
+
barrelIndex = (0, testing_1.getFileContent)(tree, barrelPath);
|
131
131
|
// console.log(barrelPath + ':');
|
132
132
|
// console.log(barrelIndex);
|
133
133
|
// component symbol should be at end of components collection
|
134
134
|
expect(barrelIndex.indexOf(`REGISTRATION_COMPONENTS`)).toBeGreaterThanOrEqual(0);
|
135
135
|
barrelPath = '/libs/xplat/web/features/src/lib/foo/components/index.ts';
|
136
|
-
barrelIndex = testing_1.getFileContent(tree, barrelPath);
|
136
|
+
barrelIndex = (0, testing_1.getFileContent)(tree, barrelPath);
|
137
137
|
// console.log(barrelPath + ':');
|
138
138
|
// console.log(barrelIndex);
|
139
139
|
expect(barrelIndex.indexOf(`REGISTRATION_COMPONENTS`)).toBeGreaterThanOrEqual(0);
|
140
140
|
}));
|
141
141
|
it('should create component for specified projects only', () => __awaiter(void 0, void 0, void 0, function* () {
|
142
142
|
// console.log('appTree:', appTree);
|
143
|
-
let tree = yield testing_2.runSchematic('feature', {
|
143
|
+
let tree = yield (0, testing_2.runSchematic)('feature', {
|
144
144
|
name: 'foo',
|
145
145
|
projects: 'nativescript-viewer,web-viewer',
|
146
146
|
onlyProject: true,
|
@@ -150,7 +150,7 @@ describe('component schematic', () => {
|
|
150
150
|
feature: 'foo',
|
151
151
|
projects: 'nativescript-viewer,web-viewer',
|
152
152
|
};
|
153
|
-
tree = yield testing_2.runSchematic('component', options, tree);
|
153
|
+
tree = yield (0, testing_2.runSchematic)('component', options, tree);
|
154
154
|
const files = tree.files;
|
155
155
|
// console.log(files. slice(91,files.length));
|
156
156
|
// component should not be setup to share
|
@@ -166,7 +166,7 @@ describe('component schematic', () => {
|
|
166
166
|
expect(tree.exists('/apps/web-viewer/src/app/features/foo/components/signup/signup.component.ts')).toBeTruthy();
|
167
167
|
// file content
|
168
168
|
let barrelPath = '/apps/nativescript-viewer/src/features/foo/components/index.ts';
|
169
|
-
let barrelIndex = testing_1.getFileContent(tree, barrelPath);
|
169
|
+
let barrelIndex = (0, testing_1.getFileContent)(tree, barrelPath);
|
170
170
|
// console.log(barrelPath + ':');
|
171
171
|
// console.log(barrelIndex);
|
172
172
|
// component symbol should be at end of components collection
|
@@ -178,7 +178,7 @@ describe('component schematic', () => {
|
|
178
178
|
// // component symbol should be at end of components collection
|
179
179
|
// expect(content.indexOf(`./signup/signup.component.ts`)).toBeGreaterThanOrEqual(0);
|
180
180
|
barrelPath = '/apps/web-viewer/src/app/features/foo/components/index.ts';
|
181
|
-
barrelIndex = testing_1.getFileContent(tree, barrelPath);
|
181
|
+
barrelIndex = (0, testing_1.getFileContent)(tree, barrelPath);
|
182
182
|
// console.log(barrelPath + ':');
|
183
183
|
// console.log(barrelIndex);
|
184
184
|
expect(barrelIndex.indexOf(`SignupComponent];`)).toBeGreaterThanOrEqual(0);
|
@@ -190,6 +190,6 @@ describe('component schematic', () => {
|
|
190
190
|
feature: 'foo',
|
191
191
|
projects: 'nativescript-viewer,web-viewer',
|
192
192
|
};
|
193
|
-
yield expect(testing_2.runSchematic('component', options, appTree)).rejects.toThrow(`apps/nativescript-viewer/src/features/foo/foo.module.ts does not exist. Create the feature module first. For example: nx g @nstudio/angular:feature foo --projects=nativescript-viewer --onlyModule`);
|
193
|
+
yield expect((0, testing_2.runSchematic)('component', options, appTree)).rejects.toThrow(`apps/nativescript-viewer/src/features/foo/foo.module.ts does not exist. Create the feature module first. For example: nx g @nstudio/angular:feature foo --projects=nativescript-viewer --onlyModule`);
|
194
194
|
}));
|
195
195
|
});
|
@@ -2,6 +2,6 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
const angular_1 = require("@nstudio/angular");
|
4
4
|
function default_1(options) {
|
5
|
-
return angular_1.generate('directive', options);
|
5
|
+
return (0, angular_1.generate)('directive', options);
|
6
6
|
}
|
7
7
|
exports.default = default_1;
|