feat: add feature plugin tests and validation for feature flags
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
#!/usr/bin/env node
|
||||
// CLI for vite-layers. Loads the TypeScript source via jiti (no build step needed).
|
||||
// CLI for vite-layers. In a source checkout it loads the TypeScript source via jiti (no build step
|
||||
// needed); a published package ships `dist` (not `src`), so it falls back to the built `dist/index.js`.
|
||||
import { existsSync } from 'node:fs'
|
||||
import { fileURLToPath } from 'node:url'
|
||||
import { dirname, resolve } from 'node:path'
|
||||
import { createJiti } from 'jiti'
|
||||
|
||||
const here = dirname(fileURLToPath(import.meta.url))
|
||||
const jiti = createJiti(import.meta.url)
|
||||
|
||||
const [cmd, appArg] = process.argv.slice(2)
|
||||
|
||||
@@ -14,7 +14,11 @@ if (cmd !== 'prepare') {
|
||||
process.exit(cmd ? 1 : 0)
|
||||
}
|
||||
|
||||
const srcEntry = resolve(here, '../src/tsconfig.ts')
|
||||
const { writeTsConfig } = existsSync(srcEntry)
|
||||
? await (await import('jiti')).createJiti(import.meta.url).import(srcEntry)
|
||||
: await import(resolve(here, '../dist/index.js'))
|
||||
|
||||
const appDir = resolve(process.cwd(), appArg ?? '.')
|
||||
const { writeTsConfig } = await jiti.import(resolve(here, '../src/tsconfig.ts'))
|
||||
const file = await writeTsConfig(appDir)
|
||||
console.log(`vite-layers: wrote ${file}`)
|
||||
|
||||
Reference in New Issue
Block a user