diff --git a/.vscode/dictionary.txt b/.vscode/dictionary.txt index bff1aca..fea5b3d 100644 --- a/.vscode/dictionary.txt +++ b/.vscode/dictionary.txt @@ -2,6 +2,7 @@ antfu biomejs booleanish bumpp +bunfig bunx changelogen changelogithub diff --git a/bin/cli.ts b/bin/cli.ts index 9fb229e..7ec95ba 100644 --- a/bin/cli.ts +++ b/bin/cli.ts @@ -4,7 +4,7 @@ import { config } from '../src/config' const cli = new CAC('my-cli') -interface ReverseProxyOption { +interface CliOption { from: string verbose: boolean } @@ -14,9 +14,12 @@ cli .option('--from ', 'The URL to proxy from') .option('--verbose', 'Enable verbose logging') .example('reverse-proxy start --from localhost:5173 --to my-project.localhost') - .action(async (options?: ReverseProxyOption) => { - if (!options?.from || !options.to) { - return startProxies(config) + .action(async (options?: CliOption) => { + if (!options?.from) { + console.error('Missing --from option') + } + else { + console.log('Options:', options) } }) diff --git a/binary.config.ts b/binary.config.ts new file mode 100644 index 0000000..e69de29 diff --git a/bun.lock b/bun.lock index 7fda3b4..ad79ef7 100755 --- a/bun.lock +++ b/bun.lock @@ -9,6 +9,7 @@ "@types/bun": "^1.1.14", "bumpp": "^9.9.2", "bun-plugin-dtsx": "^0.21.9", + "bunfig": "^0.4.0", "changelogen": "^0.5.7", "lint-staged": "^15.3.0", "simple-git-hooks": "^2.11.1", @@ -653,6 +654,8 @@ "bundle-name": ["bundle-name@4.1.0", "", { "dependencies": { "run-applescript": "^7.0.0" } }, "sha512-tjwM5exMg6BGRI+kNmTntNsvdZS1X8BFYS6tnJ2hdH0kVxM6/eVZ2xy+FqStSWvYmtfFMDLIxurorHwDKfDz5Q=="], + "bunfig": ["bunfig@0.4.0", "", {}, "sha512-VhKmKBWaG7i7Jha3/nL0rQJs9QPNg1WKnfmt1a7NlqI8AOVLusELOUas8ROXt2QXjwByiVwGm5onuATImSApbA=="], + "c12": ["c12@2.0.1", "", { "dependencies": { "chokidar": "^4.0.1", "confbox": "^0.1.7", "defu": "^6.1.4", "dotenv": "^16.4.5", "giget": "^1.2.3", "jiti": "^2.3.0", "mlly": "^1.7.1", "ohash": "^1.1.4", "pathe": "^1.1.2", "perfect-debounce": "^1.0.0", "pkg-types": "^1.2.0", "rc9": "^2.1.2" }, "peerDependencies": { "magicast": "^0.3.5" }, "optionalPeers": ["magicast"] }, "sha512-Z4JgsKXHG37C6PYUtIxCfLJZvo6FyhHJoClwwb9ftUkLpPSkuYqn6Tr+vnaN8hymm0kIbcg6Ey3kv/Q71k5w/A=="], "cac": ["cac@6.7.14", "", {}, "sha512-b6Ilus+c3RrdDk+JhLKUAQfzzgLEPy6wcXqS7f/xe1EETvsDP6GORG7SFuOs6cID5YkqchW/LXZbX5bc8j7ZcQ=="], diff --git a/package.json b/package.json index 41b36be..ab9b7b6 100644 --- a/package.json +++ b/package.json @@ -57,6 +57,7 @@ "@types/bun": "^1.1.14", "bumpp": "^9.9.2", "bun-plugin-dtsx": "^0.21.9", + "bunfig": "^0.4.0", "changelogen": "^0.5.7", "lint-staged": "^15.3.0", "simple-git-hooks": "^2.11.1", diff --git a/src/config.ts b/src/config.ts new file mode 100644 index 0000000..b0f6f4f --- /dev/null +++ b/src/config.ts @@ -0,0 +1,13 @@ +import type { BinaryConfig } from './types' +import { loadConfig } from 'bunfig' + +export const defaultConfig: BinaryConfig = { + from: 'localhost:5173', + verbose: true, +} + +// eslint-disable-next-line antfu/no-top-level-await +export const config: BinaryConfig = await loadConfig({ + name: 'binary', + defaultConfig, +}) diff --git a/src/index.ts b/src/index.ts index 98f7fcd..39bdac6 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,2 +1,2 @@ -export const one = 1 -export const two = 'two' +export * from './config' +export * from './types' diff --git a/src/types.ts b/src/types.ts new file mode 100644 index 0000000..a22375c --- /dev/null +++ b/src/types.ts @@ -0,0 +1,4 @@ +export interface BinaryConfig { + from: string + verbose: boolean +}