chore(deps): update pnpm version and clean up package.json; remove unused dependencies and scripts

- Updated package manager to pnpm@11.22.0 in package.json.
- Removed unused dependencies and scripts from package.json and pnpm-lock.yaml.
- Cleaned up fs-store.js and other files by removing commented-out code and unused imports.
- Updated workflow configurations to use environment variables for URLs.
This commit is contained in:
2026-08-21 21:48:24 +07:00
parent e84432a492
commit 9985ff3440
13 changed files with 12 additions and 103 deletions
-3
View File
@@ -1,6 +1,5 @@
import fs from "fs";
import path from "path";
import { fileURLToPath } from "url";
import { SERVER_ROOT } from "./paths.js";
const ROOT_PKG = path.resolve(SERVER_ROOT, "../../package.json");
@@ -75,5 +74,3 @@ export function satisfiesRange(version, range) {
}
return true;
}
void fileURLToPath;
-31
View File
@@ -49,12 +49,6 @@ export function readScript(name) {
return fs.readFileSync(filePath, "utf8");
}
export function writeScript(name, content) {
assertScriptName(name);
fs.mkdirSync(SCRIPTS_DIR, { recursive: true });
fs.writeFileSync(path.join(SCRIPTS_DIR, name), content, "utf8");
}
/**
* Icon next to the script: `fetch-html.js` → `fetch-html.png` or `.jpg`.
* @returns {{ filePath: string, contentType: string } | null}
@@ -78,22 +72,6 @@ export function scriptHasIcon(name) {
return resolveScriptIcon(name) != null;
}
export function deleteScript(name) {
assertScriptName(name);
const filePath = path.join(SCRIPTS_DIR, name);
if (!fs.existsSync(filePath)) return false;
const icon = resolveScriptIcon(name);
fs.unlinkSync(filePath);
if (icon) {
try {
fs.unlinkSync(icon.filePath);
} catch {
// ignore missing icon
}
}
return true;
}
export function listOwners() {
if (!fs.existsSync(WORKFLOWS_DIR)) return [];
return fs
@@ -140,15 +118,6 @@ export function writeWorkflowYaml(owner, file, content) {
fs.writeFileSync(path.join(ownerDir, file), content, "utf8");
}
export function deleteWorkflowYaml(owner, file) {
assertOwner(owner);
assertWorkflowFile(file);
const filePath = path.join(WORKFLOWS_DIR, owner, file);
if (!fs.existsSync(filePath)) return false;
fs.unlinkSync(filePath);
return true;
}
export function listOwnerYamlFiles(owner) {
const ownerDir = path.join(WORKFLOWS_DIR, owner);
if (!fs.existsSync(ownerDir)) return [];
+1
View File
@@ -39,6 +39,7 @@
"pino": "^10.3.1",
"pino-roll": "^4.0.0",
"pm2": "^6.0.13",
"rss-parser": "^3.13.0",
"ssh2-sftp-client": "^12.1.1",
"webdav": "^5.10.0",
"yaml": "^2.9.0"
-3
View File
@@ -8,7 +8,6 @@ import {
installPluginFromDirectory,
pluginDir,
} from "./plugin-store.js";
import { readManifestFile } from "./plugin-manifest.js";
const execFileAsync = promisify(execFile);
@@ -214,5 +213,3 @@ export function ensureExampleInstalled(exampleId) {
});
return { ...installed, already: false };
}
void readManifestFile;
-3
View File
@@ -8,7 +8,6 @@ import {
import * as fsStore from "../../fs-store.js";
import {
forkCoreScript,
getInstalledPlugin,
listCoreScriptNames,
listInstalledPlugins,
resolveScriptRef,
@@ -475,7 +474,5 @@ export default function scriptsPluginFactory(registry) {
}
},
);
void getInstalledPlugin;
};
}
@@ -18,7 +18,7 @@ scripts:
- script: fetch-binary.js
- script: ntfy.js
config:
url: https://ntfy.sh/jerapah-flow
url: $VAR_ntfy_channel
triggers:
- type: HTTP
method: POST
@@ -6,9 +6,7 @@ scripts:
- script: plugin/get-current-time
config:
key: ""
- script: ntfy.js
config:
url: https://n.0dev.web.id/system
- profile: ntfy_default
triggers:
- type: HTTP
method: POST
-9
View File
@@ -625,15 +625,6 @@ export function useOpsProcessRestart() {
});
}
export function useOpsBumpGeneration() {
const qc = useQueryClient();
return useMutation({
mutationFn: async (reason) =>
(await opsApi.post("/generation/bump", { reason })).data,
onSuccess: () => qc.invalidateQueries({ queryKey: ["ops-status"] }),
});
}
export function useWorkflowTrash() {
return useQuery({
queryKey: ["workflows", "trash"],
-6
View File
@@ -27,12 +27,6 @@ export const DEFAULT_INPUT_CONTEXT = `{
}
`;
export function normalizeScriptName(name) {
const trimmed = name.trim();
if (!trimmed) return "";
return trimmed.endsWith(".js") ? trimmed : `${trimmed}.js`;
}
export function scriptTags(meta) {
if (!Array.isArray(meta?.tags)) return [];
return meta.tags.map((t) => String(t).trim()).filter(Boolean);
-29
View File
@@ -12,35 +12,6 @@ triggers:
path: /new
`;
export function ensureWorkflowFilename(file) {
const trimmed = String(file ?? "").trim();
if (!trimmed) return "";
return /\.ya?ml$/i.test(trimmed) ? trimmed : `${trimmed}.yaml`;
}
/**
* Next unused copy filename: `track.yaml` → `track-copy.yaml`,
* `track-copy.yaml` → `track-copy-2.yaml`.
* @param {string} file
* @param {string[]} existingFiles
*/
export function suggestCopyFilename(file, existingFiles = []) {
const name = ensureWorkflowFilename(file) || "workflow.yaml";
const match = name.match(/^(.*?)(\.ya?ml)$/i);
const base = match ? match[1] : name;
const ext = match ? match[2] : ".yaml";
const existing = new Set(existingFiles);
const copyMatch = base.match(/^(.*)-copy(?:-(\d+))?$/);
const root = copyMatch ? copyMatch[1] : base;
const candidate = (i) =>
i <= 1 ? `${root}-copy${ext}` : `${root}-copy-${i}${ext}`;
let n = copyMatch ? Number(copyMatch[2] || 1) + 1 : 1;
while (existing.has(candidate(n))) n += 1;
return candidate(n);
}
let uidSeq = 0;
export function nextUiId(prefix = "ui") {