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.
- package/dist/cli.js +10 -3
- package/dist/index.js +10 -3
- package/dist/templates/advanced/README.md +9 -9
- package/dist/templates/advanced/bunli.config.ts +4 -0
- package/dist/templates/advanced/package.json +2 -2
- package/dist/templates/advanced/src/commands/config.ts +4 -2
- package/dist/templates/advanced/src/commands/init.ts +6 -4
- package/dist/templates/advanced/src/commands/serve.ts +6 -4
- package/dist/templates/advanced/src/commands/validate.ts +4 -2
- package/dist/templates/advanced/src/index.ts +5 -5
- package/dist/templates/advanced/src/utils/constants.ts +1 -1
- package/dist/templates/advanced/template.json +1 -1
- package/dist/templates/basic/README.md +2 -2
- package/dist/templates/basic/bunli.config.ts +4 -0
- package/dist/templates/basic/package.json +2 -2
- package/dist/templates/basic/src/commands/hello.ts +4 -2
- package/dist/templates/basic/src/index.ts +2 -2
- package/dist/templates/monorepo/README.md +1 -1
- package/dist/templates/monorepo/bunli.config.ts +4 -0
- package/dist/templates/monorepo/package.json +1 -1
- package/dist/templates/monorepo/packages/cli/package.json +6 -6
- package/dist/templates/monorepo/packages/cli/src/index.ts +3 -3
- package/dist/templates/monorepo/packages/core/package.json +3 -3
- package/dist/templates/monorepo/packages/core/scripts/build.ts +2 -2
- package/dist/templates/monorepo/packages/core/src/commands/analyze.ts +5 -3
- package/dist/templates/monorepo/packages/core/src/commands/process.ts +5 -3
- package/dist/templates/monorepo/packages/core/src/index.ts +2 -2
- package/dist/templates/monorepo/packages/utils/package.json +2 -2
- package/dist/templates/monorepo/packages/utils/scripts/build.ts +1 -1
- package/dist/templates/monorepo/template.json +1 -1
- package/package.json +6 -6
- package/templates/advanced/README.md +9 -9
- package/templates/advanced/bunli.config.ts +4 -0
- package/templates/advanced/package.json +2 -2
- package/templates/advanced/src/commands/config.ts +4 -2
- package/templates/advanced/src/commands/init.ts +6 -4
- package/templates/advanced/src/commands/serve.ts +6 -4
- package/templates/advanced/src/commands/validate.ts +4 -2
- package/templates/advanced/src/index.ts +5 -5
- package/templates/advanced/src/utils/constants.ts +1 -1
- package/templates/advanced/template.json +1 -1
- package/templates/basic/README.md +2 -2
- package/templates/basic/bunli.config.ts +4 -0
- package/templates/basic/package.json +2 -2
- package/templates/basic/src/commands/hello.ts +4 -2
- package/templates/basic/src/index.ts +2 -2
- package/templates/monorepo/README.md +1 -1
- package/templates/monorepo/bunli.config.ts +4 -0
- package/templates/monorepo/package.json +1 -1
- package/templates/monorepo/packages/cli/package.json +6 -6
- package/templates/monorepo/packages/cli/src/index.ts +3 -3
- package/templates/monorepo/packages/core/package.json +3 -3
- package/templates/monorepo/packages/core/scripts/build.ts +2 -2
- package/templates/monorepo/packages/core/src/commands/analyze.ts +5 -3
- package/templates/monorepo/packages/core/src/commands/process.ts +5 -3
- package/templates/monorepo/packages/core/src/index.ts +2 -2
- package/templates/monorepo/packages/utils/package.json +2 -2
- package/templates/monorepo/packages/utils/scripts/build.ts +1 -1
- 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
|
-
|
|
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 "
|
|
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
|
-
|
|
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 "
|
|
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
|
-
# {{
|
|
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 {{
|
|
9
|
+
bun add -g {{name}}
|
|
10
10
|
|
|
11
11
|
# Or use directly with bunx
|
|
12
|
-
bunx {{
|
|
12
|
+
bunx {{name}} [command]
|
|
13
13
|
```
|
|
14
14
|
|
|
15
15
|
## Usage
|
|
16
16
|
|
|
17
17
|
```bash
|
|
18
|
-
{{
|
|
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
|
-
{{
|
|
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
|
-
{{
|
|
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
|
-
{{
|
|
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
|
-
{{
|
|
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 `{{
|
|
81
|
+
Create a `{{name}}.config.js` file in your project root:
|
|
82
82
|
|
|
83
83
|
```javascript
|
|
84
84
|
export default {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
|
-
"name": "{{
|
|
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
|
-
"{{
|
|
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
|
-
|
|
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
|
-
|
|
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 '{{
|
|
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 '{{
|
|
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
|
-
|
|
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>{{
|
|
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>{{
|
|
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
|
-
|
|
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
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
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: '{{
|
|
10
|
+
name: '{{name}}',
|
|
11
11
|
version: '0.1.0',
|
|
12
12
|
description: '{{description}}'
|
|
13
13
|
})
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
|
-
"name": "{{
|
|
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
|
-
"{{
|
|
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
|
-
|
|
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
|
|
3
|
+
import helloCommand from './commands/hello.js'
|
|
4
4
|
|
|
5
5
|
const cli = await createCLI({
|
|
6
|
-
name: '{{
|
|
6
|
+
name: '{{name}}',
|
|
7
7
|
version: '0.1.0',
|
|
8
8
|
description: '{{description}}'
|
|
9
9
|
})
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
|
-
"name": "@{{
|
|
2
|
+
"name": "@{{name}}/cli",
|
|
3
3
|
"version": "0.1.0",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"description": "CLI for {{
|
|
5
|
+
"description": "CLI for {{name}}",
|
|
6
6
|
"author": "{{author}}",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"bin": {
|
|
9
|
-
"{{
|
|
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
|
-
"@{{
|
|
22
|
-
"@{{
|
|
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", "@{{
|
|
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 '@{{
|
|
4
|
-
import { processCommand, analyzeCommand } from '@{{
|
|
3
|
+
import { logger } from '@{{name}}/utils'
|
|
4
|
+
import { processCommand, analyzeCommand } from '@{{name}}/core'
|
|
5
5
|
|
|
6
6
|
const cli = await createCLI({
|
|
7
|
-
name: '{{
|
|
7
|
+
name: '{{name}}',
|
|
8
8
|
version: '0.1.0',
|
|
9
9
|
description: '{{description}}'
|
|
10
10
|
})
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
|
-
"name": "@{{
|
|
2
|
+
"name": "@{{name}}/core",
|
|
3
3
|
"version": "0.1.0",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"description": "Core functionality for {{
|
|
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
|
-
"@{{
|
|
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', '@{{
|
|
15
|
+
external: ['@bunli/core', '@{{name}}/utils', 'zod']
|
|
16
16
|
})
|
|
17
17
|
|
|
18
|
-
console.log('✅ @{{
|
|
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 '@{{
|
|
3
|
+
import { logger, formatTable } from '@{{name}}/utils'
|
|
4
4
|
import type { AnalyzeResult } from '../types.js'
|
|
5
5
|
|
|
6
|
-
|
|
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 '@{{
|
|
3
|
+
import { logger } from '@{{name}}/utils'
|
|
4
4
|
import type { ProcessOptions } from '../types.js'
|
|
5
5
|
|
|
6
|
-
|
|
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": "@{{
|
|
2
|
+
"name": "@{{name}}/utils",
|
|
3
3
|
"version": "0.1.0",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"description": "Shared utilities for {{
|
|
5
|
+
"description": "Shared utilities for {{name}}",
|
|
6
6
|
"author": "{{author}}",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"main": "./dist/index.js",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-bunli",
|
|
3
|
-
"version": "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.
|
|
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.
|
|
54
|
+
"zod": "^4.3.6"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
|
-
"@types/bun": "
|
|
58
|
-
"typescript": "^5.8.
|
|
57
|
+
"@types/bun": "1.3.7",
|
|
58
|
+
"typescript": "^5.8.3"
|
|
59
59
|
}
|
|
60
60
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# {{
|
|
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 {{
|
|
9
|
+
bun add -g {{name}}
|
|
10
10
|
|
|
11
11
|
# Or use directly with bunx
|
|
12
|
-
bunx {{
|
|
12
|
+
bunx {{name}} [command]
|
|
13
13
|
```
|
|
14
14
|
|
|
15
15
|
## Usage
|
|
16
16
|
|
|
17
17
|
```bash
|
|
18
|
-
{{
|
|
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
|
-
{{
|
|
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
|
-
{{
|
|
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
|
-
{{
|
|
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
|
-
{{
|
|
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 `{{
|
|
81
|
+
Create a `{{name}}.config.js` file in your project root:
|
|
82
82
|
|
|
83
83
|
```javascript
|
|
84
84
|
export default {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
|
-
"name": "{{
|
|
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
|
-
"{{
|
|
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
|
-
|
|
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
|
-
|
|
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 '{{
|
|
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 '{{
|
|
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
|
-
|
|
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>{{
|
|
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>{{
|
|
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
|
-
|
|
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
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
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: '{{
|
|
10
|
+
name: '{{name}}',
|
|
11
11
|
version: '0.1.0',
|
|
12
12
|
description: '{{description}}'
|
|
13
13
|
})
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
|
-
"name": "{{
|
|
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
|
-
"{{
|
|
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
|
-
|
|
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
|
|
3
|
+
import helloCommand from './commands/hello.js'
|
|
4
4
|
|
|
5
5
|
const cli = await createCLI({
|
|
6
|
-
name: '{{
|
|
6
|
+
name: '{{name}}',
|
|
7
7
|
version: '0.1.0',
|
|
8
8
|
description: '{{description}}'
|
|
9
9
|
})
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
|
-
"name": "@{{
|
|
2
|
+
"name": "@{{name}}/cli",
|
|
3
3
|
"version": "0.1.0",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"description": "CLI for {{
|
|
5
|
+
"description": "CLI for {{name}}",
|
|
6
6
|
"author": "{{author}}",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"bin": {
|
|
9
|
-
"{{
|
|
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
|
-
"@{{
|
|
22
|
-
"@{{
|
|
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", "@{{
|
|
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 '@{{
|
|
4
|
-
import { processCommand, analyzeCommand } from '@{{
|
|
3
|
+
import { logger } from '@{{name}}/utils'
|
|
4
|
+
import { processCommand, analyzeCommand } from '@{{name}}/core'
|
|
5
5
|
|
|
6
6
|
const cli = await createCLI({
|
|
7
|
-
name: '{{
|
|
7
|
+
name: '{{name}}',
|
|
8
8
|
version: '0.1.0',
|
|
9
9
|
description: '{{description}}'
|
|
10
10
|
})
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
|
-
"name": "@{{
|
|
2
|
+
"name": "@{{name}}/core",
|
|
3
3
|
"version": "0.1.0",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"description": "Core functionality for {{
|
|
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
|
-
"@{{
|
|
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', '@{{
|
|
15
|
+
external: ['@bunli/core', '@{{name}}/utils', 'zod']
|
|
16
16
|
})
|
|
17
17
|
|
|
18
|
-
console.log('✅ @{{
|
|
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 '@{{
|
|
3
|
+
import { logger, formatTable } from '@{{name}}/utils'
|
|
4
4
|
import type { AnalyzeResult } from '../types.js'
|
|
5
5
|
|
|
6
|
-
|
|
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 '@{{
|
|
3
|
+
import { logger } from '@{{name}}/utils'
|
|
4
4
|
import type { ProcessOptions } from '../types.js'
|
|
5
5
|
|
|
6
|
-
|
|
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": "@{{
|
|
2
|
+
"name": "@{{name}}/utils",
|
|
3
3
|
"version": "0.1.0",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"description": "Shared utilities for {{
|
|
5
|
+
"description": "Shared utilities for {{name}}",
|
|
6
6
|
"author": "{{author}}",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"main": "./dist/index.js",
|