create-bunli 0.3.0 → 0.5.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.
Files changed (59) hide show
  1. package/dist/cli.js +10 -3
  2. package/dist/index.js +10 -3
  3. package/dist/templates/advanced/README.md +9 -9
  4. package/dist/templates/advanced/bunli.config.ts +4 -0
  5. package/dist/templates/advanced/package.json +2 -2
  6. package/dist/templates/advanced/src/commands/config.ts +4 -2
  7. package/dist/templates/advanced/src/commands/init.ts +6 -4
  8. package/dist/templates/advanced/src/commands/serve.ts +6 -4
  9. package/dist/templates/advanced/src/commands/validate.ts +4 -2
  10. package/dist/templates/advanced/src/index.ts +5 -5
  11. package/dist/templates/advanced/src/utils/constants.ts +1 -1
  12. package/dist/templates/advanced/template.json +1 -1
  13. package/dist/templates/basic/README.md +2 -2
  14. package/dist/templates/basic/bunli.config.ts +4 -0
  15. package/dist/templates/basic/package.json +2 -2
  16. package/dist/templates/basic/src/commands/hello.ts +4 -2
  17. package/dist/templates/basic/src/index.ts +2 -2
  18. package/dist/templates/monorepo/README.md +1 -1
  19. package/dist/templates/monorepo/bunli.config.ts +4 -0
  20. package/dist/templates/monorepo/package.json +1 -1
  21. package/dist/templates/monorepo/packages/cli/package.json +6 -6
  22. package/dist/templates/monorepo/packages/cli/src/index.ts +3 -3
  23. package/dist/templates/monorepo/packages/core/package.json +3 -3
  24. package/dist/templates/monorepo/packages/core/scripts/build.ts +2 -2
  25. package/dist/templates/monorepo/packages/core/src/commands/analyze.ts +5 -3
  26. package/dist/templates/monorepo/packages/core/src/commands/process.ts +5 -3
  27. package/dist/templates/monorepo/packages/core/src/index.ts +2 -2
  28. package/dist/templates/monorepo/packages/utils/package.json +2 -2
  29. package/dist/templates/monorepo/packages/utils/scripts/build.ts +1 -1
  30. package/dist/templates/monorepo/template.json +1 -1
  31. package/package.json +6 -6
  32. package/templates/advanced/README.md +9 -9
  33. package/templates/advanced/bunli.config.ts +4 -0
  34. package/templates/advanced/package.json +2 -2
  35. package/templates/advanced/src/commands/config.ts +4 -2
  36. package/templates/advanced/src/commands/init.ts +6 -4
  37. package/templates/advanced/src/commands/serve.ts +6 -4
  38. package/templates/advanced/src/commands/validate.ts +4 -2
  39. package/templates/advanced/src/index.ts +5 -5
  40. package/templates/advanced/src/utils/constants.ts +1 -1
  41. package/templates/advanced/template.json +1 -1
  42. package/templates/basic/README.md +2 -2
  43. package/templates/basic/bunli.config.ts +4 -0
  44. package/templates/basic/package.json +2 -2
  45. package/templates/basic/src/commands/hello.ts +4 -2
  46. package/templates/basic/src/index.ts +2 -2
  47. package/templates/monorepo/README.md +1 -1
  48. package/templates/monorepo/bunli.config.ts +4 -0
  49. package/templates/monorepo/package.json +1 -1
  50. package/templates/monorepo/packages/cli/package.json +6 -6
  51. package/templates/monorepo/packages/cli/src/index.ts +3 -3
  52. package/templates/monorepo/packages/core/package.json +3 -3
  53. package/templates/monorepo/packages/core/scripts/build.ts +2 -2
  54. package/templates/monorepo/packages/core/src/commands/analyze.ts +5 -3
  55. package/templates/monorepo/packages/core/src/commands/process.ts +5 -3
  56. package/templates/monorepo/packages/core/src/index.ts +2 -2
  57. package/templates/monorepo/packages/utils/package.json +2 -2
  58. package/templates/monorepo/packages/utils/scripts/build.ts +1 -1
  59. package/templates/monorepo/template.json +1 -1
package/dist/cli.js CHANGED
@@ -95,7 +95,7 @@ async function getFilesToProcess(dir, manifest) {
95
95
  await walk(join(currentDir, entry.name), path);
96
96
  }
97
97
  } else {
98
- if (!path.match(/^(template\.json|\.template\.json|\.DS_Store|Thumbs\.db)$/)) {
98
+ if (!path.match(/^(template\.json|\.template\.json|\.DS_Store|Thumbs\.db)$/) || path === ".gitignore") {
99
99
  files.push(path);
100
100
  }
101
101
  }
@@ -178,9 +178,11 @@ async function createProject(options) {
178
178
  dir,
179
179
  offline,
180
180
  variables: {
181
- projectName: name,
181
+ name,
182
+ version: "0.1.0",
182
183
  description: `A CLI built with Bunli`,
183
184
  author: "",
185
+ license: "MIT",
184
186
  year: new Date().getFullYear().toString()
185
187
  }
186
188
  });
