INNER CODE UNIT · TypeScript
truthy
paralect/ship · packages/create-ship-app/src/config/index.ts:6
const truthy = (v: string | undefined, fallback: boolean) =>
v === 'true' ? true : v === 'false' ? false : fallback;
/**
* Auto-detect: when this binary lives inside a Ship monorepo (i.e. `template/`
* exists relative to the bundle), default to USE_LOCAL_REPO=true so we don't
* pull the old published template from GitHub during dev iteration.
*
* `__dirname` works under tsup's CJS output. From `dist/index.js`, the layout
* we're checking for is `<repo>/packages/create-ship-app/dist/`, so the Ship
* `template/` dir is at `../../../template`.
*/
function detectLocalCheckout(): boolean {
try {
const candidates = [
path.resolve(__dirname, '../../../template'),
path.resolve(__dirname, '../../template'),
];