@ng-atomic/schematics 5.14.0 → 6.0.3
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 +16 -15
- package/src/_utilities/add-path-to-routes.js +6 -3
- package/src/_utilities/add-path-to-routes.js.map +1 -1
- package/src/_utilities/angular-config.js +6 -4
- package/src/_utilities/angular-config.js.map +1 -1
- package/src/_utilities/ts-config.js +4 -3
- package/src/_utilities/ts-config.js.map +1 -1
- package/src/setup/index.spec.ts +1 -1
package/package.json
CHANGED
|
@@ -1,26 +1,27 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ng-atomic/schematics",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.0.3",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"schematics": "./collection.json",
|
|
6
6
|
"ng-add": {
|
|
7
7
|
"save": "devDependencies"
|
|
8
8
|
},
|
|
9
|
-
"dependencies": {
|
|
10
|
-
"@angular/animations": "^15.0.0",
|
|
11
|
-
"@angular/common": "^15.0.0",
|
|
12
|
-
"@angular/core": "^15.0.0",
|
|
13
|
-
"@angular/platform-browser": "^15.0.0",
|
|
14
|
-
"@angular/router": "^15.0.0",
|
|
15
|
-
"@schematics/angular": "^15.0.0",
|
|
16
|
-
"lodash": "4.17.21",
|
|
17
|
-
"rxjs": "^7.0.0",
|
|
18
|
-
"string-template": "^1.0.0",
|
|
19
|
-
"zone.js": "0.12.0"
|
|
20
|
-
},
|
|
21
9
|
"peerDependencies": {
|
|
22
|
-
"
|
|
10
|
+
"@angular-devkit/core": "^16.0.0",
|
|
11
|
+
"@angular-devkit/schematics": "^16.0.0",
|
|
12
|
+
"@angular/common": "16.2.12",
|
|
13
|
+
"@angular/core": "16.2.12",
|
|
14
|
+
"@angular/router": "16.2.12",
|
|
15
|
+
"@nx/workspace": "16.10.0",
|
|
16
|
+
"@schematics/angular": "16.2.10",
|
|
17
|
+
"jsonc-parser": "^3.0.0",
|
|
18
|
+
"lodash.get": "^4.4.2",
|
|
19
|
+
"lodash.set": "^4.3.2",
|
|
20
|
+
"string-template": "^1.0.0",
|
|
21
|
+
"tslib": "^2.3.0",
|
|
22
|
+
"typescript": "5.1.6"
|
|
23
23
|
},
|
|
24
|
+
"dependencies": {},
|
|
24
25
|
"main": "./src/index.js",
|
|
25
|
-
"
|
|
26
|
+
"type": "commonjs"
|
|
26
27
|
}
|
|
@@ -2,20 +2,23 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.addPathToRoutes = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
const ast_utils_1 = require("@
|
|
5
|
+
const ast_utils_1 = require("@nx/workspace/src/utils/ast-utils");
|
|
6
6
|
const typescript_1 = tslib_1.__importDefault(require("typescript"));
|
|
7
7
|
const isVariableDeclaration = (n) => n.kind === typescript_1.default.SyntaxKind.VariableDeclaration;
|
|
8
8
|
const isIdentifier = (n) => n.kind === typescript_1.default.SyntaxKind.Identifier;
|
|
9
9
|
const isArrayLiteralExpression = (n) => n.kind === typescript_1.default.SyntaxKind.ArrayLiteralExpression;
|
|
10
10
|
const matchText = (n, text) => n.getText() === text;
|
|
11
11
|
const hasMatchTextChild = (n, text) => {
|
|
12
|
-
return n.getChildren().findIndex(c =>
|
|
12
|
+
return (n.getChildren().findIndex((c) => isIdentifier(c) && matchText(c, text)) !==
|
|
13
|
+
-1);
|
|
13
14
|
};
|
|
14
15
|
const isRoutesVariableDeclaration = (n) => isVariableDeclaration(n) && hasMatchTextChild(n, 'routes');
|
|
15
16
|
const addPathToRoutes = ({ route, routesPath, removeOtherRoutes }) => (host) => {
|
|
16
17
|
const src = typescript_1.default.createSourceFile(routesPath, host.read(routesPath).toString('utf-8'), typescript_1.default.ScriptTarget.Latest, true);
|
|
17
18
|
const nodes = (0, ast_utils_1.getSourceNodes)(src);
|
|
18
|
-
const routeNodes = nodes
|
|
19
|
+
const routeNodes = nodes
|
|
20
|
+
.filter(isRoutesVariableDeclaration)
|
|
21
|
+
.map((n) => {
|
|
19
22
|
return n.getChildren().filter(isArrayLiteralExpression).reverse()[0];
|
|
20
23
|
});
|
|
21
24
|
if (routeNodes.length === 1) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add-path-to-routes.js","sourceRoot":"","sources":["../../../../../../packages/@ng-atomic/schematics/src/_utilities/add-path-to-routes.ts"],"names":[],"mappings":";;;;AACA,
|
|
1
|
+
{"version":3,"file":"add-path-to-routes.js","sourceRoot":"","sources":["../../../../../../packages/@ng-atomic/schematics/src/_utilities/add-path-to-routes.ts"],"names":[],"mappings":";;;;AACA,iEAAmE;AACnE,oEAA4B;AAE5B,MAAM,qBAAqB,GAAG,CAAC,CAAU,EAAE,EAAE,CAC3C,CAAC,CAAC,IAAI,KAAK,oBAAE,CAAC,UAAU,CAAC,mBAAmB,CAAC;AAC/C,MAAM,YAAY,GAAG,CAAC,CAAU,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,oBAAE,CAAC,UAAU,CAAC,UAAU,CAAC;AACzE,MAAM,wBAAwB,GAAG,CAAC,CAAU,EAAE,EAAE,CAC9C,CAAC,CAAC,IAAI,KAAK,oBAAE,CAAC,UAAU,CAAC,sBAAsB,CAAC;AAClD,MAAM,SAAS,GAAG,CAAC,CAAU,EAAE,IAAY,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,EAAE,KAAK,IAAI,CAAC;AACrE,MAAM,iBAAiB,GAAG,CAAC,CAAU,EAAE,IAAY,EAAE,EAAE;IACrD,OAAO,CACL,CAAC,CAAC,WAAW,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC,IAAI,SAAS,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;QACvE,CAAC,CAAC,CACH,CAAC;AACJ,CAAC,CAAC;AACF,MAAM,2BAA2B,GAAG,CAAC,CAAU,EAAE,EAAE,CACjD,qBAAqB,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0BxB"}
|
|
@@ -1,21 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.addStyleIncludePath = exports.setDefaultCollection = exports.addSchematicsConfig = void 0;
|
|
4
|
-
const
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const lodash_get_1 = tslib_1.__importDefault(require("lodash.get"));
|
|
6
|
+
const lodash_set_1 = tslib_1.__importDefault(require("lodash.set"));
|
|
5
7
|
const overwrite_1 = require("./overwrite");
|
|
6
8
|
const PACKAGE_NAME = '@ng-atomic/schematics';
|
|
7
9
|
const addSchematicsConfig = ({ project, componentsDir }, type) => (host) => {
|
|
8
10
|
const query = `projects.${project}.schematics.${PACKAGE_NAME}:${type}`;
|
|
9
|
-
return (0, overwrite_1.overwrite)(host, 'angular.json', json => ((0,
|
|
11
|
+
return (0, overwrite_1.overwrite)(host, 'angular.json', json => ((0, lodash_set_1.default)(json, query, { 'path': `${componentsDir}/${type}s` }), json));
|
|
10
12
|
};
|
|
11
13
|
exports.addSchematicsConfig = addSchematicsConfig;
|
|
12
14
|
const setDefaultCollection = () => (host) => {
|
|
13
|
-
return (0, overwrite_1.overwrite)(host, 'angular.json', json => ((0,
|
|
15
|
+
return (0, overwrite_1.overwrite)(host, 'angular.json', json => ((0, lodash_set_1.default)(json, `cli.defaultCollection`, PACKAGE_NAME), json));
|
|
14
16
|
};
|
|
15
17
|
exports.setDefaultCollection = setDefaultCollection;
|
|
16
18
|
const addStyleIncludePath = ({ project, stylesDir }) => (host) => {
|
|
17
19
|
const query = `projects.${project}.architect.build.options.stylePreprocessorOptions.includePaths`;
|
|
18
|
-
return (0, overwrite_1.overwrite)(host, 'angular.json', json => ((0,
|
|
20
|
+
return (0, overwrite_1.overwrite)(host, 'angular.json', json => ((0, lodash_set_1.default)(json, query, [...new Set((0, lodash_get_1.default)(json, query)).add(stylesDir)]), json));
|
|
19
21
|
};
|
|
20
22
|
exports.addStyleIncludePath = addStyleIncludePath;
|
|
21
23
|
//# sourceMappingURL=angular-config.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"angular-config.js","sourceRoot":"","sources":["../../../../../../packages/@ng-atomic/schematics/src/_utilities/angular-config.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"angular-config.js","sourceRoot":"","sources":["../../../../../../packages/@ng-atomic/schematics/src/_utilities/angular-config.ts"],"names":[],"mappings":";;;;AACA,oEAA6B;AAC7B,oEAA6B;AAC7B,2CAAwC;AAExC,MAAM,YAAY,GAAG,uBAAuB,CAAC;AAEtC,MAAM,mBAAmB,GAAG,CAAC,EAAC,OAAO,EAAE,aAAa,EAAM,EAAE,IAAY,EAAE,EAAE,CAAC,CAAC,IAAU,EAAQ,EAAE;IACxG,MAAM,KAAK,GAAG,YAAY,OAAO,eAAe,YAAY,IAAI,IAAI,EAAE,CAAC;IACvE,OAAO,IAAA,qBAAS,EAAC,IAAI,EAAE,cAAc,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,IAAA,oBAAG,EAAC,IAAI,EAAE,KAAK,EAAE,EAAC,MAAM,EAAE,GAAG,aAAa,IAAI,IAAI,GAAG,EAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC;AACjH,CAAC,CAAC;AAHW,QAAA,mBAAmB,uBAG9B;AAEK,MAAM,oBAAoB,GAAG,GAAG,EAAE,CAAC,CAAC,IAAU,EAAE,EAAE;IACxD,OAAO,IAAA,qBAAS,EAAC,IAAI,EAAE,cAAc,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,IAAA,oBAAG,EAAC,IAAI,EAAE,uBAAuB,EAAE,YAAY,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC;AAC1G,CAAC,CAAA;AAFY,QAAA,oBAAoB,wBAEhC;AAEM,MAAM,mBAAmB,GAAG,CAAC,EAAC,OAAO,EAAE,SAAS,EAAM,EAAE,EAAE,CAAC,CAAC,IAAU,EAAE,EAAE;IAChF,MAAM,KAAK,GAAG,YAAY,OAAO,gEAAgE,CAAC;IAClG,OAAO,IAAA,qBAAS,EAAC,IAAI,EAAE,cAAc,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,IAAA,oBAAG,EAAC,IAAI,EAAE,KAAK,EAAE,CAAC,GAAG,IAAI,GAAG,CAAC,IAAA,oBAAG,EAAC,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC;AACzH,CAAC,CAAC;AAHW,QAAA,mBAAmB,uBAG9B"}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.addPathsToTsConfig = void 0;
|
|
4
|
-
const
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const lodash_set_1 = tslib_1.__importDefault(require("lodash.set"));
|
|
5
6
|
const overwrite_1 = require("./overwrite");
|
|
6
7
|
const addPathsToTsConfig = ({ componentsDir }) => (host) => {
|
|
7
8
|
return (0, overwrite_1.overwrite)(host, host.exists('tsconfig.base.json') ? 'tsconfig.base.json' : 'tsconfig.json', json => {
|
|
8
|
-
(0,
|
|
9
|
-
(0,
|
|
9
|
+
(0, lodash_set_1.default)(json, `compilerOptions.paths.@components`, [componentsDir]);
|
|
10
|
+
(0, lodash_set_1.default)(json, `compilerOptions.paths.@components/*`, [`${componentsDir}/*`]);
|
|
10
11
|
return json;
|
|
11
12
|
});
|
|
12
13
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ts-config.js","sourceRoot":"","sources":["../../../../../../packages/@ng-atomic/schematics/src/_utilities/ts-config.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ts-config.js","sourceRoot":"","sources":["../../../../../../packages/@ng-atomic/schematics/src/_utilities/ts-config.ts"],"names":[],"mappings":";;;;AACA,oEAA6B;AAC7B,2CAAwC;AAEjC,MAAM,kBAAkB,GAAG,CAAC,EAAC,aAAa,EAAM,EAAE,EAAE,CAAC,CAAC,IAAU,EAAE,EAAE;IAC1E,OAAO,IAAA,qBAAS,EAAC,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,oBAAoB,CAAC,CAAC,CAAC,CAAC,oBAAoB,CAAC,CAAC,CAAC,eAAe,EAAE,IAAI,CAAC,EAAE;QACzG,IAAA,oBAAG,EAAC,IAAI,EAAE,mCAAmC,EAAE,CAAC,aAAa,CAAC,CAAC,CAAC;QAChE,IAAA,oBAAG,EAAC,IAAI,EAAE,qCAAqC,EAAE,CAAC,GAAG,aAAa,IAAI,CAAC,CAAC,CAAC;QACzE,OAAO,IAAI,CAAC;IACb,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC;AANW,QAAA,kBAAkB,sBAM7B"}
|
package/src/setup/index.spec.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SchematicTestRunner, UnitTestTree } from '@angular-devkit/schematics/testing';
|
|
2
2
|
import { COLLECTION_PATH, createWorkspace } from '../_testing';
|
|
3
|
-
import
|
|
3
|
+
import get from 'lodash.get';
|
|
4
4
|
|
|
5
5
|
describe('Setup Schematics', () => {
|
|
6
6
|
const runner = new SchematicTestRunner('@ng-atomic/schematics', COLLECTION_PATH);
|