create-bunli 0.1.2 → 0.1.3
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 +5 -16
- package/dist/cli.js +6 -15
- package/dist/create.d.ts +0 -2
- package/dist/index.js +4 -6
- package/dist/types.d.ts +0 -3
- package/package.json +1 -1
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
|
|
@@ -75,7 +70,6 @@ bunx create-bunli [name] [options]
|
|
|
75
70
|
Options:
|
|
76
71
|
-t, --template <template> Project template (default: "basic")
|
|
77
72
|
-d, --dir <dir> Directory to create project in
|
|
78
|
-
-p, --package-manager <pm> Package manager (bun, npm, yarn, pnpm) (default: "bun")
|
|
79
73
|
-g, --git Initialize git repository (default: true)
|
|
80
74
|
-i, --install Install dependencies (default: true)
|
|
81
75
|
--offline Use cached templates when available
|
|
@@ -89,9 +83,6 @@ Options:
|
|
|
89
83
|
# Create in current directory
|
|
90
84
|
bunx create-bunli .
|
|
91
85
|
|
|
92
|
-
# Create with specific package manager
|
|
93
|
-
bunx create-bunli my-cli --package-manager pnpm
|
|
94
|
-
|
|
95
86
|
# Create without installing dependencies
|
|
96
87
|
bunx create-bunli my-cli --no-install
|
|
97
88
|
|
|
@@ -223,7 +214,6 @@ Use these variables in your template files:
|
|
|
223
214
|
- `{{author}}` - Author name
|
|
224
215
|
- `{{license}}` - License type
|
|
225
216
|
- `{{year}}` - Current year
|
|
226
|
-
- `{{packageManager}}` - Selected package manager
|
|
227
217
|
|
|
228
218
|
Variables can be used in file contents and filenames:
|
|
229
219
|
- `__projectName__.config.js` → `my-app.config.js`
|
|
@@ -236,7 +226,6 @@ import { createProject } from 'create-bunli'
|
|
|
236
226
|
await createProject({
|
|
237
227
|
name: 'my-cli',
|
|
238
228
|
template: 'advanced',
|
|
239
|
-
packageManager: 'bun',
|
|
240
229
|
install: true,
|
|
241
230
|
git: true
|
|
242
231
|
})
|
|
@@ -275,8 +264,8 @@ If you get a "template not found" error, ensure:
|
|
|
275
264
|
|
|
276
265
|
If dependency installation fails:
|
|
277
266
|
- Check your internet connection
|
|
278
|
-
- Ensure
|
|
279
|
-
- Try running with `--no-install` and install manually
|
|
267
|
+
- Ensure Bun is installed correctly
|
|
268
|
+
- Try running with `--no-install` and install manually with `bun install`
|
|
280
269
|
|
|
281
270
|
### Permission errors
|
|
282
271
|
|
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
|
|
|
@@ -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) {
|
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;
|