@o3r/schematics 9.6.0-alpha.9 → 9.6.0-rc.0
Sign up to get free protection for your applications and to get access to all the features.
- package/package.json +9 -5
- package/schematics/ng-add/index.js.map +1 -0
- package/schematics/ng-add/schema.js.map +1 -0
- package/schematics/package.json +3 -0
- package/src/rule-factories/dev-tools/devtools-registration.d.ts +5 -0
- package/src/rule-factories/dev-tools/devtools-registration.d.ts.map +1 -1
- package/src/rule-factories/dev-tools/devtools-registration.js +41 -1
- package/src/rule-factories/dev-tools/devtools-registration.js.map +1 -1
- package/src/rule-factories/eslint-fix/index.d.ts.map +1 -1
- package/src/rule-factories/eslint-fix/index.js +7 -0
- package/src/rule-factories/eslint-fix/index.js.map +1 -1
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@o3r/schematics",
|
3
|
-
"version": "9.6.0-
|
3
|
+
"version": "9.6.0-rc.0",
|
4
4
|
"description": "Schematics module of the Otter framework",
|
5
5
|
"main": "./src/public_api.js",
|
6
6
|
"typings": "./src/public_api.d.ts",
|
@@ -26,6 +26,7 @@
|
|
26
26
|
"@angular-devkit/schematics": "~16.2.0",
|
27
27
|
"@angular/cli": "~16.2.0",
|
28
28
|
"@schematics/angular": "~16.2.0",
|
29
|
+
"eslint": "^8.42.0",
|
29
30
|
"rxjs": "^7.8.1",
|
30
31
|
"typescript": "~5.1.6"
|
31
32
|
},
|
@@ -35,6 +36,9 @@
|
|
35
36
|
},
|
36
37
|
"@angular-devkit/core": {
|
37
38
|
"optional": true
|
39
|
+
},
|
40
|
+
"eslint": {
|
41
|
+
"optional": true
|
38
42
|
}
|
39
43
|
},
|
40
44
|
"dependencies": {
|
@@ -63,9 +67,9 @@
|
|
63
67
|
"@nx/jest": "~16.10.0",
|
64
68
|
"@nx/js": "~16.10.0",
|
65
69
|
"@nx/linter": "~16.10.0",
|
66
|
-
"@o3r/build-helpers": "^9.6.0-
|
67
|
-
"@o3r/dev-tools": "^9.6.0-
|
68
|
-
"@o3r/eslint-plugin": "^9.6.0-
|
70
|
+
"@o3r/build-helpers": "^9.6.0-rc.0",
|
71
|
+
"@o3r/dev-tools": "^9.6.0-rc.0",
|
72
|
+
"@o3r/eslint-plugin": "^9.6.0-rc.0",
|
69
73
|
"@schematics/angular": "~16.2.0",
|
70
74
|
"@types/jest": "~29.5.2",
|
71
75
|
"@types/node": "^18.0.0",
|
@@ -76,7 +80,7 @@
|
|
76
80
|
"eslint": "^8.42.0",
|
77
81
|
"eslint-import-resolver-node": "^0.3.4",
|
78
82
|
"eslint-plugin-jest": "~27.6.0",
|
79
|
-
"eslint-plugin-jsdoc": "~46.
|
83
|
+
"eslint-plugin-jsdoc": "~46.10.0",
|
80
84
|
"eslint-plugin-prefer-arrow": "~1.2.3",
|
81
85
|
"eslint-plugin-unicorn": "^47.0.0",
|
82
86
|
"jest": "~29.7.0",
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../schematics/ng-add/index.ts"],"names":[],"mappings":";;;AACA,8BAA8B;AAC9B,kCAAkC;AAClC,+BAAqC;AAGrC;;GAEG;AACH,SAAgB,KAAK;IACnB,MAAM,sBAAsB,GAAG,CAAC,2BAA2B,EAAE,4BAA4B,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,QAAQ,CAAC,CAAC;IACpJ,OAAO,KAAK,EAAE,IAAU,EAAE,OAAyB,EAAiB,EAAE;QACpE,gEAAgE;QAChE,MAAM,EAAE,aAAa,EAAE,GAAG,2CAAa,iBAAiB,EAAC,CAAC;QAC1D,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,+BAA+B,CAAC,CAAC;QACrD,MAAM,eAAe,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,cAAc,CAAC,CAAC;QAC5E,MAAM,eAAe,GAAG,IAAI,CAAC,QAAQ,CAAC,gBAAgB,CAAgB,CAAC;QACvE,MAAM,kBAAkB,GAAgB,IAAI,CAAC,KAAK,CAA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10,6 +10,11 @@ export interface DevtoolRegisterOptions {
|
|
10
10
|
/** Name of the devtools service (if available) */
|
11
11
|
serviceName?: string;
|
12
12
|
}
|
13
|
+
/**
|
14
|
+
* Rule to inject a service after `bootstrapModule` or `bootstrapApplication`
|
15
|
+
* @param options
|
16
|
+
*/
|
17
|
+
export declare const injectServiceInMain: (options: DevtoolRegisterOptions) => Rule;
|
13
18
|
/**
|
14
19
|
* Register Devtools to the application
|
15
20
|
* @param tree
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"devtools-registration.d.ts","sourceRoot":"","sources":["../../../../src/rule-factories/dev-tools/devtools-registration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,IAAI,EAAE,MAAM,4BAA4B,CAAC;
|
1
|
+
{"version":3,"file":"devtools-registration.d.ts","sourceRoot":"","sources":["../../../../src/rule-factories/dev-tools/devtools-registration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAQzD,qDAAqD;AACrD,MAAM,WAAW,sBAAsB;IACrC,iCAAiC;IACjC,UAAU,EAAE,MAAM,CAAC;IACnB,sDAAsD;IACtD,WAAW,EAAE,MAAM,CAAC;IACpB,yCAAyC;IACzC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,kDAAkD;IAClD,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAqCD;;;GAGG;AACH,eAAO,MAAM,mBAAmB,YAAa,sBAAsB,KAAG,IAoDrE,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,6BAA6B,YAAa,sBAAsB,KAAG,IAsB/E,CAAC"}
|
@@ -1,11 +1,12 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.registerDevtoolsToApplication = void 0;
|
3
|
+
exports.registerDevtoolsToApplication = exports.injectServiceInMain = void 0;
|
4
4
|
const schematics_1 = require("@angular-devkit/schematics");
|
5
5
|
const ts = require("typescript");
|
6
6
|
const ast_utils_1 = require("@schematics/angular/utility/ast-utils");
|
7
7
|
const utility_1 = require("../../utility");
|
8
8
|
const utility_2 = require("../../utility");
|
9
|
+
const change_1 = require("@schematics/angular/utility/change");
|
9
10
|
const registerModule = (options) => (tree, context) => {
|
10
11
|
const moduleFilePath = (0, utility_1.getAppModuleFilePath)(tree, context, options.projectName);
|
11
12
|
if (!moduleFilePath) {
|
@@ -24,6 +25,44 @@ const registerModule = (options) => (tree, context) => {
|
|
24
25
|
tree.commitUpdate(recorder);
|
25
26
|
return tree;
|
26
27
|
};
|
28
|
+
/**
|
29
|
+
* Rule to inject a service after `bootstrapModule` or `bootstrapApplication`
|
30
|
+
* @param options
|
31
|
+
*/
|
32
|
+
const injectServiceInMain = (options) => (tree, context) => {
|
33
|
+
if (!options.serviceName) {
|
34
|
+
return tree;
|
35
|
+
}
|
36
|
+
const mainFilePath = (0, utility_1.getMainFilePath)(tree, context, options.projectName);
|
37
|
+
if (!mainFilePath || !tree.exists(mainFilePath)) {
|
38
|
+
return tree;
|
39
|
+
}
|
40
|
+
const content = tree.readText(mainFilePath);
|
41
|
+
if (content.includes(`inject(${options.serviceName})`)) {
|
42
|
+
return tree;
|
43
|
+
}
|
44
|
+
const match = /bootstrap(Module|Application)\([^)]*\)/.exec(content);
|
45
|
+
if (!match) {
|
46
|
+
return tree;
|
47
|
+
}
|
48
|
+
const sourceFile = ts.createSourceFile(mainFilePath, content, ts.ScriptTarget.ES2015, true);
|
49
|
+
const recorder = tree.beginUpdate(mainFilePath);
|
50
|
+
const changes = [];
|
51
|
+
if (!(0, ast_utils_1.isImported)(sourceFile, options.serviceName, options.packageName)) {
|
52
|
+
changes.push((0, ast_utils_1.insertImport)(sourceFile, mainFilePath, options.serviceName, options.packageName));
|
53
|
+
}
|
54
|
+
if (!(0, ast_utils_1.isImported)(sourceFile, 'inject', '@angular/core')) {
|
55
|
+
changes.push((0, ast_utils_1.insertImport)(sourceFile, mainFilePath, 'inject', '@angular/core'));
|
56
|
+
}
|
57
|
+
if (!(0, ast_utils_1.isImported)(sourceFile, 'runInInjectionContext', '@angular/core')) {
|
58
|
+
changes.push((0, ast_utils_1.insertImport)(sourceFile, mainFilePath, 'runInInjectionContext', '@angular/core'));
|
59
|
+
}
|
60
|
+
changes.push(new change_1.InsertChange(mainFilePath, match.index + match[0].length, `\n .then((m) => { runInInjectionContext(m.injector, () => { inject(${options.serviceName}); }); return m; })`));
|
61
|
+
(0, change_1.applyToUpdateRecorder)(recorder, changes);
|
62
|
+
tree.commitUpdate(recorder);
|
63
|
+
return tree;
|
64
|
+
};
|
65
|
+
exports.injectServiceInMain = injectServiceInMain;
|
27
66
|
/**
|
28
67
|
* Register Devtools to the application
|
29
68
|
* @param tree
|
@@ -43,6 +82,7 @@ const registerDevtoolsToApplication = (options) => (tree, context) => {
|
|
43
82
|
}
|
44
83
|
return (0, schematics_1.chain)([
|
45
84
|
registerModule(options),
|
85
|
+
(0, exports.injectServiceInMain)(options),
|
46
86
|
(_, ctx) => ctx.logger.info(`The devtools module ${options.moduleName} has been registered and automatically activated${options.serviceName ? ', its activation can be driven via ' + options.serviceName : ''}.`)
|
47
87
|
])(tree, context);
|
48
88
|
};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"devtools-registration.js","sourceRoot":"","sources":["../../../../src/rule-factories/dev-tools/devtools-registration.ts"],"names":[],"mappings":";;;AAAA,2DAAyD;AACzD,iCAAiC;AACjC,
|
1
|
+
{"version":3,"file":"devtools-registration.js","sourceRoot":"","sources":["../../../../src/rule-factories/dev-tools/devtools-registration.ts"],"names":[],"mappings":";;;AAAA,2DAAyD;AACzD,iCAAiC;AACjC,qEAAuG;AACvG,2CAAyH;AAEzH,2CAAkF;AAClF,+DAAyF;AAczF,MAAM,cAAc,GAAG,CAAC,OAA+B,EAAQ,EAAE,CAAC,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE;IAClF,MAAM,cAAc,GAAG,IAAA,8BAAoB,EAAC,IAAI,EAAE,OAA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AkC,SAAS,EAAE,OAAO,CAAC,WAAW,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;IAE1I,IAAI,CAAC,eAAe,EAAE,eAAe,EAAE;QACrC,OAAO,IAAI,CAAC;KACb;IAED,OAAO,IAAA,kBAAK,EAAC;QACX,cAAc,CAAC,OAAO,CAAC;QACvB,IAAA,2BAAmB,EAAC,OAAO,CAAC;QAC5B,CAAC,CAAC,EAAE,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CACzB,uBAAuB,OAAO,CAAC,UAAU,mDAAmD,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,qCAAqC,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,GAAG,CACtL;KACF,CAAC,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;AACpB,CAAC,CAAC;AAtBW,QAAA,6BAA6B,iCAsBxC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/rule-factories/eslint-fix/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
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;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,UAAU,SAAM,EAAE,SAAS,GAAE,MAAM,EAAW,EAAE,OAAO,CAAC,EAAE,aAAa,GAAG,IAAI,CAmE5G"}
|
@@ -1,6 +1,7 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.applyEsLintFix = void 0;
|
4
|
+
const schematics_1 = require("@angular-devkit/schematics");
|
4
5
|
const node_path_1 = require("node:path");
|
5
6
|
const tasks_1 = require("../../tasks");
|
6
7
|
/**
|
@@ -12,6 +13,12 @@ const tasks_1 = require("../../tasks");
|
|
12
13
|
* @param options Linter options
|
13
14
|
*/
|
14
15
|
function applyEsLintFix(_prootPath = '/', extension = ['ts'], options) {
|
16
|
+
try {
|
17
|
+
require.resolve('eslint/package.json');
|
18
|
+
}
|
19
|
+
catch {
|
20
|
+
return (0, schematics_1.noop)();
|
21
|
+
}
|
15
22
|
const linterOptions = {
|
16
23
|
continueOnError: options?.force ?? true,
|
17
24
|
force: true,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/rule-factories/eslint-fix/index.ts"],"names":[],"mappings":";;;
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/rule-factories/eslint-fix/index.ts"],"names":[],"mappings":";;;AAAA,2DAA0F;AAC1F,yCAA0C;AAC1C,uCAA2D;AAE3D;;;;;;;GAOG;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,OAAO,EAAE,KAAK,IAAI,IAAI;QACvC,KAAK,EAAE,IAAI;QACX,YAAY,EAAE,IAAI;QAClB,GAAG,OAAO;KACX,CAAC;IAEF,OAAO,CAAC,IAAU,EAAE,OAAyB,EAAE,EAAE;QAC/C,MAAM,aAAa,GAAG,IAAI,CAAC,OAAO;aAC/B,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,GAAG,CAAC;aAC7B,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;QAE7C,gCAAgC;QAChC,I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