Skip to content

Commit bc61229

Browse files
authored
fix(cli): list eject command in --help (#373)
1 parent ff39cdc commit bc61229

File tree

3 files changed

+25
-0
lines changed

3 files changed

+25
-0
lines changed

packages/cli/src/commands/eject/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ interface PackageJson {
1818
}
1919

2020
const TUTORIALKIT_VERSION = pkg.version;
21+
2122
const REQUIRED_DEPENDENCIES = [
2223
'@tutorialkit/runtime',
2324
'@webcontainer/api',
@@ -141,6 +142,8 @@ async function _eject(flags: EjectOptions) {
141142
}
142143
}
143144
}
145+
146+
return 0;
144147
}
145148

146149
function validateDestination(folder: string, force: boolean) {

packages/cli/src/index.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ async function runCommand(cmd: CLICommand, flags: yargs.Arguments): Promise<numb
4444
tables: {
4545
Commands: [
4646
['create', 'Create new tutorial app'],
47+
[
48+
'eject',
49+
'Move all default pages and components into your project, providing full control over the Astro app',
50+
],
4751
['help', 'Show this help message'],
4852
],
4953
},

packages/cli/tests/create-tutorial.test.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { tmpdir } from 'node:os';
44
import path from 'node:path';
55
import { execa } from 'execa';
66
import { afterAll, beforeAll, expect, test } from 'vitest';
7+
import { version } from '../package.json';
78

89
// on CI on windows we want to make sure to use the same drive, so we use a custom logic
910
const tmpDir =
@@ -230,6 +231,23 @@ test('cannot eject on an astro project that is not using TutorialKit 2', async (
230231
).rejects.toThrow(`Could not find import to '@tutorialkit/astro'`);
231232
});
232233

234+
test('--help prints out message', async () => {
235+
const { stdout } = await execa('node', [cli, '--help']);
236+
237+
expect(stdout.replace(version, '[version]')).toMatchInlineSnapshot(`
238+
"
239+
@tutorialkit/cli v[version] Create tutorial apps powered by WebContainer API
240+
241+
Usage: @tutorialkit/cli [command] [...options]
242+
@tutorialkit/cli [ -h | --help | -v | --version ]
243+
244+
Commands:
245+
create Create new tutorial app
246+
eject Move all default pages and components into your project, providing full control over the Astro app
247+
help Show this help message"
248+
`);
249+
});
250+
233251
function normaliseSlash(filePath: string) {
234252
return filePath.replace(/\\/g, '/');
235253
}

0 commit comments

Comments
 (0)