create-n4-app
Version:
Create Next.js app with the n4 stack
19 lines (18 loc) • 530 B
JavaScript
export const getUserPackageName = () => {
const packageName = process.env.npm_execpath;
if (packageName) {
if (packageName.startsWith("npm")) {
return "npm";
}
else if (packageName.startsWith("bun")) {
return "bun";
}
else if (packageName.startsWith("pnpm")) {
return "pnpm";
}
else if (packageName.startsWith("yarn")) {
return "yarn";
}
}
return "npm"; // Default to "npm" if no match or undefined
};