create-bunli 0.1.2 โ 0.2.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 +18 -16
- package/dist/cli.js +7 -16
- package/dist/create.d.ts +0 -2
- package/dist/index.js +4 -6
- package/dist/templates/advanced/bunli.config.ts +29 -0
- package/dist/templates/advanced/package.json +1 -1
- package/dist/templates/advanced/tsconfig.json +1 -1
- package/dist/templates/basic/bunli.config.ts +29 -0
- package/dist/templates/basic/package.json +1 -1
- package/dist/templates/basic/tsconfig.json +1 -1
- package/dist/templates/monorepo/README.md +2 -2
- package/dist/templates/monorepo/bunli.config.ts +34 -0
- package/dist/templates/monorepo/package.json +1 -1
- package/dist/templates/monorepo/packages/cli/package.json +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/tsconfig.json +1 -1
- package/dist/templates/monorepo/turbo.json +1 -1
- package/dist/types.d.ts +0 -3
- package/package.json +6 -5
- package/templates/advanced/bunli.config.ts +29 -0
- package/templates/advanced/package.json +1 -1
- package/templates/advanced/tsconfig.json +1 -1
- package/templates/basic/bunli.config.ts +29 -0
- package/templates/basic/package.json +1 -1
- package/templates/basic/tsconfig.json +1 -1
- package/templates/monorepo/README.md +2 -2
- package/templates/monorepo/bunli.config.ts +34 -0
- package/templates/monorepo/package.json +1 -1
- package/templates/monorepo/packages/cli/package.json +1 -1
- package/templates/monorepo/packages/core/package.json +1 -1
- package/templates/monorepo/packages/utils/package.json +1 -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
package/README.md
CHANGED
|
@@ -8,14 +8,9 @@ Scaffold new Bunli CLI projects with ease.
|
|
|
8
8
|
# Using bunx (recommended)
|
|
9
9
|
bunx create-bunli my-cli
|
|
10
10
|
|
|
11
|
-
#
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
# Using yarn
|
|
15
|
-
yarn create bunli my-cli
|
|
16
|
-
|
|
17
|
-
# Using pnpm
|
|
18
|
-
pnpm create bunli my-cli
|
|
11
|
+
# Or install globally and use directly
|
|
12
|
+
bun add -g create-bunli
|
|
13
|
+
create-bunli my-cli
|
|
19
14
|
```
|
|
20
15
|
|
|
21
16
|
## Features
|
|
@@ -26,6 +21,7 @@ pnpm create bunli my-cli
|
|
|
26
21
|
- ๐งช **Testing included** - Comes with @bunli/test for CLI testing
|
|
27
22
|
- ๐จ **Best practices** - Follows Bunli conventions and patterns
|
|
28
23
|
- ๐ **Flexible sources** - Use bundled templates or any GitHub repository
|
|
24
|
+
- โก **Type generation** - All templates include codegen for enhanced developer experience
|
|
29
25
|
|
|
30
26
|
## Usage
|
|
31
27
|
|
|
@@ -75,7 +71,6 @@ bunx create-bunli [name] [options]
|
|
|
75
71
|
Options:
|
|
76
72
|
-t, --template <template> Project template (default: "basic")
|
|
77
73
|
-d, --dir <dir> Directory to create project in
|
|
78
|
-
-p, --package-manager <pm> Package manager (bun, npm, yarn, pnpm) (default: "bun")
|
|
79
74
|
-g, --git Initialize git repository (default: true)
|
|
80
75
|
-i, --install Install dependencies (default: true)
|
|
81
76
|
--offline Use cached templates when available
|
|
@@ -89,9 +84,6 @@ Options:
|
|
|
89
84
|
# Create in current directory
|
|
90
85
|
bunx create-bunli .
|
|
91
86
|
|
|
92
|
-
# Create with specific package manager
|
|
93
|
-
bunx create-bunli my-cli --package-manager pnpm
|
|
94
|
-
|
|
95
87
|
# Create without installing dependencies
|
|
96
88
|
bunx create-bunli my-cli --no-install
|
|
97
89
|
|
|
@@ -214,6 +206,18 @@ Templates can include a `template.json` manifest:
|
|
|
214
206
|
}
|
|
215
207
|
```
|
|
216
208
|
|
|
209
|
+
### Type Generation
|
|
210
|
+
|
|
211
|
+
All templates include type generation configuration for enhanced developer experience:
|
|
212
|
+
|
|
213
|
+
This provides:
|
|
214
|
+
- **Autocomplete** for command names and options
|
|
215
|
+
- **Type safety** at compile time
|
|
216
|
+
- **IntelliSense** for command metadata
|
|
217
|
+
- **CLI wrappers** for programmatic execution
|
|
218
|
+
|
|
219
|
+
Learn more in the [Type Generation Guide](/docs/guides/type-generation).
|
|
220
|
+
|
|
217
221
|
### Template Variables
|
|
218
222
|
|
|
219
223
|
Use these variables in your template files:
|
|
@@ -223,7 +227,6 @@ Use these variables in your template files:
|
|
|
223
227
|
- `{{author}}` - Author name
|
|
224
228
|
- `{{license}}` - License type
|
|
225
229
|
- `{{year}}` - Current year
|
|
226
|
-
- `{{packageManager}}` - Selected package manager
|
|
227
230
|
|
|
228
231
|
Variables can be used in file contents and filenames:
|
|
229
232
|
- `__projectName__.config.js` โ `my-app.config.js`
|
|
@@ -236,7 +239,6 @@ import { createProject } from 'create-bunli'
|
|
|
236
239
|
await createProject({
|
|
237
240
|
name: 'my-cli',
|
|
238
241
|
template: 'advanced',
|
|
239
|
-
packageManager: 'bun',
|
|
240
242
|
install: true,
|
|
241
243
|
git: true
|
|
242
244
|
})
|
|
@@ -275,8 +277,8 @@ If you get a "template not found" error, ensure:
|
|
|
275
277
|
|
|
276
278
|
If dependency installation fails:
|
|
277
279
|
- Check your internet connection
|
|
278
|
-
- Ensure
|
|
279
|
-
- Try running with `--no-install` and install manually
|
|
280
|
+
- Ensure Bun is installed correctly
|
|
281
|
+
- Try running with `--no-install` and install manually with `bun install`
|
|
280
282
|
|
|
281
283
|
### Permission errors
|
|
282
284
|
|
package/dist/cli.js
CHANGED
|
@@ -144,7 +144,7 @@ async function isLocalTemplate(template) {
|
|
|
144
144
|
|
|
145
145
|
// src/create-project.ts
|
|
146
146
|
async function createProject(options) {
|
|
147
|
-
const { name, dir, template, git, install,
|
|
147
|
+
const { name, dir, template, git, install, prompt, spinner, colors, shell, offline } = options;
|
|
148
148
|
try {
|
|
149
149
|
await shell`test -d ${dir}`.quiet();
|
|
150
150
|
const overwrite = await prompt.confirm(`Directory ${dir} already exists. Overwrite?`, { default: false });
|
|
@@ -172,7 +172,6 @@ async function createProject(options) {
|
|
|
172
172
|
projectName: name,
|
|
173
173
|
description: `A CLI built with Bunli`,
|
|
174
174
|
author: "",
|
|
175
|
-
packageManager: packageManager || "bun",
|
|
176
175
|
year: new Date().getFullYear().toString()
|
|
177
176
|
}
|
|
178
177
|
});
|
|
@@ -191,15 +190,14 @@ async function createProject(options) {
|
|
|
191
190
|
}
|
|
192
191
|
}
|
|
193
192
|
if (install) {
|
|
194
|
-
const installSpin = spinner(`Installing dependencies
|
|
193
|
+
const installSpin = spinner(`Installing dependencies...`);
|
|
195
194
|
installSpin.start();
|
|
196
195
|
try {
|
|
197
|
-
|
|
198
|
-
await shell`cd ${dir} && ${installCmd}`;
|
|
196
|
+
await shell`cd ${dir} && bun install`;
|
|
199
197
|
installSpin.succeed("Dependencies installed");
|
|
200
198
|
} catch (error) {
|
|
201
199
|
installSpin.fail("Failed to install dependencies");
|
|
202
|
-
console.error(colors.dim(` You can install them manually by running:
|
|
200
|
+
console.error(colors.dim(` You can install them manually by running: bun install`));
|
|
203
201
|
}
|
|
204
202
|
}
|
|
205
203
|
} catch (error) {
|
|
@@ -240,7 +238,6 @@ async function create(context) {
|
|
|
240
238
|
console.log(colors.dim(" Location: ") + colors.cyan(projectDir));
|
|
241
239
|
console.log(colors.dim(" Git: ") + colors.cyan(flags.git ? "Yes" : "No"));
|
|
242
240
|
console.log(colors.dim(" Install: ") + colors.cyan(flags.install ? "Yes" : "No"));
|
|
243
|
-
console.log(colors.dim(" Package: ") + colors.cyan(flags["package-manager"]));
|
|
244
241
|
console.log();
|
|
245
242
|
const confirmed = await prompt.confirm("Continue?", { default: true });
|
|
246
243
|
if (!confirmed) {
|
|
@@ -254,7 +251,6 @@ async function create(context) {
|
|
|
254
251
|
template: flags.template,
|
|
255
252
|
git: flags.git,
|
|
256
253
|
install: flags.install,
|
|
257
|
-
packageManager: flags["package-manager"],
|
|
258
254
|
offline: flags.offline,
|
|
259
255
|
prompt,
|
|
260
256
|
spinner,
|
|
@@ -267,13 +263,9 @@ async function create(context) {
|
|
|
267
263
|
console.log("Next steps:");
|
|
268
264
|
console.log(colors.gray(` cd ${path.relative(process.cwd(), projectDir)}`));
|
|
269
265
|
if (!flags.install) {
|
|
270
|
-
console.log(colors.gray(`
|
|
271
|
-
}
|
|
272
|
-
if (flags.template === "monorepo") {
|
|
273
|
-
console.log(colors.gray(` ${flags["package-manager"]} run dev`));
|
|
274
|
-
} else {
|
|
275
|
-
console.log(colors.gray(` ${flags["package-manager"] === "bun" ? "bun" : flags["package-manager"] + " run"} dev`));
|
|
266
|
+
console.log(colors.gray(` bun install`));
|
|
276
267
|
}
|
|
268
|
+
console.log(colors.gray(` bun run dev`));
|
|
277
269
|
console.log();
|
|
278
270
|
}
|
|
279
271
|
|
|
@@ -285,7 +277,7 @@ async function run() {
|
|
|
285
277
|
} else if (args[0] && !args[0].startsWith("-") && args[0] !== "create") {
|
|
286
278
|
process.argv.splice(2, 0, "create");
|
|
287
279
|
}
|
|
288
|
-
const cli = createCLI({
|
|
280
|
+
const cli = await createCLI({
|
|
289
281
|
name: "create-bunli",
|
|
290
282
|
version: "0.1.0",
|
|
291
283
|
description: "Scaffold new Bunli CLI projects"
|
|
@@ -299,7 +291,6 @@ async function run() {
|
|
|
299
291
|
dir: option(z.string().optional(), { short: "d", description: "Directory to create project in" }),
|
|
300
292
|
git: option(z.boolean().default(true), { short: "g", description: "Initialize git repository" }),
|
|
301
293
|
install: option(z.boolean().default(true), { short: "i", description: "Install dependencies" }),
|
|
302
|
-
"package-manager": option(z.enum(["bun", "pnpm", "yarn", "npm"]).default("bun"), { short: "p", description: "Package manager to use" }),
|
|
303
294
|
offline: option(z.boolean().default(false), { description: "Use cached templates when available" })
|
|
304
295
|
},
|
|
305
296
|
handler: create
|
package/dist/create.d.ts
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import type { HandlerArgs } from '@bunli/core';
|
|
2
|
-
import type { PackageManager } from './types.js';
|
|
3
2
|
interface CreateOptions {
|
|
4
3
|
name?: string;
|
|
5
4
|
template: string;
|
|
6
5
|
dir?: string;
|
|
7
6
|
git: boolean;
|
|
8
7
|
install: boolean;
|
|
9
|
-
'package-manager': PackageManager;
|
|
10
8
|
offline?: boolean;
|
|
11
9
|
}
|
|
12
10
|
export declare function create(context: HandlerArgs<CreateOptions>): Promise<void>;
|
package/dist/index.js
CHANGED
|
@@ -138,7 +138,7 @@ async function isLocalTemplate(template) {
|
|
|
138
138
|
|
|
139
139
|
// src/create-project.ts
|
|
140
140
|
async function createProject(options) {
|
|
141
|
-
const { name, dir, template, git, install,
|
|
141
|
+
const { name, dir, template, git, install, prompt, spinner, colors, shell, offline } = options;
|
|
142
142
|
try {
|
|
143
143
|
await shell`test -d ${dir}`.quiet();
|
|
144
144
|
const overwrite = await prompt.confirm(`Directory ${dir} already exists. Overwrite?`, { default: false });
|
|
@@ -166,7 +166,6 @@ async function createProject(options) {
|
|
|
166
166
|
projectName: name,
|
|
167
167
|
description: `A CLI built with Bunli`,
|
|
168
168
|
author: "",
|
|
169
|
-
packageManager: packageManager || "bun",
|
|
170
169
|
year: new Date().getFullYear().toString()
|
|
171
170
|
}
|
|
172
171
|
});
|
|
@@ -185,15 +184,14 @@ async function createProject(options) {
|
|
|
185
184
|
}
|
|
186
185
|
}
|
|
187
186
|
if (install) {
|
|
188
|
-
const installSpin = spinner(`Installing dependencies
|
|
187
|
+
const installSpin = spinner(`Installing dependencies...`);
|
|
189
188
|
installSpin.start();
|
|
190
189
|
try {
|
|
191
|
-
|
|
192
|
-
await shell`cd ${dir} && ${installCmd}`;
|
|
190
|
+
await shell`cd ${dir} && bun install`;
|
|
193
191
|
installSpin.succeed("Dependencies installed");
|
|
194
192
|
} catch (error) {
|
|
195
193
|
installSpin.fail("Failed to install dependencies");
|
|
196
|
-
console.error(colors.dim(` You can install them manually by running:
|
|
194
|
+
console.error(colors.dim(` You can install them manually by running: bun install`));
|
|
197
195
|
}
|
|
198
196
|
}
|
|
199
197
|
} catch (error) {
|
|
@@ -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
|
+
})
|
|
@@ -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
|
+
})
|
|
@@ -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
|
+
})
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"dev": "turbo run dev",
|
|
13
13
|
"build": "turbo run build",
|
|
14
14
|
"test": "turbo run test",
|
|
15
|
-
"
|
|
15
|
+
"typecheck": "turbo run typecheck",
|
|
16
16
|
"lint": "turbo run lint",
|
|
17
17
|
"clean": "turbo run clean && rm -rf node_modules",
|
|
18
18
|
"changeset": "changeset",
|
package/dist/types.d.ts
CHANGED
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
export interface CreateOptions {
|
|
2
2
|
template?: string;
|
|
3
|
-
packageManager?: PackageManager;
|
|
4
3
|
install?: boolean;
|
|
5
4
|
git?: boolean;
|
|
6
5
|
offline?: boolean;
|
|
7
6
|
}
|
|
8
|
-
export type PackageManager = 'bun' | 'npm' | 'yarn' | 'pnpm';
|
|
9
7
|
export interface ProjectConfig {
|
|
10
8
|
name: string;
|
|
11
9
|
template: string;
|
|
12
|
-
packageManager: PackageManager;
|
|
13
10
|
install: boolean;
|
|
14
11
|
git: boolean;
|
|
15
12
|
offline?: boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-bunli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Scaffold new Bunli CLI projects",
|
|
6
6
|
"bin": {
|
|
@@ -43,12 +43,13 @@
|
|
|
43
43
|
"dev": "bun run src/cli.ts",
|
|
44
44
|
"build": "bun scripts/build.ts && bun run tsc",
|
|
45
45
|
"test": "bun test",
|
|
46
|
-
"
|
|
46
|
+
"typecheck": "tsc --noEmit",
|
|
47
47
|
"prepublishOnly": "bun run build"
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"@bunli/core": "0.
|
|
51
|
-
"@bunli/utils": "0.
|
|
50
|
+
"@bunli/core": "0.2.0",
|
|
51
|
+
"@bunli/utils": "0.2.0",
|
|
52
|
+
"@bunli/test": "0.2.0",
|
|
52
53
|
"giget": "^2.0.0",
|
|
53
54
|
"zod": "^3.25.67"
|
|
54
55
|
},
|
|
@@ -56,4 +57,4 @@
|
|
|
56
57
|
"@types/bun": "latest",
|
|
57
58
|
"typescript": "^5.8.0"
|
|
58
59
|
}
|
|
59
|
-
}
|
|
60
|
+
}
|
|
@@ -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
|
+
})
|
|
@@ -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
|
+
})
|
|
@@ -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
|
+
})
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"dev": "turbo run dev",
|
|
13
13
|
"build": "turbo run build",
|
|
14
14
|
"test": "turbo run test",
|
|
15
|
-
"
|
|
15
|
+
"typecheck": "turbo run typecheck",
|
|
16
16
|
"lint": "turbo run lint",
|
|
17
17
|
"clean": "turbo run clean && rm -rf node_modules",
|
|
18
18
|
"changeset": "changeset",
|
|
@@ -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
|
-
})
|