Rebrands user-facing product identity from Logseq to Synapse (package metadata, Electron appId/protocol scheme, Android/iOS display names, HTML titles, and the English UI dictionary), authored by Darío Sevilla <dario@dariosevilla.es>. Internal Clojure namespaces, :logseq.class/* and :logseq.property/* DB schema idents, and deps.edn's upstream git dependency coordinates are intentionally left untouched -- those are either persisted data in existing graphs or point at real upstream repos, and renaming them has no user-visible benefit. Also: - .gitea/workflows/build.yml: Linux (AppImage/deb/rpm), Windows (nsis), and Android (debug APK) build jobs. - deploy/: systemd unit + Caddyfile templates for a self-hosted VPS (daemon on loopback, Caddy reverse-proxies /v1/*, /mcp, /healthz and serves the static web client with TLS). - gulpfile.js / prepare-desktop-runtime-js.mjs: LOGSEQ_SKIP_CLI_BUNDLE skips the cli/ OCaml package (no toolchain in this environment) instead of failing the build; LOGSEQ_ELECTRON_BUILDER_ARGS lets CI override the packaged Linux targets independently of the local default. - resources/electron-builder.yml: drop the extraResources entry for a SKILL.md that doesn't exist in this fork, and the author.email fix needed for the rpm/deb targets' Packager/Maintainer metadata.
100 lines
3.0 KiB
JavaScript
100 lines
3.0 KiB
JavaScript
#!/usr/bin/env node
|
|
|
|
import { promises as fs } from "node:fs";
|
|
import path from "node:path";
|
|
import { fileURLToPath } from "node:url";
|
|
|
|
const __filename = fileURLToPath(import.meta.url);
|
|
const __dirname = path.dirname(__filename);
|
|
const repoRoot = path.resolve(__dirname, "..");
|
|
|
|
const staticDir = path.join(repoRoot, "static");
|
|
const staticJsDir = path.join(staticDir, "js");
|
|
const distDir = path.join(repoRoot, "dist");
|
|
const skillSourceDir = path.join(repoRoot, ".agents", "skills", "logseq-cli");
|
|
const stagedSkillDir = path.join(staticDir, ".agents", "skills", "logseq-cli");
|
|
const cliBundleRelativePath = "cli/_build/default/dist/logseq-cli.js";
|
|
const stagedCliRelativePath = "static/logseq-cli.js";
|
|
const desktopCliRelativePath = "static/js/logseq-cli.js";
|
|
const cliBundlePath = path.join(repoRoot, ...cliBundleRelativePath.split("/"));
|
|
const skipCliBundle = process.env.LOGSEQ_SKIP_CLI_BUNDLE === "1";
|
|
|
|
const copyPairs = [
|
|
{
|
|
from: path.join(repoRoot, ...stagedCliRelativePath.split("/")),
|
|
to: path.join(repoRoot, ...desktopCliRelativePath.split("/")),
|
|
generatedFrom: cliBundlePath,
|
|
refreshCommand: "pnpm cli:release",
|
|
optional: skipCliBundle,
|
|
},
|
|
{
|
|
from: path.join(staticDir, "logseq-cli.js.map"),
|
|
to: path.join(staticJsDir, "logseq-cli.js.map"),
|
|
optional: true,
|
|
},
|
|
{
|
|
from: path.join(distDir, "db-worker-node.js"),
|
|
to: path.join(staticJsDir, "db-worker-node.js"),
|
|
generatedFrom: path.join(staticDir, "db-worker-node.js"),
|
|
refreshCommand: "pnpm db-worker-node:bundle",
|
|
},
|
|
{
|
|
from: path.join(skillSourceDir, "SKILL.md"),
|
|
to: path.join(stagedSkillDir, "SKILL.md"),
|
|
optional: skipCliBundle,
|
|
},
|
|
];
|
|
|
|
async function exists(filePath) {
|
|
try {
|
|
await fs.access(filePath);
|
|
return true;
|
|
} catch {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
async function copyOne({ from, to, optional = false }) {
|
|
if (!(await exists(from))) {
|
|
if (optional) return;
|
|
throw new Error(`missing required source file: ${from}`);
|
|
}
|
|
await fs.mkdir(path.dirname(to), { recursive: true });
|
|
if (await exists(to)) {
|
|
const stats = await fs.stat(to);
|
|
await fs.chmod(to, stats.mode | 0o200);
|
|
}
|
|
await fs.copyFile(from, to);
|
|
}
|
|
|
|
async function assertFreshRuntime({ from, generatedFrom, refreshCommand }) {
|
|
if (!generatedFrom || !(await exists(generatedFrom)) || !(await exists(from))) return;
|
|
|
|
const [sourceStats, generatedStats] = await Promise.all([
|
|
fs.stat(from),
|
|
fs.stat(generatedFrom),
|
|
]);
|
|
|
|
if (sourceStats.mtimeMs + 1000 < generatedStats.mtimeMs) {
|
|
throw new Error(
|
|
`${from} is older than ${generatedFrom}; run \`${refreshCommand}\` before preparing desktop runtime JS`
|
|
);
|
|
}
|
|
}
|
|
|
|
async function main() {
|
|
await fs.mkdir(staticJsDir, { recursive: true });
|
|
|
|
for (const pair of copyPairs) {
|
|
await assertFreshRuntime(pair);
|
|
await copyOne(pair);
|
|
}
|
|
|
|
// Keep root staged runtime files available for local CLI E2E and npm packaging.
|
|
}
|
|
|
|
main().catch((error) => {
|
|
console.error(`[prepare-desktop-runtime-js] ${error.message}`);
|
|
process.exit(1);
|
|
});
|