@o3r/schematics 8.2.6 → 8.2.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@o3r/schematics",
3
- "version": "8.2.6",
3
+ "version": "8.2.8",
4
4
  "description": "Schematics module of the Otter framework",
5
5
  "main": "./src/index.js",
6
6
  "keywords": [
@@ -57,9 +57,9 @@
57
57
  "@nrwl/jest": "~15.9.0",
58
58
  "@nrwl/js": "~15.9.0",
59
59
  "@nrwl/linter": "~15.9.0",
60
- "@o3r/build-helpers": "^8.2.6",
61
- "@o3r/dev-tools": "^8.2.6",
62
- "@o3r/eslint-plugin": "^8.2.6",
60
+ "@o3r/build-helpers": "^8.2.8",
61
+ "@o3r/dev-tools": "^8.2.8",
62
+ "@o3r/eslint-plugin": "^8.2.8",
63
63
  "@schematics/angular": "~15.2.0",
64
64
  "@types/jest": "~28.1.2",
65
65
  "@types/node": "^17.0.45",
@@ -0,0 +1,6 @@
1
+ import type { Rule } from '@angular-devkit/schematics';
2
+ /**
3
+ * Add Otter schematics to an Angular Project
4
+ */
5
+ export declare function ngAdd(): Rule;
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +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;AA+B/E;;GAEG;AACH,wBAAgB,KAAK,IAAI,IAAI,CAsB5B"}
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ngAdd = void 0;
4
+ const tasks_1 = require("@angular-devkit/schematics/tasks");
5
+ const fs = require("node:fs");
6
+ const path = require("node:path");
7
+ const rxjs_1 = require("rxjs");
8
+ const options_1 = require("@angular-devkit/schematics/tasks/package-manager/options");
9
+ /**
10
+ * Install dev dependency on your application
11
+ *
12
+ * Note: it should not be moved to other packages as it should run before the installation
13
+ * of peer dependencies
14
+ */
15
+ class DevInstall extends tasks_1.NodePackageInstallTask {
16
+ /** @inheritDoc */
17
+ toConfiguration() {
18
+ const installOptions = process.env && process.env.npm_execpath && process.env.npm_execpath.indexOf('yarn') === -1 ? 'npm' : 'yarn';
19
+ return {
20
+ name: options_1.NodePackageName,
21
+ options: {
22
+ command: 'install',
23
+ quiet: this.quiet,
24
+ workingDirectory: this.workingDirectory,
25
+ packageName: `${this.packageName} ${installOptions === 'yarn' ? '--prefer-dev' : '-D'}`,
26
+ packageManager: installOptions
27
+ }
28
+ };
29
+ }
30
+ }
31
+ /**
32
+ * Add Otter schematics to an Angular Project
33
+ */
34
+ function ngAdd() {
35
+ const schematicsDependencies = ['@angular-devkit/architect', '@angular-devkit/schematics', '@angular-devkit/core', '@schematics/angular', 'comment-json', 'eslint', 'globby'];
36
+ return async (tree, context) => {
37
+ context.logger.info('Running ng add for schematics');
38
+ const packageJsonPath = path.resolve(__dirname, '..', '..', 'package.json');
39
+ const treePackageJson = tree.readJson('./package.json');
40
+ const packageJsonContent = JSON.parse(fs.readFileSync(packageJsonPath, { encoding: 'utf-8' }));
41
+ const getDependencyVersion = (dependency) => packageJsonContent?.dependencies?.[dependency] || packageJsonContent?.peerDependencies?.[dependency];
42
+ for (const dependency of schematicsDependencies) {
43
+ const version = getDependencyVersion(dependency);
44
+ context.logger.info(`Installing ${dependency}${version || ''}`);
45
+ treePackageJson.devDependencies = { ...packageJsonContent.devDependencies, [dependency]: version };
46
+ context.addTask(new DevInstall({
47
+ hideOutput: false,
48
+ packageName: `${dependency}${version ? '@' + version : ''}`,
49
+ quiet: false
50
+ }));
51
+ await (0, rxjs_1.lastValueFrom)(context.engine.executePostTasks());
52
+ }
53
+ tree.overwrite('./package.json', JSON.stringify(treePackageJson));
54
+ return () => tree;
55
+ };
56
+ }
57
+ exports.ngAdd = ngAdd;
58
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,6 @@
1
+ import { JsonObject } from '@angular-devkit/core';
2
+ export interface NgAddSchematicsSchema extends JsonObject {
3
+ /** Project name */
4
+ projectName: string | null;
5
+ }
6
+ //# sourceMappingURL=schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../schematics/ng-add/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAElD,MAAM,WAAW,qBAAsB,SAAQ,UAAU;IACvD,mBAAmB;IACnB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=schema.js.map