@@ -191,7 +193,12 @@ async function createProject(options) {
191
193
  try {
192
194
  await shell`cd ${dir} && git init`.quiet();
193
195
  await shell`cd ${dir} && git add .`.quiet();
194
- await shell`cd ${dir} && git commit -m "Initial commit"`.quiet();
196
+ await shell`cd ${dir} && git commit -m "feat: initialize ${name} CLI project with Bunli
197
+
198
+ - Generated using create-bunli template
199
+ - Includes basic CLI structure with commands directory
200
+ - Configured with Bunli build system and TypeScript
201
+ - Ready for development with bun run dev"`;
195
202
  gitSpin.succeed("Git repository initialized");
196
203
  } catch (error) {
197
204
  gitSpin.fail("Failed to initialize git repository");
package/dist/index.js CHANGED
@@ -89,7 +89,7 @@ async function getFilesToProcess(dir, manifest) {
89
89
  await walk(join(currentDir, entry.name), path);
90
90
  }
91
91
  } else {
92
- if (!path.match(/^(template\.json|\.template\.json|\.DS_Store|Thumbs\.db)$/)) {
92
+ if (!path.match(/^(template\.json|\.template\.json|\.DS_Store|Thumbs\.db)$/) || path === ".gitignore") {
93
93
  files.push(path);
94
94
  }
95
95
  }
@@ -172,9 +172,11 @@ async function createProject(options) {
172
172
  dir,
173
173
  offline,
174
174
  variables: {
175
- projectName: name,
175
+ name,
176
+ version: "0.1.0",
176
177
  description: `A CLI built with Bunli`,
177
178
  author: "",
179
+ license: "MIT",
178
180
  year: new Date().getFullYear().toString()
179
181
  }
180
182
  });
@@ -185,7 +187,12 @@ async function createProject(options) {
185
187
  try {
186
188
  await shell`cd ${dir} && git init`.quiet();
187
189
  await shell`cd ${dir} && git add .`.quiet();
188
- await shell`cd ${dir} && git commit -m "Initial commit"`.quiet();
190
+ await shell`cd ${dir} && git commit -m "feat: initialize ${name} CLI project with Bunli
191
+
192
+ - Generated using create-bunli template
193
+ - Includes basic CLI structure with commands directory
194
+ - Configured with Bunli build system and TypeScript
195
+ - Ready for development with bun run dev"`;
189
196
  gitSpin.succeed("Git repository initialized");
190
197
  } catch (error) {
191
198
  gitSpin.fail("Failed to initialize git repository");
@@ -1,4 +1,4 @@
1
- # {{projectName}}
1
+ # {{name}}
2
2
 
3
3
  {{description}}
4
4
 
@@ -6,16 +6,16 @@
6
6
 
7
7
  ```bash
8
8
  # Install globally
9
- bun add -g {{projectName}}
9
+ bun add -g {{name}}
10
10
 
11
11
  # Or use directly with bunx
12
- bunx {{projectName}} [command]
12
+ bunx {{name}} [command]
13
13
  ```
14
14
 
15
15
  ## Usage
16
16
 
17
17
  ```bash
18
- {{projectName}} <command> [options]
18
+ {{name}} <command> [options]
19
19
  ```
20
20
 
21
21
  ### Commands
@@ -24,7 +24,7 @@ bunx {{projectName}} [command]
24
24
  Initialize a new configuration file in the current directory.
25
25
 
26
26
  ```bash
27
- {{projectName}} init [options]
27
+ {{name}} init [options]
28
28
 
29
29
  Options:
30
30
  -f, --force Overwrite existing config
@@ -35,7 +35,7 @@ Options:
35
35
  Validate files against defined rules.
36
36
 
37
37
  ```bash
38
- {{projectName}} validate <files...> [options]
38
+ {{name}} validate <files...> [options]
39
39
 
40
40
  Options:
41
41
  -c, --config Path to config file
@@ -47,7 +47,7 @@ Options:
47
47
  Start a development server.
48
48
 
49
49
  ```bash
50
- {{projectName}} serve [options]
50
+ {{name}} serve [options]
51
51
 
52
52
  Options:
53
53
  -p, --port Port to listen on (default: 3000)
@@ -59,7 +59,7 @@ Options:
59
59
  Manage configuration settings.
60
60
 
61
61
  ```bash
62
- {{projectName}} config <action> [key] [value]
62
+ {{name}} config <action> [key] [value]
63
63
 
64
64
  Actions:
65
65
  get <key> Get a config value
@@ -78,7 +78,7 @@ Actions:
78
78
 
79
79
  ## Configuration
80
80
 
81
- Create a `{{projectName}}.config.js` file in your project root:
81
+ Create a `{{name}}.config.js` file in your project root:
82
82
 
83
83
  ```javascript
84
84
  export default {
@@ -5,6 +5,10 @@ export default defineConfig({
5
5
  version: '{{version}}',
6
6
  description: '{{description}}',
7
7
 
8
+ commands: {
9
+ directory: './src/commands'
10
+ },
11
+
8
12
  plugins: [],
9
13
 
10
14
  build: {
@@ -1,12 +1,12 @@
1
1
  {
2
- "name": "{{projectName}}",
2
+ "name": "{{name}}",
3
3
  "version": "0.1.0",
4
4
  "type": "module",
5
5
  "description": "{{description}}",
6
6
  "author": "{{author}}",
7
7
  "license": "{{license}}",
8
8
  "bin": {
9
- "{{projectName}}": "./dist/index.js"
9
+ "{{name}}": "./dist/index.js"
10
10
  },
11
11
  "scripts": {
12
12
  "postinstall": "bunli generate",
@@ -2,7 +2,7 @@ import { defineCommand, option } from '@bunli/core'
2
2
  import { z } from 'zod'
3
3
  import { loadConfig, saveConfig, getConfigPath } from '../utils/config.js'
4
4
 
5
- export const configCommand = defineCommand({
5
+ const configCommand = defineCommand({
6
6
  name: 'config',
7
7
  description: 'Manage configuration',
8
8
  subcommands: [
@@ -142,4 +142,6 @@ function setNestedValue(obj: any, path: string, value: any): void {
142
142
  }
143
143
 
144
144
  current[lastKey] = value
145
- }
145
+ }
146
+
147
+ export default configCommand
@@ -2,7 +2,7 @@ import { defineCommand, option } from '@bunli/core'
2
2
  import { z } from 'zod'
3
3
  import { CONFIG_FILE_NAME, DEFAULT_CONFIG } from '../utils/constants.js'
4
4
 
5
- export const initCommand = defineCommand({
5
+ const initCommand = defineCommand({
6
6
  name: 'init',
7
7
  description: 'Initialize a new configuration file',
8
8
  options: {
@@ -55,7 +55,7 @@ export const initCommand = defineCommand({
55
55
  console.log()
56
56
  console.log('Next steps:')
57
57
  console.log(colors.gray(` 1. Edit ${CONFIG_FILE_NAME} to customize your configuration`))
58
- console.log(colors.gray(` 2. Run '{{projectName}} validate' to check your files`))
58
+ console.log(colors.gray(` 2. Run '{{name}} validate' to check your files`))
59
59
 
60
60
  } catch (error) {
61
61
  spin.fail('Failed to create config file')
@@ -89,7 +89,7 @@ function getConfigTemplate(template: 'minimal' | 'default' | 'full'): string {
89
89
  exclude: ['node_modules', 'dist', 'test'],
90
90
  }`,
91
91
 
92
- full: `import { defineConfig } from '{{projectName}}'
92
+ full: `import { defineConfig } from '{{name}}'
93
93
 
94
94
  export default defineConfig({
95
95
  // Validation rules
@@ -150,4 +150,6 @@ export default defineConfig({
150
150
  }
151
151
 
152
152
  return templates[template]
153
- }
153
+ }
154
+
155
+ export default initCommand
@@ -2,7 +2,7 @@ import { defineCommand, option } from '@bunli/core'
2
2
  import { z } from 'zod'
3
3
  import { loadConfig } from '../utils/config.js'
4
4
 
5
- export const serveCommand = defineCommand({
5
+ const serveCommand = defineCommand({
6
6
  name: 'serve',
7
7
  description: 'Start a development server',
8
8
  options: {
@@ -113,7 +113,7 @@ function getHomePage(): string {
113
113
  <!DOCTYPE html>
114
114
  <html>
115
115
  <head>
116
- <title>{{projectName}}</title>
116
+ <title>{{name}}</title>
117
117
  <style>
118
118
  body {
119
119
  font-family: system-ui, -apple-system, sans-serif;
@@ -156,7 +156,7 @@ function getHomePage(): string {
156
156
  </head>
157
157
  <body>
158
158
  <div class="container">
159
- <h1>{{projectName}}</h1>
159
+ <h1>{{name}}</h1>
160
160
  <p>{{description}}</p>
161
161
  <p><span class="status">Running</span></p>
162
162
 
@@ -173,4 +173,6 @@ function getHomePage(): string {
173
173
  </body>
174
174
  </html>
175
175
  `.trim()
176
- }
176
+ }
177
+
178
+ export default serveCommand
@@ -4,7 +4,7 @@ import { loadConfig } from '../utils/config.js'
4
4
  import { validateFiles } from '../utils/validator.js'
5
5
  import { glob } from '../utils/glob.js'
6
6
 
7
- export const validateCommand = defineCommand({
7
+ const validateCommand = defineCommand({
8
8
  name: 'validate',
9
9
  description: 'Validate files against defined rules',
10
10
  args: z.array(z.string()).min(1).describe('Files to validate'),
@@ -113,4 +113,6 @@ export const validateCommand = defineCommand({
113
113
  process.exit(1)
114
114
  }
115
115
  }
116
- })
116
+ })
117
+
118
+ export default validateCommand
@@ -1,13 +1,13 @@
1
1
  #!/usr/bin/env bun
2
2
  import { createCLI } from '@bunli/core'
3
- import { initCommand } from './commands/init.js'
4
- import { validateCommand } from './commands/validate.js'
5
- import { serveCommand } from './commands/serve.js'
6
- import { configCommand } from './commands/config.js'
3
+ import initCommand from './commands/init.js'
4
+ import validateCommand from './commands/validate.js'
5
+ import serveCommand from './commands/serve.js'
6
+ import configCommand from './commands/config.js'
7
7
  import { loadConfig } from './utils/config.js'
8
8
 
9
9
  const cli = await createCLI({
10
- name: '{{projectName}}',
10
+ name: '{{name}}',
11
11
  version: '0.1.0',
12
12
  description: '{{description}}'
13
13
  })
@@ -1,4 +1,4 @@
1
- export const CONFIG_FILE_NAME = '{{projectName}}.config.js'
1
+ export const CONFIG_FILE_NAME = '{{name}}.config.js'
2
2
 
3
3
  export const DEFAULT_CONFIG = {
4
4
  rules: {},
@@ -3,7 +3,7 @@
3
3
  "description": "Advanced Bunli CLI template with multiple commands",
4
4
  "variables": [
5
5
  {
6
- "name": "projectName",
6
+ "name": "name",
7
7
  "message": "Project name",
8
8
  "type": "string",
9
9
  "default": "my-bunli-cli"
@@ -1,4 +1,4 @@
1
- # {{projectName}}
1
+ # {{name}}
2
2
 
3
3
  {{description}}
4
4
 
@@ -29,7 +29,7 @@ bun test
29
29
  ## Usage
30
30
 
31
31
  ```bash
32
- {{projectName}} hello --name World
32
+ {{name}} hello --name World
33
33
  ```
34
34
 
35
35
  ## Commands
@@ -5,6 +5,10 @@ export default defineConfig({
5
5
  version: '{{version}}',
6
6
  description: '{{description}}',
7
7
 
8
+ commands: {
9
+ directory: './src/commands'
10
+ },
11
+
8
12
  build: {
9
13
  entry: './src/index.ts',
10
14
  outdir: './dist',
@@ -1,11 +1,11 @@
1
1
  {
2
- "name": "{{projectName}}",
2
+ "name": "{{name}}",
3
3
  "version": "0.1.0",
4
4
  "type": "module",
5
5
  "description": "{{description}}",
6
6
  "author": "{{author}}",
7
7
  "bin": {
8
- "{{projectName}}": "./dist/index.js"
8
+ "{{name}}": "./dist/index.js"
9
9
  },
10
10
  "scripts": {
11
11
  "postinstall": "bunli generate",
@@ -1,7 +1,7 @@
1
1
  import { defineCommand, option } from '@bunli/core'
2
2
  import { z } from 'zod'
3
3
 
4
- export const helloCommand = defineCommand({
4
+ const helloCommand = defineCommand({
5
5
  name: 'hello',
6
6
  description: 'Say hello to someone',
7
7
  options: {
@@ -26,4 +26,6 @@ export const helloCommand = defineCommand({
26
26
 
27
27
  console.log(colors.green(message))
28
28
  }
29
- })
29
+ })
30
+
31
+ export default helloCommand
@@ -1,9 +1,9 @@
1
1
  #!/usr/bin/env bun
2
2
  import { createCLI } from '@bunli/core'
3
- import { helloCommand } from './commands/hello.js'
3
+ import helloCommand from './commands/hello.js'
4
4
 
5
5
  const cli = await createCLI({
6
- name: '{{projectName}}',
6
+ name: '{{name}}',
7
7
  version: '0.1.0',
8
8
  description: '{{description}}'
9
9
  })
@@ -1,4 +1,4 @@
1
- # {{projectName}}
1
+ # {{name}}
2
2
 
3
3
  {{description}}
4
4
 
@@ -5,6 +5,10 @@ export default defineConfig({
5
5
  version: '{{version}}',
6
6
  description: '{{description}}',
7
7
 
8
+ commands: {
9
+ directory: './packages/core/src/commands'
10
+ },
11
+
8
12
  plugins: [],
9
13
 
10
14
  build: {
@@ -1,5 +1,5 @@
1
1
  {
2
- "name": "{{projectName}}",
2
+ "name": "{{name}}",
3
3
  "version": "0.0.0",
4
4
  "private": true,
5
5
  "type": "module",
@@ -1,12 +1,12 @@
1
1
  {
2
- "name": "@{{projectName}}/cli",
2
+ "name": "@{{name}}/cli",
3
3
  "version": "0.1.0",
4
4
  "type": "module",
5
- "description": "CLI for {{projectName}}",
5
+ "description": "CLI for {{name}}",
6
6
  "author": "{{author}}",
7
7
  "license": "MIT",
8
8
  "bin": {
9
- "{{projectName}}": "./dist/index.js"
9
+ "{{name}}": "./dist/index.js"
10
10
  },
11
11
  "scripts": {
12
12
  "postinstall": "bunli generate",
@@ -18,8 +18,8 @@
18
18
  },
19
19
  "dependencies": {
20
20
  "@bunli/core": "latest",
21
- "@{{projectName}}/core": "workspace:*",
22
- "@{{projectName}}/utils": "workspace:*"
21
+ "@{{name}}/core": "workspace:*",
22
+ "@{{name}}/utils": "workspace:*"
23
23
  },
24
24
  "devDependencies": {
25
25
  "@bunli/test": "latest",
@@ -30,6 +30,6 @@
30
30
  "bunli": {
31
31
  "entry": "./src/index.ts",
32
32
  "outDir": "./dist",
33
- "external": ["@bunli/core", "@{{projectName}}/core", "@{{projectName}}/utils"]
33
+ "external": ["@bunli/core", "@{{name}}/core", "@{{name}}/utils"]
34
34
  }
35
35
  }
@@ -1,10 +1,10 @@
1
1
  #!/usr/bin/env bun
2
2
  import { createCLI } from '@bunli/core'
3
- import { logger } from '@{{projectName}}/utils'
4
- import { processCommand, analyzeCommand } from '@{{projectName}}/core'
3
+ import { logger } from '@{{name}}/utils'
4
+ import { processCommand, analyzeCommand } from '@{{name}}/core'
5
5
 
6
6
  const cli = await createCLI({
7
- name: '{{projectName}}',
7
+ name: '{{name}}',
8
8
  version: '0.1.0',
9
9
  description: '{{description}}'
10
10
  })
@@ -1,8 +1,8 @@
1
1
  {
2
- "name": "@{{projectName}}/core",
2
+ "name": "@{{name}}/core",
3
3
  "version": "0.1.0",
4
4
  "type": "module",
5
- "description": "Core functionality for {{projectName}}",
5
+ "description": "Core functionality for {{name}}",
6
6
  "author": "{{author}}",
7
7
  "license": "MIT",
8
8
  "main": "./dist/index.js",
@@ -21,7 +21,7 @@
21
21
  },
22
22
  "dependencies": {
23
23
  "@bunli/core": "latest",
24
- "@{{projectName}}/utils": "workspace:*",
24
+ "@{{name}}/utils": "workspace:*",
25
25
  "zod": "^3.22.0"
26
26
  },
27
27
  "devDependencies": {
@@ -12,7 +12,7 @@ await Bun.build({
12
12
  target: 'bun',
13
13
  format: 'esm',
14
14
  minify: false,
15
- external: ['@bunli/core', '@{{projectName}}/utils', 'zod']
15
+ external: ['@bunli/core', '@{{name}}/utils', 'zod']
16
16
  })
17
17
 
18
- console.log('✅ @{{projectName}}/core built successfully')
18
+ console.log('✅ @{{name}}/core built successfully')
@@ -1,9 +1,9 @@
1
1
  import { defineCommand, option } from '@bunli/core'
2
2
  import { z } from 'zod'
3
- import { logger, formatTable } from '@{{projectName}}/utils'
3
+ import { logger, formatTable } from '@{{name}}/utils'
4
4
  import type { AnalyzeResult } from '../types.js'
5
5
 
6
- export const analyzeCommand = defineCommand({
6
+ const analyzeCommand = defineCommand({
7
7
  name: 'analyze',
8
8
  description: 'Analyze files and generate reports',
9
9
  args: z.array(z.string()).min(1).describe('Files to analyze'),
@@ -81,4 +81,6 @@ async function analyzeFile(file: string): Promise<AnalyzeResult> {
81
81
  },
82
82
  issues: []
83
83
  }
84
- }
84
+ }
85
+
86
+ export default analyzeCommand
@@ -1,9 +1,9 @@
1
1
  import { defineCommand, option } from '@bunli/core'
2
2
  import { z } from 'zod'
3
- import { logger } from '@{{projectName}}/utils'
3
+ import { logger } from '@{{name}}/utils'
4
4
  import type { ProcessOptions } from '../types.js'
5
5
 
6
- export const processCommand = defineCommand({
6
+ const processCommand = defineCommand({
7
7
  name: 'process',
8
8
  description: 'Process input files',
9
9
  args: z.array(z.string()).min(1).describe('Files to process'),
@@ -61,4 +61,6 @@ export const processCommand = defineCommand({
61
61
  async function processFile(file: string, options: ProcessOptions): Promise<void> {
62
62
  // Implementation here
63
63
  logger.debug(`Processing ${file} with options:`, options)
64
- }
64
+ }
65
+
66
+ export default processCommand
@@ -1,3 +1,3 @@
1
- export { processCommand } from './commands/process.js'
2
- export { analyzeCommand } from './commands/analyze.js'
1
+ export { default as processCommand } from './commands/process.js'
2
+ export { default as analyzeCommand } from './commands/analyze.js'
3
3
  export type { ProcessOptions, AnalyzeResult } from './types.js'
@@ -1,8 +1,8 @@
1
1
  {
2
- "name": "@{{projectName}}/utils",
2
+ "name": "@{{name}}/utils",
3
3
  "version": "0.1.0",
4
4
  "type": "module",
5
- "description": "Shared utilities for {{projectName}}",
5
+ "description": "Shared utilities for {{name}}",
6
6
  "author": "{{author}}",
7
7
  "license": "MIT",
8
8
  "main": "./dist/index.js",
@@ -14,4 +14,4 @@ await Bun.build({
14
14
  minify: false
15
15
  })
16
16
 
17
- console.log('✅ @{{projectName}}/utils built successfully')
17
+ console.log('✅ @{{name}}/utils built successfully')
@@ -3,7 +3,7 @@
3
3
  "description": "Monorepo template for multi-package Bunli projects",
4
4
  "variables": [
5
5
  {
6
- "name": "projectName",
6
+ "name": "name",
7
7
  "message": "Project name",
8
8
  "type": "string",
9
9
  "default": "my-bunli-monorepo"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-bunli",
3
- "version": "0.3.0",
3
+ "version": "0.5.0",
4
4
  "type": "module",
5
5
  "description": "Scaffold new Bunli CLI projects",
6
6
  "bin": {
@@ -47,14 +47,14 @@
47
47
  "prepublishOnly": "bun run build"
48
48
  },
49
49
  "dependencies": {
50
- "@bunli/core": "0.3.0",
51
- "@bunli/utils": "0.2.0",
50
+ "@bunli/core": "0.4.0",
52
51
  "@bunli/test": "0.2.0",
52
+ "@bunli/utils": "0.2.0",
53
53
  "giget": "^2.0.0",
54
- "zod": "^3.25.67"
54
+ "zod": "^4.3.6"
55
55
  },
56
56
  "devDependencies": {
57
- "@types/bun": "latest",
58
- "typescript": "^5.8.0"
57
+ "@types/bun": "1.3.7",
58
+ "typescript": "^5.8.3"
59
59
  }
60
60
  }
@@ -1,4 +1,4 @@
1
- # {{projectName}}
1
+ # {{name}}
2
2
 
3
3
  {{description}}
4
4
 
@@ -6,16 +6,16 @@
6
6
 
7
7
  ```bash
8
8
  # Install globally
9
- bun add -g {{projectName}}
9
+ bun add -g {{name}}
10
10
 
11
11
  # Or use directly with bunx
12
- bunx {{projectName}} [command]
12
+ bunx {{name}} [command]
13
13
  ```
14
14
 
15
15
  ## Usage
16
16
 
17
17
  ```bash
18
- {{projectName}} <command> [options]
18
+ {{name}} <command> [options]
19
19
  ```
20
20
 
21
21
  ### Commands
@@ -24,7 +24,7 @@ bunx {{projectName}} [command]
24
24
  Initialize a new configuration file in the current directory.
25
25
 
26
26
  ```bash
27
- {{projectName}} init [options]
27
+ {{name}} init [options]
28
28
 
29
29
  Options:
30
30
  -f, --force Overwrite existing config
@@ -35,7 +35,7 @@ Options:
35
35
  Validate files against defined rules.
36
36
 
37
37
  ```bash
38
- {{projectName}} validate <files...> [options]
38
+ {{name}} validate <files...> [options]
39
39
 
40
40
  Options:
41
41
  -c, --config Path to config file
@@ -47,7 +47,7 @@ Options:
47
47
  Start a development server.
48
48
 
49
49
  ```bash
50
- {{projectName}} serve [options]
50
+ {{name}} serve [options]
51
51
 
52
52
  Options:
53
53
  -p, --port Port to listen on (default: 3000)
@@ -59,7 +59,7 @@ Options:
59
59
  Manage configuration settings.
60
60
 
61
61
  ```bash
62
- {{projectName}} config <action> [key] [value]
62
+ {{name}} config <action> [key] [value]
63
63
 
64
64
  Actions:
65
65
  get <key> Get a config value
@@ -78,7 +78,7 @@ Actions:
78
78
 
79
79
  ## Configuration
80
80
 
81
- Create a `{{projectName}}.config.js` file in your project root:
81
+ Create a `{{name}}.config.js` file in your project root:
82
82
 
83
83
  ```javascript
84
84
  export default {
@@ -5,6 +5,10 @@ export default defineConfig({
5
5
  version: '{{version}}',
6
6
  description: '{{description}}',
7
7
 
8
+ commands: {
9
+ directory: './src/commands'
10
+ },
11
+
8
12
  plugins: [],
9
13
 
10
14
  build: {
@@ -1,12 +1,12 @@
1
1
  {
2
- "name": "{{projectName}}",
2
+ "name": "{{name}}",
3
3
  "version": "0.1.0",
4
4
  "type": "module",
5
5
  "description": "{{description}}",
6
6
  "author": "{{author}}",
7
7
  "license": "{{license}}",
8
8
  "bin": {
9
- "{{projectName}}": "./dist/index.js"
9
+ "{{name}}": "./dist/index.js"
10
10
  },
11
11
  "scripts": {
12
12
  "postinstall": "bunli generate",
@@ -2,7 +2,7 @@ import { defineCommand, option } from '@bunli/core'
2
2
  import { z } from 'zod'
3
3
  import { loadConfig, saveConfig, getConfigPath } from '../utils/config.js'
4
4
 
5
- export const configCommand = defineCommand({
5
+ const configCommand = defineCommand({
6
6
  name: 'config',
7
7
  description: 'Manage configuration',
8
8
  subcommands: [
@@ -142,4 +142,6 @@ function setNestedValue(obj: any, path: string, value: any): void {
142
142
  }
143
143
 
144
144
  current[lastKey] = value
145
- }
145
+ }
146
+
147
+ export default configCommand
@@ -2,7 +2,7 @@ import { defineCommand, option } from '@bunli/core'
2
2
  import { z } from 'zod'
3
3
  import { CONFIG_FILE_NAME, DEFAULT_CONFIG } from '../utils/constants.js'
4
4
 
5
- export const initCommand = defineCommand({
5
+ const initCommand = defineCommand({
6
6
  name: 'init',
7
7
  description: 'Initialize a new configuration file',
8
8
  options: {
@@ -55,7 +55,7 @@ export const initCommand = defineCommand({
55
55
  console.log()
56
56
  console.log('Next steps:')
57
57
  console.log(colors.gray(` 1. Edit ${CONFIG_FILE_NAME} to customize your configuration`))
58
- console.log(colors.gray(` 2. Run '{{projectName}} validate' to check your files`))
58
+ console.log(colors.gray(` 2. Run '{{name}} validate' to check your files`))
59
59
 
60
60
  } catch (error) {
61
61
  spin.fail('Failed to create config file')
@@ -89,7 +89,7 @@ function getConfigTemplate(template: 'minimal' | 'default' | 'full'): string {
89
89
  exclude: ['node_modules', 'dist', 'test'],
90
90
  }`,
91
91
 
92
- full: `import { defineConfig } from '{{projectName}}'
92
+ full: `import { defineConfig } from '{{name}}'
93
93
 
94
94
  export default defineConfig({
95
95
  // Validation rules
@@ -150,4 +150,6 @@ export default defineConfig({
150
150
  }
151
151
 
152
152
  return templates[template]
153
- }
153
+ }
154
+
155
+ export default initCommand
@@ -2,7 +2,7 @@ import { defineCommand, option } from '@bunli/core'
2
2
  import { z } from 'zod'
3
3
  import { loadConfig } from '../utils/config.js'
4
4
 
5
- export const serveCommand = defineCommand({
5
+ const serveCommand = defineCommand({
6
6
  name: 'serve',
7
7
  description: 'Start a development server',
8
8
  options: {
@@ -113,7 +113,7 @@ function getHomePage(): string {
113
113
  <!DOCTYPE html>
114
114
  <html>
115
115
  <head>
116
- <title>{{projectName}}</title>
116
+ <title>{{name}}</title>
117
117
  <style>
118
118
  body {
119
119
  font-family: system-ui, -apple-system, sans-serif;
@@ -156,7 +156,7 @@ function getHomePage(): string {
156
156
  </head>
157
157
  <body>
158
158
  <div class="container">
159
- <h1>{{projectName}}</h1>
159
+ <h1>{{name}}</h1>
160
160
  <p>{{description}}</p>
161
161
  <p><span class="status">Running</span></p>
162
162
 
@@ -173,4 +173,6 @@ function getHomePage(): string {
173
173
  </body>
174
174
  </html>
175
175
  `.trim()
176
- }
176
+ }
177
+
178
+ export default serveCommand
@@ -4,7 +4,7 @@ import { loadConfig } from '../utils/config.js'
4
4
  import { validateFiles } from '../utils/validator.js'
5
5
  import { glob } from '../utils/glob.js'
6
6
 
7
- export const validateCommand = defineCommand({
7
+ const validateCommand = defineCommand({
8
8
  name: 'validate',
9
9
  description: 'Validate files against defined rules',
10
10
  args: z.array(z.string()).min(1).describe('Files to validate'),
@@ -113,4 +113,6 @@ export const validateCommand = defineCommand({
113
113
  process.exit(1)
114
114
  }
115
115
  }
116
- })
116
+ })
117
+
118
+ export default validateCommand
@@ -1,13 +1,13 @@
1
1
  #!/usr/bin/env bun
2
2
  import { createCLI } from '@bunli/core'
3
- import { initCommand } from './commands/init.js'
4
- import { validateCommand } from './commands/validate.js'
5
- import { serveCommand } from './commands/serve.js'
6
- import { configCommand } from './commands/config.js'
3
+ import initCommand from './commands/init.js'
4
+ import validateCommand from './commands/validate.js'
5
+ import serveCommand from './commands/serve.js'
6
+ import configCommand from './commands/config.js'
7
7
  import { loadConfig } from './utils/config.js'
8
8
 
9
9
  const cli = await createCLI({
10
- name: '{{projectName}}',
10
+ name: '{{name}}',
11
11
  version: '0.1.0',
12
12
  description: '{{description}}'
13
13
  })
@@ -1,4 +1,4 @@
1
- export const CONFIG_FILE_NAME = '{{projectName}}.config.js'
1
+ export const CONFIG_FILE_NAME = '{{name}}.config.js'
2
2
 
3
3
  export const DEFAULT_CONFIG = {
4
4
  rules: {},
@@ -3,7 +3,7 @@
3
3
  "description": "Advanced Bunli CLI template with multiple commands",
4
4
  "variables": [
5
5
  {
6
- "name": "projectName",
6
+ "name": "name",
7
7
  "message": "Project name",
8
8
  "type": "string",
9
9
  "default": "my-bunli-cli"
@@ -1,4 +1,4 @@
1
- # {{projectName}}
1
+ # {{name}}
2
2
 
3
3
  {{description}}
4
4
 
@@ -29,7 +29,7 @@ bun test
29
29
  ## Usage
30
30
 
31
31
  ```bash
32
- {{projectName}} hello --name World
32
+ {{name}} hello --name World
33
33
  ```
34
34
 
35
35
  ## Commands
@@ -5,6 +5,10 @@ export default defineConfig({
5
5
  version: '{{version}}',
6
6
  description: '{{description}}',
7
7
 
8
+ commands: {
9
+ directory: './src/commands'
10
+ },
11
+
8
12
  build: {
9
13
  entry: './src/index.ts',
10
14
  outdir: './dist',
@@ -1,11 +1,11 @@
1
1
  {
2
- "name": "{{projectName}}",
2
+ "name": "{{name}}",
3
3
  "version": "0.1.0",
4
4
  "type": "module",
5
5
  "description": "{{description}}",
6
6
  "author": "{{author}}",
7
7
  "bin": {
8
- "{{projectName}}": "./dist/index.js"
8
+ "{{name}}": "./dist/index.js"
9
9
  },
10
10
  "scripts": {
11
11
  "postinstall": "bunli generate",
@@ -1,7 +1,7 @@
1
1
  import { defineCommand, option } from '@bunli/core'
2
2
  import { z } from 'zod'
3
3
 
4
- export const helloCommand = defineCommand({
4
+ const helloCommand = defineCommand({
5
5
  name: 'hello',
6
6
  description: 'Say hello to someone',
7
7
  options: {
@@ -26,4 +26,6 @@ export const helloCommand = defineCommand({
26
26
 
27
27
  console.log(colors.green(message))
28
28
  }
29
- })
29
+ })
30
+
31
+ export default helloCommand
@@ -1,9 +1,9 @@
1
1
  #!/usr/bin/env bun
2
2
  import { createCLI } from '@bunli/core'
3
- import { helloCommand } from './commands/hello.js'
3
+ import helloCommand from './commands/hello.js'
4
4
 
5
5
  const cli = await createCLI({
6
- name: '{{projectName}}',
6
+ name: '{{name}}',
7
7
  version: '0.1.0',
8
8
  description: '{{description}}'
9
9
  })
@@ -1,4 +1,4 @@
1
- # {{projectName}}
1
+ # {{name}}
2
2
 
3
3
  {{description}}
4
4
 
@@ -5,6 +5,10 @@ export default defineConfig({
5
5
  version: '{{version}}',
6
6
  description: '{{description}}',
7
7
 
8
+ commands: {
9
+ directory: './packages/core/src/commands'
10
+ },
11
+
8
12
  plugins: [],
9
13
 
10
14
  build: {
@@ -1,5 +1,5 @@
1
1
  {
2
- "name": "{{projectName}}",
2
+ "name": "{{name}}",
3
3
  "version": "0.0.0",
4
4
  "private": true,
5
5
  "type": "module",
@@ -1,12 +1,12 @@
1
1
  {
2
- "name": "@{{projectName}}/cli",
2
+ "name": "@{{name}}/cli",
3
3
  "version": "0.1.0",
4
4
  "type": "module",
5
- "description": "CLI for {{projectName}}",
5
+ "description": "CLI for {{name}}",
6
6
  "author": "{{author}}",
7
7
  "license": "MIT",
8
8
  "bin": {
9
- "{{projectName}}": "./dist/index.js"
9
+ "{{name}}": "./dist/index.js"
10
10
  },
11
11
  "scripts": {
12
12
  "postinstall": "bunli generate",
@@ -18,8 +18,8 @@
18
18
  },
19
19
  "dependencies": {
20
20
  "@bunli/core": "latest",
21
- "@{{projectName}}/core": "workspace:*",
22
- "@{{projectName}}/utils": "workspace:*"
21
+ "@{{name}}/core": "workspace:*",
22
+ "@{{name}}/utils": "workspace:*"
23
23
  },
24
24
  "devDependencies": {
25
25
  "@bunli/test": "latest",
@@ -30,6 +30,6 @@
30
30
  "bunli": {
31
31
  "entry": "./src/index.ts",
32
32
  "outDir": "./dist",
33
- "external": ["@bunli/core", "@{{projectName}}/core", "@{{projectName}}/utils"]
33
+ "external": ["@bunli/core", "@{{name}}/core", "@{{name}}/utils"]
34
34
  }
35
35
  }
@@ -1,10 +1,10 @@
1
1
  #!/usr/bin/env bun
2
2
  import { createCLI } from '@bunli/core'
3
- import { logger } from '@{{projectName}}/utils'
4
- import { processCommand, analyzeCommand } from '@{{projectName}}/core'
3
+ import { logger } from '@{{name}}/utils'
4
+ import { processCommand, analyzeCommand } from '@{{name}}/core'
5
5
 
6
6
  const cli = await createCLI({
7
- name: '{{projectName}}',
7
+ name: '{{name}}',
8
8
  version: '0.1.0',
9
9
  description: '{{description}}'
10
10
  })
@@ -1,8 +1,8 @@
1
1
  {
2
- "name": "@{{projectName}}/core",
2
+ "name": "@{{name}}/core",
3
3
  "version": "0.1.0",
4
4
  "type": "module",
5
- "description": "Core functionality for {{projectName}}",
5
+ "description": "Core functionality for {{name}}",
6
6
  "author": "{{author}}",
7
7
  "license": "MIT",
8
8
  "main": "./dist/index.js",
@@ -21,7 +21,7 @@
21
21
  },
22
22
  "dependencies": {
23
23
  "@bunli/core": "latest",
24
- "@{{projectName}}/utils": "workspace:*",
24
+ "@{{name}}/utils": "workspace:*",
25
25
  "zod": "^3.22.0"
26
26
  },
27
27
  "devDependencies": {
@@ -12,7 +12,7 @@ await Bun.build({
12
12
  target: 'bun',
13
13
  format: 'esm',
14
14
  minify: false,
15
- external: ['@bunli/core', '@{{projectName}}/utils', 'zod']
15
+ external: ['@bunli/core', '@{{name}}/utils', 'zod']
16
16
  })
17
17
 
18
- console.log('✅ @{{projectName}}/core built successfully')
18
+ console.log('✅ @{{name}}/core built successfully')
@@ -1,9 +1,9 @@
1
1
  import { defineCommand, option } from '@bunli/core'
2
2
  import { z } from 'zod'
3
- import { logger, formatTable } from '@{{projectName}}/utils'
3
+ import { logger, formatTable } from '@{{name}}/utils'
4
4
  import type { AnalyzeResult } from '../types.js'
5
5
 
6
- export const analyzeCommand = defineCommand({
6
+ const analyzeCommand = defineCommand({
7
7
  name: 'analyze',
8
8
  description: 'Analyze files and generate reports',
9
9
  args: z.array(z.string()).min(1).describe('Files to analyze'),
@@ -81,4 +81,6 @@ async function analyzeFile(file: string): Promise<AnalyzeResult> {
81
81
  },
82
82
  issues: []
83
83
  }
84
- }
84
+ }
85
+
86
+ export default analyzeCommand
@@ -1,9 +1,9 @@
1
1
  import { defineCommand, option } from '@bunli/core'
2
2
  import { z } from 'zod'
3
- import { logger } from '@{{projectName}}/utils'
3
+ import { logger } from '@{{name}}/utils'
4
4
  import type { ProcessOptions } from '../types.js'
5
5
 
6
- export const processCommand = defineCommand({
6
+ const processCommand = defineCommand({
7
7
  name: 'process',
8
8
  description: 'Process input files',
9
9
  args: z.array(z.string()).min(1).describe('Files to process'),
@@ -61,4 +61,6 @@ export const processCommand = defineCommand({
61
61
  async function processFile(file: string, options: ProcessOptions): Promise<void> {
62
62
  // Implementation here
63
63
  logger.debug(`Processing ${file} with options:`, options)
64
- }
64
+ }
65
+
66
+ export default processCommand
@@ -1,3 +1,3 @@
1
- export { processCommand } from './commands/process.js'
2
- export { analyzeCommand } from './commands/analyze.js'
1
+ export { default as processCommand } from './commands/process.js'
2
+ export { default as analyzeCommand } from './commands/analyze.js'
3
3
  export type { ProcessOptions, AnalyzeResult } from './types.js'
@@ -1,8 +1,8 @@
1
1
  {
2
- "name": "@{{projectName}}/utils",
2
+ "name": "@{{name}}/utils",
3
3
  "version": "0.1.0",
4
4
  "type": "module",
5
- "description": "Shared utilities for {{projectName}}",
5
+ "description": "Shared utilities for {{name}}",
6
6
  "author": "{{author}}",
7
7
  "license": "MIT",
8
8
  "main": "./dist/index.js",
@@ -14,4 +14,4 @@ await Bun.build({
14
14
  minify: false
15
15
  })
16
16
 
17
- console.log('✅ @{{projectName}}/utils built successfully')
17
+ console.log('✅ @{{name}}/utils built successfully')
@@ -3,7 +3,7 @@
3
3
  "description": "Monorepo template for multi-package Bunli projects",
4
4
  "variables": [
5
5
  {
6
- "name": "projectName",
6
+ "name": "name",
7
7
  "message": "Project name",
8
8
  "type": "string",
9
9
  "default": "my-bunli-monorepo"