Files
radicle-explorer/scripts/inject-plausible
T
Rūdolfs Ošiņš 4c20d626e8 Add script for app.radicle.xyz deployments
Our Cloudflare deployments via GitHub broke. We can run deployments
manually to app.radicle.xyz via:

  npm run deploy

This also takes care of injecting the plausible.io script.
2026-01-09 16:55:19 -06:00

24 lines
607 B
JavaScript
Executable File
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/usr/bin/env node
import fs from "fs";
const file = "build/index.html";
const snippet = `<script defer="" data-domain="app.radicle.xyz" src="https://plausible.io/js/script.js"></script>`;
const html = fs.readFileSync(file, "utf8");
if (html.includes(snippet)) {
console.log("ℹ️ Script already present, skipping");
process.exit(0);
}
if (!html.includes("</head>")) {
console.error("❌ </head> not found in index.html");
process.exit(1);
}
const updated = html.replace("</head>", ` ${snippet}\n </head>`);
fs.writeFileSync(file, updated);
console.log("✅ Plausible script injected");