-
Notifications
You must be signed in to change notification settings - Fork 0
fix(cli): bundle @kidd-cli/* deps so published CLI is self-contained #150
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| --- | ||
| '@kidd-cli/cli': patch | ||
| '@kidd-cli/core': patch | ||
| '@kidd-cli/config': patch | ||
| '@kidd-cli/utils': patch | ||
| '@kidd-cli/bundler': patch | ||
| --- | ||
|
|
||
| fix(cli): bundle @kidd-cli/* deps so published CLI is self-contained | ||
|
|
||
| The published CLI had bare imports to workspace packages whose npm exports maps | ||
| were stale (renamed subpaths like `./loader` → `./utils`, `./fs` → `./node`). | ||
| Commands silently disappeared because the autoloader swallowed import errors. | ||
|
|
||
| - Bundle all `@kidd-cli/*` packages into CLI dist via `deps.alwaysBundle` | ||
| - Add `KIDD_DEBUG` env var support to surface autoload import failures | ||
| - Add integration test asserting all commands appear in `--help` output | ||
| - Republish all packages to sync npm exports maps with source |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| import { execFile } from 'node:child_process' | ||
| import { join } from 'node:path' | ||
|
|
||
| import { describe, expect, it } from 'vitest' | ||
|
|
||
| const CLI_BIN = join(import.meta.dirname, '..', 'bin', 'kidd.js') | ||
|
|
||
| const EXPECTED_COMMANDS = ['add', 'build', 'commands', 'dev', 'doctor', 'init', 'run', 'stories'] | ||
|
|
||
| /** | ||
| * Run the CLI binary with the given args and return stdout. | ||
| * | ||
| * @param args - CLI arguments. | ||
| * @returns A promise resolving to the stdout string. | ||
| */ | ||
| function runCli(args: readonly string[]): Promise<string> { | ||
| return new Promise((resolve, reject) => { | ||
| execFile('node', [CLI_BIN, ...args], (error, stdout, stderr) => { | ||
| if (error) { | ||
| reject(new Error(`CLI exited with code ${String(error.code)}: ${stderr}`)) | ||
| return | ||
| } | ||
| resolve(stdout) | ||
| }) | ||
| }) | ||
| } | ||
|
|
||
| describe('kidd CLI integration', () => { | ||
| it('should display all commands in --help output', async () => { | ||
| const output = await runCli(['--help']) | ||
|
|
||
| EXPECTED_COMMANDS.map((cmd) => | ||
| expect(output, `missing command: ${cmd}`).toContain(`kidd ${cmd}`) | ||
| ) | ||
| }) | ||
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| /** | ||
| * Check whether debug mode is enabled via the `KIDD_DEBUG` environment variable. | ||
| * | ||
| * Truthy values: `"true"`, `"1"` | ||
| * Falsy values: `"false"`, `"0"`, `undefined`, `null` | ||
| * | ||
| * @returns `true` when `KIDD_DEBUG` is set to a truthy value. | ||
| */ | ||
| export function isDebug(): boolean { | ||
| const value = process.env.KIDD_DEBUG | ||
| return value === 'true' || value === '1' | ||
| } |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.