Skip to content

Commit

Permalink
chore(check-flow-libs): cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
moklick committed Jun 17, 2024
1 parent dcc7492 commit 41d52e9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions scripts/check-flow-libs/flow-lib-updater.js
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -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);
Expand Down Expand Up @@ -62,7 +63,6 @@ export async function FlowLibUpdater({ siteName, packageName, envKey }) {
}

// utils

function areVersionsEqual(a, b) {
if (!a || !b) {
return false;
Expand Down
4 changes: 2 additions & 2 deletions scripts/check-flow-libs/index.js
Original file line number Diff line number Diff line change
@@ -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();

Expand All @@ -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();

Expand Down

0 comments on commit 41d52e9

Please sign in to comment.