create-pds 0.0.2 → 0.0.4
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 +48 -0
- package/dist/index.js +46 -17
- package/package.json +1 -1
- package/templates/pds-worker/package.json.tmpl +1 -0
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
|
|
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
|
});
|
|
@@ -2559,7 +2571,7 @@ runMain(defineCommand({
|
|
|
2559
2571
|
args: {
|
|
2560
2572
|
name: {
|
|
2561
2573
|
type: "positional",
|
|
2562
|
-
description: "
|
|
2574
|
+
description: "Folder name",
|
|
2563
2575
|
required: false
|
|
2564
2576
|
},
|
|
2565
2577
|
"package-manager": {
|
|
@@ -2591,22 +2603,23 @@ runMain(defineCommand({
|
|
|
2591
2603
|
},
|
|
2592
2604
|
async run({ args }) {
|
|
2593
2605
|
const nonInteractive = args.yes || !process.stdout.isTTY;
|
|
2594
|
-
Ie("Create PDS");
|
|
2595
|
-
M.
|
|
2596
|
-
|
|
2606
|
+
Ie("🦋 Create PDS");
|
|
2607
|
+
M.info("Let's build your new home in the Atmosphere!");
|
|
2608
|
+
M.warn("This is experimental software. Don't migrate your main account yet.");
|
|
2609
|
+
if (!nonInteractive) M.message("Tip: Use --yes to skip prompts");
|
|
2597
2610
|
let projectName = args.name;
|
|
2598
|
-
if (!projectName) if (nonInteractive) projectName = "pds
|
|
2611
|
+
if (!projectName) if (nonInteractive) projectName = "my-pds";
|
|
2599
2612
|
else {
|
|
2600
2613
|
const result = await he({
|
|
2601
|
-
message: "
|
|
2602
|
-
placeholder: "pds
|
|
2603
|
-
defaultValue: "pds
|
|
2614
|
+
message: "Folder name:",
|
|
2615
|
+
placeholder: "my-pds",
|
|
2616
|
+
defaultValue: "my-pds"
|
|
2604
2617
|
});
|
|
2605
2618
|
if (pD(result)) {
|
|
2606
2619
|
xe("Cancelled");
|
|
2607
2620
|
process.exit(0);
|
|
2608
2621
|
}
|
|
2609
|
-
projectName = result || "pds
|
|
2622
|
+
projectName = result || "my-pds";
|
|
2610
2623
|
}
|
|
2611
2624
|
const targetDir = join(process.cwd(), projectName);
|
|
2612
2625
|
if (existsSync(targetDir)) {
|
|
@@ -2674,7 +2687,7 @@ runMain(defineCommand({
|
|
|
2674
2687
|
if (initGit) {
|
|
2675
2688
|
spinner.start("Initializing git...");
|
|
2676
2689
|
try {
|
|
2677
|
-
await runCommand("git", ["init"], targetDir);
|
|
2690
|
+
await runCommand("git", ["init"], targetDir, { silent: true });
|
|
2678
2691
|
spinner.stop("Git initialized");
|
|
2679
2692
|
} catch {
|
|
2680
2693
|
spinner.stop("Failed to initialize git");
|
|
@@ -2683,21 +2696,37 @@ runMain(defineCommand({
|
|
|
2683
2696
|
if (!args["skip-install"]) {
|
|
2684
2697
|
spinner.start(`Installing dependencies with ${pm}...`);
|
|
2685
2698
|
try {
|
|
2686
|
-
await runCommand(pm, ["install"], targetDir);
|
|
2699
|
+
await runCommand(pm, ["install"], targetDir, { silent: true });
|
|
2687
2700
|
spinner.stop("Dependencies installed");
|
|
2688
2701
|
} catch {
|
|
2689
2702
|
spinner.stop("Failed to install dependencies");
|
|
2690
2703
|
M.warning("You can install dependencies manually later");
|
|
2691
2704
|
}
|
|
2692
2705
|
}
|
|
2706
|
+
if (initGit) try {
|
|
2707
|
+
await runCommand("git", ["add", "."], targetDir, { silent: true });
|
|
2708
|
+
await runCommand("git", [
|
|
2709
|
+
"commit",
|
|
2710
|
+
"-m",
|
|
2711
|
+
"Initial commit"
|
|
2712
|
+
], targetDir, { silent: true });
|
|
2713
|
+
} catch {}
|
|
2693
2714
|
if (!args["skip-init"] && !args["skip-install"]) {
|
|
2694
|
-
M.info("Now let's
|
|
2715
|
+
M.info("Now let's set up your account...");
|
|
2695
2716
|
try {
|
|
2696
2717
|
await runCommand(pm, [
|
|
2697
2718
|
"run",
|
|
2698
2719
|
"pds",
|
|
2699
2720
|
"init"
|
|
2700
2721
|
], targetDir);
|
|
2722
|
+
if (initGit) {
|
|
2723
|
+
await runCommand("git", ["add", "."], targetDir, { silent: true });
|
|
2724
|
+
await runCommand("git", [
|
|
2725
|
+
"commit",
|
|
2726
|
+
"-m",
|
|
2727
|
+
"Configure PDS"
|
|
2728
|
+
], targetDir, { silent: true });
|
|
2729
|
+
}
|
|
2701
2730
|
} catch {
|
|
2702
2731
|
M.warning("Failed to run pds init. You can run it manually later:");
|
|
2703
2732
|
M.info(` cd ${projectName} && ${pm}${pm === "npm" ? "run" : ""} pds init`);
|
|
@@ -2708,8 +2737,8 @@ runMain(defineCommand({
|
|
|
2708
2737
|
`${pm} dev`,
|
|
2709
2738
|
"",
|
|
2710
2739
|
"Your PDS will be running at http://localhost:5173"
|
|
2711
|
-
].join("\n"), "Next
|
|
2712
|
-
Se("
|
|
2740
|
+
].join("\n"), "Next Steps");
|
|
2741
|
+
Se("Welcome to the Atmosphere! 🦋");
|
|
2713
2742
|
}
|
|
2714
2743
|
}));
|
|
2715
2744
|
|
package/package.json
CHANGED