create-pds 0.0.4 → 0.0.5
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/index.js
CHANGED
|
@@ -2562,6 +2562,15 @@ async function replaceInFile(filePath, replacements) {
|
|
|
2562
2562
|
for (const [key, value] of Object.entries(replacements)) content = content.replaceAll(`{{${key}}}`, value);
|
|
2563
2563
|
await writeFile(filePath, content);
|
|
2564
2564
|
}
|
|
2565
|
+
async function getLatestPdsVersion() {
|
|
2566
|
+
try {
|
|
2567
|
+
const response = await fetch("https://registry.npmjs.org/@ascorbic/pds/latest");
|
|
2568
|
+
if (!response.ok) throw new Error(`Failed to fetch: ${response.status}`);
|
|
2569
|
+
return `^${(await response.json()).version}`;
|
|
2570
|
+
} catch {
|
|
2571
|
+
return "^0.2.0";
|
|
2572
|
+
}
|
|
2573
|
+
}
|
|
2565
2574
|
runMain(defineCommand({
|
|
2566
2575
|
meta: {
|
|
2567
2576
|
name: "create-pds",
|
|
@@ -2680,9 +2689,15 @@ runMain(defineCommand({
|
|
|
2680
2689
|
initGit = gitResult;
|
|
2681
2690
|
}
|
|
2682
2691
|
const spinner = Y();
|
|
2692
|
+
spinner.start("Fetching latest @ascorbic/pds version...");
|
|
2693
|
+
const pdsVersion = await getLatestPdsVersion();
|
|
2694
|
+
spinner.stop(`Using @ascorbic/pds ${pdsVersion}`);
|
|
2683
2695
|
spinner.start("Copying template...");
|
|
2684
2696
|
await copyTemplateDir(join(__dirname, "..", "templates", "pds-worker"), targetDir);
|
|
2685
|
-
await replaceInFile(join(targetDir, "package.json"), {
|
|
2697
|
+
await replaceInFile(join(targetDir, "package.json"), {
|
|
2698
|
+
name: projectName,
|
|
2699
|
+
pdsVersion
|
|
2700
|
+
});
|
|
2686
2701
|
spinner.stop("Template copied");
|
|
2687
2702
|
if (initGit) {
|
|
2688
2703
|
spinner.start("Initializing git...");
|
package/package.json
CHANGED