@o3r/schematics 10.0.0-prerelease.6 → 10.0.0-prerelease.61
Sign up to get free protection for your applications and to get access to all the features.
- package/package.json +18 -8
- package/schematics/ng-add/index.d.ts +2 -1
- package/schematics/ng-add/index.d.ts.map +1 -1
- package/schematics/ng-add/index.js +12 -4
- package/src/interfaces/angular-workspace.d.ts.map +1 -1
- package/src/rule-factories/eslint-fix/index.d.ts.map +1 -1
- package/src/rule-factories/eslint-fix/index.js +4 -2
- package/src/rule-factories/eslint-fix/index.js.map +1 -1
- package/src/utility/index.d.ts +2 -0
- package/src/utility/index.d.ts.map +1 -1
- package/src/utility/index.js +2 -0
- package/src/utility/index.js.map +1 -1
- package/src/utility/update-pipes.d.ts +15 -0
- package/src/utility/update-pipes.d.ts.map +1 -0
- package/src/utility/update-pipes.js +82 -0
- package/src/utility/update-pipes.js.map +1 -0
- package/src/utility/wrapper.d.ts +8 -0
- package/src/utility/wrapper.d.ts.map +1 -0
- package/src/utility/wrapper.js +23 -0
- package/src/utility/wrapper.js.map +1 -0
package/package.json
CHANGED
@@ -1,6 +1,9 @@
|
|
1
1
|
{
|
2
2
|
"name": "@o3r/schematics",
|
3
|
-
"version": "10.0.0-prerelease.
|
3
|
+
"version": "10.0.0-prerelease.61",
|
4
|
+
"publishConfig": {
|
5
|
+
"access": "public"
|
6
|
+
},
|
4
7
|
"description": "Schematics module of the Otter framework",
|
5
8
|
"main": "./src/public_api.js",
|
6
9
|
"typings": "./src/public_api.d.ts",
|
@@ -25,6 +28,7 @@
|
|
25
28
|
"@angular-devkit/core": "~17.0.0",
|
26
29
|
"@angular-devkit/schematics": "~17.0.0",
|
27
30
|
"@angular/cli": "~17.0.0",
|
31
|
+
"@o3r/telemetry": "^10.0.0-prerelease.61",
|
28
32
|
"@schematics/angular": "~17.0.0",
|
29
33
|
"eslint": "^8.42.0",
|
30
34
|
"rxjs": "^7.8.1",
|
@@ -37,6 +41,9 @@
|
|
37
41
|
"@angular-devkit/core": {
|
38
42
|
"optional": true
|
39
43
|
},
|
44
|
+
"@o3r/telemetry": {
|
45
|
+
"optional": true
|
46
|
+
},
|
40
47
|
"eslint": {
|
41
48
|
"optional": true
|
42
49
|
}
|
@@ -63,13 +70,15 @@
|
|
63
70
|
"@babel/core": "~7.23.0",
|
64
71
|
"@babel/preset-typescript": "~7.23.0",
|
65
72
|
"@compodoc/compodoc": "^1.1.19",
|
66
|
-
"@nx/eslint": "~17.
|
67
|
-
"@nx/eslint-plugin": "~17.
|
68
|
-
"@nx/jest": "~17.
|
69
|
-
"@nx/js": "~17.
|
70
|
-
"@o3r/build-helpers": "^10.0.0-prerelease.
|
71
|
-
"@o3r/eslint-plugin": "^10.0.0-prerelease.
|
73
|
+
"@nx/eslint": "~17.3.0",
|
74
|
+
"@nx/eslint-plugin": "~17.3.0",
|
75
|
+
"@nx/jest": "~17.3.0",
|
76
|
+
"@nx/js": "~17.3.0",
|
77
|
+
"@o3r/build-helpers": "^10.0.0-prerelease.61",
|
78
|
+
"@o3r/eslint-plugin": "^10.0.0-prerelease.61",
|
79
|
+
"@o3r/telemetry": "^10.0.0-prerelease.61",
|
72
80
|
"@schematics/angular": "~17.0.3",
|
81
|
+
"@stylistic/eslint-plugin-ts": "^1.5.4",
|
73
82
|
"@types/jest": "~29.5.2",
|
74
83
|
"@types/node": "^20.0.0",
|
75
84
|
"@types/semver": "^7.3.13",
|
@@ -86,9 +95,10 @@
|
|
86
95
|
"jest-junit": "~16.0.0",
|
87
96
|
"jsonc-eslint-parser": "~2.4.0",
|
88
97
|
"jsonschema": "~1.4.1",
|
89
|
-
"nx": "~17.
|
98
|
+
"nx": "~17.3.0",
|
90
99
|
"rxjs": "^7.8.1",
|
91
100
|
"ts-jest": "~29.1.1",
|
101
|
+
"ts-node": "~10.9.1",
|
92
102
|
"type-fest": "^4.3.1",
|
93
103
|
"typescript": "~5.2.2",
|
94
104
|
"zone.js": "~0.14.2"
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import type { Rule } from '@angular-devkit/schematics';
|
2
|
+
import type { NgAddSchematicsSchema } from './schema';
|
2
3
|
/**
|
3
4
|
* Add Otter schematics to an Angular Project
|
4
5
|
*/
|
5
|
-
export declare
|
6
|
+
export declare const ngAdd: (options: NgAddSchematicsSchema) => Rule;
|
6
7
|
//# sourceMappingURL=index.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../schematics/ng-add/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAA0B,MAAM,4BAA4B,CAAC;AAM/E;;GAEG;AACH,
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../schematics/ng-add/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAA0B,MAAM,4BAA4B,CAAC;AAM/E,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAqCtD;;GAEG;AACH,eAAO,MAAM,KAAK,0CAAiD,CAAC"}
|
@@ -4,19 +4,23 @@ exports.ngAdd = void 0;
|
|
4
4
|
const fs = require("node:fs");
|
5
5
|
const path = require("node:path");
|
6
6
|
const rxjs_1 = require("rxjs");
|
7
|
+
const schematics_1 = require("@o3r/schematics");
|
7
8
|
/**
|
8
9
|
* Add Otter schematics to an Angular Project
|
10
|
+
* @param options schematics options
|
9
11
|
*/
|
10
|
-
function
|
12
|
+
function ngAddFn(options) {
|
11
13
|
const schematicsDependencies = ['@angular-devkit/architect', '@angular-devkit/schematics', '@angular-devkit/core', '@schematics/angular', 'globby'];
|
12
|
-
return async (tree, context) => {
|
14
|
+
return () => async (tree, context) => {
|
13
15
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
14
|
-
const { AddDevInstall } = await Promise.resolve().then(() => require('@o3r/schematics'));
|
16
|
+
const { AddDevInstall, getWorkspaceConfig } = await Promise.resolve().then(() => require('@o3r/schematics'));
|
15
17
|
context.logger.info('Running ng add for schematics');
|
16
18
|
const packageJsonPath = path.resolve(__dirname, '..', '..', 'package.json');
|
17
19
|
const treePackageJson = tree.readJson('./package.json');
|
18
20
|
const packageJsonContent = JSON.parse(fs.readFileSync(packageJsonPath, { encoding: 'utf-8' }));
|
19
21
|
const getDependencyVersion = (dependency) => packageJsonContent?.dependencies?.[dependency] || packageJsonContent?.peerDependencies?.[dependency];
|
22
|
+
const workspaceProject = options.projectName ? getWorkspaceConfig(tree)?.projects[options.projectName] : undefined;
|
23
|
+
const workingDirectory = workspaceProject?.root || '.';
|
20
24
|
let packageName = '';
|
21
25
|
for (const dependency of schematicsDependencies) {
|
22
26
|
const version = getDependencyVersion(dependency);
|
@@ -27,6 +31,7 @@ function ngAdd() {
|
|
27
31
|
context.addTask(new AddDevInstall({
|
28
32
|
hideOutput: false,
|
29
33
|
packageName,
|
34
|
+
workingDirectory,
|
30
35
|
quiet: false
|
31
36
|
}));
|
32
37
|
await (0, rxjs_1.lastValueFrom)(context.engine.executePostTasks());
|
@@ -34,5 +39,8 @@ function ngAdd() {
|
|
34
39
|
return () => tree;
|
35
40
|
};
|
36
41
|
}
|
37
|
-
|
42
|
+
/**
|
43
|
+
* Add Otter schematics to an Angular Project
|
44
|
+
*/
|
45
|
+
exports.ngAdd = (0, schematics_1.createSchematicWithMetricsIfInstalled)(ngAddFn);
|
38
46
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"angular-workspace.d.ts","sourceRoot":"","sources":["../../../src/interfaces/angular-workspace.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,QAAQ,IAAI,kBAAkB,EAC9B,MAAM,IAAI,iBAAiB,EAC3B,gBAAgB,EACjB,MAAM,0CAA0C,CAAC;AAElD;;GAEG;AACH,MAAM,MAAM,uBAAuB,GAAG,MAAM,GAAG,SAAS,CAAC;AAEzD,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,YAAY,CAAC,EAAE,MAAM,CAAC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,OAAO,CAAC;QAChC,eAAe,CAAC,EAAE,OAAO,CAAC;KAC3B,GAAG,mBAAmB,CAAC,KAAK,CAAC,CAAC;IAC/B,KAAK,CAAC,EAAE,eAAe,GAAG;QACxB,2FAA2F;QAC3F,aAAa,CAAC,EAAE,uBAAuB,CAAC;KACzC,CAAC;CACH;AACD,MAAM,WAAW,gBAAiB,SAAQ,kBAAkB;IAC1D,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,aAAa,CAAC;IAC1B,IAAI,CAAC,EAAE,oBAAoB,CAAC;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,aAAa,GAAG,SAAS,CAAC;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,mBAAmB,CAAC;IACjC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,aAAa,CAAC;CACzB;AAED,MAAM,WAAW,eAAgB,SAAQ,iBAAiB;IACxD,QAAQ,EAAE;QACR,CAAC,CAAC,EAAE,MAAM,GAAG,gBAAgB,CAAC;KAC/B,CAAC;IACF,UAAU,CAAC,EAAE,mBAAmB,CAAC;CAClC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/rule-factories/eslint-fix/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,IAAI,EAA0B,MAAM,4BAA4B,CAAC;AAE1F,OAAO,EAAiB,aAAa,EAAE,MAAM,aAAa,CAAC;AAE3D;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,UAAU,SAAM,EAAE,SAAS,GAAE,MAAM,EAAW,EAAE,OAAO,CAAC,EAAE,aAAa,GAAG,IAAI,
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/rule-factories/eslint-fix/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,IAAI,EAA0B,MAAM,4BAA4B,CAAC;AAE1F,OAAO,EAAiB,aAAa,EAAE,MAAM,aAAa,CAAC;AAE3D;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,UAAU,SAAM,EAAE,SAAS,GAAE,MAAM,EAAW,EAAE,OAAO,CAAC,EAAE,aAAa,GAAG,IAAI,CAoE5G"}
|
@@ -49,12 +49,14 @@ function applyEsLintFix(_prootPath = '/', extension = ['ts'], options) {
|
|
49
49
|
You can consider to run later the following command to add otter linter rules: ng add @o3r/eslint-config-otter`);
|
50
50
|
}
|
51
51
|
const files = filesToBeLint.reduce((acc, filePath) => {
|
52
|
-
if (extension.some((ext) => filePath.endsWith(`.${ext}`)) && dir && filePath.startsWith(dir.path)) {
|
52
|
+
if (extension.some((ext) => filePath.endsWith(`.${ext}`)) && dir && filePath.startsWith(dir.path.substring(1))) {
|
53
53
|
acc.add(filePath);
|
54
54
|
}
|
55
55
|
return acc;
|
56
56
|
}, new Set());
|
57
|
-
|
57
|
+
if (files.size) {
|
58
|
+
context.addTask(new tasks_1.EslintFixTask(Array.from(files), undefined, eslintFile, linterOptions));
|
59
|
+
}
|
58
60
|
return tree;
|
59
61
|
};
|
60
62
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/rule-factories/eslint-fix/index.ts"],"names":[],"mappings":";;;AAAA,2DAA0F;AAC1F,yCAA0C;AAC1C,uCAA2D;AAE3D;;;;;;GAMG;AACH,SAAgB,cAAc,CAAC,UAAU,GAAG,GAAG,EAAE,YAAsB,CAAC,IAAI,CAAC,EAAE,OAAuB;IACpG,IAAI;QACF,OAAO,CAAC,OAAO,CAAC,qBAAqB,CAAC,CAAC;KACxC;IAAC,MAAM;QACN,OAAO,IAAA,iBAAI,GAAE,CAAC;KACf;IAED,MAAM,aAAa,GAAkB;QACnC,eAAe,EAAE,IAAI;QACrB,YAAY,EAAE,IAAI;QAClB,GAAG,OAAO;KACX,CAAC;IAEF,OAAO,CAAC,IAAU,EAAE,OAAyB,EAAE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AC,IAAI,EAAE;YACd,OAAO,CAAC,OAAO,CACb,IAAI,qBAAa,CACf,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,EACjB,SAAS,EACT,UAAU,EACV,aAAa,CACd,CACF,CAAC;SACH;QAED,OAAO,IAAI,CAAC;IACd,CAAC,CAAC;AACJ,CAAC;AApED,wCAoEC"}
|
package/src/utility/index.d.ts
CHANGED
@@ -19,5 +19,7 @@ export * from './routes';
|
|
19
19
|
export * from './sub-entry';
|
20
20
|
export * from './template-property.helper';
|
21
21
|
export * from './update-imports';
|
22
|
+
export * from './update-pipes';
|
22
23
|
export * from './builder';
|
24
|
+
export * from './wrapper';
|
23
25
|
//# sourceMappingURL=index.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utility/index.ts"],"names":[],"mappings":"AAAA,cAAc,OAAO,CAAC;AACtB,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC;AACvB,cAAc,kBAAkB,CAAC;AACjC,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,0BAA0B,CAAC;AACzC,cAAc,mBAAmB,CAAC;AAClC,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,4BAA4B,CAAC;AAC3C,cAAc,kBAAkB,CAAC;AACjC,cAAc,WAAW,CAAC"}
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utility/index.ts"],"names":[],"mappings":"AAAA,cAAc,OAAO,CAAC;AACtB,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC;AACvB,cAAc,kBAAkB,CAAC;AACjC,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,0BAA0B,CAAC;AACzC,cAAc,mBAAmB,CAAC;AAClC,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,4BAA4B,CAAC;AAC3C,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC"}
|
package/src/utility/index.js
CHANGED
@@ -22,5 +22,7 @@ tslib_1.__exportStar(require("./routes"), exports);
|
|
22
22
|
tslib_1.__exportStar(require("./sub-entry"), exports);
|
23
23
|
tslib_1.__exportStar(require("./template-property.helper"), exports);
|
24
24
|
tslib_1.__exportStar(require("./update-imports"), exports);
|
25
|
+
tslib_1.__exportStar(require("./update-pipes"), exports);
|
25
26
|
tslib_1.__exportStar(require("./builder"), exports);
|
27
|
+
tslib_1.__exportStar(require("./wrapper"), exports);
|
26
28
|
//# sourceMappingURL=index.js.map
|
package/src/utility/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utility/index.ts"],"names":[],"mappings":";;;AAAA,gDAAsB;AACtB,uDAA6B;AAC7B,sDAA4B;AAC5B,yDAA+B;AAC/B,wDAA8B;AAC9B,kDAAwB;AACxB,sDAA4B;AAC5B,uDAA6B;AAC7B,sDAA4B;AAC5B,oDAA0B;AAC1B,iDAAuB;AACvB,2DAAiC;AACjC,oDAA0B;AAC1B,qDAA2B;AAC3B,mEAAyC;AACzC,4DAAkC;AAClC,qDAA2B;AAC3B,mDAAyB;AACzB,sDAA4B;AAC5B,qEAA2C;AAC3C,2DAAiC;AACjC,oDAA0B"}
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utility/index.ts"],"names":[],"mappings":";;;AAAA,gDAAsB;AACtB,uDAA6B;AAC7B,sDAA4B;AAC5B,yDAA+B;AAC/B,wDAA8B;AAC9B,kDAAwB;AACxB,sDAA4B;AAC5B,uDAA6B;AAC7B,sDAA4B;AAC5B,oDAA0B;AAC1B,iDAAuB;AACvB,2DAAiC;AACjC,oDAA0B;AAC1B,qDAA2B;AAC3B,mEAAyC;AACzC,4DAAkC;AAClC,qDAA2B;AAC3B,mDAAyB;AACzB,sDAA4B;AAC5B,qEAA2C;AAC3C,2DAAiC;AACjC,yDAA+B;AAC/B,oDAA0B;AAC1B,oDAA0B"}
|
@@ -0,0 +1,15 @@
|
|
1
|
+
import { Rule } from '@angular-devkit/schematics';
|
2
|
+
/** Dictionary of pipes to be updated */
|
3
|
+
export type PipeReplacementInfo = Record<string, {
|
4
|
+
new: {
|
5
|
+
name: string;
|
6
|
+
import?: string;
|
7
|
+
};
|
8
|
+
import: string;
|
9
|
+
}>;
|
10
|
+
/**
|
11
|
+
* Returns a rule tu update pipes
|
12
|
+
* @param pipeReplacementInfo
|
13
|
+
*/
|
14
|
+
export declare const updatePipes: (pipeReplacementInfo: PipeReplacementInfo) => Rule;
|
15
|
+
//# sourceMappingURL=update-pipes.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"update-pipes.d.ts","sourceRoot":"","sources":["../../../src/utility/update-pipes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAA0B,MAAM,4BAA4B,CAAC;AAO1E,wCAAwC;AACxC,MAAM,MAAM,mBAAmB,GAAG,MAAM,CAAC,MAAM,EAAE;IAAE,GAAG,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AAmD7G;;;GAGG;AACH,eAAO,MAAM,WAAW,wBAAyB,mBAAmB,KAAG,IAoDtE,CAAC"}
|
@@ -0,0 +1,82 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.updatePipes = void 0;
|
4
|
+
const node_path_1 = require("node:path");
|
5
|
+
const ts = require("typescript");
|
6
|
+
const ast_1 = require("./ast");
|
7
|
+
const component_1 = require("./component");
|
8
|
+
const loaders_1 = require("./loaders");
|
9
|
+
const applyChanges = (pipeReplacementInfo, ngDecorator, matchers, fileWithImports, templateFile, tree, context) => {
|
10
|
+
if (ts.isObjectLiteralExpression(ngDecorator.expression.arguments[0])) {
|
11
|
+
const importsProp = ngDecorator.expression.arguments[0].properties.find((prop) => ts.isPropertyAssignment(prop)
|
12
|
+
&& ts.isIdentifier(prop.name)
|
13
|
+
&& prop.name.text === 'imports'
|
14
|
+
&& ts.isArrayLiteralExpression(prop.initializer));
|
15
|
+
if (importsProp) {
|
16
|
+
matchers.forEach((matcher) => {
|
17
|
+
const pipeName = matcher[1];
|
18
|
+
const importModuleRegexp = new RegExp(`\\b${pipeReplacementInfo[pipeName].import}\\b`, 'g');
|
19
|
+
if (importsProp.initializer.elements.some((element) => importModuleRegexp.test(element.getText()))) {
|
20
|
+
if (pipeReplacementInfo[pipeName].new.import) {
|
21
|
+
tree.overwrite(fileWithImports, tree.readText(fileWithImports).replaceAll(importModuleRegexp, pipeReplacementInfo[pipeName].new.import));
|
22
|
+
}
|
23
|
+
tree.overwrite(templateFile, tree.readText(templateFile).replaceAll(new RegExp(`\\|\\s*${pipeName}`, 'g'), `| ${pipeReplacementInfo[pipeName].new.name}`));
|
24
|
+
}
|
25
|
+
else {
|
26
|
+
context.logger.warn(`Deprecated pipe ${pipeName} was found in ${templateFile} `
|
27
|
+
+ `but no associated import in ${fileWithImports}`
|
28
|
+
+ `to be able to migrate to the new pipe ${pipeReplacementInfo[pipeName].new.name}.`);
|
29
|
+
}
|
30
|
+
});
|
31
|
+
}
|
32
|
+
}
|
33
|
+
};
|
34
|
+
const isNgModuleDecorator = (decorator) => ts.isCallExpression(decorator.expression)
|
35
|
+
&& decorator.expression.expression
|
36
|
+
&& ts.isIdentifier(decorator.expression.expression)
|
37
|
+
&& decorator.expression.expression.text === 'NgModule';
|
38
|
+
/**
|
39
|
+
* Returns a rule tu update pipes
|
40
|
+
* @param pipeReplacementInfo
|
41
|
+
*/
|
42
|
+
const updatePipes = (pipeReplacementInfo) => (tree, context) => {
|
43
|
+
const pipeRegex = new RegExp(`\\|\\s*(${Object.keys(pipeReplacementInfo).join('|')})`, 'g');
|
44
|
+
const files = (0, loaders_1.findFilesInTree)(tree.root, (file) => file.endsWith('.html'));
|
45
|
+
files.forEach((file) => {
|
46
|
+
const matchers = Array.from(file.content.toString().matchAll(pipeRegex)).filter((matcher) => !!pipeReplacementInfo[matcher[1]]);
|
47
|
+
if (matchers.length) {
|
48
|
+
const directory = (0, node_path_1.dirname)(file.path);
|
49
|
+
const baseFileName = (0, node_path_1.basename)(file.path, '.template.html');
|
50
|
+
const componentFile = (0, node_path_1.join)(directory, `${baseFileName}.component.ts`);
|
51
|
+
const moduleFile = (0, node_path_1.join)(directory, `${baseFileName}.module.ts`);
|
52
|
+
let standalone = false;
|
53
|
+
if (tree.exists(componentFile)) {
|
54
|
+
try {
|
55
|
+
const info = (0, component_1.getO3rComponentInfoOrThrowIfNotFound)(tree, componentFile);
|
56
|
+
standalone = info.standalone;
|
57
|
+
}
|
58
|
+
catch { }
|
59
|
+
}
|
60
|
+
if (standalone) {
|
61
|
+
const componentSourceFile = ts.createSourceFile(componentFile, tree.readText(componentFile), ts.ScriptTarget.ES2020, true);
|
62
|
+
const [ngClass] = componentSourceFile.statements.filter((statement) => ts.isClassDeclaration(statement)
|
63
|
+
&& (0, component_1.isNgClassComponent)(statement));
|
64
|
+
const [ngDecorator] = ((ngClass && ts.getDecorators(ngClass)) || []).filter(component_1.isNgClassDecorator);
|
65
|
+
if (ngDecorator) {
|
66
|
+
applyChanges(pipeReplacementInfo, ngDecorator, matchers, componentFile, file.path, tree, context);
|
67
|
+
}
|
68
|
+
}
|
69
|
+
else if (tree.exists(moduleFile)) {
|
70
|
+
const moduleSourceFile = ts.createSourceFile(moduleFile, tree.readText(moduleFile), ts.ScriptTarget.ES2020, true);
|
71
|
+
const ngModuleClass = moduleSourceFile.statements.find((statement) => ts.isClassDeclaration(statement)
|
72
|
+
&& !!(ts.getDecorators(statement) || []).find(isNgModuleDecorator));
|
73
|
+
const ngDecorator = ((ngModuleClass && ts.getDecorators(ngModuleClass)) || []).find(isNgModuleDecorator);
|
74
|
+
if (ngDecorator && (0, ast_1.isDecoratorWithArg)(ngDecorator)) {
|
75
|
+
applyChanges(pipeReplacementInfo, ngDecorator, matchers, moduleFile, file.path, tree, context);
|
76
|
+
}
|
77
|
+
}
|
78
|
+
}
|
79
|
+
});
|
80
|
+
};
|
81
|
+
exports.updatePipes = updatePipes;
|
82
|
+
//# sourceMappingURL=update-pipes.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"update-pipes.js","sourceRoot":"","sources":["../../../src/utility/update-pipes.ts"],"names":[],"mappings":";;;AACA,yCAAoD;AACpD,iCAAiC;AACjC,+BAA6D;AAC7D,2CAA2G;AAC3G,uCAA4C;AAK5C,MAAM,YAAY,GAAG,CACnB,mBAAwC,EACxC,WAA6B,EAC7B,QAA4B,EAC5B,eAAuB,EACvB,YAAoB,EACpB,IAAU,EACV,OAAyB,EACzB,EAAE;IACF,IAAI,EAAE,CAAC,yBAAyB,CAAC,WAAW,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,EAAE;QACrE,MAAM,WAAW,GAAG,WAAW,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,UAAU,CAA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IAAI,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;iBACnG;aACF;iBAAM,IAAI,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,EAAE;gBAClC,MAAM,gBAAgB,GAAG,EAAE,CAAC,gBAAgB,CAC1C,UAAU,EACV,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,EACzB,EAAE,CAAC,YAAY,CAAC,MAAM,EACtB,IAAI,CACL,CAAC;gBACF,MAAM,aAAa,GAAG,gBAAgB,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,SAAS,EAAoC,EAAE,CACrG,EAAE,CAAC,kBAAkB,CAAC,SAAS,CAAC;uBAC7B,CAAC,CAAC,CAAC,EAAE,CAAC,aAAa,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,mBAAmB,CAAC,CACnE,CAAC;gBACF,MAAM,WAAW,GAAG,CAAC,CAAC,aAAa,IAAI,EAAE,CAAC,aAAa,CAAC,aAAa,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC;gBACzG,IAAI,WAAW,IAAI,IAAA,wBAAkB,EAAC,WAAW,CAAC,EAAE;oBAClD,YAAY,CAAC,mBAAmB,EAAE,WAAW,EAAE,QAAQ,EAAE,UAAU,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;iBAChG;aACF;SACF;IACH,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AApDW,QAAA,WAAW,eAoDtB"}
|
@@ -0,0 +1,8 @@
|
|
1
|
+
import type { SchematicWrapper } from '@o3r/telemetry';
|
2
|
+
/**
|
3
|
+
* Wrapper method of a schematic to retrieve some metrics around the schematic run
|
4
|
+
* if @o3r/telemetry is installed
|
5
|
+
* @param schematicFn
|
6
|
+
*/
|
7
|
+
export declare const createSchematicWithMetricsIfInstalled: SchematicWrapper;
|
8
|
+
//# sourceMappingURL=wrapper.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"wrapper.d.ts","sourceRoot":"","sources":["../../../src/utility/wrapper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAIvD;;;;GAIG;AACH,eAAO,MAAM,qCAAqC,EAAE,gBAUnD,CAAC"}
|
@@ -0,0 +1,23 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.createSchematicWithMetricsIfInstalled = void 0;
|
4
|
+
const noopSchematicWrapper = (fn) => fn;
|
5
|
+
/**
|
6
|
+
* Wrapper method of a schematic to retrieve some metrics around the schematic run
|
7
|
+
* if @o3r/telemetry is installed
|
8
|
+
* @param schematicFn
|
9
|
+
*/
|
10
|
+
const createSchematicWithMetricsIfInstalled = (schematicFn) => (opts) => async (_, context) => {
|
11
|
+
let wrapper = noopSchematicWrapper;
|
12
|
+
try {
|
13
|
+
const { createSchematicWithMetrics } = await Promise.resolve().then(() => require('@o3r/telemetry'));
|
14
|
+
wrapper = createSchematicWithMetrics;
|
15
|
+
}
|
16
|
+
catch (e) {
|
17
|
+
// Do not throw if `@o3r/telemetry is not installed
|
18
|
+
context.logger.debug('`@o3r/telemetry` is not available\n' + e.toString());
|
19
|
+
}
|
20
|
+
return wrapper(schematicFn)(opts);
|
21
|
+
};
|
22
|
+
exports.createSchematicWithMetricsIfInstalled = createSchematicWithMetricsIfInstalled;
|
23
|
+
//# sourceMappingURL=wrapper.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"wrapper.js","sourceRoot":"","sources":["../../../src/utility/wrapper.ts"],"names":[],"mappings":";;;AAEA,MAAM,oBAAoB,GAAqB,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC;AAE1D;;;;GAIG;AACI,MAAM,qCAAqC,GAAqB,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,EAAE;IACrH,IAAI,OAAO,GAAqB,oBAAoB,CAAC;IACrD,IAAI;QACF,MAAM,EAAE,0BAA0B,EAAE,GAAG,2CAAa,gBAAgB,EAAC,CAAC;QACtE,OAAO,GAAG,0BAA0B,CAAC;KACtC;IAAC,OAAO,CAAM,EAAE;QACf,mDAAmD;QACnD,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,qCAAqC,GAAG,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC;KAC5E;IACD,OAAO,OAAO,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,CAAC;AACpC,CAAC,CAAC;AAVW,QAAA,qCAAqC,yCAUhD"}
|