@ama-mfe/ng-utils 12.4.0-rc.3 → 12.4.0

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,11 +1,11 @@
1
1
  {
2
2
  "name": "@ama-mfe/ng-utils",
3
- "version": "12.4.0-rc.3",
3
+ "version": "12.4.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
7
7
  "peerDependencies": {
8
- "@ama-mfe/messages": "^12.4.0-rc.3",
8
+ "@ama-mfe/messages": "^12.4.0",
9
9
  "@amadeus-it-group/microfrontends": "0.0.7",
10
10
  "@amadeus-it-group/microfrontends-angular": "0.0.7",
11
11
  "@angular-devkit/core": "~19.2.0",
@@ -14,15 +14,16 @@
14
14
  "@angular/core": "^19.0.0",
15
15
  "@angular/platform-browser": "~19.2.0",
16
16
  "@angular/router": "~19.2.0",
17
- "@o3r/logger": "^12.4.0-rc.3",
18
- "@o3r/schematics": "^12.4.0-rc.3",
19
- "rxjs": "^7.8.1"
17
+ "@o3r/logger": "^12.4.0",
18
+ "@o3r/schematics": "^12.4.0",
19
+ "rxjs": "^7.8.1",
20
+ "type-fest": "^4.30.1"
20
21
  },
21
22
  "dependencies": {
22
23
  "@amadeus-it-group/microfrontends": "0.0.7",
23
24
  "@amadeus-it-group/microfrontends-angular": "0.0.7",
24
- "@o3r/logger": "^12.4.0-rc.3",
25
- "@o3r/schematics": "^12.4.0-rc.3",
25
+ "@o3r/logger": "^12.4.0",
26
+ "@o3r/schematics": "^12.4.0",
26
27
  "tslib": "^2.6.2"
27
28
  },
28
29
  "sideEffects": false,
@@ -57,6 +58,9 @@
57
58
  },
58
59
  "@schematics/angular": {
59
60
  "optional": true
61
+ },
62
+ "type-fest": {
63
+ "optional": true
60
64
  }
61
65
  },
62
66
  "module": "fesm2022/ama-mfe-ng-utils.mjs",
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../schematics/ng-add/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAGL,IAAI,EACL,MAAM,4BAA4B,CAAC;AASpC,OAAO,KAAK,EACV,qBAAqB,EACtB,MAAM,UAAU,CAAC;AAiDlB;;;GAGG;AACH,eAAO,MAAM,KAAK,GAAI,SAAS,qBAAqB,SAA2C,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../schematics/ng-add/index.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,IAAI,EACL,MAAM,4BAA4B,CAAC;AAYpC,OAAO,KAAK,EACV,qBAAqB,EACtB,MAAM,UAAU,CAAC;AAgElB;;;GAGG;AACH,eAAO,MAAM,KAAK,GAAI,SAAS,qBAAqB,SAA2C,CAAC"}
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ngAdd = void 0;
4
- const fs = require("node:fs");
5
4
  const path = require("node:path");
6
5
  const schematics_1 = require("@angular-devkit/schematics");
7
6
  const schematics_2 = require("@o3r/schematics");
@@ -10,8 +9,17 @@ const doCustomAction = (tree) => {
10
9
  // your custom code here
11
10
  return tree;
12
11
  };
12
+ /**
13
+ * List of external dependencies to be added to the project as dev dependencies
14
+ */
15
+ const devDependenciesToInstall = [];
16
+ /**
17
+ * List of external dependencies to be added to the project as peer dependencies
18
+ */
13
19
  const dependenciesToInstall = [
14
- // Add the dependencies to install here
20
+ '@angular/common',
21
+ '@angular/core',
22
+ '@angular/router'
15
23
  ];
16
24
  const dependenciesToNgAdd = [
17
25
  // Add the dependencies to install with NgAdd here
@@ -21,26 +29,29 @@ const dependenciesToNgAdd = [
21
29
  * @param options
22
30
  */
23
31
  function ngAddFn(options) {
24
- return (tree) => {
32
+ return (tree, context) => {
25
33
  // current package version
26
- const version = JSON.parse(fs.readFileSync(packageJsonPath, { encoding: 'utf8' })).version;
27
34
  const workspaceProject = options.projectName ? (0, schematics_2.getWorkspaceConfig)(tree)?.projects[options.projectName] : undefined;
28
- const dependencies = [...dependenciesToInstall, ...dependenciesToNgAdd].reduce((acc, dep) => {
29
- acc[dep] = {
30
- inManifest: [{
31
- range: `~${version}`,
32
- types: (0, schematics_2.getProjectNewDependenciesTypes)(workspaceProject)
33
- }]
34
- };
35
- return acc;
36
- }, (0, schematics_2.getPackageInstallConfig)(packageJsonPath, tree, options.projectName));
35
+ const projectDirectory = workspaceProject?.root || '.';
36
+ const projectPackageJson = tree.readJson(path.posix.join(projectDirectory, 'package.json'));
37
+ const externalDependenciesInfo = (0, schematics_2.getExternalDependenciesInfo)({
38
+ devDependenciesToInstall: devDependenciesToInstall,
39
+ dependenciesToInstall: dependenciesToInstall,
40
+ o3rPackageJsonPath: packageJsonPath,
41
+ projectPackageJson,
42
+ projectType: workspaceProject?.projectType
43
+ }, context.logger);
44
+ const dependencies = (0, schematics_2.getPackageInstallConfig)(packageJsonPath, tree, options.projectName);
37
45
  return (0, schematics_1.chain)([
38
46
  // optional custom action dedicated to this module
39
47
  doCustomAction,
40
48
  options.skipLinter ? (0, schematics_1.noop)() : (0, schematics_2.applyEsLintFix)(),
41
49
  (0, schematics_2.setupDependencies)({
42
50
  projectName: options.projectName,
43
- dependencies,
51
+ dependencies: {
52
+ ...dependencies,
53
+ ...externalDependenciesInfo
54
+ },
44
55
  ngAddToRun: dependenciesToNgAdd,
45
56
  skipInstall: options.skipInstall
46
57
  })
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../schematics/ng-add/index.ts"],"names":[],"mappings":";;;AAAA,8BAA8B;AAC9B,kCAAkC;AAClC,2DAIoC;AACpC,gDAOyB;AAKzB,MAAM,eAAe,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,cAAc,CAAC,CAAC;AAE5E,MAAM,cAAc,GAAS,CAAC,IAAI,EAAE,EAAE;IACpC,wBAAwB;IACxB,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAEF,MAAM,qBAAqB,GAA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