@nstudio/angular 16.8.0 → 17.0.0-alpha.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/collection.json +0 -5
- package/package.json +3 -3
- package/src/schematics/application/index.js +20 -60
- package/src/schematics/application/index.spec.js +2 -2
- package/src/schematics/component/index.js +0 -2
- package/src/schematics/feature/index.js +0 -2
- package/src/schematics/helpers/index.js +1 -2
- package/src/schematics/xplat/index.js +0 -2
- package/src/utils/generator.js +0 -2
- package/src/utils/versions.d.ts +2 -3
- package/src/utils/versions.js +4 -5
- package/src/utils/xplat.js +1 -1
- package/src/schematics/elements/_builder_files/builder/elements.ts__tmpl__ +0 -6
- package/src/schematics/elements/_builder_files/builder/index.html +0 -13
- package/src/schematics/elements/_builder_files/builder/polyfills.ts__tmpl__ +0 -77
- package/src/schematics/elements/_builder_files/builder/tsconfig.elements.json +0 -10
- package/src/schematics/elements/_files/__name__.module.ts__tmpl__ +0 -20
- package/src/schematics/elements/index.d.ts +0 -3
- package/src/schematics/elements/index.js +0 -239
- package/src/schematics/elements/index.spec.d.ts +0 -1
- package/src/schematics/elements/index.spec.js +0 -137
- package/src/schematics/elements/schema.json +0 -38
package/collection.json
CHANGED
@@ -49,11 +49,6 @@
|
|
49
49
|
"schema": "./src/schematics/ngrx/schema.json",
|
50
50
|
"description": "Create a ngrx store."
|
51
51
|
},
|
52
|
-
"elements": {
|
53
|
-
"factory": "./src/schematics/elements",
|
54
|
-
"schema": "./src/schematics/elements/schema.json",
|
55
|
-
"description": "Create custom elements for the web with Angular."
|
56
|
-
},
|
57
52
|
"helpers": {
|
58
53
|
"factory": "./src/schematics/helpers",
|
59
54
|
"schema": "./src/schematics/helpers/schema.json",
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@nstudio/angular",
|
3
|
-
"version": "
|
3
|
+
"version": "17.0.0-alpha.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
|
-
"@nx/angular": "^
|
32
|
+
"@nx/angular": "^17.0.0"
|
33
33
|
},
|
34
34
|
"peerDependencies": {
|
35
|
-
"@nstudio/xplat": "
|
35
|
+
"@nstudio/xplat": "17.0.0-alpha.0"
|
36
36
|
}
|
37
37
|
}
|
@@ -10,7 +10,8 @@ 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
|
13
|
+
const devkit_1 = require("@nx/devkit");
|
14
|
+
const generators_1 = require("@nx/angular/generators");
|
14
15
|
const xplat_1 = require("@nstudio/xplat");
|
15
16
|
const xplat_utils_1 = require("@nstudio/xplat-utils");
|
16
17
|
function default_1(options) {
|
@@ -52,16 +53,13 @@ function default_1(options) {
|
|
52
53
|
// ensure ends up in apps directory
|
53
54
|
nrwlWebOptions.directory = `apps/${options.directory}`;
|
54
55
|
}
|
55
|
-
let executionOptions;
|
56
56
|
if (options.useXplat) {
|
57
57
|
// when generating xplat architecture, ensure:
|
58
58
|
// 1. sass is used
|
59
59
|
nrwlWebOptions.style = 'scss';
|
60
|
-
// executionOptions = {
|
61
|
-
// interactive: false
|
62
|
-
// };
|
63
60
|
}
|
64
|
-
|
61
|
+
// NOTE: This is what this needs to be:
|
62
|
+
return (0, devkit_1.convertNxGenerator)(generators_1.applicationGenerator)(nrwlWebOptions);
|
65
63
|
},
|
66
64
|
(tree, context) => addHeadlessE2e(options)(tree, context),
|
67
65
|
options.useXplat
|
@@ -72,58 +70,18 @@ function default_1(options) {
|
|
72
70
|
: (0, schematics_1.noop)(),
|
73
71
|
// adjust app files
|
74
72
|
options.useXplat
|
75
|
-
? (tree, context) => adjustAppFiles(options, tree)
|
73
|
+
? (tree, context) => adjustAppFiles(options, tree, context)
|
76
74
|
: (0, schematics_1.noop)(),
|
77
|
-
(0, workspace_1.formatFiles)({ skipFormat: options.skipFormat }),
|
78
75
|
]);
|
79
76
|
}
|
80
77
|
exports.default = default_1;
|
81
|
-
/**
|
82
|
-
* Add a Protractor config with headless Chrome and create a
|
83
|
-
* target configuration to use the config created.
|
84
|
-
*
|
85
|
-
* @param options
|
86
|
-
*/
|
87
|
-
function addProtractorCiConfig(options) {
|
88
|
-
return (tree, context) => {
|
89
|
-
const config = `
|
90
|
-
const defaultConfig = require('./protractor.conf').config;
|
91
|
-
defaultConfig.capabilities.chromeOptions = {
|
92
|
-
args: ['--headless']
|
93
|
-
};
|
94
|
-
|
95
|
-
exports.config = defaultConfig;
|
96
|
-
`;
|
97
|
-
const directory = options.directory ? `${options.directory}/` : '';
|
98
|
-
const e2eProjectName = `${options.name}-e2e`;
|
99
|
-
const confFile = 'protractor.headless.js';
|
100
|
-
tree.create(`/apps/${directory}${e2eProjectName}/${confFile}`, config);
|
101
|
-
return (0, workspace_1.updateWorkspace)((workspace) => {
|
102
|
-
if (workspace.projects.has(e2eProjectName)) {
|
103
|
-
const projectDef = workspace.projects.get(e2eProjectName);
|
104
|
-
const e2eDef = projectDef.targets.get('e2e');
|
105
|
-
if (e2eDef) {
|
106
|
-
e2eDef.configurations.ci = {
|
107
|
-
protractorConfig: `apps/${directory}${e2eProjectName}/${confFile}`,
|
108
|
-
};
|
109
|
-
projectDef.targets.set('e2e', e2eDef);
|
110
|
-
}
|
111
|
-
}
|
112
|
-
});
|
113
|
-
};
|
114
|
-
}
|
115
78
|
/**
|
116
79
|
* Add headless options to e2e tests
|
117
80
|
* @param options
|
118
81
|
*/
|
119
82
|
function addHeadlessE2e(options) {
|
120
83
|
const framework = options.e2eTestRunner;
|
121
|
-
|
122
|
-
case 'protractor':
|
123
|
-
return addProtractorCiConfig(options);
|
124
|
-
default:
|
125
|
-
return (0, schematics_1.noop)();
|
126
|
-
}
|
84
|
+
return (0, schematics_1.noop)();
|
127
85
|
}
|
128
86
|
function addAppFiles(options, extra = '') {
|
129
87
|
extra = extra ? `${extra}_` : '';
|
@@ -133,7 +91,7 @@ function addAppFiles(options, extra = '') {
|
|
133
91
|
(0, schematics_1.move)(`apps/${directory}${options.name}`),
|
134
92
|
])));
|
135
93
|
}
|
136
|
-
function adjustAppFiles(options, tree) {
|
94
|
+
function adjustAppFiles(options, tree, context) {
|
137
95
|
return __awaiter(this, void 0, void 0, function* () {
|
138
96
|
const directory = options.directory ? `${options.directory}/` : '';
|
139
97
|
tree.overwrite(`/apps/${directory}${options.name}/src/index.html`, indexContent(options.name));
|
@@ -150,18 +108,20 @@ function adjustAppFiles(options, tree) {
|
|
150
108
|
tree.overwrite(`/apps/${directory}${options.name}/src/app/app.component.spec.ts`, appCmpSpec());
|
151
109
|
tree.overwrite(`/apps/${directory}${options.name}/src/app/app.module.ts`, appModuleContent(options));
|
152
110
|
// update cli config for shared web specific scss
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
111
|
+
(0, devkit_1.updateProjectConfiguration)((0, xplat_1.convertNgTreeToDevKit)(tree, context), options.name, {
|
112
|
+
root: `apps/${directory}${options.name}`,
|
113
|
+
targets: {
|
114
|
+
build: {
|
115
|
+
options: {
|
116
|
+
styles: [
|
117
|
+
`libs/xplat/${xplat_1.XplatHelpers.getXplatFoldername('web', 'angular')}/scss/src/_index.scss`,
|
118
|
+
`apps/${directory}${options.name}/src/styles.scss`,
|
119
|
+
]
|
120
|
+
}
|
121
|
+
}
|
162
122
|
}
|
163
|
-
}
|
164
|
-
return (0,
|
123
|
+
});
|
124
|
+
return (0, schematics_1.noop)();
|
165
125
|
});
|
166
126
|
}
|
167
127
|
function indexContent(name) {
|
@@ -40,7 +40,7 @@ describe('app', () => {
|
|
40
40
|
expect(tree.exists('/libs/xplat/web/scss/src/_index.scss')).toBeTruthy();
|
41
41
|
expect(tree.exists('/libs/xplat/web/scss/src/package.json')).toBeTruthy();
|
42
42
|
// let checkPath = 'angular.json'
|
43
|
-
// let checkFile =
|
43
|
+
// let checkFile = tree.readContent(checkPath)
|
44
44
|
// console.log(checkPath, checkFile)
|
45
45
|
}));
|
46
46
|
it('should create all files for web app using groupByName', () => __awaiter(void 0, void 0, void 0, function* () {
|
@@ -51,7 +51,7 @@ describe('app', () => {
|
|
51
51
|
// console.log(files);
|
52
52
|
expect(files.indexOf('/apps/foo-web/tsconfig.json')).toBeGreaterThanOrEqual(0);
|
53
53
|
let checkPath = (0, xplat_utils_1.getRootTsConfigPath)();
|
54
|
-
let checkFile =
|
54
|
+
let checkFile = tree.readContent(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);
|
@@ -3,7 +3,6 @@ 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("@nx/workspace");
|
7
6
|
const angular_1 = require("@nstudio/angular");
|
8
7
|
let componentSettings;
|
9
8
|
function default_1(options) {
|
@@ -47,7 +46,6 @@ function default_1(options) {
|
|
47
46
|
: (0, schematics_1.noop)()(tree, context),
|
48
47
|
// add platform chains
|
49
48
|
(tree, context) => (0, schematics_1.chain)(externalChains),
|
50
|
-
(0, workspace_1.formatFiles)({ skipFormat: options.skipFormat }),
|
51
49
|
]);
|
52
50
|
}
|
53
51
|
exports.default = default_1;
|
@@ -1,7 +1,6 @@
|
|
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("@nx/workspace");
|
5
4
|
const xplat_1 = require("@nstudio/xplat");
|
6
5
|
const xplat_utils_1 = require("@nstudio/xplat-utils");
|
7
6
|
function default_1(options) {
|
@@ -40,7 +39,6 @@ function default_1(options) {
|
|
40
39
|
: xplat_1.XplatFeatureHelpers.adjustBarrelIndex(options, 'libs/xplat/features/src/lib/index.ts'),
|
41
40
|
// external schematic handling
|
42
41
|
(tree, context) => (0, schematics_1.chain)(externalChains),
|
43
|
-
(0, workspace_1.formatFiles)({ skipFormat: options.skipFormat }),
|
44
42
|
]);
|
45
43
|
}
|
46
44
|
exports.default = default_1;
|
@@ -4,7 +4,6 @@ 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("@nx/workspace");
|
8
7
|
const supportedHelpers = {
|
9
8
|
applitools: applitools_1.config,
|
10
9
|
};
|
@@ -22,6 +21,6 @@ function default_1(options) {
|
|
22
21
|
helperChain.push((0, schematics_1.noop)());
|
23
22
|
}
|
24
23
|
}
|
25
|
-
return (0, schematics_1.chain)([(0, xplat_utils_1.prerun)(options), ...helperChain
|
24
|
+
return (0, schematics_1.chain)([(0, xplat_utils_1.prerun)(options), ...helperChain]);
|
26
25
|
}
|
27
26
|
exports.default = default_1;
|
@@ -1,7 +1,6 @@
|
|
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("@nx/workspace");
|
5
4
|
const xplat_1 = require("@nstudio/xplat");
|
6
5
|
const xplat_utils_1 = require("@nstudio/xplat-utils");
|
7
6
|
const xplat_2 = require("../../utils/xplat");
|
@@ -40,7 +39,6 @@ function default_1(options) {
|
|
40
39
|
}
|
41
40
|
});
|
42
41
|
},
|
43
|
-
(0, workspace_1.formatFiles)({ skipFormat: options.skipFormat }),
|
44
42
|
// clean shared code script - don't believe need this anymore
|
45
43
|
// (tree: Tree) => {
|
46
44
|
// const scripts = {};
|
package/src/utils/generator.js
CHANGED
@@ -2,7 +2,6 @@
|
|
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("@nx/workspace");
|
6
5
|
const xplat_1 = require("@nstudio/xplat");
|
7
6
|
const xplat_utils_1 = require("@nstudio/xplat-utils");
|
8
7
|
const ast_1 = require("./ast");
|
@@ -164,7 +163,6 @@ function generate(type, options) {
|
|
164
163
|
? // ensure ngrx dependencies are added to root package
|
165
164
|
(0, xplat_1.updatePackageForNgrx)(tree)
|
166
165
|
: (0, schematics_1.noop)()(tree, context),
|
167
|
-
(0, workspace_1.formatFiles)({ skipFormat: options.skipFormat }),
|
168
166
|
]);
|
169
167
|
}
|
170
168
|
exports.generate = generate;
|
package/src/utils/versions.d.ts
CHANGED
@@ -1,10 +1,9 @@
|
|
1
1
|
export declare const xplatVersion = "*";
|
2
|
-
export declare const nxVersion = "^
|
2
|
+
export declare const nxVersion = "^17.0.0";
|
3
3
|
export declare const angularVersion = "^16.0.0";
|
4
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.8.0";
|
8
8
|
export declare const zonejsVersion = "~0.13.0";
|
9
|
-
export declare const
|
10
|
-
export declare const typesJest = "29.4.0";
|
9
|
+
export declare const typesJest = "29.5.6";
|
package/src/utils/versions.js
CHANGED
@@ -1,13 +1,12 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.typesJest = exports.
|
4
|
-
exports.xplatVersion = '
|
5
|
-
exports.nxVersion = '^
|
3
|
+
exports.typesJest = exports.zonejsVersion = exports.rxjsVersion = exports.ngxTranslateHttpVersion = exports.ngxTranslateVersion = exports.angularDevkitVersion = exports.angularVersion = exports.nxVersion = exports.xplatVersion = void 0;
|
4
|
+
exports.xplatVersion = '17.0.0-alpha.0';
|
5
|
+
exports.nxVersion = '^17.0.0';
|
6
6
|
exports.angularVersion = '^16.0.0';
|
7
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.8.0';
|
11
11
|
exports.zonejsVersion = '~0.13.0';
|
12
|
-
exports.
|
13
|
-
exports.typesJest = '29.4.0';
|
12
|
+
exports.typesJest = '29.5.6';
|
package/src/utils/xplat.js
CHANGED
@@ -119,7 +119,7 @@ var XplatAngularHelpers;
|
|
119
119
|
dependencies[`@${(0, xplat_utils_1.getNpmScope)()}/xplat-scss`] = 'file:libs/xplat/scss/src';
|
120
120
|
return xplat_1.XplatHelpers.updatePackageForXplat(options, {
|
121
121
|
dependencies: Object.assign(Object.assign({}, dependencies), { '@ngx-translate/core': versions_1.ngxTranslateVersion, '@ngx-translate/http-loader': versions_1.ngxTranslateHttpVersion }),
|
122
|
-
devDependencies: Object.assign(Object.assign({}, devDependencies), { '@types/jest': versions_1.typesJest
|
122
|
+
devDependencies: Object.assign(Object.assign({}, devDependencies), { '@types/jest': versions_1.typesJest }),
|
123
123
|
})(tree, context);
|
124
124
|
};
|
125
125
|
}
|
@@ -1,6 +0,0 @@
|
|
1
|
-
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
2
|
-
import { <%= utils.classify(name) %>Module } from '../<%= name %>.module';
|
3
|
-
|
4
|
-
platformBrowserDynamic()
|
5
|
-
.bootstrapModule(<%= utils.classify(name) %>Module)
|
6
|
-
.catch(err => console.log(err));
|
@@ -1,13 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html lang="en">
|
3
|
-
<head>
|
4
|
-
<meta charset="utf-8" />
|
5
|
-
<title>Custom Elements</title>
|
6
|
-
<base href="/" />
|
7
|
-
|
8
|
-
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
9
|
-
</head>
|
10
|
-
<body>
|
11
|
-
<%= htmlElements %>
|
12
|
-
</body>
|
13
|
-
</html>
|
@@ -1,77 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* This file includes polyfills needed by Angular and is loaded before the app.
|
3
|
-
* You can add your own extra polyfills to this file.
|
4
|
-
*
|
5
|
-
* This file is divided into 2 sections:
|
6
|
-
* 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers.
|
7
|
-
* 2. Application imports. Files imported after ZoneJS that should be loaded before your main
|
8
|
-
* file.
|
9
|
-
*
|
10
|
-
* The current setup is for so-called "evergreen" browsers; the last versions of browsers that
|
11
|
-
* automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera),
|
12
|
-
* Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile.
|
13
|
-
*
|
14
|
-
* Learn more in https://angular.io/docs/ts/latest/guide/browser-support.html
|
15
|
-
*/
|
16
|
-
|
17
|
-
/***************************************************************************************************
|
18
|
-
* BROWSER POLYFILLS
|
19
|
-
*/
|
20
|
-
|
21
|
-
/** IE9, IE10 and IE11 requires all of the following polyfills. **/
|
22
|
-
// import 'core-js/es6/symbol';
|
23
|
-
// import 'core-js/es6/object';
|
24
|
-
// import 'core-js/es6/function';
|
25
|
-
// import 'core-js/es6/parse-int';
|
26
|
-
// import 'core-js/es6/parse-float';
|
27
|
-
// import 'core-js/es6/number';
|
28
|
-
// import 'core-js/es6/math';
|
29
|
-
// import 'core-js/es6/string';
|
30
|
-
// import 'core-js/es6/date';
|
31
|
-
// import 'core-js/es6/array';
|
32
|
-
// import 'core-js/es6/regexp';
|
33
|
-
// import 'core-js/es6/map';
|
34
|
-
// import 'core-js/es6/weak-map';
|
35
|
-
// import 'core-js/es6/set';
|
36
|
-
|
37
|
-
/** IE10 and IE11 requires the following for NgClass support on SVG elements */
|
38
|
-
// import 'classlist.js'; // Run `npm install --save classlist.js`.
|
39
|
-
|
40
|
-
/** IE10 and IE11 requires the following for the Reflect API. */
|
41
|
-
// import 'core-js/es6/reflect';
|
42
|
-
|
43
|
-
/** Evergreen browsers require these. **/
|
44
|
-
// Used for reflect-metadata in JIT. If you use AOT (and only Angular decorators), you can remove.
|
45
|
-
// import 'core-js/es/reflect';
|
46
|
-
|
47
|
-
/**
|
48
|
-
* Web Animations `@angular/platform-browser/animations`
|
49
|
-
* Only required if AnimationBuilder is used within the application and using IE/Edge or Safari.
|
50
|
-
* Standard animation support in Angular DOES NOT require any polyfills (as of Angular 6.0).
|
51
|
-
**/
|
52
|
-
// import 'web-animations-js'; // Run `npm install --save web-animations-js`.
|
53
|
-
|
54
|
-
/**
|
55
|
-
* By default, zone.js will patch all possible macroTask and DomEvents
|
56
|
-
* user can disable parts of macroTask/DomEvents patch by setting following flags
|
57
|
-
*/
|
58
|
-
|
59
|
-
// (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame
|
60
|
-
// (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick
|
61
|
-
// (window as any).__zone_symbol__BLACK_LISTED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames
|
62
|
-
|
63
|
-
/*
|
64
|
-
* in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js
|
65
|
-
* with the following flag, it will bypass `zone.js` patch for IE/Edge
|
66
|
-
*/
|
67
|
-
// (window as any).__Zone_enable_cross_context_check = true;
|
68
|
-
|
69
|
-
/***************************************************************************************************
|
70
|
-
* Zone JS is required by default for Angular itself.
|
71
|
-
*/
|
72
|
-
import 'zone.js/dist/zone'; // Included with Angular CLI.
|
73
|
-
|
74
|
-
/***************************************************************************************************
|
75
|
-
* APPLICATION IMPORTS
|
76
|
-
*/
|
77
|
-
import '@webcomponents/webcomponentsjs/custom-elements-es5-adapter.js';
|
@@ -1,20 +0,0 @@
|
|
1
|
-
import { NgModule, Injector } from '@angular/core';
|
2
|
-
import { BrowserModule } from '@angular/platform-browser';
|
3
|
-
import { createCustomElement } from '@angular/elements';
|
4
|
-
import { <%= componentSymbolList %> } from '<%= barrel %>';
|
5
|
-
|
6
|
-
@NgModule({
|
7
|
-
imports: [BrowserModule],
|
8
|
-
entryComponents: [
|
9
|
-
<%= componentSymbolList %>
|
10
|
-
]
|
11
|
-
})
|
12
|
-
export class <%= utils.classify(name) %>Module {
|
13
|
-
constructor(private injector: Injector) {
|
14
|
-
|
15
|
-
}
|
16
|
-
|
17
|
-
ngDoBootstrap() {
|
18
|
-
<%= customElementList %>
|
19
|
-
}
|
20
|
-
}
|
@@ -1,239 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
const schematics_1 = require("@angular-devkit/schematics");
|
4
|
-
const workspace_1 = require("@nx/workspace");
|
5
|
-
const xplat_1 = require("@nstudio/xplat");
|
6
|
-
const xplat_utils_1 = require("@nstudio/xplat-utils");
|
7
|
-
let customElementList;
|
8
|
-
let componentSymbols;
|
9
|
-
let componentSymbolList;
|
10
|
-
let htmlElements;
|
11
|
-
function default_1(options) {
|
12
|
-
if (!options.builderModule) {
|
13
|
-
const example = `nx g @nstudio/angular:elements menu --barrel=@mycompany/ui --components=menu,footer`;
|
14
|
-
if (!options.name) {
|
15
|
-
throw new schematics_1.SchematicsException((0, xplat_1.missingArgument)('name', 'Provide a name for the custom element module.', example));
|
16
|
-
}
|
17
|
-
if (!options.barrel) {
|
18
|
-
throw new schematics_1.SchematicsException((0, xplat_1.missingArgument)('barrel', 'Provide the name of the workspace barrel where your components live.', example));
|
19
|
-
}
|
20
|
-
if (!options.components) {
|
21
|
-
throw new schematics_1.SchematicsException((0, xplat_1.missingArgument)('components', `Provide a comma delimited list of components you'd like to create as custom elements.`, example));
|
22
|
-
}
|
23
|
-
}
|
24
|
-
return (0, schematics_1.chain)([
|
25
|
-
(0, xplat_utils_1.prerun)(options),
|
26
|
-
(tree) => {
|
27
|
-
if (!options.builderModule) {
|
28
|
-
const workspacePrefix = options.prefix || (0, xplat_utils_1.getPrefix)() || '';
|
29
|
-
const htmlElementList = [];
|
30
|
-
componentSymbols = [];
|
31
|
-
// parse component names to standard convention
|
32
|
-
const componentNames = options.components.split(',');
|
33
|
-
for (let component of componentNames) {
|
34
|
-
// using short name ("menu" for a component named "MenuComponent")
|
35
|
-
// convert to fully best practice name
|
36
|
-
const isShortName = component.toLowerCase().indexOf('component') === -1;
|
37
|
-
let selector = `${workspacePrefix ? `${workspacePrefix}-` : ''}`;
|
38
|
-
if (isShortName) {
|
39
|
-
selector += component.toLowerCase();
|
40
|
-
}
|
41
|
-
else {
|
42
|
-
const parts = component.toLowerCase().split('component');
|
43
|
-
selector += parts[0];
|
44
|
-
}
|
45
|
-
componentSymbols.push({
|
46
|
-
selector,
|
47
|
-
symbol: `${xplat_1.stringUtils.classify(component)}${isShortName ? 'Component' : ''}`,
|
48
|
-
});
|
49
|
-
htmlElementList.push(`<${selector}></${selector}>`);
|
50
|
-
}
|
51
|
-
componentSymbolList = componentSymbols.map((c) => c.symbol).join(', ');
|
52
|
-
htmlElements = htmlElementList.join('\n');
|
53
|
-
customElementList = createCustomElementList(componentSymbols);
|
54
|
-
}
|
55
|
-
return tree;
|
56
|
-
},
|
57
|
-
// add custom element module
|
58
|
-
(tree, context) => {
|
59
|
-
return options.builderModule ? (0, schematics_1.noop)() : addFiles(options)(tree, context);
|
60
|
-
},
|
61
|
-
// add builder files or update them
|
62
|
-
(tree, context) => {
|
63
|
-
if (tree.exists('libs/xplat/web/elements/builder/index.html')) {
|
64
|
-
return updateBuilder(tree, options);
|
65
|
-
}
|
66
|
-
else {
|
67
|
-
return addFiles(options, 'builder')(tree, context);
|
68
|
-
}
|
69
|
-
},
|
70
|
-
// adjust app files
|
71
|
-
// (tree: Tree) => adjustAppFiles(options, tree),
|
72
|
-
// add build scripts
|
73
|
-
(tree) => {
|
74
|
-
if (options.builderModule) {
|
75
|
-
return (0, schematics_1.noop)();
|
76
|
-
}
|
77
|
-
else {
|
78
|
-
const scripts = {};
|
79
|
-
scripts[`build.web.elements`] = `ng build web-elements --prod --output-hashing=none --single-bundle=true --keep-polyfills=true`;
|
80
|
-
scripts[`preview.web.elements`] = `http-server dist/ngelements`;
|
81
|
-
return (0, xplat_1.updatePackageScripts)(tree, scripts);
|
82
|
-
}
|
83
|
-
},
|
84
|
-
(tree, context) => {
|
85
|
-
if (options.builderModule) {
|
86
|
-
return (0, schematics_1.noop)()(tree, context);
|
87
|
-
}
|
88
|
-
else {
|
89
|
-
return (0, workspace_1.updateWorkspace)((workspace) => {
|
90
|
-
const projectDef = {
|
91
|
-
root: '',
|
92
|
-
sourceRoot: 'libs/xplat/web/elements/builder',
|
93
|
-
projectType: 'application',
|
94
|
-
prefix: 'web-elements',
|
95
|
-
schematics: {},
|
96
|
-
targets: {
|
97
|
-
build: {
|
98
|
-
builder: 'ngx-build-plus:build',
|
99
|
-
options: {
|
100
|
-
outputPath: 'dist/ngelements',
|
101
|
-
index: 'libs/xplat/web/elements/builder/index.html',
|
102
|
-
main: 'libs/xplat/web/elements/builder/elements.ts',
|
103
|
-
polyfills: 'libs/xplat/web/elements/builder/polyfills.ts',
|
104
|
-
tsConfig: 'libs/xplat/web/elements/builder/tsconfig.elements.json',
|
105
|
-
},
|
106
|
-
configurations: {
|
107
|
-
production: {
|
108
|
-
optimization: true,
|
109
|
-
outputHashing: 'all',
|
110
|
-
sourceMap: false,
|
111
|
-
extractCss: true,
|
112
|
-
namedChunks: false,
|
113
|
-
aot: true,
|
114
|
-
extractLicenses: true,
|
115
|
-
vendorChunk: false,
|
116
|
-
buildOptimizer: true,
|
117
|
-
},
|
118
|
-
},
|
119
|
-
},
|
120
|
-
serve: {
|
121
|
-
builder: 'ngx-build-plus:dev-server',
|
122
|
-
options: {
|
123
|
-
browserTarget: 'web-elements:build',
|
124
|
-
},
|
125
|
-
configurations: {
|
126
|
-
production: {
|
127
|
-
browserTarget: 'web-elements:build:production',
|
128
|
-
},
|
129
|
-
},
|
130
|
-
},
|
131
|
-
},
|
132
|
-
};
|
133
|
-
if (workspace.projects.has('web-elements')) {
|
134
|
-
workspace.projects.set('web-elements', projectDef);
|
135
|
-
}
|
136
|
-
else {
|
137
|
-
workspace.projects.add(Object.assign({ name: `web-elements` }, projectDef));
|
138
|
-
}
|
139
|
-
});
|
140
|
-
}
|
141
|
-
},
|
142
|
-
// update dependencies
|
143
|
-
(tree, context) => {
|
144
|
-
return options.builderModule
|
145
|
-
? (0, schematics_1.noop)()
|
146
|
-
: updateWorkspaceSupport(options, tree, context);
|
147
|
-
},
|
148
|
-
// update for builderModule if desired
|
149
|
-
(tree, context) => {
|
150
|
-
if (options.builderModule) {
|
151
|
-
}
|
152
|
-
else {
|
153
|
-
return (0, schematics_1.noop)();
|
154
|
-
}
|
155
|
-
},
|
156
|
-
(0, workspace_1.formatFiles)({ skipFormat: options.skipFormat }),
|
157
|
-
]);
|
158
|
-
}
|
159
|
-
exports.default = default_1;
|
160
|
-
function addFiles(options, extra = '') {
|
161
|
-
extra = extra ? `${extra}_` : '';
|
162
|
-
const xplatFolderName = xplat_1.XplatHelpers.getXplatFoldername('web', 'angular');
|
163
|
-
return (0, schematics_1.branchAndMerge)((0, schematics_1.mergeWith)((0, schematics_1.apply)((0, schematics_1.url)(`./_${extra}files`), [
|
164
|
-
(0, schematics_1.template)(Object.assign(Object.assign(Object.assign({}, options), (0, xplat_1.getDefaultTemplateOptions)()), { name: options.name.toLowerCase(), xplatFolderName,
|
165
|
-
customElementList,
|
166
|
-
componentSymbolList,
|
167
|
-
componentSymbols,
|
168
|
-
htmlElements })),
|
169
|
-
(0, schematics_1.move)(`libs/xplat/${xplatFolderName}/elements`),
|
170
|
-
])));
|
171
|
-
}
|
172
|
-
function updateWorkspaceSupport(options, tree, context) {
|
173
|
-
const packagePath = 'package.json';
|
174
|
-
const json = (0, xplat_utils_1.getJsonFromFile)(tree, packagePath);
|
175
|
-
json.scripts = json.scripts || {};
|
176
|
-
json.dependencies = json.dependencies || {};
|
177
|
-
const angularVersion = json.dependencies['@angular/core'];
|
178
|
-
json.dependencies = Object.assign(Object.assign({}, json.dependencies), { '@angular/elements': angularVersion, '@webcomponents/webcomponentsjs': '^2.6.0' });
|
179
|
-
json.devDependencies = json.devDependencies || {};
|
180
|
-
json.devDependencies = Object.assign(Object.assign({}, json.devDependencies), { 'http-server': '^14.1.1', 'ngx-build-plus': '^16.0.0' });
|
181
|
-
return (0, xplat_utils_1.updateJsonFile)(tree, packagePath, json);
|
182
|
-
}
|
183
|
-
function createCustomElementList(componentSymbols) {
|
184
|
-
const customElements = ['let component;'];
|
185
|
-
for (const comp of componentSymbols) {
|
186
|
-
customElements.push(`component = createCustomElement(${comp.symbol}, { injector: this.injector });
|
187
|
-
customElements.define('${comp.selector}', component);`);
|
188
|
-
}
|
189
|
-
return customElements.join('\n');
|
190
|
-
}
|
191
|
-
function updateBuilder(tree, options) {
|
192
|
-
if (options.builderModule) {
|
193
|
-
tree.overwrite(`libs/xplat/web/elements/builder/elements.ts`, builderElementsContent(options.builderModule));
|
194
|
-
const moduleFilePath = `libs/xplat/web/elements/${options.builderModule}.module.ts`;
|
195
|
-
if (tree.exists(moduleFilePath)) {
|
196
|
-
const moduleFile = tree.get(moduleFilePath).content.toString();
|
197
|
-
const selectorParts = moduleFile.split('.define(');
|
198
|
-
selectorParts.splice(0, 1); // remove starting data
|
199
|
-
const customElements = [];
|
200
|
-
for (const part of selectorParts) {
|
201
|
-
let selector = part.split(',')[0].replace(/'/gi, '').replace(/"/gi, '');
|
202
|
-
customElements.push(`<${selector}></${selector}>`);
|
203
|
-
}
|
204
|
-
tree.overwrite(`libs/xplat/web/elements/builder/index.html`, buildIndexContent(customElements.join('\n')));
|
205
|
-
}
|
206
|
-
else {
|
207
|
-
throw new schematics_1.SchematicsException(`${moduleFilePath} does not exist.`);
|
208
|
-
}
|
209
|
-
}
|
210
|
-
else {
|
211
|
-
tree.overwrite(`libs/xplat/web/elements/builder/elements.ts`, builderElementsContent(options.name));
|
212
|
-
tree.overwrite(`libs/xplat/web/elements/builder/index.html`, buildIndexContent(htmlElements));
|
213
|
-
}
|
214
|
-
return tree;
|
215
|
-
}
|
216
|
-
function builderElementsContent(name) {
|
217
|
-
return `import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
218
|
-
import { ${xplat_1.stringUtils.classify(name)}Module } from '../${name}.module';
|
219
|
-
|
220
|
-
platformBrowserDynamic()
|
221
|
-
.bootstrapModule(${xplat_1.stringUtils.classify(name)}Module)
|
222
|
-
.catch(err => console.log(err));
|
223
|
-
`;
|
224
|
-
}
|
225
|
-
function buildIndexContent(customElements) {
|
226
|
-
return `<!doctype html>
|
227
|
-
<html lang="en">
|
228
|
-
<head>
|
229
|
-
<meta charset="utf-8">
|
230
|
-
<title>Custom Elements</title>
|
231
|
-
<base href="/">
|
232
|
-
|
233
|
-
<meta name="viewport" content="width=device-width, initial-scale=1">
|
234
|
-
</head>
|
235
|
-
<body>
|
236
|
-
${customElements}
|
237
|
-
</body>
|
238
|
-
</html>`;
|
239
|
-
}
|
@@ -1 +0,0 @@
|
|
1
|
-
export {};
|
@@ -1,137 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
9
|
-
});
|
10
|
-
};
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
12
|
-
const schematics_1 = require("@angular-devkit/schematics");
|
13
|
-
const testing_1 = require("@nstudio/xplat/testing");
|
14
|
-
const testing_2 = require("../../utils/testing");
|
15
|
-
describe('elements schematic', () => {
|
16
|
-
let appTree;
|
17
|
-
const defaultOptions = {
|
18
|
-
name: 'ui-kit',
|
19
|
-
barrel: '@mycompany/xplat/web/features',
|
20
|
-
components: 'menu,footer',
|
21
|
-
};
|
22
|
-
beforeEach(() => {
|
23
|
-
appTree = schematics_1.Tree.empty();
|
24
|
-
appTree = (0, testing_1.createXplatWithApps)(appTree, 'angular');
|
25
|
-
});
|
26
|
-
it('should create an elements module that provides the specified components', () => __awaiter(void 0, void 0, void 0, function* () {
|
27
|
-
const options = Object.assign({}, defaultOptions);
|
28
|
-
// console.log('appTree:', appTree);
|
29
|
-
const componentOptions = {
|
30
|
-
name: 'menu',
|
31
|
-
platforms: 'web',
|
32
|
-
};
|
33
|
-
let tree = yield (0, testing_2.runSchematic)('component', componentOptions, appTree);
|
34
|
-
componentOptions.name = 'footer';
|
35
|
-
tree = yield (0, testing_2.runSchematic)('component', componentOptions, tree);
|
36
|
-
let files = tree.files;
|
37
|
-
// console.log(files.slice(85,files.length));
|
38
|
-
expect(files.indexOf('/libs/xplat/web/features/src/lib/ui/components/menu/menu.component.html')).toBeGreaterThanOrEqual(0);
|
39
|
-
expect(files.indexOf('/libs/xplat/web/features/src/lib/ui/components/menu/menu.component.ts')).toBeGreaterThanOrEqual(0);
|
40
|
-
expect(files.indexOf('/libs/xplat/web/features/src/lib/ui/components/footer/footer.component.html')).toBeGreaterThanOrEqual(0);
|
41
|
-
expect(files.indexOf('/libs/xplat/web/features/src/lib/ui/components/footer/footer.component.ts')).toBeGreaterThanOrEqual(0);
|
42
|
-
tree = yield (0, testing_2.runSchematic)('elements', options, tree);
|
43
|
-
files = tree.files;
|
44
|
-
const elementModulePath = '/libs/xplat/web/elements/ui-kit.module.ts';
|
45
|
-
expect(files.indexOf(elementModulePath)).toBeGreaterThanOrEqual(0);
|
46
|
-
const elementModule = (0, testing_1.getFileContent)(tree, elementModulePath);
|
47
|
-
// console.log(elementModule);
|
48
|
-
expect(elementModule.indexOf(`import { MenuComponent, FooterComponent } from '@mycompany/xplat/web/features';`)).toBeGreaterThanOrEqual(0);
|
49
|
-
expect(elementModule.indexOf(`createCustomElement(MenuComponent`)).toBeGreaterThanOrEqual(0);
|
50
|
-
expect(elementModule.indexOf(`define('tt-menu'`)).toBeGreaterThanOrEqual(0);
|
51
|
-
expect(elementModule.indexOf(`createCustomElement(FooterComponent`)).toBeGreaterThanOrEqual(0);
|
52
|
-
expect(elementModule.indexOf(`define('tt-footer'`)).toBeGreaterThanOrEqual(0);
|
53
|
-
const packageFile = (0, testing_1.getFileContent)(tree, 'package.json');
|
54
|
-
// console.log(elementModule);
|
55
|
-
expect(packageFile.indexOf(`build.web.elements`)).toBeGreaterThanOrEqual(0);
|
56
|
-
expect(packageFile.indexOf(`preview.web.elements`)).toBeGreaterThanOrEqual(0);
|
57
|
-
}));
|
58
|
-
it('--builderModule argument', () => __awaiter(void 0, void 0, void 0, function* () {
|
59
|
-
const options = Object.assign({}, defaultOptions);
|
60
|
-
// console.log('appTree:', appTree);
|
61
|
-
const componentOptions = {
|
62
|
-
name: 'menu',
|
63
|
-
platforms: 'web',
|
64
|
-
};
|
65
|
-
let tree = yield (0, testing_2.runSchematic)('component', componentOptions, appTree);
|
66
|
-
componentOptions.name = 'footer';
|
67
|
-
tree = yield (0, testing_2.runSchematic)('component', componentOptions, tree);
|
68
|
-
let files = tree.files;
|
69
|
-
// console.log(files.slice(85,files.length));
|
70
|
-
expect(files.indexOf('/libs/xplat/web/features/src/lib/ui/components/menu/menu.component.html')).toBeGreaterThanOrEqual(0);
|
71
|
-
expect(files.indexOf('/libs/xplat/web/features/src/lib/ui/components/menu/menu.component.ts')).toBeGreaterThanOrEqual(0);
|
72
|
-
expect(files.indexOf('/libs/xplat/web/features/src/lib/ui/components/footer/footer.component.html')).toBeGreaterThanOrEqual(0);
|
73
|
-
expect(files.indexOf('/libs/xplat/web/features/src/lib/ui/components/footer/footer.component.ts')).toBeGreaterThanOrEqual(0);
|
74
|
-
tree = yield (0, testing_2.runSchematic)('elements', options, tree);
|
75
|
-
files = tree.files;
|
76
|
-
let elementModulePath = '/libs/xplat/web/elements/ui-kit.module.ts';
|
77
|
-
expect(files.indexOf(elementModulePath)).toBeGreaterThanOrEqual(0);
|
78
|
-
let elementModule = (0, testing_1.getFileContent)(tree, elementModulePath);
|
79
|
-
// console.log(elementModule);
|
80
|
-
expect(elementModule.indexOf(`'@mycompany/xplat/web/features';`)).toBeGreaterThanOrEqual(0);
|
81
|
-
let builderPath = '/libs/xplat/web/elements/builder/elements.ts';
|
82
|
-
expect(files.indexOf(builderPath)).toBeGreaterThanOrEqual(0);
|
83
|
-
let builderModule = (0, testing_1.getFileContent)(tree, builderPath);
|
84
|
-
// console.log(builderModule);
|
85
|
-
expect(builderModule.indexOf(`../ui-kit.module`)).toBeGreaterThanOrEqual(0);
|
86
|
-
let builderIndexPath = '/libs/xplat/web/elements/builder/index.html';
|
87
|
-
expect(files.indexOf(builderPath)).toBeGreaterThanOrEqual(0);
|
88
|
-
let builderIndex = (0, testing_1.getFileContent)(tree, builderIndexPath);
|
89
|
-
// console.log(builderIndex);
|
90
|
-
expect(builderIndex.indexOf(`<tt-menu></tt-menu>`)).toBeGreaterThanOrEqual(0);
|
91
|
-
expect(builderIndex.indexOf(`<tt-footer></tt-footer>`)).toBeGreaterThanOrEqual(0);
|
92
|
-
const component2Options = {
|
93
|
-
name: 'dropdown',
|
94
|
-
platforms: 'web',
|
95
|
-
};
|
96
|
-
tree = yield (0, testing_2.runSchematic)('component', component2Options, tree);
|
97
|
-
component2Options.name = 'link';
|
98
|
-
tree = yield (0, testing_2.runSchematic)('component', component2Options, tree);
|
99
|
-
files = tree.files;
|
100
|
-
// console.log(files.slice(85,files.length));
|
101
|
-
expect(files.indexOf('/libs/xplat/web/features/src/lib/ui/components/dropdown/dropdown.component.html')).toBeGreaterThanOrEqual(0);
|
102
|
-
expect(files.indexOf('/libs/xplat/web/features/src/lib/ui/components/dropdown/dropdown.component.ts')).toBeGreaterThanOrEqual(0);
|
103
|
-
expect(files.indexOf('/libs/xplat/web/features/src/lib/ui/components/link/link.component.html')).toBeGreaterThanOrEqual(0);
|
104
|
-
expect(files.indexOf('/libs/xplat/web/features/src/lib/ui/components/link/link.component.ts')).toBeGreaterThanOrEqual(0);
|
105
|
-
const newElementOptions = {
|
106
|
-
name: 'widgets',
|
107
|
-
barrel: '@mycompany/xplat/web/features',
|
108
|
-
components: 'dropdown,link',
|
109
|
-
};
|
110
|
-
tree = yield (0, testing_2.runSchematic)('elements', newElementOptions, tree);
|
111
|
-
files = tree.files;
|
112
|
-
elementModulePath = '/libs/xplat/web/elements/widgets.module.ts';
|
113
|
-
expect(files.indexOf(elementModulePath)).toBeGreaterThanOrEqual(0);
|
114
|
-
elementModule = (0, testing_1.getFileContent)(tree, elementModulePath);
|
115
|
-
// console.log(elementModule);
|
116
|
-
expect(elementModule.indexOf(`'@mycompany/xplat/web/features';`)).toBeGreaterThanOrEqual(0);
|
117
|
-
builderModule = (0, testing_1.getFileContent)(tree, builderPath);
|
118
|
-
// console.log(builderModule);
|
119
|
-
expect(builderModule.indexOf(`../widgets.module`)).toBeGreaterThanOrEqual(0);
|
120
|
-
builderIndex = (0, testing_1.getFileContent)(tree, builderIndexPath);
|
121
|
-
// console.log(builderIndex);
|
122
|
-
expect(builderIndex.indexOf(`<tt-dropdown></tt-dropdown>`)).toBeGreaterThanOrEqual(0);
|
123
|
-
expect(builderIndex.indexOf(`<tt-link></tt-link>`)).toBeGreaterThanOrEqual(0);
|
124
|
-
const builderOption = {
|
125
|
-
builderModule: 'ui-kit',
|
126
|
-
};
|
127
|
-
tree = yield (0, testing_2.runSchematic)('elements', builderOption, tree);
|
128
|
-
files = tree.files;
|
129
|
-
builderModule = (0, testing_1.getFileContent)(tree, builderPath);
|
130
|
-
// console.log(builderModule);
|
131
|
-
expect(builderModule.indexOf(`../ui-kit.module`)).toBeGreaterThanOrEqual(0);
|
132
|
-
builderIndex = (0, testing_1.getFileContent)(tree, builderIndexPath);
|
133
|
-
// console.log(builderIndex);
|
134
|
-
expect(builderIndex.indexOf(`<tt-menu></tt-menu>`)).toBeGreaterThanOrEqual(0);
|
135
|
-
expect(builderIndex.indexOf(`<tt-footer></tt-footer>`)).toBeGreaterThanOrEqual(0);
|
136
|
-
}));
|
137
|
-
});
|
@@ -1,38 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"$schema": "http://json-schema.org/schema",
|
3
|
-
"$id": "elements",
|
4
|
-
"title": "Create custom elements for the web.",
|
5
|
-
"type": "object",
|
6
|
-
"properties": {
|
7
|
-
"name": {
|
8
|
-
"description": "The name of the custom element module.",
|
9
|
-
"type": "string",
|
10
|
-
"$default": {
|
11
|
-
"$source": "argv",
|
12
|
-
"index": 0
|
13
|
-
}
|
14
|
-
},
|
15
|
-
"barrel": {
|
16
|
-
"description": "The barrel in your workspace that contains the components you'd like to create as custom elements.",
|
17
|
-
"type": "string"
|
18
|
-
},
|
19
|
-
"components": {
|
20
|
-
"description": "Comma delimited list of components from your barrel to create as custom elements.",
|
21
|
-
"type": "string"
|
22
|
-
},
|
23
|
-
"builderModule": {
|
24
|
-
"type": "string",
|
25
|
-
"description": "Update builder files to use a different Angular Element module. Used in isolation with no other options."
|
26
|
-
},
|
27
|
-
"prefix": {
|
28
|
-
"type": "string",
|
29
|
-
"description": "A unique prefix to add to each custom element. Defaults to workspace selector setting."
|
30
|
-
},
|
31
|
-
"skipFormat": {
|
32
|
-
"description": "Skip formatting files",
|
33
|
-
"type": "boolean",
|
34
|
-
"default": false
|
35
|
-
}
|
36
|
-
},
|
37
|
-
"required": []
|
38
|
-
}
|