@o3r/schematics 10.0.0-alpha.2 → 10.0.0-alpha.4

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-alpha.2",
3
+ "version": "10.0.0-alpha.4",
4
4
  "description": "Schematics module of the Otter framework",
5
5
  "main": "./src/public_api.js",
6
6
  "typings": "./src/public_api.d.ts",
@@ -67,13 +67,13 @@
67
67
  "@nx/eslint-plugin": "~17.1.1",
68
68
  "@nx/jest": "~17.1.1",
69
69
  "@nx/js": "~17.1.1",
70
- "@o3r/build-helpers": "^10.0.0-alpha.2",
71
- "@o3r/eslint-plugin": "^10.0.0-alpha.2",
70
+ "@o3r/build-helpers": "^10.0.0-alpha.4",
71
+ "@o3r/eslint-plugin": "^10.0.0-alpha.4",
72
72
  "@schematics/angular": "~17.0.3",
73
73
  "@types/jest": "~29.5.2",
74
74
  "@types/node": "^20.0.0",
75
75
  "@types/semver": "^7.3.13",
76
- "@typescript-eslint/eslint-plugin": "6.11.0",
76
+ "@typescript-eslint/eslint-plugin": "6.18.1",
77
77
  "@typescript-eslint/parser": "^6.11.0",
78
78
  "cpy-cli": "^5.0.0",
79
79
  "eslint": "^8.42.0",
@@ -3,20 +3,24 @@
3
3
  * @param packageJsonPath
4
4
  * @param pattern
5
5
  */
6
- export declare function getPeerDepWithPattern(packageJsonPath: string, pattern?: RegExp): {
6
+ export declare function getPeerDepWithPattern(packageJsonPath: string, pattern?: RegExp | string[]): {
7
7
  packageName: string | undefined;
8
8
  packageVersion: string | undefined;
9
9
  matchingPackages: string[];
10
+ matchingPackagesVersions: {
11
+ [k: string]: string | undefined;
12
+ };
10
13
  };
11
14
  /**
12
15
  * Get the list of o3r peer deps from a given package.json file
13
16
  * @param packageJsonPath The package json on which we search for o3r peer deps
14
17
  * @param filterBasics If activated it will remove the basic peer deps (o3r/core, o3r/dev-tools, o3r/workspace and o3r/schematics) from the list of results
15
18
  * @param packagePattern Pattern of the package name to look in the packages peer dependencies.
19
+ * @param versionRangePrefix Prefix to add to the package version to determine Semver Range
16
20
  */
17
- export declare function getO3rPeerDeps(packageJsonPath: string, filterBasics?: boolean, packagePattern?: RegExp): {
21
+ export declare function getO3rPeerDeps(packageJsonPath: string, filterBasics?: boolean, packagePattern?: RegExp, versionRangePrefix?: string): {
18
22
  packageName: string | undefined;
19
- packageVersion: string | undefined;
23
+ packageVersion: string;
20
24
  o3rPeerDeps: string[];
21
25
  };
22
26
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"matching-peers.d.ts","sourceRoot":"","sources":["../../../src/utility/matching-peers.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,eAAe,EAAE,MAAM,EAAE,OAAO,SAA0B;;;;EAY/F;AASD;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,eAAe,EAAE,MAAM,EAAE,YAAY,UAAO,EAAE,cAAc,SAAsB;;;;EAUhH;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,eAAe,EAAE,MAAM,EAAE,cAAc,SAAsB;;;;EAahG"}
1
+ {"version":3,"file":"matching-peers.d.ts","sourceRoot":"","sources":["../../../src/utility/matching-peers.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,eAAe,EAAE,MAAM,EAAE,OAAO,GAAE,MAAM,GAAG,MAAM,EAA4B;;;;;;;EAelH;AASD;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,eAAe,EAAE,MAAM,EAAE,YAAY,UAAO,EAAE,cAAc,SAAsB,EAAE,kBAAkB,SAAM;;;;EAU1I;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,eAAe,EAAE,MAAM,EAAE,cAAc,SAAsB;;;;EAahG"}
@@ -14,9 +14,10 @@ function getPeerDepWithPattern(packageJsonPath, pattern = /^@(otter|o3r|ama-sdk)
14
14
  const optionalPackages = Object.entries(packageJsonContent.peerDependenciesMeta || {})
15
15
  .filter(([, dep]) => dep?.optional)
16
16
  .map(([depName]) => depName);
17
- const matchingPackages = Object.keys(packageJsonContent.peerDependencies || [])
18
- .filter(peerDep => pattern.test(peerDep) && !optionalPackages.includes(peerDep));
19
- return { packageName, packageVersion, matchingPackages };
17
+ const matchingPackagesVersions = Object.fromEntries(Object.entries(packageJsonContent.peerDependencies || {})
18
+ .filter(([peerDep]) => (Array.isArray(pattern) ? pattern.includes(peerDep) : pattern.test(peerDep)) && !optionalPackages.includes(peerDep)));
19
+ const matchingPackages = Object.keys(matchingPackagesVersions);
20
+ return { packageName, packageVersion, matchingPackages, matchingPackagesVersions };
20
21
  }
21
22
  exports.getPeerDepWithPattern = getPeerDepWithPattern;
22
23
  const basicsPackageName = new Set([
@@ -30,12 +31,13 @@ const basicsPackageName = new Set([
30
31
  * @param packageJsonPath The package json on which we search for o3r peer deps
31
32
  * @param filterBasics If activated it will remove the basic peer deps (o3r/core, o3r/dev-tools, o3r/workspace and o3r/schematics) from the list of results
32
33
  * @param packagePattern Pattern of the package name to look in the packages peer dependencies.
34
+ * @param versionRangePrefix Prefix to add to the package version to determine Semver Range
33
35
  */
34
- function getO3rPeerDeps(packageJsonPath, filterBasics = true, packagePattern = /^@(?:o3r|ama-sdk)/) {
36
+ function getO3rPeerDeps(packageJsonPath, filterBasics = true, packagePattern = /^@(?:o3r|ama-sdk)/, versionRangePrefix = '^') {
35
37
  const depsInfo = getPeerDepWithPattern(packageJsonPath, packagePattern);
36
38
  return {
37
39
  packageName: depsInfo.packageName,
38
- packageVersion: depsInfo.packageVersion,
40
+ packageVersion: versionRangePrefix + depsInfo.packageVersion,
39
41
  o3rPeerDeps: filterBasics ?
40
42
  depsInfo.matchingPackages.filter((peerDep) => !basicsPackageName.has(peerDep))
41
43
  : depsInfo.matchingPackages
@@ -1 +1 @@
1
- {"version":3,"file":"matching-peers.js","sourceRoot":"","sources":["../../../src/utility/matching-peers.ts"],"names":[],"mappings":";;;AAAA,8BAA8B;AAG9B;;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