chore: point svemagie fork deps and docs at Gitea
Some checks failed
Deploy Indiekit Server / deploy (push) Failing after 7s
Some checks failed
Deploy Indiekit Server / deploy (push) Failing after 7s
- Switch 4 svemagie fork deps from github: shorthand to git+https://gitea.giersig.eu/svemagie/... - Add patch-store-github-error-message.mjs to replace hardcoded github.com token URL with gitea.giersig.eu - Update CLAUDE.md and README.md fork dependency docs Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
55
scripts/patch-store-github-error-message.mjs
Normal file
55
scripts/patch-store-github-error-message.mjs
Normal file
@@ -0,0 +1,55 @@
|
||||
import { access, readFile, writeFile } from "node:fs/promises";
|
||||
|
||||
const candidates = [
|
||||
"node_modules/@indiekit/store-github/index.js",
|
||||
];
|
||||
|
||||
const MARKER = "// [patched] store-github-error-message";
|
||||
|
||||
const OLD_SNIPPET = ` \`Ensure the GitHub token is not expired and has the necessary permissions\`,
|
||||
\`You can check your tokens here: https://github.com/settings/tokens\`,`;
|
||||
|
||||
const NEW_SNIPPET = ` \`Ensure the Gitea token is not expired and has the necessary permissions\`,
|
||||
\`You can check your tokens here: https://gitea.giersig.eu/user/settings/applications\`, ${MARKER}`;
|
||||
|
||||
async function exists(path) {
|
||||
try {
|
||||
await access(path);
|
||||
return true;
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
let checked = 0;
|
||||
let patched = 0;
|
||||
|
||||
for (const filePath of candidates) {
|
||||
if (!(await exists(filePath))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
checked += 1;
|
||||
|
||||
const source = await readFile(filePath, "utf8");
|
||||
|
||||
if (source.includes(MARKER)) {
|
||||
console.log("[postinstall] store-github error message already patched");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!source.includes(OLD_SNIPPET)) {
|
||||
console.warn("[postinstall] store-github: unexpected source layout, skipping");
|
||||
continue;
|
||||
}
|
||||
|
||||
const updated = source.replace(OLD_SNIPPET, NEW_SNIPPET);
|
||||
await writeFile(filePath, updated, "utf8");
|
||||
patched += 1;
|
||||
}
|
||||
|
||||
if (checked === 0) {
|
||||
console.log("[postinstall] No store-github index.js found");
|
||||
} else if (patched > 0) {
|
||||
console.log(`[postinstall] Patched store-github error message in ${patched} file(s)`);
|
||||
}
|
||||
Reference in New Issue
Block a user