create-pds 0.0.2 → 0.0.3

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 ADDED
@@ -0,0 +1,48 @@
1
+ # create-pds
2
+
3
+ Scaffold a new [AT Protocol](https://atproto.com) Personal Data Server (PDS) on Cloudflare Workers.
4
+
5
+ ## Usage
6
+
7
+ ```bash
8
+ npm create pds
9
+ # or
10
+ pnpm create pds
11
+ yarn create pds
12
+ bun create pds
13
+ ```
14
+
15
+ This will:
16
+
17
+ 1. Create a new project directory with the PDS template
18
+ 2. Install dependencies
19
+ 3. Run the setup wizard to configure your PDS
20
+
21
+ ## Options
22
+
23
+ ```
24
+ create-pds [name]
25
+
26
+ Arguments:
27
+ name Project name (default: pds-worker)
28
+
29
+ Options:
30
+ --package-manager Package manager to use (npm, yarn, pnpm, bun)
31
+ --skip-install Skip installing dependencies
32
+ --skip-git Skip git initialization
33
+ --skip-init Skip running pds init
34
+ -y, --yes Accept all defaults (non-interactive)
35
+ ```
36
+
37
+ ## What's Next
38
+
39
+ After scaffolding, start the dev server:
40
+
41
+ ```bash
42
+ cd pds-worker
43
+ npm run dev
44
+ ```
45
+
46
+ Your PDS will be running at http://localhost:5173
47
+
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
@@ -2517,16 +2517,28 @@ function detectPackageManager() {
2517
2517
  if (userAgent.startsWith("bun")) return "bun";
2518
2518
  return "npm";
2519
2519
  }
2520
- function runCommand(command, args, cwd) {
2520
+ function runCommand(command, args, cwd, options = {}) {
2521
2521
  return new Promise((resolve, reject) => {
2522
2522
  const child = spawn(command, args, {
2523
2523
  cwd,
2524
- stdio: "inherit",
2524
+ stdio: options.silent ? "pipe" : "inherit",
2525
2525
  shell: process.platform === "win32"
2526
2526
  });
2527
+ let output = "";
2528
+ if (options.silent) {
2529
+ child.stdout?.on("data", (data) => {
2530
+ output += data.toString();
2531
+ });
2532
+ child.stderr?.on("data", (data) => {
2533
+ output += data.toString();
2534
+ });
2535
+ }
2527
2536
  child.on("close", (code) => {
2528
2537
  if (code === 0) resolve();
2529
- else reject(/* @__PURE__ */ new Error(`${command} ${args.join(" ")} failed with code ${code}`));
2538
+ else {
2539
+ if (options.silent && output) console.error(output);
2540
+ reject(/* @__PURE__ */ new Error(`${command} ${args.join(" ")} failed with code ${code}`));
2541
+ }
2530
2542
  });
2531
2543
  child.on("error", reject);
2532
2544
  });
@@ -2674,7 +2686,7 @@ runMain(defineCommand({
2674
2686
  if (initGit) {
2675
2687
  spinner.start("Initializing git...");
2676
2688
  try {
2677
- await runCommand("git", ["init"], targetDir);
2689
+ await runCommand("git", ["init"], targetDir, { silent: true });
2678
2690
  spinner.stop("Git initialized");
2679
2691
  } catch {
2680
2692
  spinner.stop("Failed to initialize git");
@@ -2683,13 +2695,21 @@ runMain(defineCommand({
2683
2695
  if (!args["skip-install"]) {
2684
2696
  spinner.start(`Installing dependencies with ${pm}...`);
2685
2697
  try {
2686
- await runCommand(pm, ["install"], targetDir);
2698
+ await runCommand(pm, ["install"], targetDir, { silent: true });
2687
2699
  spinner.stop("Dependencies installed");
2688
2700
  } catch {
2689
2701
  spinner.stop("Failed to install dependencies");
2690
2702
  M.warning("You can install dependencies manually later");
2691
2703
  }
2692
2704
  }
2705
+ if (initGit) try {
2706
+ await runCommand("git", ["add", "."], targetDir, { silent: true });
2707
+ await runCommand("git", [
2708
+ "commit",
2709
+ "-m",
2710
+ "Initial commit"
2711
+ ], targetDir, { silent: true });
2712
+ } catch {}
2693
2713
  if (!args["skip-init"] && !args["skip-install"]) {
2694
2714
  M.info("Now let's configure your PDS for local development");
2695
2715
  try {
@@ -2698,6 +2718,14 @@ runMain(defineCommand({
2698
2718
  "pds",
2699
2719
  "init"
2700
2720
  ], targetDir);
2721
+ if (initGit) {
2722
+ await runCommand("git", ["add", "."], targetDir, { silent: true });
2723
+ await runCommand("git", [
2724
+ "commit",
2725
+ "-m",
2726
+ "Configure PDS"
2727
+ ], targetDir, { silent: true });
2728
+ }
2701
2729
  } catch {
2702
2730
  M.warning("Failed to run pds init. You can run it manually later:");
2703
2731
  M.info(` cd ${projectName} && ${pm}${pm === "npm" ? "run" : ""} pds init`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-pds",
3
- "version": "0.0.2",
3
+ "version": "0.0.3",
4
4
  "description": "Create a new AT Protocol PDS on Cloudflare Workers",
5
5
  "type": "module",
6
6
  "bin": {
@@ -9,6 +9,7 @@
9
9
  },
10
10
  "devDependencies": {
11
11
  "@cloudflare/vite-plugin": "^1.17.0",
12
+ "@types/node": "^22",
12
13
  "vite": "^6.4.1",
13
14
  "wrangler": "^4.54.0"
14
15
  },