@huyikai/vitepress-helper
Advanced tools
Comparing version 0.0.12 to 0.0.13
@@ -1,6 +0,6 @@ | ||
import { blodText } from './utils'; | ||
import { execSync } from 'child_process'; | ||
import fs from 'fs-extra'; | ||
import ora from 'ora'; | ||
import path from 'path'; | ||
import { blodText } from "./utils"; | ||
import { execSync } from "child_process"; | ||
import fs from "fs-extra"; | ||
import ora from "ora"; | ||
import path from "path"; | ||
interface Answers { | ||
@@ -21,8 +21,8 @@ name: string; | ||
const { name, author, version, cms } = answers; | ||
spinner.start('Installing...'); | ||
spinner.start("Installing..."); | ||
// const targetDir = path.join(cwd, newDir ? name : ''); | ||
// 初始化package.json | ||
execSync('npm init -y'); | ||
execSync('npm install @huyikai/vitepress-helper', { stdio: 'inherit' }); | ||
execSync("npm init -y"); | ||
execSync("npm install @huyikai/vitepress-helper", { stdio: "inherit" }); | ||
// execSync('npm link @huyikai/vitepress-helper'); | ||
@@ -33,6 +33,6 @@ | ||
cwd, | ||
'node_modules/@huyikai/vitepress-helper/template' | ||
"node_modules/@huyikai/vitepress-helper/template" | ||
); | ||
// 目标目录的路径 | ||
const targetPath = path.join(cwd, ''); | ||
const targetPath = path.join(cwd, ""); | ||
// 将模板文件拷贝到目标目录 | ||
@@ -42,3 +42,3 @@ fs.copySync(templatePath, targetPath); | ||
const changeConfig = () => { | ||
const packagePath = path.join(cwd, 'package.json'); | ||
const packagePath = path.join(cwd, "package.json"); | ||
let packageInfo = JSON.parse(fs.readFileSync(packagePath).toString()); | ||
@@ -48,8 +48,8 @@ packageInfo.name = name; | ||
packageInfo.version = version; | ||
packageInfo.scripts['cms'] = cms | ||
? 'node node_modules/@huyikai/local-cms/cms.js docs' | ||
packageInfo.scripts["cms"] = cms | ||
? "node node_modules/@huyikai/local-cms/cms.js docs" | ||
: undefined; | ||
packageInfo.devDependencies['@huyikai/vitepress-helper'] = '^0.0.11'; | ||
packageInfo.devDependencies['@huyikai/local-cms'] = cms | ||
? 'latest' | ||
packageInfo.devDependencies["@huyikai/vitepress-helper"] = "^0.0.13"; | ||
packageInfo.devDependencies["@huyikai/local-cms"] = cms | ||
? "latest" | ||
: undefined; | ||
@@ -59,8 +59,8 @@ fs.writeFileSync(packagePath, JSON.stringify(packageInfo, null, 2)); | ||
changeConfig(); | ||
execSync('npm i', { stdio: 'inherit' }); | ||
spinner.succeed('Install Complete!!!'); | ||
execSync("npm i", { stdio: "inherit" }); | ||
spinner.succeed("Install Complete!!!"); | ||
console.log( | ||
`\r\nNow you can:\r\nrun ${blodText('npm run dev')} to preview` + | ||
(cms ? `\r\nrun ${blodText('npm run cms')} to manage content` : '') | ||
`\r\nNow you can:\r\nrun ${blodText("npm run dev")} to preview` + | ||
(cms ? `\r\nrun ${blodText("npm run cms")} to manage content` : "") | ||
); | ||
}; |
{ | ||
"name": "@huyikai/vitepress-helper", | ||
"version": "0.0.12", | ||
"version": "0.0.13", | ||
"private": false, | ||
@@ -5,0 +5,0 @@ "description": "This tool is designed to help you to use VitePress more easily.", |