timconspicuous.neocities.org
1// Helper script to deploy the files to Neocities
2import { NeocitiesAPIClient } from "npm:async-neocities";
3import { load } from "jsr:@std/dotenv";
4
5await load({ export: true });
6
7// Get credentials from environment
8const siteName = Deno.env.get("NEOCITIES_SITE_NAME");
9const password = Deno.env.get("NEOCITIES_PASSWORD");
10
11if (!siteName || !password) {
12 throw new Error(
13 "Please set NEOCITIES_SITE_NAME and NEOCITIES_PASSWORD environment variables.",
14 );
15}
16
17const apiKeyResponse = await NeocitiesAPIClient.getKey({
18 siteName: siteName,
19 ownerPassword: [password],
20});
21
22const client = new NeocitiesAPIClient(apiKeyResponse.api_key);
23
24// Deploy the site
25await client.deploy({
26 directory: "./public",
27 cleanup: true, // Delete orphaned files
28 includeUnsupportedFiles: false, // Upload unsupported files (paid feature)
29});
30
31console.log("Successfully deployed to Neocities!");