create-pds 0.0.4 → 0.0.6
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
|
+
const data = await response.json();
|
|
2570
|
+
if (data.version) return data.version;
|
|
2571
|
+
} catch {}
|
|
2572
|
+
return "^0.2.0";
|
|
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: `^${pdsVersion}`
|
|
2700
|
+
});
|
|
2686
2701
|
spinner.stop("Template copied");
|
|
2687
2702
|
if (initGit) {
|
|
2688
2703
|
spinner.start("Initializing git...");
|
package/package.json
CHANGED
|
@@ -1,27 +1,14 @@
|
|
|
1
|
-
#
|
|
2
|
-
#
|
|
3
|
-
# Or run `pnpm pds init --local` to generate automatically
|
|
1
|
+
# Environment variables for local development
|
|
2
|
+
# Run `pnpm pds init` to generate this file automatically
|
|
4
3
|
|
|
5
|
-
#
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
# Your account's DID (usually did:web:{PDS_HOSTNAME})
|
|
9
|
-
DID=did:web:demo-pds.example.com
|
|
10
|
-
|
|
11
|
-
# Your account's handle
|
|
12
|
-
HANDLE=alice.demo-pds.example.com
|
|
13
|
-
|
|
14
|
-
# Bearer token for write operations (generate a random string)
|
|
15
|
-
AUTH_TOKEN=your-secret-token-here
|
|
4
|
+
# Bearer token for write operations
|
|
5
|
+
AUTH_TOKEN=
|
|
16
6
|
|
|
17
7
|
# Private key for signing commits (secp256k1 JWK)
|
|
18
|
-
SIGNING_KEY=
|
|
19
|
-
|
|
20
|
-
# Public key for DID document (multibase encoded)
|
|
21
|
-
SIGNING_KEY_PUBLIC=zQ3sh...
|
|
8
|
+
SIGNING_KEY=
|
|
22
9
|
|
|
23
|
-
# Secret for signing session JWTs
|
|
24
|
-
JWT_SECRET=
|
|
10
|
+
# Secret for signing session JWTs
|
|
11
|
+
JWT_SECRET=
|
|
25
12
|
|
|
26
|
-
#
|
|
27
|
-
|
|
13
|
+
# Bcrypt hash of account password (for app login)
|
|
14
|
+
PASSWORD_HASH=
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
// AT Protocol PDS on Cloudflare Workers
|
|
3
3
|
// Run `pnpm pds init` to configure, or `pnpm pds init --production` to deploy secrets
|
|
4
|
-
"name": "
|
|
4
|
+
"name": "my-pds",
|
|
5
5
|
"main": "src/index.ts",
|
|
6
6
|
"compatibility_date": "2025-12-02",
|
|
7
7
|
"compatibility_flags": [
|
|
@@ -47,4 +47,4 @@
|
|
|
47
47
|
// - SIGNING_KEY: Private signing key (secp256k1 JWK)
|
|
48
48
|
// - JWT_SECRET: Secret for signing session JWTs
|
|
49
49
|
// - PASSWORD_HASH: Bcrypt hash of account password (for Bluesky app login)
|
|
50
|
-
}
|
|
50
|
+
}
|