create-pds 0.0.3 → 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/README.md CHANGED
@@ -45,4 +45,4 @@ npm run dev
45
45
 
46
46
  Your PDS will be running at http://localhost:5173
47
47
 
48
- See the [@ascorbic/pds documentation](https://github.com/ascorbic/atproto-worker/tree/main/packages/pds) for configuration and deployment instructions.
48
+ See the [@ascorbic/pds documentation](https://github.com/ascorbic/atproto-worker/tree/main/packages/pds) for configuration and deployment instructions.
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",
@@ -2571,7 +2580,7 @@ runMain(defineCommand({
2571
2580
  args: {
2572
2581
  name: {
2573
2582
  type: "positional",
2574
- description: "Project name",
2583
+ description: "Folder name",
2575
2584
  required: false
2576
2585
  },
2577
2586
  "package-manager": {
@@ -2603,22 +2612,23 @@ runMain(defineCommand({
2603
2612
  },
2604
2613
  async run({ args }) {
2605
2614
  const nonInteractive = args.yes || !process.stdout.isTTY;
2606
- Ie("Create PDS");
2607
- M.warn("This is experimental software. Do not migrate your main Bluesky account yet.");
2608
- if (!nonInteractive) Me("Use --yes to run non-interactively", "Tip");
2615
+ Ie("🦋 Create PDS");
2616
+ M.info("Let's build your new home in the Atmosphere!");
2617
+ M.warn("This is experimental software. Don't migrate your main account yet.");
2618
+ if (!nonInteractive) M.message("Tip: Use --yes to skip prompts");
2609
2619
  let projectName = args.name;
2610
- if (!projectName) if (nonInteractive) projectName = "pds-worker";
2620
+ if (!projectName) if (nonInteractive) projectName = "my-pds";
2611
2621
  else {
2612
2622
  const result = await he({
2613
- message: "Project name:",
2614
- placeholder: "pds-worker",
2615
- defaultValue: "pds-worker"
2623
+ message: "Folder name:",
2624
+ placeholder: "my-pds",
2625
+ defaultValue: "my-pds"
2616
2626
  });
2617
2627
  if (pD(result)) {
2618
2628
  xe("Cancelled");
2619
2629
  process.exit(0);
2620
2630
  }
2621
- projectName = result || "pds-worker";
2631
+ projectName = result || "my-pds";
2622
2632
  }
2623
2633
  const targetDir = join(process.cwd(), projectName);
2624
2634
  if (existsSync(targetDir)) {
@@ -2679,9 +2689,15 @@ runMain(defineCommand({
2679
2689
  initGit = gitResult;
2680
2690
  }
2681
2691
  const spinner = Y();
2692
+ spinner.start("Fetching latest @ascorbic/pds version...");
2693
+ const pdsVersion = await getLatestPdsVersion();
2694
+ spinner.stop(`Using @ascorbic/pds ${pdsVersion}`);
2682
2695
  spinner.start("Copying template...");
2683
2696
  await copyTemplateDir(join(__dirname, "..", "templates", "pds-worker"), targetDir);
2684
- await replaceInFile(join(targetDir, "package.json"), { name: projectName });
2697
+ await replaceInFile(join(targetDir, "package.json"), {
2698
+ name: projectName,
2699
+ pdsVersion
2700
+ });
2685
2701
  spinner.stop("Template copied");
2686
2702
  if (initGit) {
2687
2703
  spinner.start("Initializing git...");
@@ -2711,7 +2727,7 @@ runMain(defineCommand({
2711
2727
  ], targetDir, { silent: true });
2712
2728
  } catch {}
2713
2729
  if (!args["skip-init"] && !args["skip-install"]) {
2714
- M.info("Now let's configure your PDS for local development");
2730
+ M.info("Now let's set up your account...");
2715
2731
  try {
2716
2732
  await runCommand(pm, [
2717
2733
  "run",
@@ -2736,8 +2752,8 @@ runMain(defineCommand({
2736
2752
  `${pm} dev`,
2737
2753
  "",
2738
2754
  "Your PDS will be running at http://localhost:5173"
2739
- ].join("\n"), "Next steps");
2740
- Se("Happy building!");
2755
+ ].join("\n"), "Next Steps");
2756
+ Se("Welcome to the Atmosphere! 🦋");
2741
2757
  }
2742
2758
  }));
2743
2759
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-pds",
3
- "version": "0.0.3",
3
+ "version": "0.0.5",
4
4
  "description": "Create a new AT Protocol PDS on Cloudflare Workers",
5
5
  "type": "module",
6
6
  "bin": {
@@ -5,7 +5,7 @@
5
5
  "type": "module",
6
6
  "private": true,
7
7
  "dependencies": {
8
- "@ascorbic/pds": "^0.0.0"
8
+ "@ascorbic/pds": "{{pdsVersion}}"
9
9
  },
10
10
  "devDependencies": {
11
11
  "@cloudflare/vite-plugin": "^1.17.0",