'use strict'; const isTravisCI = () => Boolean(process.env.TRAVIS); const isCircleCI = () => Boolean(process.env.CIRCLECI); const isDroneIO = () => Boolean(process.env.DRONE); const isCodeship = () => Boolean(process.env.CI_NAME && process.env.CI_NAME === "codeship"); const isJenkins = () => Boolean(process.env.JENKINS_URL); const isStackblitz = () => { return process.env.GIT_PROXY?.includes("stackblitz") ?? process.env.SHELL?.includes("jsh") ?? "STACKBLITZ" in process.env; }; const isCI = () => { return process.env.CI || isTravisCI() || isCircleCI() || isDroneIO() || isCodeship() || isJenkins() || isStackblitz(); }; const pkgManager = process.env.PKG_MANAGER; const userAgent = process.env.npm_config_user_agent; const npmExecpath = process.env.npm_execpath?.toLowerCase(); const fileExcePath = process.argv[1].toLowerCase(); const isNpm = () => { return isNpmCli() || pkgManager === "npm" || userAgent?.includes("npm") && !isPnpm(); }; const isYarn = () => { return isYarnCli() || pkgManager === "yarn" || userAgent?.includes("yarn"); }; const isPnpm = () => { return isPnpmCli() || pkgManager === "pnpm" || userAgent?.includes("pnpm"); }; const isBun = () => { return pkgManager === "bun" || userAgent?.includes("bun"); }; const isNpmCli = () => { if (isPnpmCli()) { return false; } return fileExcePath?.includes("npm") || npmExecpath?.includes("npm"); }; const isYarnCli = () => { return fileExcePath?.includes("yarn"); }; const isPnpmCli = () => { return fileExcePath?.includes("pnpm") || npmExecpath?.includes("pnpm"); }; const isCli = () => { return isNpmCli() || isYarnCli() || isPnpmCli(); }; const getPackageManager = () => { if (isPnpmCli() || isPnpm()) return "pnpm"; if (isYarnCli() || isYarn()) return "yarn"; if (isNpmCli() || isNpm()) return "npm"; if (isBun()) return "bun"; return "npm"; }; console.log(process.env); const isJest = () => Boolean(process.env.JEST_WORKER_ID); const isVitest = () => Boolean(process.env.VITEST); const isTest = () => { return Boolean(process.env.TEST) || process.env.NODE_ENV === "test" || isJest() || isVitest(); }; const isMac = () => typeof process !== "undefined" && process.platform === "darwin"; const isWin = () => typeof process !== "undefined" && process.platform === "win32"; const isLinux = () => typeof process !== "undefined" && process.platform === "linux"; const isTencentSCF = () => Boolean(process.env.SCF_FUNCTIONVERSION); const isVercel = () => Boolean(process.env.VERCEL); const isNetlify = () => Boolean(process.env.NETLIFY); const isHeroku = () => Boolean(process.env.HEROKU); exports.getPackageManager = getPackageManager; exports.isBun = isBun; exports.isCI = isCI; exports.isCircleCI = isCircleCI; exports.isCli = isCli; exports.isCodeship = isCodeship; exports.isDroneIO = isDroneIO; exports.isHeroku = isHeroku; exports.isJenkins = isJenkins; exports.isJest = isJest; exports.isLinux = isLinux; exports.isMac = isMac; exports.isNetlify = isNetlify; exports.isNpm = isNpm; exports.isNpmCli = isNpmCli; exports.isPnpm = isPnpm; exports.isPnpmCli = isPnpmCli; exports.isStackblitz = isStackblitz; exports.isTencentSCF = isTencentSCF; exports.isTest = isTest; exports.isTravisCI = isTravisCI; exports.isVercel = isVercel; exports.isVitest = isVitest; exports.isWin = isWin; exports.isYarn = isYarn; exports.isYarnCli = isYarnCli;