mirror of
https://github.com/kunkunsh/kunkun.git
synced 2025-04-15 03:04:36 +00:00

* chore: add extension templates * feat: add create-kunkun and cli package * fix: cli and create-kunkun package location * fix: cli package test * ci: run test for CI pipeline only on Linux The most important E2E test is run with docker, Linux anyways, no need to run on Mac and Windows
32 lines
738 B
TypeScript
32 lines
738 B
TypeScript
import path from "path"
|
|
import { fileURLToPath } from "url"
|
|
|
|
const filepath = fileURLToPath(import.meta.url)
|
|
const filename = path.basename(filepath)
|
|
const __dirname = path.dirname(filepath)
|
|
const isInJs = filename.endsWith(".js")
|
|
|
|
function inferNodeEnv() {
|
|
if (isInJs) {
|
|
return "production"
|
|
}
|
|
if (process.env.NODE_ENV) {
|
|
return process.env.NODE_ENV
|
|
}
|
|
return "development"
|
|
}
|
|
|
|
export const NODE_ENV = inferNodeEnv()
|
|
|
|
export function getRootDir() {
|
|
return isInJs ? __dirname : path.dirname(__dirname)
|
|
}
|
|
|
|
export function getDockerFolder() {
|
|
return isInJs ? path.join(getRootDir(), "docker") : path.join(getRootDir(), "src/docker")
|
|
}
|
|
|
|
export function getDockerEntrypoint() {
|
|
return path.join(getDockerFolder(), "entrypoint.sh")
|
|
}
|