create-bunli 0.7.0 → 0.8.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.d.ts +1 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +184 -36
- package/dist/create-project.d.ts +1 -0
- package/dist/create-project.d.ts.map +1 -0
- package/dist/create.d.ts +1 -0
- package/dist/create.d.ts.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +184 -33
- package/dist/steps.d.ts +36 -0
- package/dist/steps.d.ts.map +1 -0
- package/dist/template-engine.d.ts +1 -0
- package/dist/template-engine.d.ts.map +1 -0
- package/dist/templates/advanced/package.json +2 -1
- package/dist/templates/advanced/src/commands/config.ts +2 -1
- package/dist/templates/advanced/src/commands/init.ts +3 -2
- package/dist/templates/advanced/src/commands/serve.ts +2 -1
- package/dist/templates/advanced/src/commands/validate.ts +4 -2
- package/dist/templates/basic/package.json +2 -1
- package/dist/templates/basic/src/commands/hello.ts +3 -2
- package/dist/templates/monorepo/package.json +1 -0
- package/dist/templates/monorepo/packages/cli/package.json +2 -1
- package/dist/templates/monorepo/packages/cli/tsconfig.json +1 -1
- package/dist/templates/monorepo/packages/core/package.json +3 -2
- package/dist/templates/monorepo/packages/core/src/commands/analyze.ts +2 -1
- package/dist/templates/monorepo/packages/core/src/commands/process.ts +2 -1
- package/dist/templates/monorepo/packages/core/tsconfig.json +1 -1
- package/dist/templates/monorepo/packages/utils/package.json +3 -2
- package/dist/templates/monorepo/packages/utils/tsconfig.json +1 -1
- package/dist/types.d.ts +1 -0
- package/dist/types.d.ts.map +1 -0
- package/package.json +9 -8
- package/templates/advanced/package.json +2 -1
- package/templates/advanced/src/commands/config.ts +2 -1
- package/templates/advanced/src/commands/init.ts +3 -2
- package/templates/advanced/src/commands/serve.ts +2 -1
- package/templates/advanced/src/commands/validate.ts +4 -2
- package/templates/basic/package.json +2 -1
- package/templates/basic/src/commands/hello.ts +3 -2
- package/templates/monorepo/package.json +1 -0
- package/templates/monorepo/packages/cli/package.json +2 -1
- package/templates/monorepo/packages/cli/tsconfig.json +1 -1
- package/templates/monorepo/packages/core/package.json +3 -2
- package/templates/monorepo/packages/core/src/commands/analyze.ts +2 -1
- package/templates/monorepo/packages/core/src/commands/process.ts +2 -1
- package/templates/monorepo/packages/core/tsconfig.json +1 -1
- package/templates/monorepo/packages/utils/package.json +3 -2
- package/templates/monorepo/packages/utils/tsconfig.json +1 -1
package/dist/cli.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":""}
|
package/dist/cli.js
CHANGED
|
@@ -158,7 +158,139 @@ async function isLocalTemplate(template) {
|
|
|
158
158
|
return await Bun.file(join(bundledPath, "package.json")).exists();
|
|
159
159
|
}
|
|
160
160
|
|
|
161
|
-
//
|
|
161
|
+
// src/steps.ts
|
|
162
|
+
import { existsSync } from "fs";
|
|
163
|
+
import { join as join2 } from "path";
|
|
164
|
+
var LOCKFILE_MAP = [
|
|
165
|
+
["bun.lock", "bun"],
|
|
166
|
+
["bun.lockb", "bun"],
|
|
167
|
+
["pnpm-lock.yaml", "pnpm"],
|
|
168
|
+
["yarn.lock", "yarn"],
|
|
169
|
+
["package-lock.json", "npm"]
|
|
170
|
+
];
|
|
171
|
+
function detectPackageManager(cwd) {
|
|
172
|
+
const dir = cwd ?? process.cwd();
|
|
173
|
+
for (const [lockfile, manager] of LOCKFILE_MAP) {
|
|
174
|
+
if (existsSync(join2(dir, lockfile))) {
|
|
175
|
+
return manager;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
const userAgent = process.env.npm_config_user_agent;
|
|
179
|
+
if (userAgent) {
|
|
180
|
+
if (userAgent.startsWith("bun"))
|
|
181
|
+
return "bun";
|
|
182
|
+
if (userAgent.startsWith("pnpm"))
|
|
183
|
+
return "pnpm";
|
|
184
|
+
if (userAgent.startsWith("yarn"))
|
|
185
|
+
return "yarn";
|
|
186
|
+
if (userAgent.startsWith("npm"))
|
|
187
|
+
return "npm";
|
|
188
|
+
}
|
|
189
|
+
return "bun";
|
|
190
|
+
}
|
|
191
|
+
function isInGitRepo(cwd) {
|
|
192
|
+
try {
|
|
193
|
+
const result = Bun.spawnSync(["git", "rev-parse", "--is-inside-work-tree"], { cwd: cwd ?? process.cwd(), stdout: "ignore", stderr: "ignore" });
|
|
194
|
+
return result.exitCode === 0;
|
|
195
|
+
} catch {
|
|
196
|
+
return false;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
async function runSteps(dir, steps) {
|
|
200
|
+
for (const step of steps) {
|
|
201
|
+
switch (step.type) {
|
|
202
|
+
case "install":
|
|
203
|
+
await runInstall(dir);
|
|
204
|
+
break;
|
|
205
|
+
case "git-init":
|
|
206
|
+
await runGitInit(dir, step.commit);
|
|
207
|
+
break;
|
|
208
|
+
case "open-editor":
|
|
209
|
+
await runOpenEditor(dir);
|
|
210
|
+
break;
|
|
211
|
+
case "command":
|
|
212
|
+
await runCommand(step.cmd, step.cwd ?? dir);
|
|
213
|
+
break;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
async function runInstall(cwd) {
|
|
218
|
+
const pm = detectPackageManager(cwd);
|
|
219
|
+
const proc = Bun.spawn([pm, "install"], {
|
|
220
|
+
cwd,
|
|
221
|
+
stdout: "pipe",
|
|
222
|
+
stderr: "pipe"
|
|
223
|
+
});
|
|
224
|
+
const exitCode = await proc.exited;
|
|
225
|
+
if (exitCode !== 0) {
|
|
226
|
+
const stderr = await new Response(proc.stderr).text();
|
|
227
|
+
throw new Error(`"${pm} install" exited with code ${exitCode}${stderr ? `: ${stderr.trim()}` : ""}`);
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
async function runGitInit(cwd, commit) {
|
|
231
|
+
await spawnChecked(["git", "init"], cwd, "git init");
|
|
232
|
+
if (commit) {
|
|
233
|
+
await ensureGitIdentity(cwd);
|
|
234
|
+
await spawnChecked(["git", "add", "."], cwd, "git add");
|
|
235
|
+
await spawnChecked(["git", "commit", "-m", commit], cwd, "git commit");
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
async function runOpenEditor(cwd) {
|
|
239
|
+
const editor = process.env.EDITOR || "code";
|
|
240
|
+
try {
|
|
241
|
+
const proc = Bun.spawn([editor, cwd], {
|
|
242
|
+
stdout: "ignore",
|
|
243
|
+
stderr: "ignore"
|
|
244
|
+
});
|
|
245
|
+
const raceResult = await Promise.race([
|
|
246
|
+
proc.exited.then((code) => ({ kind: "exited", code })),
|
|
247
|
+
new Promise((resolve) => setTimeout(() => resolve({ kind: "timeout" }), 500))
|
|
248
|
+
]);
|
|
249
|
+
if (raceResult.kind === "exited" && raceResult.code !== 0) {
|
|
250
|
+
console.warn(`Warning: could not open editor "${editor}" (exit code ${raceResult.code})`);
|
|
251
|
+
}
|
|
252
|
+
} catch {
|
|
253
|
+
console.warn(`Warning: could not open editor "${editor}"`);
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
function getCommandSpawnArgs(cmd, platform = process.platform) {
|
|
257
|
+
return platform === "win32" ? ["cmd", "/d", "/s", "/c", cmd] : ["sh", "-c", cmd];
|
|
258
|
+
}
|
|
259
|
+
async function runCommand(cmd, cwd) {
|
|
260
|
+
const proc = Bun.spawn(getCommandSpawnArgs(cmd), {
|
|
261
|
+
cwd,
|
|
262
|
+
stdout: "inherit",
|
|
263
|
+
stderr: "inherit"
|
|
264
|
+
});
|
|
265
|
+
const exitCode = await proc.exited;
|
|
266
|
+
if (exitCode !== 0) {
|
|
267
|
+
throw new Error(`Command "${cmd}" exited with code ${exitCode}`);
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
async function ensureGitIdentity(cwd) {
|
|
271
|
+
const hasName = Bun.spawnSync(["git", "config", "user.name"], { cwd }).exitCode === 0;
|
|
272
|
+
const hasEmail = Bun.spawnSync(["git", "config", "user.email"], { cwd }).exitCode === 0;
|
|
273
|
+
if (!hasName) {
|
|
274
|
+
await spawnChecked(["git", "config", "user.name", "Bunli"], cwd, "git config user.name");
|
|
275
|
+
}
|
|
276
|
+
if (!hasEmail) {
|
|
277
|
+
await spawnChecked(["git", "config", "user.email", "bunli@scaffolded.project"], cwd, "git config user.email");
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
async function spawnChecked(cmd, cwd, label) {
|
|
281
|
+
const proc = Bun.spawn(cmd, {
|
|
282
|
+
cwd,
|
|
283
|
+
stdout: "ignore",
|
|
284
|
+
stderr: "pipe"
|
|
285
|
+
});
|
|
286
|
+
const exitCode = await proc.exited;
|
|
287
|
+
if (exitCode !== 0) {
|
|
288
|
+
const stderr = await new Response(proc.stderr).text();
|
|
289
|
+
throw new Error(`"${label}" failed with exit code ${exitCode}${stderr ? `: ${stderr.trim()}` : ""}`);
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
// ../../node_modules/.bun/better-result@2.7.0/node_modules/better-result/dist/index.mjs
|
|
162
294
|
function dual(arity, body) {
|
|
163
295
|
if (arity === 2)
|
|
164
296
|
return (...args) => {
|
|
@@ -583,6 +715,34 @@ var Result = {
|
|
|
583
715
|
|
|
584
716
|
// src/create-project.ts
|
|
585
717
|
var toErrorMessage = (error) => error instanceof Error ? error.message : String(error);
|
|
718
|
+
function stepLabel(step) {
|
|
719
|
+
switch (step.type) {
|
|
720
|
+
case "install":
|
|
721
|
+
return {
|
|
722
|
+
running: "Installing dependencies...",
|
|
723
|
+
done: "Dependencies installed",
|
|
724
|
+
failed: "Failed to install dependencies"
|
|
725
|
+
};
|
|
726
|
+
case "git-init":
|
|
727
|
+
return {
|
|
728
|
+
running: "Initializing git repository...",
|
|
729
|
+
done: "Git repository initialized",
|
|
730
|
+
failed: "Failed to initialize git repository"
|
|
731
|
+
};
|
|
732
|
+
case "open-editor":
|
|
733
|
+
return {
|
|
734
|
+
running: "Opening editor...",
|
|
735
|
+
done: "Editor opened",
|
|
736
|
+
failed: "Failed to open editor"
|
|
737
|
+
};
|
|
738
|
+
case "command":
|
|
739
|
+
return {
|
|
740
|
+
running: `Running ${step.cmd}...`,
|
|
741
|
+
done: `Completed ${step.cmd}`,
|
|
742
|
+
failed: `Failed to run ${step.cmd}`
|
|
743
|
+
};
|
|
744
|
+
}
|
|
745
|
+
}
|
|
586
746
|
var tryAsync = (fn, mapError2) => Result.tryPromise({ try: fn, catch: mapError2 });
|
|
587
747
|
|
|
588
748
|
class UserCancelledError extends TaggedError("UserCancelledError")() {
|
|
@@ -655,40 +815,28 @@ async function createProject(options) {
|
|
|
655
815
|
return templateResult;
|
|
656
816
|
}
|
|
657
817
|
spin.succeed("Project structure created");
|
|
818
|
+
const postSteps = [];
|
|
819
|
+
if (install) {
|
|
820
|
+
postSteps.push({ type: "install" });
|
|
821
|
+
}
|
|
658
822
|
if (git) {
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
const gitCommit = await shell`cd ${dir} && git commit -m "feat: initialize ${name} CLI project with Bunli
|
|
664
|
-
|
|
665
|
-
- Generated using create-bunli template
|
|
666
|
-
- Includes basic CLI structure with commands directory
|
|
667
|
-
- Configured with Bunli build system and TypeScript
|
|
668
|
-
- Ready for development with bun run dev"`.nothrow();
|
|
669
|
-
if (gitInit.exitCode === 0 && gitAdd.exitCode === 0 && gitCommit.exitCode === 0) {
|
|
670
|
-
gitSpin.succeed("Git repository initialized");
|
|
671
|
-
} else {
|
|
672
|
-
gitSpin.fail("Failed to initialize git repository");
|
|
673
|
-
const output = [gitInit.stderr, gitAdd.stderr, gitCommit.stderr].map((value) => value.toString().trim()).filter(Boolean).join(`
|
|
674
|
-
`);
|
|
675
|
-
if (output) {
|
|
676
|
-
console.error(colors.dim(` ${output}`));
|
|
677
|
-
}
|
|
678
|
-
}
|
|
823
|
+
postSteps.push({
|
|
824
|
+
type: "git-init",
|
|
825
|
+
commit: `feat: initialize ${name} CLI project with Bunli`
|
|
826
|
+
});
|
|
679
827
|
}
|
|
680
|
-
|
|
681
|
-
const
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
const
|
|
690
|
-
if (
|
|
691
|
-
console.error(colors.dim(` ${
|
|
828
|
+
for (const step of postSteps) {
|
|
829
|
+
const label = stepLabel(step);
|
|
830
|
+
const stepSpin = spinner(label.running);
|
|
831
|
+
stepSpin.start();
|
|
832
|
+
try {
|
|
833
|
+
await runSteps(dir, [step]);
|
|
834
|
+
stepSpin.succeed(label.done);
|
|
835
|
+
} catch (error) {
|
|
836
|
+
stepSpin.fail(label.failed);
|
|
837
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
838
|
+
if (message) {
|
|
839
|
+
console.error(colors.dim(` ${message}`));
|
|
692
840
|
}
|
|
693
841
|
}
|
|
694
842
|
}
|
|
@@ -795,9 +943,9 @@ async function run() {
|
|
|
795
943
|
name: option(z.string().optional(), { description: "Project name" }),
|
|
796
944
|
template: option(z.string().default("basic"), { short: "t", description: "Project template (basic, advanced, monorepo, or github:user/repo)" }),
|
|
797
945
|
dir: option(z.string().optional(), { short: "d", description: "Directory to create project in" }),
|
|
798
|
-
git: option(z.boolean().default(true), { short: "g", description: "Initialize git repository" }),
|
|
799
|
-
install: option(z.boolean().default(true), { short: "i", description: "Install dependencies" }),
|
|
800
|
-
offline: option(z.boolean().default(false), { description: "Use cached templates when available" })
|
|
946
|
+
git: option(z.boolean().default(true), { short: "g", description: "Initialize git repository", argumentKind: "flag" }),
|
|
947
|
+
install: option(z.boolean().default(true), { short: "i", description: "Install dependencies", argumentKind: "flag" }),
|
|
948
|
+
offline: option(z.boolean().default(false), { description: "Use cached templates when available", argumentKind: "flag" })
|
|
801
949
|
},
|
|
802
950
|
handler: async (context) => {
|
|
803
951
|
const result = await create(context);
|
package/dist/create-project.d.ts
CHANGED
|
@@ -35,3 +35,4 @@ declare class TemplateProcessingError extends TemplateProcessingError_base {
|
|
|
35
35
|
export type CreateProjectError = UserCancelledError | ShellCommandError | TemplateProcessingError;
|
|
36
36
|
export declare function createProject(options: CreateProjectOptions): Promise<Result<void, CreateProjectError>>;
|
|
37
37
|
export {};
|
|
38
|
+
//# sourceMappingURL=create-project.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-project.d.ts","sourceRoot":"","sources":["../src/create-project.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAA;AAClE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAI1C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAC/C,OAAO,EAAE,MAAM,EAAe,MAAM,eAAe,CAAA;AAuCnD,UAAU,oBAAqB,SAAQ,aAAa;IAClD,IAAI,EAAE,MAAM,CAAA;IACZ,GAAG,EAAE,MAAM,CAAA;IACX,QAAQ,EAAE,MAAM,CAAA;IAChB,MAAM,EAAE,SAAS,CAAA;IACjB,OAAO,EAAE,oBAAoB,CAAA;IAC7B,MAAM,EAAE,MAAM,CAAA;IACd,KAAK,EAAE,OAAO,GAAG,CAAC,CAAC,CAAA;CACpB;;aAGU,MAAM;;AADjB,qBAAa,kBAAmB,SAAQ,uBAEpC;IACF,YAAY,OAAO,EAAE,MAAM,EAE1B;CACF;;aAGU,MAAM;aACN,MAAM;YACP,MAAM;;AAHhB,cAAM,iBAAkB,SAAQ,sBAI5B;IACF,YAAY,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAM1C;CACF;;aAGU,MAAM;WACR,OAAO;;AAFhB,cAAM,uBAAwB,SAAQ,4BAGlC;IACF,YAAY,KAAK,EAAE,OAAO,EAEzB;CACF;AAED,MAAM,MAAM,kBAAkB,GAAG,kBAAkB,GAAG,iBAAiB,GAAG,uBAAuB,CAAA;AAEjG,wBAAsB,aAAa,CACjC,OAAO,EAAE,oBAAoB,GAC5B,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,kBAAkB,CAAC,CAAC,CAiG3C"}
|
package/dist/create.d.ts
CHANGED
|
@@ -24,3 +24,4 @@ export declare class UserCancelledError extends UserCancelledError_base {
|
|
|
24
24
|
export type CreateCommandError = InvalidProjectNameError | UserCancelledError | CreateProjectError;
|
|
25
25
|
export declare function create(context: HandlerArgs<CreateOptions>): Promise<Result<void, CreateCommandError>>;
|
|
26
26
|
export {};
|
|
27
|
+
//# sourceMappingURL=create.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../src/create.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAC9C,OAAO,EAEL,KAAK,kBAAkB,EAExB,MAAM,qBAAqB,CAAA;AAE5B,OAAO,EAAE,MAAM,EAAe,MAAM,eAAe,CAAA;AAEnD,UAAU,aAAa;IACrB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,MAAM,CAAA;IAChB,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,GAAG,EAAE,OAAO,CAAA;IACZ,OAAO,EAAE,OAAO,CAAA;IAChB,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;;aAGU,MAAM;;AADjB,cAAM,uBAAwB,SAAQ,4BAElC;IACF,YAAY,IAAI,EAAE,MAAM,EAEvB;CACF;;aAGU,MAAM;;AADjB,qBAAa,kBAAmB,SAAQ,uBAEpC;IACF,YAAY,OAAO,EAAE,MAAM,EAE1B;CACF;AAED,MAAM,MAAM,kBAAkB,GAAG,uBAAuB,GAAG,kBAAkB,GAAG,kBAAkB,CAAA;AAElG,wBAAsB,MAAM,CAC1B,OAAO,EAAE,WAAW,CAAC,aAAa,CAAC,GAClC,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,kBAAkB,CAAC,CAAC,CA8E3C"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
export { createProject } from './create-project.js';
|
|
2
2
|
export { processTemplate, resolveTemplateSource, isLocalTemplate } from './template-engine.js';
|
|
3
|
+
export { runSteps, detectPackageManager, isInGitRepo } from './steps.js';
|
|
4
|
+
export type { Step, PackageManager } from './steps.js';
|
|
3
5
|
export type { CreateOptions, ProjectConfig, TemplateManifest, TemplateVariable } from './types.js';
|
|
4
6
|
export declare const version = "0.1.0";
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AACnD,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAC9F,OAAO,EAAE,QAAQ,EAAE,oBAAoB,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AACxE,YAAY,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AACtD,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAGlG,eAAO,MAAM,OAAO,UAAU,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -152,7 +152,139 @@ async function isLocalTemplate(template) {
|
|
|
152
152
|
return await Bun.file(join(bundledPath, "package.json")).exists();
|
|
153
153
|
}
|
|
154
154
|
|
|
155
|
-
//
|
|
155
|
+
// src/steps.ts
|
|
156
|
+
import { existsSync } from "fs";
|
|
157
|
+
import { join as join2 } from "path";
|
|
158
|
+
var LOCKFILE_MAP = [
|
|
159
|
+
["bun.lock", "bun"],
|
|
160
|
+
["bun.lockb", "bun"],
|
|
161
|
+
["pnpm-lock.yaml", "pnpm"],
|
|
162
|
+
["yarn.lock", "yarn"],
|
|
163
|
+
["package-lock.json", "npm"]
|
|
164
|
+
];
|
|
165
|
+
function detectPackageManager(cwd) {
|
|
166
|
+
const dir = cwd ?? process.cwd();
|
|
167
|
+
for (const [lockfile, manager] of LOCKFILE_MAP) {
|
|
168
|
+
if (existsSync(join2(dir, lockfile))) {
|
|
169
|
+
return manager;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
const userAgent = process.env.npm_config_user_agent;
|
|
173
|
+
if (userAgent) {
|
|
174
|
+
if (userAgent.startsWith("bun"))
|
|
175
|
+
return "bun";
|
|
176
|
+
if (userAgent.startsWith("pnpm"))
|
|
177
|
+
return "pnpm";
|
|
178
|
+
if (userAgent.startsWith("yarn"))
|
|
179
|
+
return "yarn";
|
|
180
|
+
if (userAgent.startsWith("npm"))
|
|
181
|
+
return "npm";
|
|
182
|
+
}
|
|
183
|
+
return "bun";
|
|
184
|
+
}
|
|
185
|
+
function isInGitRepo(cwd) {
|
|
186
|
+
try {
|
|
187
|
+
const result = Bun.spawnSync(["git", "rev-parse", "--is-inside-work-tree"], { cwd: cwd ?? process.cwd(), stdout: "ignore", stderr: "ignore" });
|
|
188
|
+
return result.exitCode === 0;
|
|
189
|
+
} catch {
|
|
190
|
+
return false;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
async function runSteps(dir, steps) {
|
|
194
|
+
for (const step of steps) {
|
|
195
|
+
switch (step.type) {
|
|
196
|
+
case "install":
|
|
197
|
+
await runInstall(dir);
|
|
198
|
+
break;
|
|
199
|
+
case "git-init":
|
|
200
|
+
await runGitInit(dir, step.commit);
|
|
201
|
+
break;
|
|
202
|
+
case "open-editor":
|
|
203
|
+
await runOpenEditor(dir);
|
|
204
|
+
break;
|
|
205
|
+
case "command":
|
|
206
|
+
await runCommand(step.cmd, step.cwd ?? dir);
|
|
207
|
+
break;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
async function runInstall(cwd) {
|
|
212
|
+
const pm = detectPackageManager(cwd);
|
|
213
|
+
const proc = Bun.spawn([pm, "install"], {
|
|
214
|
+
cwd,
|
|
215
|
+
stdout: "pipe",
|
|
216
|
+
stderr: "pipe"
|
|
217
|
+
});
|
|
218
|
+
const exitCode = await proc.exited;
|
|
219
|
+
if (exitCode !== 0) {
|
|
220
|
+
const stderr = await new Response(proc.stderr).text();
|
|
221
|
+
throw new Error(`"${pm} install" exited with code ${exitCode}${stderr ? `: ${stderr.trim()}` : ""}`);
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
async function runGitInit(cwd, commit) {
|
|
225
|
+
await spawnChecked(["git", "init"], cwd, "git init");
|
|
226
|
+
if (commit) {
|
|
227
|
+
await ensureGitIdentity(cwd);
|
|
228
|
+
await spawnChecked(["git", "add", "."], cwd, "git add");
|
|
229
|
+
await spawnChecked(["git", "commit", "-m", commit], cwd, "git commit");
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
async function runOpenEditor(cwd) {
|
|
233
|
+
const editor = process.env.EDITOR || "code";
|
|
234
|
+
try {
|
|
235
|
+
const proc = Bun.spawn([editor, cwd], {
|
|
236
|
+
stdout: "ignore",
|
|
237
|
+
stderr: "ignore"
|
|
238
|
+
});
|
|
239
|
+
const raceResult = await Promise.race([
|
|
240
|
+
proc.exited.then((code) => ({ kind: "exited", code })),
|
|
241
|
+
new Promise((resolve) => setTimeout(() => resolve({ kind: "timeout" }), 500))
|
|
242
|
+
]);
|
|
243
|
+
if (raceResult.kind === "exited" && raceResult.code !== 0) {
|
|
244
|
+
console.warn(`Warning: could not open editor "${editor}" (exit code ${raceResult.code})`);
|
|
245
|
+
}
|
|
246
|
+
} catch {
|
|
247
|
+
console.warn(`Warning: could not open editor "${editor}"`);
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
function getCommandSpawnArgs(cmd, platform = process.platform) {
|
|
251
|
+
return platform === "win32" ? ["cmd", "/d", "/s", "/c", cmd] : ["sh", "-c", cmd];
|
|
252
|
+
}
|
|
253
|
+
async function runCommand(cmd, cwd) {
|
|
254
|
+
const proc = Bun.spawn(getCommandSpawnArgs(cmd), {
|
|
255
|
+
cwd,
|
|
256
|
+
stdout: "inherit",
|
|
257
|
+
stderr: "inherit"
|
|
258
|
+
});
|
|
259
|
+
const exitCode = await proc.exited;
|
|
260
|
+
if (exitCode !== 0) {
|
|
261
|
+
throw new Error(`Command "${cmd}" exited with code ${exitCode}`);
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
async function ensureGitIdentity(cwd) {
|
|
265
|
+
const hasName = Bun.spawnSync(["git", "config", "user.name"], { cwd }).exitCode === 0;
|
|
266
|
+
const hasEmail = Bun.spawnSync(["git", "config", "user.email"], { cwd }).exitCode === 0;
|
|
267
|
+
if (!hasName) {
|
|
268
|
+
await spawnChecked(["git", "config", "user.name", "Bunli"], cwd, "git config user.name");
|
|
269
|
+
}
|
|
270
|
+
if (!hasEmail) {
|
|
271
|
+
await spawnChecked(["git", "config", "user.email", "bunli@scaffolded.project"], cwd, "git config user.email");
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
async function spawnChecked(cmd, cwd, label) {
|
|
275
|
+
const proc = Bun.spawn(cmd, {
|
|
276
|
+
cwd,
|
|
277
|
+
stdout: "ignore",
|
|
278
|
+
stderr: "pipe"
|
|
279
|
+
});
|
|
280
|
+
const exitCode = await proc.exited;
|
|
281
|
+
if (exitCode !== 0) {
|
|
282
|
+
const stderr = await new Response(proc.stderr).text();
|
|
283
|
+
throw new Error(`"${label}" failed with exit code ${exitCode}${stderr ? `: ${stderr.trim()}` : ""}`);
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
// ../../node_modules/.bun/better-result@2.7.0/node_modules/better-result/dist/index.mjs
|
|
156
288
|
function dual(arity, body) {
|
|
157
289
|
if (arity === 2)
|
|
158
290
|
return (...args) => {
|
|
@@ -577,6 +709,34 @@ var Result = {
|
|
|
577
709
|
|
|
578
710
|
// src/create-project.ts
|
|
579
711
|
var toErrorMessage = (error) => error instanceof Error ? error.message : String(error);
|
|
712
|
+
function stepLabel(step) {
|
|
713
|
+
switch (step.type) {
|
|
714
|
+
case "install":
|
|
715
|
+
return {
|
|
716
|
+
running: "Installing dependencies...",
|
|
717
|
+
done: "Dependencies installed",
|
|
718
|
+
failed: "Failed to install dependencies"
|
|
719
|
+
};
|
|
720
|
+
case "git-init":
|
|
721
|
+
return {
|
|
722
|
+
running: "Initializing git repository...",
|
|
723
|
+
done: "Git repository initialized",
|
|
724
|
+
failed: "Failed to initialize git repository"
|
|
725
|
+
};
|
|
726
|
+
case "open-editor":
|
|
727
|
+
return {
|
|
728
|
+
running: "Opening editor...",
|
|
729
|
+
done: "Editor opened",
|
|
730
|
+
failed: "Failed to open editor"
|
|
731
|
+
};
|
|
732
|
+
case "command":
|
|
733
|
+
return {
|
|
734
|
+
running: `Running ${step.cmd}...`,
|
|
735
|
+
done: `Completed ${step.cmd}`,
|
|
736
|
+
failed: `Failed to run ${step.cmd}`
|
|
737
|
+
};
|
|
738
|
+
}
|
|
739
|
+
}
|
|
580
740
|
var tryAsync = (fn, mapError2) => Result.tryPromise({ try: fn, catch: mapError2 });
|
|
581
741
|
|
|
582
742
|
class UserCancelledError extends TaggedError("UserCancelledError")() {
|
|
@@ -649,40 +809,28 @@ async function createProject(options) {
|
|
|
649
809
|
return templateResult;
|
|
650
810
|
}
|
|
651
811
|
spin.succeed("Project structure created");
|
|
812
|
+
const postSteps = [];
|
|
813
|
+
if (install) {
|
|
814
|
+
postSteps.push({ type: "install" });
|
|
815
|
+
}
|
|
652
816
|
if (git) {
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
const gitCommit = await shell`cd ${dir} && git commit -m "feat: initialize ${name} CLI project with Bunli
|
|
658
|
-
|
|
659
|
-
- Generated using create-bunli template
|
|
660
|
-
- Includes basic CLI structure with commands directory
|
|
661
|
-
- Configured with Bunli build system and TypeScript
|
|
662
|
-
- Ready for development with bun run dev"`.nothrow();
|
|
663
|
-
if (gitInit.exitCode === 0 && gitAdd.exitCode === 0 && gitCommit.exitCode === 0) {
|
|
664
|
-
gitSpin.succeed("Git repository initialized");
|
|
665
|
-
} else {
|
|
666
|
-
gitSpin.fail("Failed to initialize git repository");
|
|
667
|
-
const output = [gitInit.stderr, gitAdd.stderr, gitCommit.stderr].map((value) => value.toString().trim()).filter(Boolean).join(`
|
|
668
|
-
`);
|
|
669
|
-
if (output) {
|
|
670
|
-
console.error(colors.dim(` ${output}`));
|
|
671
|
-
}
|
|
672
|
-
}
|
|
817
|
+
postSteps.push({
|
|
818
|
+
type: "git-init",
|
|
819
|
+
commit: `feat: initialize ${name} CLI project with Bunli`
|
|
820
|
+
});
|
|
673
821
|
}
|
|
674
|
-
|
|
675
|
-
const
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
const
|
|
684
|
-
if (
|
|
685
|
-
console.error(colors.dim(` ${
|
|
822
|
+
for (const step of postSteps) {
|
|
823
|
+
const label = stepLabel(step);
|
|
824
|
+
const stepSpin = spinner(label.running);
|
|
825
|
+
stepSpin.start();
|
|
826
|
+
try {
|
|
827
|
+
await runSteps(dir, [step]);
|
|
828
|
+
stepSpin.succeed(label.done);
|
|
829
|
+
} catch (error) {
|
|
830
|
+
stepSpin.fail(label.failed);
|
|
831
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
832
|
+
if (message) {
|
|
833
|
+
console.error(colors.dim(` ${message}`));
|
|
686
834
|
}
|
|
687
835
|
}
|
|
688
836
|
}
|
|
@@ -693,8 +841,11 @@ async function createProject(options) {
|
|
|
693
841
|
var version = "0.1.0";
|
|
694
842
|
export {
|
|
695
843
|
version,
|
|
844
|
+
runSteps,
|
|
696
845
|
resolveTemplateSource,
|
|
697
846
|
processTemplate,
|
|
698
847
|
isLocalTemplate,
|
|
848
|
+
isInGitRepo,
|
|
849
|
+
detectPackageManager,
|
|
699
850
|
createProject
|
|
700
851
|
};
|
package/dist/steps.d.ts
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A declarative step to run after scaffolding completes.
|
|
3
|
+
* Steps are executed sequentially in array order by {@link runSteps}.
|
|
4
|
+
*/
|
|
5
|
+
export type Step = {
|
|
6
|
+
readonly type: 'install';
|
|
7
|
+
} | {
|
|
8
|
+
readonly type: 'git-init';
|
|
9
|
+
readonly commit?: string;
|
|
10
|
+
} | {
|
|
11
|
+
readonly type: 'open-editor';
|
|
12
|
+
} | {
|
|
13
|
+
readonly type: 'command';
|
|
14
|
+
readonly cmd: string;
|
|
15
|
+
readonly cwd?: string;
|
|
16
|
+
};
|
|
17
|
+
export type PackageManager = 'bun' | 'npm' | 'pnpm' | 'yarn';
|
|
18
|
+
/**
|
|
19
|
+
* Detect the package manager for a project directory.
|
|
20
|
+
*
|
|
21
|
+
* 1. Lockfile probe (bun -> pnpm -> yarn -> npm)
|
|
22
|
+
* 2. npm_config_user_agent environment variable
|
|
23
|
+
* 3. Default to "bun" (this is a Bun-first framework)
|
|
24
|
+
*/
|
|
25
|
+
export declare function detectPackageManager(cwd?: string): PackageManager;
|
|
26
|
+
/**
|
|
27
|
+
* Check whether a directory is inside an existing git repository.
|
|
28
|
+
*/
|
|
29
|
+
export declare function isInGitRepo(cwd?: string): boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Execute an array of post-scaffold steps sequentially.
|
|
32
|
+
* If any step fails, the error propagates immediately (remaining steps are skipped).
|
|
33
|
+
*/
|
|
34
|
+
export declare function runSteps(dir: string, steps: Step[]): Promise<void>;
|
|
35
|
+
export declare function getCommandSpawnArgs(cmd: string, platform?: NodeJS.Platform): string[];
|
|
36
|
+
//# sourceMappingURL=steps.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"steps.d.ts","sourceRoot":"","sources":["../src/steps.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,MAAM,MAAM,IAAI,GACZ;IAAE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAA;CAAE,GAC5B;IAAE,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,GACvD;IAAE,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAA;CAAE,GAChC;IAAE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IAAC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,CAAA;AAE7E,MAAM,MAAM,cAAc,GAAG,KAAK,GAAG,KAAK,GAAG,MAAM,GAAG,MAAM,CAAA;AAU5D;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,cAAc,CAkBjE;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,OAAO,CAUjD;AAED;;;GAGG;AACH,wBAAsB,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAiBxE;AAiDD,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,GAAE,MAAM,CAAC,QAA2B,GAAG,MAAM,EAAE,CAIvG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"template-engine.d.ts","sourceRoot":"","sources":["../src/template-engine.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAElD,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,CAAC,EAAE,QAAQ,GAAG,KAAK,GAAG,OAAO,GAAG,SAAS,CAAA;IAC7C,GAAG,EAAE,MAAM,CAAA;IACX,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CACnC;AAED;;GAEG;AACH,wBAAsB,eAAe,CAAC,OAAO,EAAE,eAAe;;;GA6C7D;AAqJD;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAwB9D;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE3D;AAED;;GAEG;AACH,wBAAsB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAQxE"}
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"build": "bunli build",
|
|
15
15
|
"test": "bun test",
|
|
16
16
|
"test:watch": "bun test --watch",
|
|
17
|
-
"typecheck": "
|
|
17
|
+
"typecheck": "tsgo --noEmit",
|
|
18
18
|
"lint": "tsc --noEmit",
|
|
19
19
|
"prepare": "bun run build"
|
|
20
20
|
},
|
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
"zod": "^3.22.0"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
|
+
"@tsconfig/bun": "catalog:",
|
|
28
29
|
"@bunli/test": "latest",
|
|
29
30
|
"@types/bun": "latest",
|
|
30
31
|
"bunli": "latest",
|
|
@@ -10,7 +10,8 @@ const initCommand = defineCommand({
|
|
|
10
10
|
z.boolean().default(false),
|
|
11
11
|
{
|
|
12
12
|
short: 'f',
|
|
13
|
-
description: 'Overwrite existing config'
|
|
13
|
+
description: 'Overwrite existing config',
|
|
14
|
+
argumentKind: 'flag'
|
|
14
15
|
}
|
|
15
16
|
),
|
|
16
17
|
template: option(
|
|
@@ -152,4 +153,4 @@ export default defineConfig({
|
|
|
152
153
|
return templates[template]
|
|
153
154
|
}
|
|
154
155
|
|
|
155
|
-
export default initCommand
|
|
156
|
+
export default initCommand
|
|
@@ -19,13 +19,15 @@ const validateCommand = defineCommand({
|
|
|
19
19
|
z.boolean().default(false),
|
|
20
20
|
{
|
|
21
21
|
short: 'f',
|
|
22
|
-
description: 'Auto-fix issues'
|
|
22
|
+
description: 'Auto-fix issues',
|
|
23
|
+
argumentKind: 'flag'
|
|
23
24
|
}
|
|
24
25
|
),
|
|
25
26
|
cache: option(
|
|
26
27
|
z.boolean().default(true),
|
|
27
28
|
{
|
|
28
|
-
description: 'Enable caching'
|
|
29
|
+
description: 'Enable caching',
|
|
30
|
+
argumentKind: 'flag'
|
|
29
31
|
}
|
|
30
32
|
)
|
|
31
33
|
},
|
|
@@ -12,12 +12,13 @@
|
|
|
12
12
|
"dev": "bun run src/index.ts",
|
|
13
13
|
"build": "bunli build",
|
|
14
14
|
"test": "bun test",
|
|
15
|
-
"typecheck": "
|
|
15
|
+
"typecheck": "tsgo --noEmit"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"@bunli/core": "latest"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
|
+
"@tsconfig/bun": "catalog:",
|
|
21
22
|
"@bunli/test": "latest",
|
|
22
23
|
"@types/bun": "latest",
|
|
23
24
|
"bunli": "latest",
|
|
@@ -16,7 +16,8 @@ const helloCommand = defineCommand({
|
|
|
16
16
|
z.boolean().default(false),
|
|
17
17
|
{
|
|
18
18
|
description: 'Add excitement!',
|
|
19
|
-
short: 'e'
|
|
19
|
+
short: 'e',
|
|
20
|
+
argumentKind: 'flag'
|
|
20
21
|
}
|
|
21
22
|
)
|
|
22
23
|
},
|
|
@@ -28,4 +29,4 @@ const helloCommand = defineCommand({
|
|
|
28
29
|
}
|
|
29
30
|
})
|
|
30
31
|
|
|
31
|
-
export default helloCommand
|
|
32
|
+
export default helloCommand
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"dev": "bun run src/index.ts",
|
|
14
14
|
"build": "bunli build",
|
|
15
15
|
"test": "bun test",
|
|
16
|
-
"typecheck": "
|
|
16
|
+
"typecheck": "tsgo --noEmit",
|
|
17
17
|
"clean": "rm -rf dist"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
"@{{name}}/utils": "workspace:^"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
|
+
"@tsconfig/bun": "catalog:",
|
|
25
26
|
"@bunli/test": "latest",
|
|
26
27
|
"@types/bun": "latest",
|
|
27
28
|
"bunli": "latest",
|
|
@@ -14,9 +14,9 @@
|
|
|
14
14
|
}
|
|
15
15
|
},
|
|
16
16
|
"scripts": {
|
|
17
|
-
"build": "bun scripts/build.ts && bun run
|
|
17
|
+
"build": "bun scripts/build.ts && bun run tsgo",
|
|
18
18
|
"test": "bun test",
|
|
19
|
-
"typecheck": "
|
|
19
|
+
"typecheck": "tsgo --noEmit",
|
|
20
20
|
"clean": "rm -rf dist"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
"zod": "^3.22.0"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
|
+
"@tsconfig/bun": "catalog:",
|
|
28
29
|
"@bunli/test": "latest",
|
|
29
30
|
"@types/bun": "latest",
|
|
30
31
|
"typescript": "^5.0.0"
|
|
@@ -14,12 +14,13 @@
|
|
|
14
14
|
}
|
|
15
15
|
},
|
|
16
16
|
"scripts": {
|
|
17
|
-
"build": "bun scripts/build.ts && bun run
|
|
17
|
+
"build": "bun scripts/build.ts && bun run tsgo",
|
|
18
18
|
"test": "bun test",
|
|
19
|
-
"typecheck": "
|
|
19
|
+
"typecheck": "tsgo --noEmit",
|
|
20
20
|
"clean": "rm -rf dist"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
|
+
"@tsconfig/bun": "catalog:",
|
|
23
24
|
"@types/bun": "latest",
|
|
24
25
|
"typescript": "^5.0.0"
|
|
25
26
|
}
|
package/dist/types.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,GAAG,CAAC,EAAE,OAAO,CAAA;IACb,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,MAAM,CAAA;IAChB,OAAO,EAAE,OAAO,CAAA;IAChB,GAAG,EAAE,OAAO,CAAA;IACZ,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAED,MAAM,WAAW,gBAAgB;IAC/B,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,SAAS,CAAC,EAAE,gBAAgB,EAAE,CAAA;IAC9B,KAAK,CAAC,EAAE;QACN,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;QAClB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;KACnB,CAAA;IACD,KAAK,CAAC,EAAE;QACN,WAAW,CAAC,EAAE,MAAM,EAAE,CAAA;KACvB,CAAA;IACD,YAAY,CAAC,EAAE;QACb,IAAI,CAAC,EAAE,MAAM,CAAA;QACb,GAAG,CAAC,EAAE,MAAM,CAAA;KACb,CAAA;CACF;AAED,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;IACf,IAAI,CAAC,EAAE,QAAQ,GAAG,SAAS,GAAG,QAAQ,GAAG,QAAQ,CAAA;IACjD,OAAO,CAAC,EAAE,GAAG,CAAA;IACb,OAAO,CAAC,EAAE,KAAK,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,GAAG,CAAA;KAAE,CAAC,CAAA;IAC9C,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,OAAO,GAAG,MAAM,CAAA;CAC5C;AAGD,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,EAAE,MAAM,CAAA;IACnB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAC9B"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-bunli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Scaffold new Bunli CLI projects",
|
|
6
6
|
"bin": {
|
|
@@ -41,21 +41,22 @@
|
|
|
41
41
|
],
|
|
42
42
|
"scripts": {
|
|
43
43
|
"dev": "bun run src/cli.ts",
|
|
44
|
-
"build": "bun scripts/build.ts && bun run
|
|
44
|
+
"build": "bun scripts/build.ts && bun run tsgo",
|
|
45
45
|
"test": "bun test",
|
|
46
|
-
"typecheck": "
|
|
46
|
+
"typecheck": "tsgo --noEmit",
|
|
47
47
|
"prepublishOnly": "bun run build"
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"@bunli/core": "^0.
|
|
51
|
-
"@bunli/test": "^0.
|
|
52
|
-
"@bunli/utils": "^0.
|
|
50
|
+
"@bunli/core": "^0.9.0",
|
|
51
|
+
"@bunli/test": "^0.6.0",
|
|
52
|
+
"@bunli/utils": "^0.6.0",
|
|
53
53
|
"better-result": "^2.7.0",
|
|
54
54
|
"giget": "^2.0.0",
|
|
55
55
|
"zod": "^4.3.6"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
|
-
"@
|
|
59
|
-
"
|
|
58
|
+
"@tsconfig/bun": "1.0.10",
|
|
59
|
+
"@types/bun": "1.3.10",
|
|
60
|
+
"typescript": "^6.0.2"
|
|
60
61
|
}
|
|
61
62
|
}
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"build": "bunli build",
|
|
15
15
|
"test": "bun test",
|
|
16
16
|
"test:watch": "bun test --watch",
|
|
17
|
-
"typecheck": "
|
|
17
|
+
"typecheck": "tsgo --noEmit",
|
|
18
18
|
"lint": "tsc --noEmit",
|
|
19
19
|
"prepare": "bun run build"
|
|
20
20
|
},
|
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
"zod": "^3.22.0"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
|
+
"@tsconfig/bun": "catalog:",
|
|
28
29
|
"@bunli/test": "latest",
|
|
29
30
|
"@types/bun": "latest",
|
|
30
31
|
"bunli": "latest",
|
|
@@ -10,7 +10,8 @@ const initCommand = defineCommand({
|
|
|
10
10
|
z.boolean().default(false),
|
|
11
11
|
{
|
|
12
12
|
short: 'f',
|
|
13
|
-
description: 'Overwrite existing config'
|
|
13
|
+
description: 'Overwrite existing config',
|
|
14
|
+
argumentKind: 'flag'
|
|
14
15
|
}
|
|
15
16
|
),
|
|
16
17
|
template: option(
|
|
@@ -152,4 +153,4 @@ export default defineConfig({
|
|
|
152
153
|
return templates[template]
|
|
153
154
|
}
|
|
154
155
|
|
|
155
|
-
export default initCommand
|
|
156
|
+
export default initCommand
|
|
@@ -19,13 +19,15 @@ const validateCommand = defineCommand({
|
|
|
19
19
|
z.boolean().default(false),
|
|
20
20
|
{
|
|
21
21
|
short: 'f',
|
|
22
|
-
description: 'Auto-fix issues'
|
|
22
|
+
description: 'Auto-fix issues',
|
|
23
|
+
argumentKind: 'flag'
|
|
23
24
|
}
|
|
24
25
|
),
|
|
25
26
|
cache: option(
|
|
26
27
|
z.boolean().default(true),
|
|
27
28
|
{
|
|
28
|
-
description: 'Enable caching'
|
|
29
|
+
description: 'Enable caching',
|
|
30
|
+
argumentKind: 'flag'
|
|
29
31
|
}
|
|
30
32
|
)
|
|
31
33
|
},
|
|
@@ -12,12 +12,13 @@
|
|
|
12
12
|
"dev": "bun run src/index.ts",
|
|
13
13
|
"build": "bunli build",
|
|
14
14
|
"test": "bun test",
|
|
15
|
-
"typecheck": "
|
|
15
|
+
"typecheck": "tsgo --noEmit"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"@bunli/core": "latest"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
|
+
"@tsconfig/bun": "catalog:",
|
|
21
22
|
"@bunli/test": "latest",
|
|
22
23
|
"@types/bun": "latest",
|
|
23
24
|
"bunli": "latest",
|
|
@@ -16,7 +16,8 @@ const helloCommand = defineCommand({
|
|
|
16
16
|
z.boolean().default(false),
|
|
17
17
|
{
|
|
18
18
|
description: 'Add excitement!',
|
|
19
|
-
short: 'e'
|
|
19
|
+
short: 'e',
|
|
20
|
+
argumentKind: 'flag'
|
|
20
21
|
}
|
|
21
22
|
)
|
|
22
23
|
},
|
|
@@ -28,4 +29,4 @@ const helloCommand = defineCommand({
|
|
|
28
29
|
}
|
|
29
30
|
})
|
|
30
31
|
|
|
31
|
-
export default helloCommand
|
|
32
|
+
export default helloCommand
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"dev": "bun run src/index.ts",
|
|
14
14
|
"build": "bunli build",
|
|
15
15
|
"test": "bun test",
|
|
16
|
-
"typecheck": "
|
|
16
|
+
"typecheck": "tsgo --noEmit",
|
|
17
17
|
"clean": "rm -rf dist"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
"@{{name}}/utils": "workspace:^"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
|
+
"@tsconfig/bun": "catalog:",
|
|
25
26
|
"@bunli/test": "latest",
|
|
26
27
|
"@types/bun": "latest",
|
|
27
28
|
"bunli": "latest",
|
|
@@ -14,9 +14,9 @@
|
|
|
14
14
|
}
|
|
15
15
|
},
|
|
16
16
|
"scripts": {
|
|
17
|
-
"build": "bun scripts/build.ts && bun run
|
|
17
|
+
"build": "bun scripts/build.ts && bun run tsgo",
|
|
18
18
|
"test": "bun test",
|
|
19
|
-
"typecheck": "
|
|
19
|
+
"typecheck": "tsgo --noEmit",
|
|
20
20
|
"clean": "rm -rf dist"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
"zod": "^3.22.0"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
|
+
"@tsconfig/bun": "catalog:",
|
|
28
29
|
"@bunli/test": "latest",
|
|
29
30
|
"@types/bun": "latest",
|
|
30
31
|
"typescript": "^5.0.0"
|
|
@@ -14,12 +14,13 @@
|
|
|
14
14
|
}
|
|
15
15
|
},
|
|
16
16
|
"scripts": {
|
|
17
|
-
"build": "bun scripts/build.ts && bun run
|
|
17
|
+
"build": "bun scripts/build.ts && bun run tsgo",
|
|
18
18
|
"test": "bun test",
|
|
19
|
-
"typecheck": "
|
|
19
|
+
"typecheck": "tsgo --noEmit",
|
|
20
20
|
"clean": "rm -rf dist"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
|
+
"@tsconfig/bun": "catalog:",
|
|
23
24
|
"@types/bun": "latest",
|
|
24
25
|
"typescript": "^5.0.0"
|
|
25
26
|
}
|