From 41d52e937a758ad3aa862f0fe8262e83f9f3703d Mon Sep 17 00:00:00 2001 From: moklick Date: Mon, 17 Jun 2024 11:57:53 +0200 Subject: [PATCH] chore(check-flow-libs): cleanup --- scripts/check-flow-libs/flow-lib-updater.js | 6 +++--- scripts/check-flow-libs/index.js | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/scripts/check-flow-libs/flow-lib-updater.js b/scripts/check-flow-libs/flow-lib-updater.js index 21551199d..bf0febc25 100644 --- a/scripts/check-flow-libs/flow-lib-updater.js +++ b/scripts/check-flow-libs/flow-lib-updater.js @@ -1,6 +1,7 @@ import { dirname, resolve } from 'path'; import { fileURLToPath } from 'url'; import { readFile, writeFile } from 'fs/promises'; + import latestVersion from 'latest-version'; import { exec } from '@actions/exec'; import { parse as parseEnv, stringify as stringifyEnv } from 'envfile'; @@ -11,8 +12,8 @@ const __dirname = dirname(fileURLToPath(import.meta.url)); * This is a helper function for checking the latest version on npm against the version in the .env file for a specific site. * You need to create the helper and then call the start method to check the version. */ -export async function FlowLibUpdater({ siteName, packageName, envKey }) { - const sitePath = resolve(__dirname, `../../sites/${siteName}`); +export async function FlowLibUpdater({ site, packageName, envKey }) { + const sitePath = resolve(__dirname, `../../sites/${site}`); const latestNpmVersion = await latestVersion(packageName); const envPath = resolve(sitePath, '.env'); const envContent = await readFile(envPath); @@ -62,7 +63,6 @@ export async function FlowLibUpdater({ siteName, packageName, envKey }) { } // utils - function areVersionsEqual(a, b) { if (!a || !b) { return false; diff --git a/scripts/check-flow-libs/index.js b/scripts/check-flow-libs/index.js index aa88e00a4..c6d08dc4e 100644 --- a/scripts/check-flow-libs/index.js +++ b/scripts/check-flow-libs/index.js @@ -1,9 +1,9 @@ import { FlowLibUpdater } from './flow-lib-updater.js'; const reactFlowUpdater = await FlowLibUpdater({ + site: 'reactflow.dev', packageName: 'reactflow', envKey: 'NEXT_PUBLIC_REACT_FLOW_VERSION', - siteName: 'reactflow.dev', }); const reactFlowUpdated = await reactFlowUpdater.start(); @@ -12,9 +12,9 @@ if (reactFlowUpdated) { } const svelteFlowUpdater = await FlowLibUpdater({ + site: 'svelteflow.dev', packageName: '@xyflow/svelte', envKey: 'NEXT_PUBLIC_SVELTE_FLOW_VERSION', - siteName: 'svelteflow.dev', }); const svelteFlowUpdated = await svelteFlowUpdater.start();