mirror of
https://github.com/geoffsee/open-gsio.git
synced 2025-09-08 22:56:46 +00:00
Remove unused scripts and rename sitemap generation script
Deleted obsolete scripts `check-analytics.js`, `get_groq_models.js`, and `killport.js` to clean up the codebase. Renamed `gen_sitemap.js` to `generate_sitemap.js` for better readability and consistency.
This commit is contained in:

committed by
Geoff Seemueller

parent
c99068ecb4
commit
fb41f5f816
@@ -1,31 +0,0 @@
|
||||
const TOKEN = "";
|
||||
const ACCOUNT_ID = "";
|
||||
|
||||
async function showTables() {
|
||||
const url = `https://api.cloudflare.com/client/v4/accounts/${ACCOUNT_ID}/analytics_engine/sql`;
|
||||
|
||||
const options = {
|
||||
method: "POST",
|
||||
headers: {
|
||||
Authorization: `Bearer ${TOKEN}`,
|
||||
"Content-Type": "application/x-www-form-urlencoded",
|
||||
},
|
||||
body: "SHOW TABLES",
|
||||
};
|
||||
|
||||
try {
|
||||
console.log("Sending request to Cloudflare Analytics Engine...");
|
||||
const response = await fetch(url, options);
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error(`HTTP error! status: ${response.status}`);
|
||||
}
|
||||
|
||||
const data = await response.json();
|
||||
console.log("Response received:", JSON.stringify(data, null, 2));
|
||||
} catch (error) {
|
||||
console.error("Error occurred:", error.message);
|
||||
}
|
||||
}
|
||||
|
||||
showTables();
|
@@ -1,22 +0,0 @@
|
||||
(async () => {
|
||||
// Run the script with bun so it automatically picks up the env
|
||||
const apiKey = process.env.GROQ_API_KEY;
|
||||
|
||||
try {
|
||||
const response = await fetch("https://api.groq.com/openai/v1/models", {
|
||||
method: "GET",
|
||||
headers: {
|
||||
Authorization: `Bearer ${apiKey}`,
|
||||
},
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error(`HTTP error! Status: ${response.status}`);
|
||||
}
|
||||
|
||||
const data = await response.json();
|
||||
console.log(JSON.stringify(data));
|
||||
} catch (error) {
|
||||
console.error("Error fetching data:", error);
|
||||
}
|
||||
})();
|
@@ -1,36 +0,0 @@
|
||||
import * as child_process from "node:child_process";
|
||||
|
||||
export const killProcessOnPort = (port) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
child_process.exec(`lsof -t -i :${port}`.trim(), (err, stdout) => {
|
||||
if (err) {
|
||||
if (err.code !== 1) {
|
||||
console.error(`Error finding process on port ${port}:`, err);
|
||||
return reject(err);
|
||||
} else {
|
||||
console.log(`No process found on port ${port}`);
|
||||
return resolve();
|
||||
}
|
||||
}
|
||||
|
||||
const pid = stdout.trim();
|
||||
if (!pid) {
|
||||
console.log(`No process is currently running on port ${port}`);
|
||||
return resolve();
|
||||
}
|
||||
|
||||
child_process.exec(`kill -9 ${pid}`.trim(), (killErr) => {
|
||||
if (killErr) {
|
||||
console.error(
|
||||
`Failed to kill process ${pid} on port ${port}`,
|
||||
killErr,
|
||||
);
|
||||
return reject(killErr);
|
||||
}
|
||||
|
||||
console.log(`Successfully killed process ${pid} on port ${port}`);
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
});
|
||||
};
|
@@ -9,7 +9,7 @@ export default defineConfig(({ command }) => {
|
||||
name: "sitemap-generator",
|
||||
buildStart(options) {
|
||||
if (command === "build") {
|
||||
child_process.execSync("./scripts/gen_sitemap.js");
|
||||
child_process.execSync("./scripts/generate_sitemap.js");
|
||||
console.log("Generated Sitemap -> public/sitemap.xml");
|
||||
}
|
||||
},
|
||||
|
Reference in New Issue
Block a user