@o3r/schematics 10.0.0-prerelease.2 → 10.0.0-prerelease.21
Sign up to get free protection for your applications and to get access to all the features.
- package/package.json +8 -3
- 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/utility/index.d.ts +1 -0
- package/src/utility/index.d.ts.map +1 -1
- package/src/utility/index.js +1 -0
- package/src/utility/index.js.map +1 -1
- 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,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@o3r/schematics",
|
3
|
-
"version": "10.0.0-prerelease.
|
3
|
+
"version": "10.0.0-prerelease.21",
|
4
4
|
"description": "Schematics module of the Otter framework",
|
5
5
|
"main": "./src/public_api.js",
|
6
6
|
"typings": "./src/public_api.d.ts",
|
@@ -25,6 +25,7 @@
|
|
25
25
|
"@angular-devkit/core": "~17.0.0",
|
26
26
|
"@angular-devkit/schematics": "~17.0.0",
|
27
27
|
"@angular/cli": "~17.0.0",
|
28
|
+
"@o3r/telemetry": "^10.0.0-prerelease.21",
|
28
29
|
"@schematics/angular": "~17.0.0",
|
29
30
|
"eslint": "^8.42.0",
|
30
31
|
"rxjs": "^7.8.1",
|
@@ -37,6 +38,9 @@
|
|
37
38
|
"@angular-devkit/core": {
|
38
39
|
"optional": true
|
39
40
|
},
|
41
|
+
"@o3r/telemetry": {
|
42
|
+
"optional": true
|
43
|
+
},
|
40
44
|
"eslint": {
|
41
45
|
"optional": true
|
42
46
|
}
|
@@ -67,8 +71,9 @@
|
|
67
71
|
"@nx/eslint-plugin": "~17.2.0",
|
68
72
|
"@nx/jest": "~17.2.0",
|
69
73
|
"@nx/js": "~17.2.0",
|
70
|
-
"@o3r/build-helpers": "^10.0.0-prerelease.
|
71
|
-
"@o3r/eslint-plugin": "^10.0.0-prerelease.
|
74
|
+
"@o3r/build-helpers": "^10.0.0-prerelease.21",
|
75
|
+
"@o3r/eslint-plugin": "^10.0.0-prerelease.21",
|
76
|
+
"@o3r/telemetry": "^10.0.0-prerelease.21",
|
72
77
|
"@schematics/angular": "~17.0.3",
|
73
78
|
"@types/jest": "~29.5.2",
|
74
79
|
"@types/node": "^20.0.0",
|
@@ -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: (opts: 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,uCAAiD,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
|
package/src/utility/index.d.ts
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utility/index.ts"],"names":[],"mappings":"AAAA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/index.js
CHANGED
@@ -23,4 +23,5 @@ 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
25
|
tslib_1.__exportStar(require("./builder"), exports);
|
26
|
+
tslib_1.__exportStar(require("./wrapper"), exports);
|
26
27
|
//# 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,oDAA0B;AAC1B,oDAA0B"}
|
@@ -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"}
|