From 9985ff344033b7b6c6de5c9f4dacf5d1905ec1f0 Mon Sep 17 00:00:00 2001 From: Nasyarobby Putra Date: Fri, 21 Aug 2026 21:48:24 +0700 Subject: [PATCH] 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. --- package.json | 11 +------ packages/server/app-version.js | 3 -- packages/server/fs-store.js | 31 ------------------- packages/server/package.json | 1 + packages/server/plugin-install.js | 3 -- packages/server/src/api/scripts.js | 3 -- .../default/comic-monkeyuser-to-ntfy.yaml | 2 +- .../default/time-to-ntfy-example.yaml | 4 +-- packages/web/src/api/hooks.js | 9 ------ packages/web/src/lib/script.js | 6 ---- packages/web/src/lib/workflow-doc.js | 29 ----------------- pnpm-lock.yaml | 9 +++--- pnpm-workspace.yaml | 4 +++ 13 files changed, 12 insertions(+), 103 deletions(-) diff --git a/package.json b/package.json index 8cc5674..b0ee1b8 100644 --- a/package.json +++ b/package.json @@ -16,14 +16,5 @@ "start:control": "pnpm --filter @jerapah-flow/server start:control", "migrate": "pnpm --filter @jerapah-flow/server migrate" }, - "packageManager": "pnpm@10.25.0", - "pnpm": { - "onlyBuiltDependencies": [ - "better-sqlite3", - "esbuild" - ] - }, - "dependencies": { - "rss-parser": "^3.13.0" - } + "packageManager": "pnpm@11.22.0" } diff --git a/packages/server/app-version.js b/packages/server/app-version.js index c81629f..ae46a37 100644 --- a/packages/server/app-version.js +++ b/packages/server/app-version.js @@ -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; diff --git a/packages/server/fs-store.js b/packages/server/fs-store.js index 2f2c842..72a419b 100644 --- a/packages/server/fs-store.js +++ b/packages/server/fs-store.js @@ -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 []; diff --git a/packages/server/package.json b/packages/server/package.json index 45af17b..289b7c2 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -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" diff --git a/packages/server/plugin-install.js b/packages/server/plugin-install.js index 06c1f05..2a49484 100644 --- a/packages/server/plugin-install.js +++ b/packages/server/plugin-install.js @@ -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; diff --git a/packages/server/src/api/scripts.js b/packages/server/src/api/scripts.js index 8858255..af1e017 100644 --- a/packages/server/src/api/scripts.js +++ b/packages/server/src/api/scripts.js @@ -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; }; } diff --git a/packages/server/workflows/default/comic-monkeyuser-to-ntfy.yaml b/packages/server/workflows/default/comic-monkeyuser-to-ntfy.yaml index 8e8690b..a5aebbd 100644 --- a/packages/server/workflows/default/comic-monkeyuser-to-ntfy.yaml +++ b/packages/server/workflows/default/comic-monkeyuser-to-ntfy.yaml @@ -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 diff --git a/packages/server/workflows/default/time-to-ntfy-example.yaml b/packages/server/workflows/default/time-to-ntfy-example.yaml index 67dcdf3..148ecad 100644 --- a/packages/server/workflows/default/time-to-ntfy-example.yaml +++ b/packages/server/workflows/default/time-to-ntfy-example.yaml @@ -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 diff --git a/packages/web/src/api/hooks.js b/packages/web/src/api/hooks.js index 2324d0d..cce8f82 100644 --- a/packages/web/src/api/hooks.js +++ b/packages/web/src/api/hooks.js @@ -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"], diff --git a/packages/web/src/lib/script.js b/packages/web/src/lib/script.js index b1731e4..34fd33e 100644 --- a/packages/web/src/lib/script.js +++ b/packages/web/src/lib/script.js @@ -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); diff --git a/packages/web/src/lib/workflow-doc.js b/packages/web/src/lib/workflow-doc.js index fb3c5a0..300f4f4 100644 --- a/packages/web/src/lib/workflow-doc.js +++ b/packages/web/src/lib/workflow-doc.js @@ -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") { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 4755284..b7d815a 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -6,11 +6,7 @@ settings: importers: - .: - dependencies: - rss-parser: - specifier: ^3.13.0 - version: 3.13.0 + .: {} packages/server: dependencies: @@ -80,6 +76,9 @@ importers: pm2: specifier: ^6.0.13 version: 6.0.14 + rss-parser: + specifier: ^3.13.0 + version: 3.13.0 ssh2-sftp-client: specifier: ^12.1.1 version: 12.1.1 diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index 101f05b..ba78ceb 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -2,4 +2,8 @@ packages: - packages/* allowBuilds: better-sqlite3: true + cpu-features: true esbuild: true + msgpackr-extract: true + ssh2: true + rss-parser: true