添加开发环境变量

This commit is contained in:
lutinglt
2025-06-28 11:58:36 +08:00
parent 5ae1f2f634
commit bedb8befa7
5 changed files with 31 additions and 1 deletions

View File

@@ -1,3 +1,4 @@
import { execSync } from "node:child_process";
import crypto from "node:crypto";
import fs from "node:fs";
import path from "node:path";
@@ -46,6 +47,9 @@ export function themeInput(
input[fileName] = tmpInputTs;
}
}
if (mode === "dev") {
console.log("[themeInput] devTheme:", devTheme);
}
return input;
}
@@ -88,5 +92,22 @@ export function themePlugin(): Plugin {
}
}
},
closeBundle() {
const server = process.env.SSH_SERVER;
const user = process.env.SSH_USER || "root";
const path = process.env.GITEA_THEME_PATH;
if (server && path) {
const cmd = `scp dist/${prefix}*.css ${user}@${server}:${path}`;
console.log("[themePlugin] exec:", cmd);
try {
execSync(cmd, { stdio: "inherit" });
// eslint-disable-next-line @typescript-eslint/no-unused-vars
} catch (_) {
// continue regardless of error
}
} else {
console.log("[themePlugin] no SSH_SERVER or GITEA_THEME_PATH, skip upload");
}
},
};
}