-
Notifications
You must be signed in to change notification settings - Fork 2
feat(cli): implement interactive bb init project scaffolding
#3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,4 +5,5 @@ dist | |
| .next | ||
| .env | ||
| .env.* | ||
| !.env.example | ||
| .DS_Store | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| # @betterbase/cli-legacy | ||
|
|
||
| This package is a legacy wrapper placeholder. | ||
|
|
||
| - Canonical CLI implementation: `betterbase/packages/cli` (`@betterbase/cli`) | ||
| - This package exists only for backwards compatibility and forwards execution. |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,3 +1,15 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| #!/usr/bin/env node | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| console.log('BetterBase CLI scaffold: bb'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /** | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * Legacy bb wrapper entrypoint. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * Forwards execution to the canonical CLI implementation in packages/cli. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| */ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| export async function runLegacyCli(): Promise<void> { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const cliModule = await import('../../../packages/cli/src/index'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await cliModule.runCli(process.argv); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (import.meta.main) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await runLegacyCli(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+1
to
+14
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shebang declares Line 1 uses Suggested fix (option A — align shebang with Bun)-#!/usr/bin/env node
+#!/usr/bin/env bun📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| { | ||
| "name": "@betterbase/cli", | ||
| "version": "0.1.0", | ||
| "private": true, | ||
| "type": "module", | ||
| "bin": { | ||
| "bb": "./dist/index.js" | ||
| }, | ||
| "scripts": { | ||
| "build": "bun run src/build.ts", | ||
| "dev": "bun run src/index.ts", | ||
| "test": "bun test", | ||
| "typecheck": "tsc -p tsconfig.json --noEmit" | ||
| }, | ||
| "dependencies": { | ||
| "chalk": "^5.3.0", | ||
| "commander": "^12.1.0", | ||
| "inquirer": "^10.2.2", | ||
| "zod": "^3.23.8" | ||
| }, | ||
| "devDependencies": { | ||
| "@types/bun": "^1.3.9", | ||
| "typescript": "^5.6.0" | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| /** | ||
| * Build the CLI as a standalone bundled executable output. | ||
| */ | ||
| export async function buildStandaloneCli(): Promise<void> { | ||
| const result = await Bun.build({ | ||
| entrypoints: ['./src/index.ts'], | ||
| outdir: './dist', | ||
| target: 'bun', | ||
| format: 'esm', | ||
| minify: false, | ||
| sourcemap: 'external', | ||
| naming: 'index.js', | ||
| }); | ||
|
|
||
| if (!result.success) { | ||
| throw new Error(`Build failed with ${result.logs.length} error(s).`); | ||
| } | ||
|
|
||
| const outputPath = './dist/index.js'; | ||
| const compiled = await Bun.file(outputPath).text(); | ||
| await Bun.write(outputPath, `#!/usr/bin/env bun\n${compiled}`); | ||
| } | ||
|
|
||
| await buildStandaloneCli(); |
Uh oh!
There was an error while loading. Please reload this page.