INNER CODE UNIT · TypeScript

detectLocalCheckout

paralect/ship · packages/create-ship-app/src/config/index.ts:18

function detectLocalCheckout(): boolean {
  try {
    const candidates = [
      path.resolve(__dirname, '../../../template'),
      path.resolve(__dirname, '../../template'),
    ];
    return candidates.some((p) => existsSync(p));
  } catch {
    return false;
  }
}

const config = {
  /** When true, the CLI copies the local Ship monorepo (next to this binary)
   *  instead of downloading `paralect/ship#main`. Auto-detected when running
   *  from a local checkout. Override via `USE_LOCAL_REPO=` env or `--local`. */
  USE_LOCAL_REPO: truthy(process.env.USE_LOCAL_REPO, detectLocalCheckout()),
  USE_TEMP_DIR: truthy(process.env.USE_TEMP_DIR, false),

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…