@utopia-utils/cli
Version:
Collection of common cli utils
3 lines • 749 B
JavaScript
import e from"node:path";import{execSync as t}from"node:child_process";import n,{access as r}from"node:fs/promises";const i=e.resolve(process.cwd(),`node_modules/.cache`);function a(){try{let e=t(`git rev-parse --short HEAD`).toString().replace(`
`,``).trim();if(e===`undefined`)throw Error(`Could not retrieve git commit hash.`);return e}catch{console.error(`Could not retrieve git commit hash.`)}}async function o(e){try{let t=await n.stat(e);return t.isDirectory()}catch{return!1}}async function s(e){try{let t=await n.stat(e);return t.isFile()}catch{return!1}}async function c(e){try{return await r(e),!0}catch{return!1}}export{i as CACHE_DIR,a as getGitCommitHash,o as isDirector,s as isFile,c as pathExists};
//# sourceMappingURL=index.mjs.map