diff --git a/package.json b/package.json index a921ce3..565686e 100644 --- a/package.json +++ b/package.json @@ -14,8 +14,7 @@ "build": "pnpm -F vitepress-theme-mild run build", "build:dev": "pnpm -F create-mild-theme run build", "demo:build": "pnpm -F demo run build", - "release": "pnpm -F vitepress-theme-mild run release", - "cli:release": "pnpm -F create-mild-theme run release", + "release": "pnpm -F vitepress-theme-mild run release && pnpm -F create-mild-theme run release", "demo:preview": "pnpm -F demo run preview", "prepare": "simple-git-hooks", "commit": "git-cz" diff --git a/packages/create-theme/src/index.ts b/packages/create-theme/src/index.ts index 7234c35..7dc26f3 100644 --- a/packages/create-theme/src/index.ts +++ b/packages/create-theme/src/index.ts @@ -16,6 +16,14 @@ export async function bootstrap() { const targetPath = path.resolve(process.cwd(), packageName); fs.copySync(templatePath, targetPath); fs.renameSync(path.resolve(targetPath, '_gitignore'), path.resolve(targetPath, '.gitignore')); + + const pkg = JSON.parse( + fs.readFileSync(path.resolve(targetPath, 'package.json'), 'utf-8') + ); + pkg.name = packageName; + + fs.writeFileSync(path.resolve(targetPath, 'package.json'), `${JSON.stringify(pkg, null, 2)}\n`); + console.log(`\ncd ${targetPath}\nnpm run install\nnpm run dev`); }