From 424eb658a94b998e652ddcfd3cd72b9bfe718e7a Mon Sep 17 00:00:00 2001 From: Haoqun Jiang Date: Wed, 2 Apr 2025 14:42:36 +0800 Subject: [PATCH] fix: use fileURLToPath instead of pathname --- index.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/index.ts b/index.ts index 0d7e1dfb..e2340627 100755 --- a/index.ts +++ b/index.ts @@ -2,7 +2,7 @@ import * as fs from 'node:fs' import * as path from 'node:path' - +import { fileURLToPath } from 'node:url' import { parseArgs } from 'node:util' import { intro, outro, text, confirm, multiselect, select, isCancel, cancel } from '@clack/prompts' import { red, green, cyan, bold, dim } from 'picocolors' @@ -368,7 +368,7 @@ async function init() { const pkg = { name: result.packageName, version: '0.0.0' } fs.writeFileSync(path.resolve(root, 'package.json'), JSON.stringify(pkg, null, 2)) - const templateRoot = new URL('./template', import.meta.url).pathname + const templateRoot = fileURLToPath(new URL('./template', import.meta.url)) const callbacks = [] const render = function render(templateName) { const templateDir = path.resolve(templateRoot, templateName) -- 2.39.5