@o3r/schematics 10.0.0-prerelease.14 → 10.0.0-prerelease.16

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@o3r/schematics",
3
- "version": "10.0.0-prerelease.14",
3
+ "version": "10.0.0-prerelease.16",
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,7 +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.14",
28
+ "@o3r/telemetry": "^10.0.0-prerelease.16",
29
29
  "@schematics/angular": "~17.0.0",
30
30
  "eslint": "^8.42.0",
31
31
  "rxjs": "^7.8.1",
@@ -71,9 +71,9 @@
71
71
  "@nx/eslint-plugin": "~17.2.0",
72
72
  "@nx/jest": "~17.2.0",
73
73
  "@nx/js": "~17.2.0",
74
- "@o3r/build-helpers": "^10.0.0-prerelease.14",
75
- "@o3r/eslint-plugin": "^10.0.0-prerelease.14",
76
- "@o3r/telemetry": "^10.0.0-prerelease.14",
74
+ "@o3r/build-helpers": "^10.0.0-prerelease.16",
75
+ "@o3r/eslint-plugin": "^10.0.0-prerelease.16",
76
+ "@o3r/telemetry": "^10.0.0-prerelease.16",
77
77
  "@schematics/angular": "~17.0.3",
78
78
  "@types/jest": "~29.5.2",
79
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 const ngAdd: (opts: unknown) => Rule;
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;AAsC/E;;GAEG;AACH,eAAO,MAAM,KAAK,yBAAiD,CAAC"}
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"}
@@ -7,17 +7,20 @@ const rxjs_1 = require("rxjs");
7
7
  const schematics_1 = require("@o3r/schematics");
8
8
  /**
9
9
  * Add Otter schematics to an Angular Project
10
+ * @param options schematics options
10
11
  */
11
- function ngAddFn() {
12
+ function ngAddFn(options) {
12
13
  const schematicsDependencies = ['@angular-devkit/architect', '@angular-devkit/schematics', '@angular-devkit/core', '@schematics/angular', 'globby'];
13
14
  return () => async (tree, context) => {
14
15
  // eslint-disable-next-line @typescript-eslint/naming-convention
15
- const { AddDevInstall } = await Promise.resolve().then(() => require('@o3r/schematics'));
16
+ const { AddDevInstall, getWorkspaceConfig } = await Promise.resolve().then(() => require('@o3r/schematics'));
16
17
  context.logger.info('Running ng add for schematics');
17
18
  const packageJsonPath = path.resolve(__dirname, '..', '..', 'package.json');
18
19
  const treePackageJson = tree.readJson('./package.json');
19
20
  const packageJsonContent = JSON.parse(fs.readFileSync(packageJsonPath, { encoding: 'utf-8' }));
20
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 || '.';
21
24
  let packageName = '';
22
25
  for (const dependency of schematicsDependencies) {
23
26
  const version = getDependencyVersion(dependency);
@@ -28,6 +31,7 @@ function ngAddFn() {
28
31
  context.addTask(new AddDevInstall({
29
32
  hideOutput: false,
30
33
  packageName,
34
+ workingDirectory,
31
35
  quiet: false
32
36
  }));
33
37
  await (0, rxjs_1.lastValueFrom)(context.engine.executePostTasks());