mirror of
https://github.com/shishantbiswas/bknd.git
synced 2026-03-15 20:17:22 +00:00
finalize deno addition to the cli starters
This commit is contained in:
@@ -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,15 +261,17 @@ async function action(options: {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// update package name
|
// update package name if there is a package.json
|
||||||
await overridePackageJson(
|
if (fs.existsSync(path.resolve(ctx.dir, "package.json"))) {
|
||||||
(pkg) => ({
|
await overridePackageJson(
|
||||||
...pkg,
|
(pkg) => ({
|
||||||
name: ctx.name,
|
...pkg,
|
||||||
}),
|
name: ctx.name,
|
||||||
{ 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 =
|
||||||
|
|||||||
@@ -93,17 +93,19 @@ export async function replacePackageJsonVersions(
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function updateBkndPackages(dir?: string, map?: Record<string, string>) {
|
export async function updateBkndPackages(dir?: string, map?: Record<string, string>) {
|
||||||
const versions = {
|
try {
|
||||||
bknd: await sysGetVersion(),
|
const versions = {
|
||||||
...(map ?? {}),
|
bknd: await sysGetVersion(),
|
||||||
};
|
...(map ?? {}),
|
||||||
await replacePackageJsonVersions(
|
};
|
||||||
async (pkg) => {
|
await replacePackageJsonVersions(
|
||||||
if (pkg in versions) {
|
async (pkg) => {
|
||||||
return versions[pkg];
|
if (pkg in versions) {
|
||||||
}
|
return versions[pkg];
|
||||||
return;
|
}
|
||||||
},
|
return;
|
||||||
{ dir },
|
},
|
||||||
);
|
{ dir },
|
||||||
|
);
|
||||||
|
} catch (e) {}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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"
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user