@fundamental-ngx/cx 0.63.0-rc.7 → 0.63.0-rc.8
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/package.json +4 -4
- package/schematics/ng-add/index.d.ts +0 -3
- package/schematics/ng-add/index.js +0 -64
- package/schematics/ng-add/index.js.map +0 -1
- package/schematics/ng-add/schema.d.ts +0 -3
- package/schematics/ng-add/schema.js +0 -3
- package/schematics/ng-add/schema.js.map +0 -1
- package/schematics/utils/ng-module-utils.d.ts +0 -3
- package/schematics/utils/ng-module-utils.js +0 -62
- package/schematics/utils/ng-module-utils.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fundamental-ngx/cx",
|
|
3
|
-
"version": "0.63.0-rc.
|
|
3
|
+
"version": "0.63.0-rc.8",
|
|
4
4
|
"schematics": "./schematics/collection.json",
|
|
5
5
|
"description": "Fundamental Library for Angular - cx",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
"@angular/forms": "^21.0.0",
|
|
20
20
|
"@angular/platform-browser": "^21.0.0",
|
|
21
21
|
"@angular/router": "^21.0.0",
|
|
22
|
-
"@fundamental-ngx/core": "0.63.0-rc.
|
|
23
|
-
"@fundamental-ngx/i18n": "0.63.0-rc.
|
|
22
|
+
"@fundamental-ngx/core": "0.63.0-rc.8",
|
|
23
|
+
"@fundamental-ngx/i18n": "0.63.0-rc.8",
|
|
24
24
|
"rxjs": "^7.8.0"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
@@ -56,4 +56,4 @@
|
|
|
56
56
|
}
|
|
57
57
|
},
|
|
58
58
|
"sideEffects": false
|
|
59
|
-
}
|
|
59
|
+
}
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ngAdd = ngAdd;
|
|
4
|
-
const schematics_1 = require("@angular-devkit/schematics");
|
|
5
|
-
const tasks_1 = require("@angular-devkit/schematics/tasks");
|
|
6
|
-
const dependencies_1 = require("@schematics/angular/utility/dependencies");
|
|
7
|
-
const fdStylesIconPath = 'node_modules/fundamental-styles/dist/icon.css';
|
|
8
|
-
/** Installs cx package and dependencies. */
|
|
9
|
-
function ngAdd(options) {
|
|
10
|
-
return (0, schematics_1.chain)([addDependencies(), addStylePathToConfig(options)]);
|
|
11
|
-
}
|
|
12
|
-
// Adds missing dependencies to the project.
|
|
13
|
-
function addDependencies() {
|
|
14
|
-
return (tree, context) => {
|
|
15
|
-
const ngCoreVersionTag = (0, dependencies_1.getPackageJsonDependency)(tree, '@angular/core');
|
|
16
|
-
const dependencies = [];
|
|
17
|
-
const formsDependency = (0, dependencies_1.getPackageJsonDependency)(tree, '@angular/forms');
|
|
18
|
-
if (!formsDependency) {
|
|
19
|
-
dependencies.push(Object.assign(Object.assign({}, ngCoreVersionTag), { name: '@angular/forms' }));
|
|
20
|
-
}
|
|
21
|
-
dependencies.forEach((dependency) => {
|
|
22
|
-
(0, dependencies_1.addPackageJsonDependency)(tree, dependency);
|
|
23
|
-
console.log(`Added ${dependency.name} to ${dependency.type}.`);
|
|
24
|
-
});
|
|
25
|
-
context.addTask(new tasks_1.NodePackageInstallTask());
|
|
26
|
-
return tree;
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
// Adds the icon style path to the angular.json.
|
|
30
|
-
function addStylePathToConfig(options) {
|
|
31
|
-
return (tree) => {
|
|
32
|
-
const angularConfigPath = '/angular.json';
|
|
33
|
-
const workspaceConfig = tree.read('/angular.json');
|
|
34
|
-
if (!workspaceConfig) {
|
|
35
|
-
throw new schematics_1.SchematicsException(`Unable to find angular.json. Please manually configure your styles array.`);
|
|
36
|
-
}
|
|
37
|
-
const workspaceJson = JSON.parse(workspaceConfig.toString());
|
|
38
|
-
try {
|
|
39
|
-
let stylesArray = workspaceJson.projects[options.project].architect.build.options['styles'];
|
|
40
|
-
if (!stylesArray.includes(fdStylesIconPath)) {
|
|
41
|
-
stylesArray = pushStylesToArray(stylesArray, fdStylesIconPath);
|
|
42
|
-
workspaceJson.projects[options.project].architect.build.options['styles'] = stylesArray;
|
|
43
|
-
}
|
|
44
|
-
else {
|
|
45
|
-
console.log(`✅️ Found duplicate style path in angular.json. Skipping.`);
|
|
46
|
-
return tree;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
catch (e) {
|
|
50
|
-
console.error('Error:', e);
|
|
51
|
-
throw new schematics_1.SchematicsException(`Unable to find angular.json project styles. Please manually configure your styles array.`);
|
|
52
|
-
}
|
|
53
|
-
tree.overwrite(angularConfigPath, JSON.stringify(workspaceJson, null, 2));
|
|
54
|
-
console.log(`✅️ Added fundamental-styles path to angular.json.`);
|
|
55
|
-
return tree;
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
function pushStylesToArray(stylesArray, path) {
|
|
59
|
-
if (!stylesArray.includes(path)) {
|
|
60
|
-
stylesArray.push(path);
|
|
61
|
-
}
|
|
62
|
-
return stylesArray;
|
|
63
|
-
}
|
|
64
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../libs/cx/schematics/ng-add/index.ts"],"names":[],"mappings":";;AAYA,sBAEC;AAdD,2DAAsG;AACtG,4DAA0E;AAC1E,2EAIkD;AAGlD,MAAM,gBAAgB,GAAG,+CAA+C,CAAC;AAEzE,4CAA4C;AAC5C,SAAgB,KAAK,CAAC,OAAY;IAC9B,OAAO,IAAA,kBAAK,EAAC,CAAC,eAAe,EAAE,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;AACrE,CAAC;AAED,4CAA4C;AAC5C,SAAS,eAAe;IACpB,OAAO,CAAC,IAAU,EAAE,OAAyB,EAAE,EAAE;QAC7C,MAAM,gBAAgB,GAAG,IAAA,u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AC1C,WAAW,GAAG,iBAAiB,CAAC,WAAW,EAAE,gBAAgB,CAAC,CAAC;gBAC9D,aAAc,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAE,CAAC,SAAU,CAAC,KAAM,CAAC,OAAe,CAAC,QAAQ,CAAC,GAAG,WAAW,CAAC;YACzG,CAAC;iBAAM,CAAC;gBACJ,OAAO,CAAC,GAAG,CAAC,0DAA0D,CAAC,CAAC;gBACxE,OAAO,IAAI,CAAC;YAChB,CAAC;QACL,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACT,OAAO,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC;YAC3B,MAAM,IAAI,gCAAmB,CACzB,0FAA0F,CAC7F,CAAC;QACN,CAAC;QACD,IAAI,CAAC,SAAS,CAAC,iBAAiB,EAAE,IAAI,CAAC,SAAS,CAAC,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;QAC1E,OAAO,CAAC,GAAG,CAAC,mDAAmD,CAAC,CAAC;QACjE,OAAO,IAAI,CAAC;IAChB,CAAC,CAAC;AACN,CAAC;AAED,SAAS,iBAAiB,CAAC,WAAgB,EAAE,IAAY;IACrD,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;QAC9B,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC3B,CAAC;IACD,OAAO,WAAW,CAAC;AACvB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../../../libs/cx/schematics/ng-add/schema.ts"],"names":[],"mappings":""}
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.hasModuleImport = hasModuleImport;
|
|
4
|
-
const schematics_1 = require("@angular-devkit/schematics");
|
|
5
|
-
const ts = require("typescript");
|
|
6
|
-
/** Checks if an import is included in the module. */
|
|
7
|
-
function hasModuleImport(tree, modulePath, className) {
|
|
8
|
-
const moduleFileContent = tree.read(modulePath);
|
|
9
|
-
if (!moduleFileContent) {
|
|
10
|
-
throw new schematics_1.SchematicsException(`Could not read Angular module file: ${modulePath}`);
|
|
11
|
-
}
|
|
12
|
-
const parsedFile = ts.createSourceFile(modulePath, moduleFileContent.toString(), ts.ScriptTarget.Latest, true);
|
|
13
|
-
const ngModuleMetadata = findNgModuleMetadata(parsedFile);
|
|
14
|
-
if (!ngModuleMetadata) {
|
|
15
|
-
throw new schematics_1.SchematicsException(`Could not find NgModule declaration inside: "${modulePath}"`);
|
|
16
|
-
}
|
|
17
|
-
for (const property of ngModuleMetadata.properties) {
|
|
18
|
-
if (!ts.isPropertyAssignment(property) ||
|
|
19
|
-
property.name.getText() !== 'imports' ||
|
|
20
|
-
!ts.isArrayLiteralExpression(property.initializer)) {
|
|
21
|
-
continue;
|
|
22
|
-
}
|
|
23
|
-
if (property.initializer.elements.some((element) => element.getText() === className)) {
|
|
24
|
-
return true;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
return false;
|
|
28
|
-
}
|
|
29
|
-
// Borrowed from the Angular CDK
|
|
30
|
-
function findNgModuleMetadata(rootNode) {
|
|
31
|
-
// Add immediate child nodes of the root node to the queue.
|
|
32
|
-
const nodeQueue = [...rootNode.getChildren()];
|
|
33
|
-
while (nodeQueue.length) {
|
|
34
|
-
const node = nodeQueue.shift();
|
|
35
|
-
if (ts.isDecorator(node) && ts.isCallExpression(node.expression) && isNgModuleCallExpression(node.expression)) {
|
|
36
|
-
return node.expression.arguments[0];
|
|
37
|
-
}
|
|
38
|
-
else {
|
|
39
|
-
nodeQueue.push(...node.getChildren());
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
return null;
|
|
43
|
-
}
|
|
44
|
-
// Borrowed from the Angular CDK
|
|
45
|
-
function resolveIdentifierOfExpression(expression) {
|
|
46
|
-
if (ts.isIdentifier(expression)) {
|
|
47
|
-
return expression;
|
|
48
|
-
}
|
|
49
|
-
else if (ts.isPropertyAccessExpression(expression) && ts.isIdentifier(expression.name)) {
|
|
50
|
-
return expression.name;
|
|
51
|
-
}
|
|
52
|
-
return null;
|
|
53
|
-
}
|
|
54
|
-
// Borrowed from the Angular CDK
|
|
55
|
-
function isNgModuleCallExpression(callExpression) {
|
|
56
|
-
if (!callExpression.arguments.length || !ts.isObjectLiteralExpression(callExpression.arguments[0])) {
|
|
57
|
-
return false;
|
|
58
|
-
}
|
|
59
|
-
const decoratorIdentifier = resolveIdentifierOfExpression(callExpression.expression);
|
|
60
|
-
return decoratorIdentifier ? decoratorIdentifier.text === 'NgModule' : false;
|
|
61
|
-
}
|
|
62
|
-
//# sourceMappingURL=ng-module-utils.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ng-module-utils.js","sourceRoot":"","sources":["../../../../../libs/cx/schematics/utils/ng-module-utils.ts"],"names":[],"mappings":";;AAKA,0CA6BC;AAlCD,2DAAuE;AAEvE,iCAAiC;AAEjC,qDAAqD;AACrD,SAAgB,eAAe,CAAC,IAAU,EAAE,UAAkB,EAAE,SAAiB;IAC7E,MAAM,iBAAiB,GAAG,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IAEhD,IAAI,CAAC,iBAAiB,EAAE,CAAC;QACrB,MAAM,IAAI,gCAAmB,CAAC,uCAAuC,UAAU,EAAE,CAAC,CAAC;IACvF,CAAC;IAED,MAAM,UAAU,GAAG,EAAE,CAAC,gBAAgB,CAAC,UAAU,EAAE,iBAAiB,CAAC,QAAQ,EAAE,EAAE,EAAE,CAAC,YAAY,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IAC/G,MAAM,gBAAgB,GAAG,oBAAoB,CAAC,UAAU,CAAC,CAAC;IAE1D,IAAI,CAAC,gBAAgB,EAAE,CAAC;QACpB,MAAM,IAAI,gCAAmB,CAAC,gDAAgD,UAAU,GAAG,CAAC,CAAC;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