neocities test
All checks were successful
/ build (push) Successful in 22s

This commit is contained in:
Nycki 2024-12-27 22:46:03 -08:00
parent 48c023d582
commit 9276e234ef
4 changed files with 39 additions and 0 deletions

10
package-lock.json generated
View file

@ -17,6 +17,7 @@
"jsdom": "^25.0.1", "jsdom": "^25.0.1",
"luxon": "^3.3.0", "luxon": "^3.3.0",
"markdown-it-anchor": "^8.6.7", "markdown-it-anchor": "^8.6.7",
"neocities": "^0.0.3",
"sharp": "^0.33.5" "sharp": "^0.33.5"
}, },
"engines": { "engines": {
@ -2333,6 +2334,15 @@
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
"integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA=="
}, },
"node_modules/neocities": {
"version": "0.0.3",
"resolved": "https://registry.npmjs.org/neocities/-/neocities-0.0.3.tgz",
"integrity": "sha512-veH8WhrNz7l3YhSA2y6EHokCy45F19hUs14N3e1oVk5MWwg39bG7AeC9xp7WpdLqRkHQjy86J3aOy5Xvf3vslQ==",
"license": "BSD-2-Clause",
"dependencies": {
"form-data": "*"
}
},
"node_modules/node-retrieve-globals": { "node_modules/node-retrieve-globals": {
"version": "6.0.0", "version": "6.0.0",
"resolved": "https://registry.npmjs.org/node-retrieve-globals/-/node-retrieve-globals-6.0.0.tgz", "resolved": "https://registry.npmjs.org/node-retrieve-globals/-/node-retrieve-globals-6.0.0.tgz",

View file

@ -42,6 +42,7 @@
"jsdom": "^25.0.1", "jsdom": "^25.0.1",
"luxon": "^3.3.0", "luxon": "^3.3.0",
"markdown-it-anchor": "^8.6.7", "markdown-it-anchor": "^8.6.7",
"neocities": "^0.0.3",
"sharp": "^0.33.5" "sharp": "^0.33.5"
} }
} }

View file

@ -0,0 +1 @@
hello from node.js!

View file

@ -0,0 +1,27 @@
import fs from 'node:fs/promises';
import path from 'node:path';
import dotenv from 'dotenv';
import Neocities from 'neocities'
const uploadDir = 'tools/neocities';
async function listFiles() {
const files = [];
for (let name of await fs.readdir(uploadDir, { recursive: true })) {
const file = path.join(uploadDir, name);
const stat = await fs.stat(file);
if (stat.isDirectory()) continue;
files.push({ name: name, path: file });
}
return files;
}
async function main() {
dotenv.config();
const api = new Neocities(process.env.NEOCITIES_USERNAME, process.env.NEOCITIES_PASSWORD);
const files = await listFiles();
const response = await new Promise(cb => api.upload(files, cb));
console.log(response);
}
main();