mirror of
https://github.com/tmlnv/obsidian-telegram-bridge.git
synced 2026-07-22 06:53:13 +00:00
- move src/, test/, esbuild.config.mjs, styles.css, tsconfig.json, package.json, package-lock.json from plugin/ to repo root - merge plugin/package.json into root package.json (deps + scripts) - drop esbuild mirror-files plugin (manifest.json/versions.json no longer need to be copied; they live next to the build output) - update release workflow, gitignore, README, scripts to match - swap fetch() for obsidian's requestUrl in setupBot per plugin guidelines
59 lines
1.6 KiB
JavaScript
59 lines
1.6 KiB
JavaScript
#!/usr/bin/env node
|
|
|
|
import { spawnSync } from "node:child_process";
|
|
|
|
const requiredEnv = [
|
|
"SUPABASE_ACCESS_TOKEN",
|
|
"SUPABASE_DB_PASSWORD",
|
|
"SUPABASE_PROJECT_ID",
|
|
];
|
|
|
|
function getMissingEnv() {
|
|
return requiredEnv.filter((name) => !process.env[name]);
|
|
}
|
|
|
|
function hasSupabaseCli() {
|
|
const result = spawnSync("supabase", ["--version"], {
|
|
encoding: "utf8",
|
|
stdio: ["ignore", "pipe", "pipe"],
|
|
});
|
|
|
|
return result.status === 0;
|
|
}
|
|
|
|
function main() {
|
|
const missing = getMissingEnv();
|
|
|
|
if (missing.length > 0) {
|
|
console.error("Missing required environment variables:");
|
|
for (const name of missing) {
|
|
console.error(`- ${name}`);
|
|
}
|
|
process.exitCode = 1;
|
|
return;
|
|
}
|
|
|
|
if (!hasSupabaseCli()) {
|
|
console.error("Supabase CLI not found in PATH.");
|
|
process.exitCode = 1;
|
|
return;
|
|
}
|
|
|
|
const projectId = process.env.SUPABASE_PROJECT_ID;
|
|
|
|
console.log("Bootstrap script scaffold is ready.");
|
|
console.log("Run the following commands from the repository root:");
|
|
console.log("");
|
|
console.log(`supabase link --project-ref ${projectId}`);
|
|
console.log("supabase db push");
|
|
console.log("supabase functions deploy telegram-webhook");
|
|
console.log("supabase functions deploy setup-bot");
|
|
console.log("supabase secrets set SUPABASE_ANON_KEY=<value> SUPABASE_SERVICE_ROLE_KEY=<value>");
|
|
console.log("");
|
|
console.log("After deployment:");
|
|
console.log("1. Install plugin dependencies with: npm install");
|
|
console.log("2. Build the plugin with: npm run build");
|
|
console.log("3. Open Obsidian and complete bot setup in the plugin settings.");
|
|
}
|
|
|
|
main();
|