create-bunli 0.1.3 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -0
- package/dist/cli.js +10 -1
- package/dist/index.js +9 -0
- package/dist/templates/advanced/.bunli/commands.gen.report.json +6 -0
- package/dist/templates/advanced/.bunli/commands.gen.ts +66 -0
- package/dist/templates/advanced/bunli.config.ts +29 -0
- package/dist/templates/advanced/package.json +2 -1
- package/dist/templates/advanced/src/index.ts +1 -1
- package/dist/templates/advanced/template.json +8 -1
- package/dist/templates/advanced/tsconfig.json +1 -1
- package/dist/templates/basic/.bunli/commands.gen.report.json +6 -0
- package/dist/templates/basic/.bunli/commands.gen.ts +66 -0
- package/dist/templates/basic/bunli.config.ts +29 -0
- package/dist/templates/basic/package.json +2 -1
- package/dist/templates/basic/src/index.ts +1 -1
- package/dist/templates/basic/tsconfig.json +1 -1
- package/dist/templates/monorepo/.bunli/commands.gen.report.json +6 -0
- package/dist/templates/monorepo/.bunli/commands.gen.ts +66 -0
- package/dist/templates/monorepo/README.md +2 -2
- package/dist/templates/monorepo/bunli.config.ts +34 -0
- package/dist/templates/monorepo/package.json +2 -1
- package/dist/templates/monorepo/packages/cli/package.json +2 -1
- package/dist/templates/monorepo/packages/cli/src/index.ts +1 -1
- package/dist/templates/monorepo/packages/core/package.json +1 -1
- package/dist/templates/monorepo/packages/utils/package.json +1 -1
- package/dist/templates/monorepo/template.json +8 -1
- package/dist/templates/monorepo/tsconfig.json +1 -1
- package/dist/templates/monorepo/turbo.json +1 -1
- package/package.json +6 -5
- package/templates/advanced/.bunli/commands.gen.report.json +6 -0
- package/templates/advanced/.bunli/commands.gen.ts +66 -0
- package/templates/advanced/bunli.config.ts +29 -0
- package/templates/advanced/package.json +2 -1
- package/templates/advanced/src/index.ts +1 -1
- package/templates/advanced/template.json +8 -1
- package/templates/advanced/tsconfig.json +1 -1
- package/templates/basic/.bunli/commands.gen.report.json +6 -0
- package/templates/basic/.bunli/commands.gen.ts +66 -0
- package/templates/basic/bunli.config.ts +29 -0
- package/templates/basic/package.json +2 -1
- package/templates/basic/src/index.ts +1 -1
- package/templates/basic/tsconfig.json +1 -1
- package/templates/monorepo/.bunli/commands.gen.report.json +6 -0
- package/templates/monorepo/.bunli/commands.gen.ts +66 -0
- package/templates/monorepo/README.md +2 -2
- package/templates/monorepo/bunli.config.ts +34 -0
- package/templates/monorepo/package.json +2 -1
- package/templates/monorepo/packages/cli/package.json +2 -1
- package/templates/monorepo/packages/cli/src/index.ts +1 -1
- package/templates/monorepo/packages/core/package.json +1 -1
- package/templates/monorepo/packages/utils/package.json +1 -1
- package/templates/monorepo/template.json +8 -1
- package/templates/monorepo/tsconfig.json +1 -1
- package/templates/monorepo/turbo.json +1 -1
- package/dist/templates/advanced/test/commands.test.ts +0 -34
- package/dist/templates/basic/test/hello.test.ts +0 -26
- package/templates/advanced/test/commands.test.ts +0 -34
- package/templates/basic/test/hello.test.ts +0 -26
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
// This file was automatically generated by Bunli.
|
|
2
|
+
// You should NOT make any changes in this file as it will be overwritten.
|
|
3
|
+
|
|
4
|
+
import type { Command, CLI, GeneratedOptionMeta, RegisteredCommands, CommandOptions, GeneratedCommandMeta } from '@bunli/core'
|
|
5
|
+
import { createGeneratedHelpers, registerGeneratedStore } from '@bunli/core'
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
// Narrow list of command names to avoid typeof-cycles in types
|
|
10
|
+
const names = [] as const
|
|
11
|
+
type GeneratedNames = typeof names[number]
|
|
12
|
+
|
|
13
|
+
const modules: Record<GeneratedNames, Command<any>> = {
|
|
14
|
+
|
|
15
|
+
} as const
|
|
16
|
+
|
|
17
|
+
const metadata: Record<GeneratedNames, GeneratedCommandMeta> = {
|
|
18
|
+
|
|
19
|
+
} as const
|
|
20
|
+
|
|
21
|
+
export const generated = registerGeneratedStore(createGeneratedHelpers(modules, metadata))
|
|
22
|
+
|
|
23
|
+
export const commands = generated.commands
|
|
24
|
+
export const commandMeta = generated.metadata
|
|
25
|
+
|
|
26
|
+
export interface GeneratedCLI {
|
|
27
|
+
register(cli?: CLI<any>): GeneratedCLI
|
|
28
|
+
list(): Array<{
|
|
29
|
+
name: GeneratedNames
|
|
30
|
+
command: (typeof modules)[GeneratedNames]
|
|
31
|
+
metadata: (typeof metadata)[GeneratedNames]
|
|
32
|
+
}>
|
|
33
|
+
get<Name extends GeneratedNames>(name: Name): (typeof modules)[Name]
|
|
34
|
+
getMetadata<Name extends GeneratedNames>(name: Name): (typeof metadata)[Name]
|
|
35
|
+
getFlags<Name extends keyof RegisteredCommands & string>(name: Name): CommandOptions<Name>
|
|
36
|
+
getFlagsMeta<Name extends GeneratedNames>(name: Name): Record<string, GeneratedOptionMeta>
|
|
37
|
+
withCLI(cli: CLI<any>): { execute(name: string, options: unknown): Promise<void> }
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export const cli: GeneratedCLI = {
|
|
41
|
+
register: (cliInstance?: CLI<any>) => { generated.register(cliInstance); return cli },
|
|
42
|
+
list: () => generated.list(),
|
|
43
|
+
get: <Name extends GeneratedNames>(name: Name) => generated.get(name),
|
|
44
|
+
getMetadata: <Name extends GeneratedNames>(name: Name) => generated.getMetadata(name),
|
|
45
|
+
getFlags: <Name extends keyof RegisteredCommands & string>(name: Name) => generated.getFlags(name) as CommandOptions<Name>,
|
|
46
|
+
getFlagsMeta: <Name extends GeneratedNames>(name: Name) => generated.getFlagsMeta(name),
|
|
47
|
+
withCLI: (cliInstance) => generated.withCLI(cliInstance)
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// Enhanced helper functions
|
|
51
|
+
export const listCommands = () => generated.list().map(c => c.name)
|
|
52
|
+
export const getCommandApi = <Name extends GeneratedNames>(name: Name) => generated.getMetadata(name)
|
|
53
|
+
export const getTypedFlags = <Name extends GeneratedNames>(name: Name) => generated.getFlags(name) as CommandOptions<Name>
|
|
54
|
+
export const validateCommand = <Name extends GeneratedNames>(name: Name, flags: Record<string, unknown>) => generated.validateCommand(name, flags)
|
|
55
|
+
export const findCommandByName = <Name extends GeneratedNames>(name: Name) => generated.findByName(name)
|
|
56
|
+
export const findCommandsByDescription = (searchTerm: string) => generated.findByDescription(searchTerm)
|
|
57
|
+
export const getCommandNames = () => generated.getCommandNames()
|
|
58
|
+
|
|
59
|
+
// Auto-register on import for zero-config usage
|
|
60
|
+
export default cli
|
|
61
|
+
|
|
62
|
+
// Ensure module augmentation happens on import
|
|
63
|
+
declare module '@bunli/core' {
|
|
64
|
+
// Precise key mapping without typeof cycles
|
|
65
|
+
interface RegisteredCommands extends Record<GeneratedNames, Command<any>> {}
|
|
66
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { defineConfig } from '@bunli/core'
|
|
2
|
+
|
|
3
|
+
export default defineConfig({
|
|
4
|
+
name: '{{name}}',
|
|
5
|
+
version: '{{version}}',
|
|
6
|
+
description: '{{description}}',
|
|
7
|
+
|
|
8
|
+
plugins: [],
|
|
9
|
+
|
|
10
|
+
build: {
|
|
11
|
+
entry: './src/index.ts',
|
|
12
|
+
outdir: './dist',
|
|
13
|
+
targets: ['darwin-arm64', 'darwin-x64', 'linux-x64', 'windows-x64'],
|
|
14
|
+
minify: true,
|
|
15
|
+
sourcemap: true,
|
|
16
|
+
compress: true
|
|
17
|
+
},
|
|
18
|
+
|
|
19
|
+
dev: {
|
|
20
|
+
watch: true,
|
|
21
|
+
inspect: false
|
|
22
|
+
},
|
|
23
|
+
|
|
24
|
+
test: {
|
|
25
|
+
pattern: ['**/*.test.ts', '**/*.spec.ts'],
|
|
26
|
+
coverage: true,
|
|
27
|
+
watch: false
|
|
28
|
+
}
|
|
29
|
+
})
|
|
@@ -9,11 +9,12 @@
|
|
|
9
9
|
"{{projectName}}": "./dist/index.js"
|
|
10
10
|
},
|
|
11
11
|
"scripts": {
|
|
12
|
+
"postinstall": "bunli generate",
|
|
12
13
|
"dev": "bun run src/index.ts",
|
|
13
14
|
"build": "bunli build",
|
|
14
15
|
"test": "bun test",
|
|
15
16
|
"test:watch": "bun test --watch",
|
|
16
|
-
"
|
|
17
|
+
"typecheck": "tsc --noEmit",
|
|
17
18
|
"lint": "tsc --noEmit",
|
|
18
19
|
"prepare": "bun run build"
|
|
19
20
|
},
|
|
@@ -6,7 +6,7 @@ import { serveCommand } from './commands/serve.js'
|
|
|
6
6
|
import { configCommand } from './commands/config.js'
|
|
7
7
|
import { loadConfig } from './utils/config.js'
|
|
8
8
|
|
|
9
|
-
const cli = createCLI({
|
|
9
|
+
const cli = await createCLI({
|
|
10
10
|
name: '{{projectName}}',
|
|
11
11
|
version: '0.1.0',
|
|
12
12
|
description: '{{description}}'
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
// This file was automatically generated by Bunli.
|
|
2
|
+
// You should NOT make any changes in this file as it will be overwritten.
|
|
3
|
+
|
|
4
|
+
import type { Command, CLI, GeneratedOptionMeta, RegisteredCommands, CommandOptions, GeneratedCommandMeta } from '@bunli/core'
|
|
5
|
+
import { createGeneratedHelpers, registerGeneratedStore } from '@bunli/core'
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
// Narrow list of command names to avoid typeof-cycles in types
|
|
10
|
+
const names = [] as const
|
|
11
|
+
type GeneratedNames = typeof names[number]
|
|
12
|
+
|
|
13
|
+
const modules: Record<GeneratedNames, Command<any>> = {
|
|
14
|
+
|
|
15
|
+
} as const
|
|
16
|
+
|
|
17
|
+
const metadata: Record<GeneratedNames, GeneratedCommandMeta> = {
|
|
18
|
+
|
|
19
|
+
} as const
|
|
20
|
+
|
|
21
|
+
export const generated = registerGeneratedStore(createGeneratedHelpers(modules, metadata))
|
|
22
|
+
|
|
23
|
+
export const commands = generated.commands
|
|
24
|
+
export const commandMeta = generated.metadata
|
|
25
|
+
|
|
26
|
+
export interface GeneratedCLI {
|
|
27
|
+
register(cli?: CLI<any>): GeneratedCLI
|
|
28
|
+
list(): Array<{
|
|
29
|
+
name: GeneratedNames
|
|
30
|
+
command: (typeof modules)[GeneratedNames]
|
|
31
|
+
metadata: (typeof metadata)[GeneratedNames]
|
|
32
|
+
}>
|
|
33
|
+
get<Name extends GeneratedNames>(name: Name): (typeof modules)[Name]
|
|
34
|
+
getMetadata<Name extends GeneratedNames>(name: Name): (typeof metadata)[Name]
|
|
35
|
+
getFlags<Name extends keyof RegisteredCommands & string>(name: Name): CommandOptions<Name>
|
|
36
|
+
getFlagsMeta<Name extends GeneratedNames>(name: Name): Record<string, GeneratedOptionMeta>
|
|
37
|
+
withCLI(cli: CLI<any>): { execute(name: string, options: unknown): Promise<void> }
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export const cli: GeneratedCLI = {
|
|
41
|
+
register: (cliInstance?: CLI<any>) => { generated.register(cliInstance); return cli },
|
|
42
|
+
list: () => generated.list(),
|
|
43
|
+
get: <Name extends GeneratedNames>(name: Name) => generated.get(name),
|
|
44
|
+
getMetadata: <Name extends GeneratedNames>(name: Name) => generated.getMetadata(name),
|
|
45
|
+
getFlags: <Name extends keyof RegisteredCommands & string>(name: Name) => generated.getFlags(name) as CommandOptions<Name>,
|
|
46
|
+
getFlagsMeta: <Name extends GeneratedNames>(name: Name) => generated.getFlagsMeta(name),
|
|
47
|
+
withCLI: (cliInstance) => generated.withCLI(cliInstance)
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// Enhanced helper functions
|
|
51
|
+
export const listCommands = () => generated.list().map(c => c.name)
|
|
52
|
+
export const getCommandApi = <Name extends GeneratedNames>(name: Name) => generated.getMetadata(name)
|
|
53
|
+
export const getTypedFlags = <Name extends GeneratedNames>(name: Name) => generated.getFlags(name) as CommandOptions<Name>
|
|
54
|
+
export const validateCommand = <Name extends GeneratedNames>(name: Name, flags: Record<string, unknown>) => generated.validateCommand(name, flags)
|
|
55
|
+
export const findCommandByName = <Name extends GeneratedNames>(name: Name) => generated.findByName(name)
|
|
56
|
+
export const findCommandsByDescription = (searchTerm: string) => generated.findByDescription(searchTerm)
|
|
57
|
+
export const getCommandNames = () => generated.getCommandNames()
|
|
58
|
+
|
|
59
|
+
// Auto-register on import for zero-config usage
|
|
60
|
+
export default cli
|
|
61
|
+
|
|
62
|
+
// Ensure module augmentation happens on import
|
|
63
|
+
declare module '@bunli/core' {
|
|
64
|
+
// Precise key mapping without typeof cycles
|
|
65
|
+
interface RegisteredCommands extends Record<GeneratedNames, Command<any>> {}
|
|
66
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { defineConfig } from '@bunli/core'
|
|
2
|
+
|
|
3
|
+
export default defineConfig({
|
|
4
|
+
name: '{{name}}',
|
|
5
|
+
version: '{{version}}',
|
|
6
|
+
description: '{{description}}',
|
|
7
|
+
|
|
8
|
+
build: {
|
|
9
|
+
entry: './src/index.ts',
|
|
10
|
+
outdir: './dist',
|
|
11
|
+
targets: ['native'],
|
|
12
|
+
minify: true,
|
|
13
|
+
sourcemap: true,
|
|
14
|
+
compress: false
|
|
15
|
+
},
|
|
16
|
+
|
|
17
|
+
dev: {
|
|
18
|
+
watch: true,
|
|
19
|
+
inspect: true
|
|
20
|
+
},
|
|
21
|
+
|
|
22
|
+
test: {
|
|
23
|
+
pattern: ['**/*.test.ts', '**/*.spec.ts'],
|
|
24
|
+
coverage: true,
|
|
25
|
+
watch: false
|
|
26
|
+
},
|
|
27
|
+
|
|
28
|
+
plugins: [],
|
|
29
|
+
})
|
|
@@ -8,10 +8,11 @@
|
|
|
8
8
|
"{{projectName}}": "./dist/index.js"
|
|
9
9
|
},
|
|
10
10
|
"scripts": {
|
|
11
|
+
"postinstall": "bunli generate",
|
|
11
12
|
"dev": "bun run src/index.ts",
|
|
12
13
|
"build": "bunli build",
|
|
13
14
|
"test": "bun test",
|
|
14
|
-
"
|
|
15
|
+
"typecheck": "tsc --noEmit"
|
|
15
16
|
},
|
|
16
17
|
"dependencies": {
|
|
17
18
|
"@bunli/core": "latest"
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
// This file was automatically generated by Bunli.
|
|
2
|
+
// You should NOT make any changes in this file as it will be overwritten.
|
|
3
|
+
|
|
4
|
+
import type { Command, CLI, GeneratedOptionMeta, RegisteredCommands, CommandOptions, GeneratedCommandMeta } from '@bunli/core'
|
|
5
|
+
import { createGeneratedHelpers, registerGeneratedStore } from '@bunli/core'
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
// Narrow list of command names to avoid typeof-cycles in types
|
|
10
|
+
const names = [] as const
|
|
11
|
+
type GeneratedNames = typeof names[number]
|
|
12
|
+
|
|
13
|
+
const modules: Record<GeneratedNames, Command<any>> = {
|
|
14
|
+
|
|
15
|
+
} as const
|
|
16
|
+
|
|
17
|
+
const metadata: Record<GeneratedNames, GeneratedCommandMeta> = {
|
|
18
|
+
|
|
19
|
+
} as const
|
|
20
|
+
|
|
21
|
+
export const generated = registerGeneratedStore(createGeneratedHelpers(modules, metadata))
|
|
22
|
+
|
|
23
|
+
export const commands = generated.commands
|
|
24
|
+
export const commandMeta = generated.metadata
|
|
25
|
+
|
|
26
|
+
export interface GeneratedCLI {
|
|
27
|
+
register(cli?: CLI<any>): GeneratedCLI
|
|
28
|
+
list(): Array<{
|
|
29
|
+
name: GeneratedNames
|
|
30
|
+
command: (typeof modules)[GeneratedNames]
|
|
31
|
+
metadata: (typeof metadata)[GeneratedNames]
|
|
32
|
+
}>
|
|
33
|
+
get<Name extends GeneratedNames>(name: Name): (typeof modules)[Name]
|
|
34
|
+
getMetadata<Name extends GeneratedNames>(name: Name): (typeof metadata)[Name]
|
|
35
|
+
getFlags<Name extends keyof RegisteredCommands & string>(name: Name): CommandOptions<Name>
|
|
36
|
+
getFlagsMeta<Name extends GeneratedNames>(name: Name): Record<string, GeneratedOptionMeta>
|
|
37
|
+
withCLI(cli: CLI<any>): { execute(name: string, options: unknown): Promise<void> }
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export const cli: GeneratedCLI = {
|
|
41
|
+
register: (cliInstance?: CLI<any>) => { generated.register(cliInstance); return cli },
|
|
42
|
+
list: () => generated.list(),
|
|
43
|
+
get: <Name extends GeneratedNames>(name: Name) => generated.get(name),
|
|
44
|
+
getMetadata: <Name extends GeneratedNames>(name: Name) => generated.getMetadata(name),
|
|
45
|
+
getFlags: <Name extends keyof RegisteredCommands & string>(name: Name) => generated.getFlags(name) as CommandOptions<Name>,
|
|
46
|
+
getFlagsMeta: <Name extends GeneratedNames>(name: Name) => generated.getFlagsMeta(name),
|
|
47
|
+
withCLI: (cliInstance) => generated.withCLI(cliInstance)
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// Enhanced helper functions
|
|
51
|
+
export const listCommands = () => generated.list().map(c => c.name)
|
|
52
|
+
export const getCommandApi = <Name extends GeneratedNames>(name: Name) => generated.getMetadata(name)
|
|
53
|
+
export const getTypedFlags = <Name extends GeneratedNames>(name: Name) => generated.getFlags(name) as CommandOptions<Name>
|
|
54
|
+
export const validateCommand = <Name extends GeneratedNames>(name: Name, flags: Record<string, unknown>) => generated.validateCommand(name, flags)
|
|
55
|
+
export const findCommandByName = <Name extends GeneratedNames>(name: Name) => generated.findByName(name)
|
|
56
|
+
export const findCommandsByDescription = (searchTerm: string) => generated.findByDescription(searchTerm)
|
|
57
|
+
export const getCommandNames = () => generated.getCommandNames()
|
|
58
|
+
|
|
59
|
+
// Auto-register on import for zero-config usage
|
|
60
|
+
export default cli
|
|
61
|
+
|
|
62
|
+
// Ensure module augmentation happens on import
|
|
63
|
+
declare module '@bunli/core' {
|
|
64
|
+
// Precise key mapping without typeof cycles
|
|
65
|
+
interface RegisteredCommands extends Record<GeneratedNames, Command<any>> {}
|
|
66
|
+
}
|
|
@@ -32,7 +32,7 @@ bun run build
|
|
|
32
32
|
bun test
|
|
33
33
|
|
|
34
34
|
# Type check
|
|
35
|
-
bun run
|
|
35
|
+
bun run typecheck
|
|
36
36
|
```
|
|
37
37
|
|
|
38
38
|
## Creating a New Package
|
|
@@ -62,7 +62,7 @@ bun run release
|
|
|
62
62
|
- `dev` - Run all packages in development mode
|
|
63
63
|
- `build` - Build all packages
|
|
64
64
|
- `test` - Run all tests
|
|
65
|
-
- `
|
|
65
|
+
- `typecheck` - Type check all packages
|
|
66
66
|
- `lint` - Lint all packages
|
|
67
67
|
- `clean` - Clean all build artifacts
|
|
68
68
|
- `changeset` - Create a new changeset
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { defineConfig } from '@bunli/core'
|
|
2
|
+
|
|
3
|
+
export default defineConfig({
|
|
4
|
+
name: '{{name}}',
|
|
5
|
+
version: '{{version}}',
|
|
6
|
+
description: '{{description}}',
|
|
7
|
+
|
|
8
|
+
plugins: [],
|
|
9
|
+
|
|
10
|
+
build: {
|
|
11
|
+
entry: './packages/core/src/index.ts',
|
|
12
|
+
outdir: './packages/core/dist',
|
|
13
|
+
targets: ['darwin-arm64', 'darwin-x64', 'linux-x64', 'windows-x64'],
|
|
14
|
+
minify: true,
|
|
15
|
+
compress: true,
|
|
16
|
+
sourcemap: true
|
|
17
|
+
},
|
|
18
|
+
|
|
19
|
+
dev: {
|
|
20
|
+
watch: true,
|
|
21
|
+
inspect: false
|
|
22
|
+
},
|
|
23
|
+
|
|
24
|
+
test: {
|
|
25
|
+
pattern: ['**/*.test.ts', '**/*.spec.ts'],
|
|
26
|
+
coverage: true,
|
|
27
|
+
watch: false
|
|
28
|
+
},
|
|
29
|
+
|
|
30
|
+
workspace: {
|
|
31
|
+
packages: ['./packages/*'],
|
|
32
|
+
versionStrategy: 'fixed'
|
|
33
|
+
}
|
|
34
|
+
})
|
|
@@ -9,10 +9,11 @@
|
|
|
9
9
|
"packages/*"
|
|
10
10
|
],
|
|
11
11
|
"scripts": {
|
|
12
|
+
"postinstall": "bunli generate",
|
|
12
13
|
"dev": "turbo run dev",
|
|
13
14
|
"build": "turbo run build",
|
|
14
15
|
"test": "turbo run test",
|
|
15
|
-
"
|
|
16
|
+
"typecheck": "turbo run typecheck",
|
|
16
17
|
"lint": "turbo run lint",
|
|
17
18
|
"clean": "turbo run clean && rm -rf node_modules",
|
|
18
19
|
"changeset": "changeset",
|
|
@@ -9,10 +9,11 @@
|
|
|
9
9
|
"{{projectName}}": "./dist/index.js"
|
|
10
10
|
},
|
|
11
11
|
"scripts": {
|
|
12
|
+
"postinstall": "bunli generate",
|
|
12
13
|
"dev": "bun run src/index.ts",
|
|
13
14
|
"build": "bunli build",
|
|
14
15
|
"test": "bun test",
|
|
15
|
-
"
|
|
16
|
+
"typecheck": "tsc --noEmit",
|
|
16
17
|
"clean": "rm -rf dist"
|
|
17
18
|
},
|
|
18
19
|
"dependencies": {
|
|
@@ -3,7 +3,7 @@ import { createCLI } from '@bunli/core'
|
|
|
3
3
|
import { logger } from '@{{projectName}}/utils'
|
|
4
4
|
import { processCommand, analyzeCommand } from '@{{projectName}}/core'
|
|
5
5
|
|
|
6
|
-
const cli = createCLI({
|
|
6
|
+
const cli = await createCLI({
|
|
7
7
|
name: '{{projectName}}',
|
|
8
8
|
version: '0.1.0',
|
|
9
9
|
description: '{{description}}'
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { test, expect } from 'bun:test'
|
|
2
|
-
import { testCommand, expectCommand } from '@bunli/test'
|
|
3
|
-
import { initCommand } from '../src/commands/init.js'
|
|
4
|
-
import { validateCommand } from '../src/commands/validate.js'
|
|
5
|
-
import { configCommand } from '../src/commands/config.js'
|
|
6
|
-
|
|
7
|
-
test('init command - creates config file', async () => {
|
|
8
|
-
const result = await testCommand(initCommand, {
|
|
9
|
-
flags: { template: 'minimal', force: true }
|
|
10
|
-
})
|
|
11
|
-
|
|
12
|
-
expectCommand(result).toHaveSucceeded()
|
|
13
|
-
expectCommand(result).toContainInStdout('Config file created')
|
|
14
|
-
})
|
|
15
|
-
|
|
16
|
-
test('validate command - reports errors', async () => {
|
|
17
|
-
const result = await testCommand(validateCommand, {
|
|
18
|
-
args: ['src/**/*.ts'],
|
|
19
|
-
flags: { fix: false }
|
|
20
|
-
})
|
|
21
|
-
|
|
22
|
-
// Result depends on actual files, but command should run
|
|
23
|
-
expect(result.exitCode).toBeDefined()
|
|
24
|
-
})
|
|
25
|
-
|
|
26
|
-
test('config list command', async () => {
|
|
27
|
-
const listCommand = configCommand.subcommands?.find(cmd => cmd.name === 'list')
|
|
28
|
-
expect(listCommand).toBeDefined()
|
|
29
|
-
|
|
30
|
-
const result = await testCommand(listCommand!, {})
|
|
31
|
-
|
|
32
|
-
expectCommand(result).toHaveSucceeded()
|
|
33
|
-
expectCommand(result).toContainInStdout('Configuration:')
|
|
34
|
-
})
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { test, expect } from 'bun:test'
|
|
2
|
-
import { testCommand, expectCommand } from '@bunli/test'
|
|
3
|
-
import { helloCommand } from '../src/commands/hello.js'
|
|
4
|
-
|
|
5
|
-
test('hello command - default name', async () => {
|
|
6
|
-
const result = await testCommand(helloCommand)
|
|
7
|
-
|
|
8
|
-
expectCommand(result).toHaveSucceeded()
|
|
9
|
-
expectCommand(result).toContainInStdout('Hello, World.')
|
|
10
|
-
})
|
|
11
|
-
|
|
12
|
-
test('hello command - custom name', async () => {
|
|
13
|
-
const result = await testCommand(helloCommand, {
|
|
14
|
-
flags: { name: 'Alice' }
|
|
15
|
-
})
|
|
16
|
-
|
|
17
|
-
expectCommand(result).toContainInStdout('Hello, Alice.')
|
|
18
|
-
})
|
|
19
|
-
|
|
20
|
-
test('hello command - excited flag', async () => {
|
|
21
|
-
const result = await testCommand(helloCommand, {
|
|
22
|
-
flags: { name: 'Bob', excited: true }
|
|
23
|
-
})
|
|
24
|
-
|
|
25
|
-
expectCommand(result).toContainInStdout('Hello, Bob!')
|
|
26
|
-
})
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { test, expect } from 'bun:test'
|
|
2
|
-
import { testCommand, expectCommand } from '@bunli/test'
|
|
3
|
-
import { initCommand } from '../src/commands/init.js'
|
|
4
|
-
import { validateCommand } from '../src/commands/validate.js'
|
|
5
|
-
import { configCommand } from '../src/commands/config.js'
|
|
6
|
-
|
|
7
|
-
test('init command - creates config file', async () => {
|
|
8
|
-
const result = await testCommand(initCommand, {
|
|
9
|
-
flags: { template: 'minimal', force: true }
|
|
10
|
-
})
|
|
11
|
-
|
|
12
|
-
expectCommand(result).toHaveSucceeded()
|
|
13
|
-
expectCommand(result).toContainInStdout('Config file created')
|
|
14
|
-
})
|
|
15
|
-
|
|
16
|
-
test('validate command - reports errors', async () => {
|
|
17
|
-
const result = await testCommand(validateCommand, {
|
|
18
|
-
args: ['src/**/*.ts'],
|
|
19
|
-
flags: { fix: false }
|
|
20
|
-
})
|
|
21
|
-
|
|
22
|
-
// Result depends on actual files, but command should run
|
|
23
|
-
expect(result.exitCode).toBeDefined()
|
|
24
|
-
})
|
|
25
|
-
|
|
26
|
-
test('config list command', async () => {
|
|
27
|
-
const listCommand = configCommand.subcommands?.find(cmd => cmd.name === 'list')
|
|
28
|
-
expect(listCommand).toBeDefined()
|
|
29
|
-
|
|
30
|
-
const result = await testCommand(listCommand!, {})
|
|
31
|
-
|
|
32
|
-
expectCommand(result).toHaveSucceeded()
|
|
33
|
-
expectCommand(result).toContainInStdout('Configuration:')
|
|
34
|
-
})
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { test, expect } from 'bun:test'
|
|
2
|
-
import { testCommand, expectCommand } from '@bunli/test'
|
|
3
|
-
import { helloCommand } from '../src/commands/hello.js'
|
|
4
|
-
|
|
5
|
-
test('hello command - default name', async () => {
|
|
6
|
-
const result = await testCommand(helloCommand)
|
|
7
|
-
|
|
8
|
-
expectCommand(result).toHaveSucceeded()
|
|
9
|
-
expectCommand(result).toContainInStdout('Hello, World.')
|
|
10
|
-
})
|
|
11
|
-
|
|
12
|
-
test('hello command - custom name', async () => {
|
|
13
|
-
const result = await testCommand(helloCommand, {
|
|
14
|
-
flags: { name: 'Alice' }
|
|
15
|
-
})
|
|
16
|
-
|
|
17
|
-
expectCommand(result).toContainInStdout('Hello, Alice.')
|
|
18
|
-
})
|
|
19
|
-
|
|
20
|
-
test('hello command - excited flag', async () => {
|
|
21
|
-
const result = await testCommand(helloCommand, {
|
|
22
|
-
flags: { name: 'Bob', excited: true }
|
|
23
|
-
})
|
|
24
|
-
|
|
25
|
-
expectCommand(result).toContainInStdout('Hello, Bob!')
|
|
26
|
-
})
|