Skip to content

Commit

Permalink
chore: 🤖 create global install checker
Browse files Browse the repository at this point in the history
  • Loading branch information
heldrida committed Nov 5, 2024
1 parent 33d8842 commit 174a644
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/utils/fs.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { promises as fsPromises } from 'node:fs';
import { promises as fsPromises, realpathSync } from 'node:fs';

interface FsError extends Error {
code?: string;
Expand All @@ -18,3 +18,9 @@ export const fileExists = async (path: string) => {
throw e;
}
};

export const isGlobalNodeModuleInstall = () => {
const GLOBAL_EXEC_PATH_INCLUDES = 'node_modules/@fleek-platform/cli/bin/index.js';
const executedScript = realpathSync(process.argv[1]);
return executedScript.includes(GLOBAL_EXEC_PATH_INCLUDES);
}

0 comments on commit 174a644

Please sign in to comment.