@mehdad67/create-apitogo 0.1.25 → 0.1.27
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/dist/templates/index.ts
CHANGED
|
@@ -25,6 +25,34 @@ const formatAppTitle = (appName: string) =>
|
|
|
25
25
|
.map((part) => part.charAt(0).toUpperCase() + part.slice(1))
|
|
26
26
|
.join(" ");
|
|
27
27
|
|
|
28
|
+
const resolveCoreApitogoPackageName = async (): Promise<string> => {
|
|
29
|
+
const createPackageJson = JSON.parse(
|
|
30
|
+
await fs.readFile(path.join(PACKAGE_ROOT, "package.json"), "utf8"),
|
|
31
|
+
) as { name: string };
|
|
32
|
+
return createPackageJson.name.replace("/create-apitogo", "/apitogo");
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
const ensureSecondaryApitogoAliases = (
|
|
36
|
+
dependencies: Record<string, string>,
|
|
37
|
+
corePackageName: string,
|
|
38
|
+
version: string,
|
|
39
|
+
) => {
|
|
40
|
+
if (corePackageName.startsWith("@mehdad67/")) {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const alias = (target: string) => `npm:${target}@${version}`;
|
|
45
|
+
const scope = corePackageName.slice(0, corePackageName.indexOf("/"));
|
|
46
|
+
|
|
47
|
+
dependencies["@mehdad67/apitogo"] = alias(corePackageName);
|
|
48
|
+
dependencies["@mehdad67/apitogo-module-landing"] = alias(
|
|
49
|
+
`${scope}/apitogo-module-landing`,
|
|
50
|
+
);
|
|
51
|
+
dependencies["@mehdad67/apitogo-module-user-panel"] = alias(
|
|
52
|
+
`${scope}/apitogo-module-user-panel`,
|
|
53
|
+
);
|
|
54
|
+
};
|
|
55
|
+
|
|
28
56
|
const parseWorkspaceCatalog = async (workspaceFile: string) => {
|
|
29
57
|
const content = await fs.readFile(workspaceFile, "utf8");
|
|
30
58
|
const catalog: Record<string, string> = {};
|
|
@@ -253,6 +281,8 @@ export const installTemplate = async ({
|
|
|
253
281
|
})
|
|
254
282
|
.catch(() => version);
|
|
255
283
|
|
|
284
|
+
const coreApitogoPackageName = await resolveCoreApitogoPackageName();
|
|
285
|
+
|
|
256
286
|
/** Create a package.json for the new project and write it to disk. */
|
|
257
287
|
// biome-ignore lint/suspicious/noExplicitAny: Allow any type
|
|
258
288
|
const packageJson: any = {
|
|
@@ -273,11 +303,19 @@ export const installTemplate = async ({
|
|
|
273
303
|
dependencies: {
|
|
274
304
|
react: ">=19.0.0",
|
|
275
305
|
"react-dom": ">=19.0.0",
|
|
276
|
-
|
|
306
|
+
[coreApitogoPackageName]: resolvedZudokuDependency,
|
|
277
307
|
},
|
|
278
308
|
devDependencies: {},
|
|
279
309
|
};
|
|
280
310
|
|
|
311
|
+
if (!resolvedZudokuDependency.startsWith("file:")) {
|
|
312
|
+
ensureSecondaryApitogoAliases(
|
|
313
|
+
packageJson.dependencies,
|
|
314
|
+
coreApitogoPackageName,
|
|
315
|
+
resolvedZudokuDependency,
|
|
316
|
+
);
|
|
317
|
+
}
|
|
318
|
+
|
|
281
319
|
/**
|
|
282
320
|
* TypeScript projects will have type definitions and other devDependencies.
|
|
283
321
|
*/
|