tmlnv_obsidian-telegram-bridge/scripts/verify-local-env.mjs
tmlnv b70131db90 flatten plugin/ into repo root for obsidian community plugin layout
- 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
2026-04-29 22:35:55 +03:00

67 lines
1.5 KiB
JavaScript

#!/usr/bin/env node
import { access } from "node:fs/promises";
import { constants } from "node:fs";
import { spawnSync } from "node:child_process";
const requiredFiles = [
"manifest.json",
"package.json",
"supabase/config.toml",
"supabase/migrations/202603030001_initial_schema.sql",
];
const requiredEnv = [
"SUPABASE_ACCESS_TOKEN",
"SUPABASE_DB_PASSWORD",
"SUPABASE_PROJECT_ID",
];
async function fileExists(path) {
try {
await access(path, constants.F_OK);
return true;
} catch {
return false;
}
}
function printCheck(label, ok, details = "") {
const status = ok ? "OK" : "MISSING";
const suffix = details ? `: ${details}` : "";
console.log(`${status} ${label}${suffix}`);
}
function getSupabaseVersion() {
const result = spawnSync("supabase", ["--version"], {
encoding: "utf8",
stdio: ["ignore", "pipe", "pipe"],
});
if (result.status !== 0) {
return null;
}
return (result.stdout || result.stderr).trim() || "installed";
}
async function main() {
const major = Number.parseInt(process.versions.node.split(".")[0], 10);
printCheck("Node.js >= 20", major >= 20, process.versions.node);
for (const path of requiredFiles) {
printCheck(path, await fileExists(path));
}
for (const name of requiredEnv) {
printCheck(`env ${name}`, Boolean(process.env[name]));
}
const supabaseVersion = getSupabaseVersion();
printCheck("Supabase CLI", Boolean(supabaseVersion), supabaseVersion ?? "not found in PATH");
}
main().catch((error) => {
console.error(error);
process.exitCode = 1;
});