@mehdad67/create-apitogo 0.1.29 → 0.1.31

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.
@@ -32,25 +32,24 @@ const resolveCoreApitogoPackageName = async (): Promise<string> => {
32
32
  return createPackageJson.name.replace("/create-apitogo", "/apitogo");
33
33
  };
34
34
 
35
+ /** Primary npm scope; split so secondary publish does not rewrite this guard. */
36
+ const PRIMARY_APITOGO_SCOPE = "@lukow" + "eb";
37
+
38
+ const normalizeDependencyVersion = (version: string): string =>
39
+ version.replace(/^[\^~>=<]+/, "");
40
+
35
41
  const ensureRequiredApitogoModules = (
36
42
  dependencies: Record<string, string>,
37
43
  corePackageName: string,
38
44
  version: string,
39
45
  ) => {
40
- if (corePackageName.startsWith("@mehdad67/")) {
41
- return;
42
- }
43
-
44
46
  const scope = corePackageName.slice(0, corePackageName.indexOf("/"));
45
47
  const landing = `${scope}/apitogo-module-landing`;
46
48
  const userPanel = `${scope}/apitogo-module-user-panel`;
49
+ const moduleVersion = `^${normalizeDependencyVersion(version)}`;
47
50
 
48
- if (!(landing in dependencies)) {
49
- dependencies[landing] = version;
50
- }
51
- if (!(userPanel in dependencies)) {
52
- dependencies[userPanel] = version;
53
- }
51
+ dependencies[landing] ??= moduleVersion;
52
+ dependencies[userPanel] ??= moduleVersion;
54
53
  };
55
54
 
56
55
  const ensureSecondaryApitogoAliases = (
@@ -58,18 +57,19 @@ const ensureSecondaryApitogoAliases = (
58
57
  corePackageName: string,
59
58
  version: string,
60
59
  ) => {
61
- if (corePackageName.startsWith("@mehdad67/")) {
60
+ if (corePackageName.startsWith(`${PRIMARY_APITOGO_SCOPE}/`)) {
62
61
  return;
63
62
  }
64
63
 
65
- const alias = (target: string) => `npm:${target}@${version}`;
64
+ const alias = (target: string) =>
65
+ `npm:${target}@${normalizeDependencyVersion(version)}`;
66
66
  const scope = corePackageName.slice(0, corePackageName.indexOf("/"));
67
67
 
68
- dependencies["@mehdad67/apitogo"] = alias(corePackageName);
69
- dependencies["@mehdad67/apitogo-module-landing"] = alias(
68
+ dependencies[`${PRIMARY_APITOGO_SCOPE}/apitogo`] = alias(corePackageName);
69
+ dependencies[`${PRIMARY_APITOGO_SCOPE}/apitogo-module-landing`] = alias(
70
70
  `${scope}/apitogo-module-landing`,
71
71
  );
72
- dependencies["@mehdad67/apitogo-module-user-panel"] = alias(
72
+ dependencies[`${PRIMARY_APITOGO_SCOPE}/apitogo-module-user-panel`] = alias(
73
73
  `${scope}/apitogo-module-user-panel`,
74
74
  );
75
75
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mehdad67/create-apitogo",
3
- "version": "0.1.29",
3
+ "version": "0.1.31",
4
4
  "keywords": [
5
5
  "react",
6
6
  "apitogo"