finalize deno addition to the cli starters

This commit is contained in:
dswbx
2025-10-25 10:26:05 +02:00
parent b787837dd2
commit 2fd5e71574
3 changed files with 30 additions and 22 deletions

View File

@@ -10,6 +10,7 @@ import color from "picocolors";
import { overridePackageJson, updateBkndPackages } from "./npm"; import { overridePackageJson, updateBkndPackages } from "./npm";
import { type Template, templates, type TemplateSetupCtx } from "./templates"; import { type Template, templates, type TemplateSetupCtx } from "./templates";
import { createScoped, flush } from "cli/utils/telemetry"; import { createScoped, flush } from "cli/utils/telemetry";
import path from "node:path";
const config = { const config = {
types: { types: {
@@ -260,7 +261,8 @@ async function action(options: {
} }
} }
// update package name // update package name if there is a package.json
if (fs.existsSync(path.resolve(ctx.dir, "package.json"))) {
await overridePackageJson( await overridePackageJson(
(pkg) => ({ (pkg) => ({
...pkg, ...pkg,
@@ -269,6 +271,7 @@ async function action(options: {
{ dir: ctx.dir }, { dir: ctx.dir },
); );
$p.log.success(`Updated package name to ${color.cyan(ctx.name)}`); $p.log.success(`Updated package name to ${color.cyan(ctx.name)}`);
}
if (template.installDeps !== false) { if (template.installDeps !== false) {
const install = const install =

View File

@@ -93,6 +93,7 @@ export async function replacePackageJsonVersions(
} }
export async function updateBkndPackages(dir?: string, map?: Record<string, string>) { export async function updateBkndPackages(dir?: string, map?: Record<string, string>) {
try {
const versions = { const versions = {
bknd: await sysGetVersion(), bknd: await sysGetVersion(),
...(map ?? {}), ...(map ?? {}),
@@ -106,4 +107,5 @@ export async function updateBkndPackages(dir?: string, map?: Record<string, stri
}, },
{ dir }, { dir },
); );
} catch (e) {}
} }

View File

@@ -1,5 +1,8 @@
{ {
"nodeModulesDir": "auto", "nodeModulesDir": "auto",
"tasks": {
"dev": "deno serve -A --watch main.ts"
},
"imports": { "imports": {
"bknd": "npm:bknd@0.19.0-rc.1" "bknd": "npm:bknd@0.19.0-rc.1"
}, },