mirror of
https://github.com/shishantbiswas/bknd.git
synced 2026-03-16 12:37:20 +00:00
refactor console verbosity and internal env handling
This commit is contained in:
@@ -5,7 +5,7 @@ import type { CliCommand } from "cli/types";
|
||||
import { typewriter, wait } from "cli/utils/cli";
|
||||
import { execAsync, getVersion } from "cli/utils/sys";
|
||||
import { Option } from "commander";
|
||||
import { colorizeConsole } from "core";
|
||||
import { env } from "core";
|
||||
import color from "picocolors";
|
||||
import { overridePackageJson, updateBkndPackages } from "./npm";
|
||||
import { type Template, templates } from "./templates";
|
||||
@@ -50,7 +50,6 @@ function errorOutro() {
|
||||
|
||||
async function action(options: { template?: string; dir?: string; integration?: string }) {
|
||||
console.log("");
|
||||
colorizeConsole(console);
|
||||
|
||||
const downloadOpts = {
|
||||
dir: options.dir || "./",
|
||||
@@ -59,7 +58,7 @@ async function action(options: { template?: string; dir?: string; integration?:
|
||||
|
||||
const version = await getVersion();
|
||||
$p.intro(
|
||||
`👋 Welcome to the ${color.bold(color.cyan("bknd"))} create wizard ${color.bold(`v${version}`)}`,
|
||||
`👋 Welcome to the ${color.bold(color.cyan("bknd"))} create cli ${color.bold(`v${version}`)}`,
|
||||
);
|
||||
|
||||
await $p.stream.message(
|
||||
@@ -178,10 +177,11 @@ async function action(options: { template?: string; dir?: string; integration?:
|
||||
const ctx = { template, dir: downloadOpts.dir, name };
|
||||
|
||||
{
|
||||
const ref = process.env.BKND_CLI_CREATE_REF ?? `v${version}`;
|
||||
if (process.env.BKND_CLI_CREATE_REF) {
|
||||
$p.log.warn(color.dim("[DEV] Using local ref: ") + color.yellow(ref));
|
||||
}
|
||||
const ref = env("cli_create_ref", `#v${version}`, {
|
||||
onValid: (given) => {
|
||||
$p.log.warn(color.dim("[DEV] Using local ref: ") + color.yellow(given));
|
||||
},
|
||||
});
|
||||
|
||||
const prefix =
|
||||
template.ref === true
|
||||
|
||||
@@ -8,7 +8,15 @@ export type TemplateSetupCtx = {
|
||||
name: string;
|
||||
};
|
||||
|
||||
export type Integration = "node" | "bun" | "cloudflare" | "nextjs" | "remix" | "astro" | "custom";
|
||||
export type Integration =
|
||||
| "node"
|
||||
| "bun"
|
||||
| "cloudflare"
|
||||
| "nextjs"
|
||||
| "remix"
|
||||
| "astro"
|
||||
| "aws"
|
||||
| "custom";
|
||||
|
||||
type TemplateScripts = "install" | "dev" | "build" | "start";
|
||||
export type Template = {
|
||||
@@ -61,4 +69,12 @@ export const templates: Template[] = [
|
||||
path: "gh:bknd-io/bknd/examples/astro",
|
||||
ref: true,
|
||||
},
|
||||
{
|
||||
key: "aws",
|
||||
title: "AWS Lambda Basic",
|
||||
integration: "aws",
|
||||
description: "A basic bknd AWS Lambda starter",
|
||||
path: "gh:bknd-io/bknd/examples/aws-lambda",
|
||||
ref: true,
|
||||
},
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user