create-vuepress-theme-hope 2.0.0-rc.7 → 2.0.0-rc.71
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/lib/index.js +44 -34
- package/package.json +12 -11
- package/template/blog/config/base/styles/config.scss +1 -2
- package/template/blog/config/base/styles/palette.scss +0 -1
- package/template/blog/config/en/config.ts +1 -0
- package/template/blog/config/en/sidebar.ts +1 -1
- package/template/blog/config/en/theme.ts +88 -69
- package/template/blog/config/multi/config.ts +1 -0
- package/template/blog/config/multi/sidebar/en.ts +1 -1
- package/template/blog/config/multi/sidebar/zh.ts +1 -1
- package/template/blog/config/multi/theme.ts +92 -70
- package/template/blog/config/zh/config.ts +2 -1
- package/template/blog/config/zh/sidebar.ts +1 -1
- package/template/blog/config/zh/theme.ts +95 -72
- package/template/blog/en/README.md +7 -7
- package/template/blog/en/demo/README.md +1 -1
- package/template/blog/en/demo/markdown.md +151 -111
- package/template/blog/zh/README.md +7 -7
- package/template/blog/zh/demo/README.md +1 -1
- package/template/blog/zh/demo/markdown.md +159 -99
- package/template/blog/zh/demo/page.md +1 -1
- package/template/docs/config/base/styles/config.scss +1 -2
- package/template/docs/config/base/styles/palette.scss +0 -1
- package/template/docs/config/en/config.ts +1 -0
- package/template/docs/config/en/navbar.ts +1 -0
- package/template/docs/config/en/sidebar.ts +2 -1
- package/template/docs/config/en/theme.ts +82 -67
- package/template/docs/config/multi/config.ts +1 -0
- package/template/docs/config/multi/navbar/en.ts +1 -0
- package/template/docs/config/multi/navbar/zh.ts +1 -0
- package/template/docs/config/multi/sidebar/en.ts +2 -1
- package/template/docs/config/multi/sidebar/zh.ts +2 -1
- package/template/docs/config/multi/theme.ts +86 -68
- package/template/docs/config/zh/config.ts +2 -1
- package/template/docs/config/zh/navbar.ts +1 -0
- package/template/docs/config/zh/sidebar.ts +2 -1
- package/template/docs/config/zh/theme.ts +92 -71
- package/template/docs/en/README.md +100 -54
- package/template/docs/en/demo/README.md +1 -1
- package/template/docs/en/demo/markdown.md +151 -111
- package/template/docs/en/portfolio.md +23 -0
- package/template/docs/zh/README.md +111 -60
- package/template/docs/zh/demo/README.md +1 -1
- package/template/docs/zh/demo/markdown.md +159 -99
- package/template/docs/zh/demo/page.md +1 -1
- package/template/docs/zh/portfolio.md +24 -0
- package/template/blog/config/base/logo.ts +0 -2
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# create-vuepress-theme-hope
|
|
2
2
|
|
|
3
|
-
[
|
|
3
|
+
[](https://www.npmjs.com/package/create-vuepress-theme-hope)
|
|
4
4
|
|
|
5
5
|
Create template shortcut for vuepress-theme-hope.
|
|
6
6
|
|
|
@@ -8,7 +8,7 @@ Create template shortcut for vuepress-theme-hope.
|
|
|
8
8
|
|
|
9
9
|
```bash
|
|
10
10
|
# npm
|
|
11
|
-
npm init vuepress-theme-hope <dir>
|
|
11
|
+
npm init vuepress-theme-hope@latest <dir>
|
|
12
12
|
|
|
13
13
|
# yarn
|
|
14
14
|
yarn create vuepress-theme-hope <dir>
|
|
@@ -25,7 +25,7 @@ pnpm create vuepress-theme-hope <dir>
|
|
|
25
25
|
|
|
26
26
|
```bash
|
|
27
27
|
# npm
|
|
28
|
-
npm init vuepress-theme-hope <dir>
|
|
28
|
+
npm init vuepress-theme-hope@latest <dir>
|
|
29
29
|
|
|
30
30
|
# yarn
|
|
31
31
|
yarn create vuepress-theme-hope <dir>
|
package/lib/index.js
CHANGED
|
@@ -1,25 +1,16 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{existsSync as f,readFileSync as
|
|
3
|
-
启动成功后,请在浏览器输入给出的开发服务器地址(默认为 'localhost:8080')`},question:{packageManager:"选择包管理器",i18n:"项目需要用到多语言么?",git:"是否初始化 Git 仓库?",workflow:"是否需要一个自动部署文档到 GitHub Pages 的工作流?",preset:"你想要创建什么类型的项目?",devServer:"是否想要现在启动 Demo 查看?",name:"设置应用名称",version:"设置应用版本号",description:"设置应用描述",license:"设置协议"},hint:{install:`这可能需要数分钟,请耐心等待.
|
|
4
|
-
我们无法正确输出子进程的进度条,所以进程可能会看似未响应`,finish:"模板已成功生成!",devServer:e=>`提示: 请使用 "${e} run docs:dev" 命令启动开发服务器`},error:{name:"应用名称应只包含小写字母、数字和连接线 (-)",version:"此版本无效,版本号应为 'x.x.x'",preset:"预设 (--preset) 仅支持 doc 或 blog",outputDirMissing:e=>`"[dir]" 的方括号表示此处为一个参数,你应该替换为自己想使用的文件夹名称,如 "my-blog", "project-docs" 等!
|
|
5
|
-
例如: "${e} init vuepress-theme-hope project-docs"`,updateDirMissing:e=>`"[dir]" 的方括号表示此处为一个参数,你应该替换为自己想使用的文件夹名称,如 "src", "docs" 等!
|
|
6
|
-
例如: "${e} init vuepress-theme-hope docs"`,dirNotEmpty:e=>`目标文件夹 "${e}" 不为空,请选择一个空文件夹或者手动删除文件夹中的文件`}},"english (US)":{flow:{getVersion:"Getting latest version of deps...",createPackage:"Generating package.json...",updatePackage:"Updating package.json...",generateTemplate:"Generating Template...",install:"Installing Deps...",devServer:`Staring dev server...
|
|
7
|
-
After the dev server starts running, please visit the given server link ('localhost:8080' by default)`},question:{i18n:"Does the project need multiple languages?",git:"Initialize a git repository?",workflow:"Do you need a GitHub workflow to deploy docs on GitHub pages?",preset:"What type of project do you want to create?",packageManager:"Choose package manager",devServer:"Would you like to preview template now?",name:"Your project name",version:"Your project version",description:"Your project description",license:"Your project license"},hint:{install:`This may take a few minutes, please be patient.
|
|
8
|
-
We can not correctly output progress bar from child process, so the process may look stuck.`,finish:"Successful Generated!",devServer:e=>`Hint: You should execute "${e} run docs:dev" to start dev server.`},error:{name:"package name should only contain lowercase characters, numbers and dash",version:"This version is not a valid one. Version should be like 'x.x.x'",preset:'preset (--preset) only support "doc" or "blog"',outputDirMissing:e=>`The brackets in "[dir]" means it is an argument, you should replace it with folder name you want to use! E.g.: "my-blog", "project-docs"
|
|
9
|
-
For example: "${e} init vuepress-theme-hope project-docs"`,updateDirMissing:e=>`The brackets in "[dir]" means it is an argument, you should replace it with folder name you want to use! E.g.: "src", "docs"
|
|
10
|
-
For example: "${e} init vuepress-theme-hope docs"`,dirNotEmpty:e=>`Target folder "${e}" is not empty, please choose an empty folder or delete files in it.`}}},J=async()=>{const{language:e}=await m.prompt([{name:"language",type:"list",message:"Select a language to display / 选择显示语言",choices:["english (US)","简体中文"]}]);return{lang:e,message:H[e]}},Y=e=>`
|
|
2
|
+
import{existsSync as f,readFileSync as j,writeFileSync as h,readdirSync as S,mkdirSync as J,statSync as N,createReadStream as B,createWriteStream as Y}from"node:fs";import{resolve as n,join as T,dirname as C}from"node:path";import{select as v,confirm as y,input as w}from"@inquirer/prompts";import{createCommand as V}from"commander";import{execaCommandSync as l,execaCommand as U}from"execa";import{fileURLToPath as L}from"node:url";const M=["vite","webpack"],z=["blog","docs"],K=()=>{try{return l("pnpm --version",{stdio:"ignore"}).exitCode===0}catch{return!1}},Q=()=>{try{return l("yarn --version",{stdio:"ignore"}).exitCode===0}catch{return!1}},x=["npm"];K()&&x.unshift("pnpm"),Q()&&x.unshift("yarn");const X=e=>`
|
|
11
3
|
node_modules/
|
|
12
4
|
${e}/.vuepress/.cache/
|
|
13
5
|
${e}/.vuepress/.temp/
|
|
14
6
|
${e}/.vuepress/dist/
|
|
15
|
-
`,
|
|
16
|
-
name: ${s
|
|
7
|
+
`,E=(e,t=process.cwd())=>{const o=n(t,".gitignore"),s=f(o)?j(o,{encoding:"utf-8"}):"";h(o,`${s}${X(e)}`,{encoding:"utf-8"})},Z=(e,t,o,{workflow:s})=>`
|
|
8
|
+
name: ${s.name}
|
|
17
9
|
|
|
18
10
|
on:
|
|
19
11
|
push:
|
|
20
12
|
branches:
|
|
21
|
-
|
|
22
|
-
- main
|
|
13
|
+
- ${l("git branch --show-current",{cwd:t}).stdout.trim()}
|
|
23
14
|
|
|
24
15
|
permissions:
|
|
25
16
|
contents: write
|
|
@@ -29,41 +20,60 @@ jobs:
|
|
|
29
20
|
runs-on: ubuntu-latest
|
|
30
21
|
steps:
|
|
31
22
|
- name: Checkout
|
|
32
|
-
uses: actions/checkout@
|
|
23
|
+
uses: actions/checkout@v4
|
|
33
24
|
with:
|
|
34
25
|
fetch-depth: 0
|
|
35
|
-
# ${s
|
|
26
|
+
# ${s.submodule}
|
|
36
27
|
# submodules: true
|
|
37
28
|
|
|
38
|
-
${e==="pnpm"?` - name: ${s
|
|
39
|
-
uses: pnpm/action-setup@
|
|
40
|
-
with:
|
|
41
|
-
run_install: true
|
|
42
|
-
version: 8
|
|
29
|
+
${e==="pnpm"?` - name: ${s.setupPnpm}
|
|
30
|
+
uses: pnpm/action-setup@v4
|
|
43
31
|
`:""}
|
|
44
32
|
|
|
45
|
-
- name: ${s
|
|
46
|
-
uses: actions/setup-node@
|
|
33
|
+
- name: ${s.setupNode}
|
|
34
|
+
uses: actions/setup-node@v4
|
|
47
35
|
with:
|
|
48
|
-
node-version:
|
|
36
|
+
node-version: 22
|
|
49
37
|
cache: ${e}
|
|
50
38
|
|
|
51
|
-
|
|
52
|
-
run:
|
|
53
|
-
|
|
54
|
-
|
|
39
|
+
- name: ${s.install}
|
|
40
|
+
run: |
|
|
41
|
+
corepack enable
|
|
42
|
+
${e==="npm"?"npm ci":`${e} install --frozen-lockfile`}
|
|
43
|
+
|
|
44
|
+
- name: ${s.build}
|
|
55
45
|
env:
|
|
56
46
|
NODE_OPTIONS: --max_old_space_size=8192
|
|
57
47
|
run: |-
|
|
58
48
|
${e} run docs:build
|
|
59
|
-
> ${
|
|
49
|
+
> ${T(o,".vuepress/dist/.nojekyll").replace(/\\/g,"/")}
|
|
60
50
|
|
|
61
|
-
- name: ${s
|
|
51
|
+
- name: ${s.deploy}
|
|
62
52
|
uses: JamesIves/github-pages-deploy-action@v4
|
|
63
53
|
with:
|
|
64
|
-
# ${s
|
|
54
|
+
# ${s.deploy}
|
|
65
55
|
branch: gh-pages
|
|
66
|
-
folder: ${
|
|
67
|
-
`,
|
|
68
|
-
|
|
69
|
-
|
|
56
|
+
folder: ${T(o,".vuepress/dist").replace(/\\/g,"/")}
|
|
57
|
+
`,ee=/^(?:@[a-z0-9-*~][a-z0-9-*._~]*\/)?[a-z0-9-~][a-z0-9-._~]*$/u,te=/^[0-9]+\.[0-9]+\.(?:[0-9]+|[0-9]+-[a-z]+\.[0-9])$/u,{isArray:se}=Array,D=e=>Object.prototype.toString.call(e)==="[object Object]",b=(e,...t)=>{if(t.length===0)return e;const o=t.shift();return o&&Object.entries(o).forEach(([s,r])=>{s==="__proto__"||s==="constructor"||(D(e[s])&&D(r)?b(e[s],r):se(r)?e[s]=[...r]:D(r)?e[s]={...r}:e[s]=o[s])}),b(e,...t)},$=e=>{try{S(e)}catch{try{J(e,{recursive:!0})}catch{}}},G=(e,t)=>{const o=C(t);$(o);const s=B(e),r=Y(t);s.pipe(r)},P=(e,t)=>{$(t),S(e,{withFileTypes:!0}).forEach(o=>{o.isFile()?G(`${e}/${o.name}`,`${t}/${o.name}`):o.isDirectory()&&P(`${e}/${o.name}`,`${t}/${o.name}`)})},u=(e,t)=>{N(e).isDirectory()?P(e,t):N(e).isFile()&&G(e,t)},oe=(e=process.cwd())=>{try{return l("git status",{cwd:e}),!0}catch{return!1}},re=()=>{try{return l("git --version"),!0}catch{return!1}},q="https://registry.npmmirror.com/",ne=(e,t)=>l(`${e} config get ${t?"npmRegistryServer":"registry"}`).stdout,ae=async(e,t)=>{const o=e==="yarn"&&!l("yarn --version").stdout.startsWith("1"),s=ne(e,o);return/https:\/\/registry\.npm\.taobao\.org\/?/.test(s)&&(console.error("npm.taobao.org is no longer available, resetting it to npmmirror.com"),l(`${e} config set ${o?"npmRegistryServer":"registry"} ${q}`)),t==="zh"&&await v({message:"选择你想使用的源",choices:["国内镜像源","当前源"].map(r=>({name:r,value:r}))})==="国内镜像源"?q:s},ie=L(import.meta.url),d=C(ie),O=async({cwd:e=process.cwd(),targetDir:t,lang:o,locale:s,preset:r,packageManager:a})=>{r||(r=await v({message:s.question.preset,choices:z.map(g=>({name:g,value:g}))}));const p=await y({message:s.question.i18n,default:!1});console.log(s.flow.generateTemplate);const i=r;u(n(d,"../template/public"),n(e,t,"./.vuepress/public")),u(n(d,"../template",i,"config/base"),n(e,t,".vuepress")),p?(u(n(d,"../template",i,"en"),n(e,t)),u(n(d,"../template",i,"zh"),n(e,t,"zh")),u(n(d,"../template",i,"config/multi"),n(e,t,".vuepress"))):o==="zh"?(u(n(d,"../template",i,"zh"),n(e,t)),u(n(d,"../template",i,"config/zh"),n(e,t,".vuepress"))):(u(n(d,"../template",i,"en"),n(e,t)),u(n(d,"../template",i,"config/en"),n(e,t,".vuepress")));let c=oe(e);if(c?E(t,e):re()&&await y({message:s.question.git,default:!0})&&(l("git init -b main",{cwd:e}),E(t,e),c=!0),c&&await y({message:s.question.workflow,default:!0})){const g=n(e,".github/workflows");$(g),h(n(g,"deploy-docs.yml"),Z(a,e,t,s),{encoding:"utf-8"})}};var ce="create-vuepress-theme-hope",pe="2.0.0-rc.71",le="Create vuepress-theme-hope demo project helper",ue=["create","vuepress","vuepress2","vuepress-theme","vuepress-theme-hope"],de="https://theme-hope.vuejs.press/",me={url:"https://github.com/vuepress-theme-hope/vuepress-theme-hope/issues"},ge={type:"git",url:"git+https://github.com/vuepress-theme-hope/vuepress-theme-hope.git",directory:"packages/create"},he="MIT",ve={name:"Mr.Hope",email:"mister-hope@outlook.com",url:"https://mister-hope.com"},fe="module",ye={"./package.json":"./package.json"},we="./lib/node/index.js",be="./lib/node/index.d.ts",$e={"create-vuepress-theme-hope":"./lib/index.js"},ke=["lib","template"],je={build:"rollup -c rollup.config.ts --configPlugin esbuild",clean:"rimraf --glob ./lib ./*.tsbuildinfo",dev:"pnpm dev:ts","dev:ts":"tsc -b tsconfig.build.json --watch"},Se={"@inquirer/prompts":"^7.2.3",commander:"^13.1.0",execa:"^9.5.2"},xe={vuepress:"2.0.0-rc.19","vuepress-theme-hope":"workspace:*"},De={node:">=18.19.0",npm:">=8",pnpm:">=7",yarn:">=2"},Ne={name:ce,version:pe,description:le,keywords:ue,homepage:de,bugs:me,repository:ge,license:he,author:ve,type:fe,exports:ye,main:we,types:be,bin:$e,files:ke,scripts:je,dependencies:Se,devDependencies:xe,engines:De};const _=Ne.version,Te={flow:{getVersion:"Getting latest version of deps...",createPackage:"Generating package.json...",updatePackage:"Updating package.json...",createTsConfig:"Generating tsconfig.json...",updateTsConfig:"Updating tsconfig.json...",generateTemplate:"Generating Template...",install:"Installing Deps...",devServer:`Staring dev server...
|
|
58
|
+
After the dev server starts running, please visit the given server link ('localhost:8080' by default)`},question:{i18n:"Does the project need multiple languages?",git:"Initialize a git repository?",workflow:"Do you need a GitHub workflow to deploy docs on GitHub pages?",bundler:"Which bundler do you want to use?",preset:"What type of project do you want to create?",packageManager:"Choose package manager",devServer:"Would you like to preview template now?",name:"Your project name",version:"Your project version",description:"Your project description",license:"Your project license"},hint:{install:`This may take a few minutes, please be patient.
|
|
59
|
+
We can not correctly output progress bar from child process, so the process may look stuck.`,finish:"Successful Generated!",devServer:e=>`Hint: You should execute "${e} run docs:dev" to start dev server.`},workflow:{name:"Deploy Docs",checkout:"Checkout code",submodule:"if your docs needs submodules, uncomment the following line",setupPnpm:"Setup pnpm",setupNode:"Setup Node.js",install:"Install Deps",build:"Build Docs",deploy:"Deploy Docs",deployBranch:"This is the branch where the docs are deployed to"},error:{name:"package name should only contain lowercase characters, numbers and dash",version:"This version is not a valid one. Version should be like 'x.x.x'",bundler:'bundler (--bundler) only support "vite" or "webpack"',preset:'preset (--preset) only support "docs" or "blog"',outputDirHint:e=>`The angle brackets in "<dir>" means it is a required argument, you should replace it with folder name you want to use! E.g.: "my-blog", "project-docs"
|
|
60
|
+
For example: "${e} init vuepress-theme-hope project-docs"`,addDirHint:e=>`The brackets in "<dir>" means it is a required argument, you should replace it with folder name you want to use! E.g.: "src", "docs"
|
|
61
|
+
For example: "${e} init vuepress-theme-hope add docs"`,dirNotEmpty:e=>`Target folder "${e}" is not empty, please choose an empty folder or delete files in it.`}},Ce={flow:{getVersion:"获取依赖的最新版本...",createPackage:"生成 package.json...",updatePackage:"更新 package.json...",createTsConfig:"生成 tsconfig.json...",updateTsConfig:"更新 tsconfig.json...",generateTemplate:"生成模板...",install:"安装依赖...",devServer:`启动开发服务器...
|
|
62
|
+
启动成功后,请在浏览器输入给出的开发服务器地址(默认为 'localhost:8080')`},question:{packageManager:"选择包管理器",i18n:"项目需要用到多语言么?",git:"是否初始化 Git 仓库?",workflow:"是否需要一个自动部署文档到 GitHub Pages 的工作流?",bundler:"你想要使用哪个打包器?",preset:"你想要创建什么类型的项目?",devServer:"是否想要现在启动 Demo 查看?",name:"设置应用名称",version:"设置应用版本号",description:"设置应用描述",license:"设置协议"},hint:{install:`这可能需要数分钟,请耐心等待.
|
|
63
|
+
我们无法正确输出子进程的进度条,所以进程可能会看似未响应`,finish:"模板已成功生成!",devServer:e=>`提示: 请使用 "${e} run docs:dev" 命令启动开发服务器`},workflow:{name:"部署文档",checkout:"检出代码",submodule:"如果你文档需要 Git 子模块,取消注释下一行",setupPnpm:"设置 pnpm",setupNode:"设置 Node.js",install:"安装依赖",build:"构建文档",deploy:"部署文档",deployBranch:"这是文档部署到的分支名称"},error:{name:"应用名称应只包含小写字母、数字和连接线 (-)",version:"此版本无效,版本号应为 'x.x.x'",bundler:"打包器 (--bundler) 仅支持 vite 或 webpack",preset:"预设 (--preset) 仅支持 docs 或 blog",outputDirHint:e=>`"<dir>" 的尖括号表示此处为一个必填参数,你应该替换为自己想使用的文件夹名称,如 "my-blog", "project-docs" 等!
|
|
64
|
+
例如: "${e} init vuepress-theme-hope project-docs"`,addDirHint:e=>`"<dir>" 的尖括号表示此处为一个必填参数,你应该替换为自己想使用的文件夹名称,如 "src", "docs" 等!
|
|
65
|
+
例如: "${e} init vuepress-theme-hope add docs"`,dirNotEmpty:e=>`目标文件夹 "${e}" 不为空,请选择一个空文件夹或者手动删除文件夹中的文件`}},Me={en:Te,zh:Ce},ze=async()=>{const e=await v({message:"Select a language to display / 选择显示语言",choices:[{name:"English",value:"en"},{name:"简体中文",value:"zh"}]});return{lang:e,locale:Me[e]}},Ee=(e,t,o)=>({"docs:build":`vuepress-${t} build ${o}`,"docs:clean-dev":`vuepress-${t} dev ${o} --clean-cache`,"docs:dev":`vuepress-${t} dev ${o}`,"docs:update-package":`${e==="npm"?"npx":`${e} dlx`} vp-update`}),A=async({packageManager:e,locale:t,source:o,bundler:s,cwd:r=process.cwd()})=>{s||(s=await v({message:t.question.bundler,choices:M.map(c=>({name:c,value:c}))}));const a=n(r,"package.json"),p=Ee(e,s,o),i={[`@vuepress/bundler-${s}`]:"2.0.0-rc.19","sass-embedded":"^1.83.0",vue:"^3.5.13",vuepress:"2.0.0-rc.19","vuepress-theme-hope":_};if(s==="webpack"&&(i["sass-loader"]="^16.0.4"),f(a)){console.log(t.flow.updatePackage);const c=JSON.parse(j(a,{encoding:"utf-8"}));b(c,{scripts:p,devDependencies:i}),h(a,`${JSON.stringify(c,null,2)}
|
|
66
|
+
`,{encoding:"utf-8"})}else{console.log(t.flow.createPackage);const c=await w({message:t.question.name,default:"vuepress-theme-hope-template",validate:k=>ee.exec(k)?!0:t.error.name}),g=await w({message:t.question.description,default:"A project of vuepress-theme-hope"}),W=await w({message:t.question.version,default:"2.0.0",validate:k=>te.exec(k)?!0:t.error.version}),F=await w({message:t.question.license,default:"MIT"});h(a,`${JSON.stringify({name:c,description:g,version:W,license:F,type:"module",scripts:p,devDependencies:i},null,2)}
|
|
67
|
+
`,{encoding:"utf-8"})}},H=({source:e,locale:t,cwd:o=process.cwd()})=>{const s=n(o,"tsconfig.json");if(f(s)){console.log(t.flow.updateTsConfig);const r=JSON.parse(j(s,{encoding:"utf-8"}));b(r,{compilerOptions:{module:"NodeNext",moduleResolution:"NodeNext"},include:[...r.include??[],`${e}/.vuepress/**/*.ts`,`${e}/.vuepress/**/*.vue`]}),h(s,`${JSON.stringify(r,null,2)}
|
|
68
|
+
`,{encoding:"utf-8"})}else{console.log(t.flow.createTsConfig);const r={compilerOptions:{module:"NodeNext",moduleResolution:"NodeNext",target:"ES2022"},include:[`${e}/.vuepress/**/*.ts`,`${e}/.vuepress/**/*.vue`],exclude:["node_modules"]};h(s,`${JSON.stringify(r,null,2)}
|
|
69
|
+
`,{encoding:"utf-8"})}},m=V("create-vuepress-theme-hope"),R=async(e,{bundler:t,preset:o,add:s})=>{const{lang:r,locale:a}=await ze();t&&!M.includes(t)&&m.error(a.error.bundler),o&&!z.includes(o)&&m.error(a.error.preset);const p=n(process.cwd(),e);f(p)&&S(p).length&&m.error(a.error.dirNotEmpty(e));const i=await v({message:a.question.packageManager,choices:x.map(c=>({name:c,value:c}))});return e.startsWith("<")&&e.endsWith(">")&&m.error(a.error[s?"addDirHint":"outputDirHint"](i)),$(p),{lang:r,locale:a,packageManager:i}},I=async({cwd:e=process.cwd(),lang:t,locale:o,packageManager:s})=>{const r=s==="pnpm"?"":await ae(s,t);console.log(o.flow.install),console.warn(o.hint.install),l(`${s} install ${r?`--registry ${r}`:""}`,{cwd:e,stdout:"inherit"}),console.log(o.hint.finish),await y({message:o.question.devServer,default:!0})?(console.log(o.flow.devServer),await U(`${s} run docs:dev`,{cwd:e,stdout:"inherit"})):console.info(o.hint.devServer(s))};m.description(`Generate a new vuepress-theme-hope template
|
|
70
|
+
|
|
71
|
+
· pnpm create vuepress-theme-hope <dir>
|
|
72
|
+
· npm init vuepress-theme-hope@latest <dir>
|
|
73
|
+
· yarn create vuepress-theme-hope <dir>
|
|
74
|
+
`).option("-b, --bundler [bundler]","Bundler to use, vite or webpack only").option("-p, --preset [preset]","Preset to use, docs or blog only").argument("<dir>","Dir to create the template in").action(async(e,{bundler:t,preset:o})=>{const s=n(process.cwd(),e),{lang:r,locale:a,packageManager:p}=await R(e,{bundler:t,preset:o,add:!1});await A({bundler:t,locale:a,packageManager:p,cwd:e,source:"src"}),H({cwd:e,source:"src",locale:a}),await O({preset:o,lang:r,locale:a,packageManager:p,cwd:s,targetDir:"src"}),await I({lang:r,locale:a,packageManager:p,cwd:s})}),m.command("add").alias("inject").summary("Add template to <dir> inside project").description(`Add vuepress-theme-hope template in <dir> under current project
|
|
75
|
+
|
|
76
|
+
· pnpm create vuepress-theme-hope add <dir>
|
|
77
|
+
· npm init vuepress-theme-hope@latest add <dir>
|
|
78
|
+
· yarn create vuepress-theme-hope add <dir>
|
|
79
|
+
`).usage("").option("-b, --bundler [bundler]","Choose bundler to use").option("-p, --preset [preset]","Choose preset to use").argument("<dir>","Dir to create the template in").action(async(e,{bundler:t,preset:o})=>{const{lang:s,locale:r,packageManager:a}=await R(e,{bundler:t,preset:o,add:!0});await A({bundler:t,packageManager:a,locale:r,source:e}),H({source:e,locale:r}),await O({packageManager:a,lang:s,locale:r,preset:o,targetDir:e}),await I({lang:s,locale:r,packageManager:a})}),m.version(_),m.showHelpAfterError("add --help for additional information"),await m.parseAsync();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-vuepress-theme-hope",
|
|
3
|
-
"version": "2.0.0-rc.
|
|
3
|
+
"version": "2.0.0-rc.71",
|
|
4
4
|
"description": "Create vuepress-theme-hope demo project helper",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"create",
|
|
@@ -37,23 +37,24 @@
|
|
|
37
37
|
"lib",
|
|
38
38
|
"template"
|
|
39
39
|
],
|
|
40
|
+
"dependencies": {
|
|
41
|
+
"@inquirer/prompts": "^7.2.3",
|
|
42
|
+
"commander": "^13.1.0",
|
|
43
|
+
"execa": "^9.5.2"
|
|
44
|
+
},
|
|
45
|
+
"devDependencies": {
|
|
46
|
+
"vuepress": "2.0.0-rc.19",
|
|
47
|
+
"vuepress-theme-hope": "2.0.0-rc.71"
|
|
48
|
+
},
|
|
40
49
|
"engines": {
|
|
41
|
-
"node": ">=18.
|
|
50
|
+
"node": ">=18.19.0",
|
|
42
51
|
"npm": ">=8",
|
|
43
52
|
"pnpm": ">=7",
|
|
44
53
|
"yarn": ">=2"
|
|
45
54
|
},
|
|
46
|
-
"dependencies": {
|
|
47
|
-
"cac": "6.7.14",
|
|
48
|
-
"execa": "8.0.1",
|
|
49
|
-
"inquirer": "9.2.12"
|
|
50
|
-
},
|
|
51
|
-
"devDependencies": {
|
|
52
|
-
"@types/inquirer": "9.0.7"
|
|
53
|
-
},
|
|
54
55
|
"scripts": {
|
|
55
56
|
"build": "rollup -c rollup.config.ts --configPlugin esbuild",
|
|
56
|
-
"clean": "rimraf ./lib ./*.tsbuildinfo",
|
|
57
|
+
"clean": "rimraf --glob ./lib ./*.tsbuildinfo",
|
|
57
58
|
"dev": "pnpm dev:ts",
|
|
58
59
|
"dev:ts": "tsc -b tsconfig.build.json --watch"
|
|
59
60
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { hopeTheme } from "vuepress-theme-hope";
|
|
2
|
+
|
|
2
3
|
import navbar from "./navbar.js";
|
|
3
4
|
import sidebar from "./sidebar.js";
|
|
4
|
-
import { MR_HOPE_AVATAR } from "../base/logo.js";
|
|
5
5
|
|
|
6
6
|
export default hopeTheme({
|
|
7
7
|
hostname: "https://mister-hope.github.io",
|
|
@@ -11,8 +11,6 @@ export default hopeTheme({
|
|
|
11
11
|
url: "https://mister-hope.com",
|
|
12
12
|
},
|
|
13
13
|
|
|
14
|
-
iconAssets: "fontawesome-with-brands",
|
|
15
|
-
|
|
16
14
|
logo: "https://theme-hope-assets.vuejs.press/logo.svg",
|
|
17
15
|
|
|
18
16
|
repo: "vuepress-theme-hope/vuepress-theme-hope",
|
|
@@ -31,7 +29,10 @@ export default hopeTheme({
|
|
|
31
29
|
|
|
32
30
|
encrypt: {
|
|
33
31
|
config: {
|
|
34
|
-
"/demo/encrypt.html":
|
|
32
|
+
"/demo/encrypt.html": {
|
|
33
|
+
hint: "Password: 1234",
|
|
34
|
+
password: "1234",
|
|
35
|
+
},
|
|
35
36
|
},
|
|
36
37
|
},
|
|
37
38
|
|
|
@@ -70,7 +71,10 @@ export default hopeTheme({
|
|
|
70
71
|
Whatsapp: "https://example.com",
|
|
71
72
|
Youtube: "https://example.com",
|
|
72
73
|
Zhihu: "https://example.com",
|
|
73
|
-
|
|
74
|
+
VuePressThemeHope: {
|
|
75
|
+
icon: "https://theme-hope-assets.vuejs.press/logo.svg",
|
|
76
|
+
link: "https://theme-hope.vuejs.press",
|
|
77
|
+
},
|
|
74
78
|
},
|
|
75
79
|
},
|
|
76
80
|
|
|
@@ -78,88 +82,103 @@ export default hopeTheme({
|
|
|
78
82
|
editLink: "Edit this page on GitHub",
|
|
79
83
|
},
|
|
80
84
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
85
|
+
// enable it to preview all changes in time
|
|
86
|
+
// hotReload: true,
|
|
87
|
+
|
|
88
|
+
// These features are enabled for demo, only preserve features you need here
|
|
89
|
+
markdown: {
|
|
90
|
+
align: true,
|
|
91
|
+
attrs: true,
|
|
92
|
+
codeTabs: true,
|
|
93
|
+
component: true,
|
|
94
|
+
demo: true,
|
|
95
|
+
figure: true,
|
|
96
|
+
gfm: true,
|
|
97
|
+
imgLazyload: true,
|
|
98
|
+
imgSize: true,
|
|
99
|
+
include: true,
|
|
100
|
+
mark: true,
|
|
101
|
+
plantuml: true,
|
|
102
|
+
spoiler: true,
|
|
103
|
+
stylize: [
|
|
104
|
+
{
|
|
105
|
+
matcher: "Recommended",
|
|
106
|
+
replacer: ({ tag }) => {
|
|
107
|
+
if (tag === "em")
|
|
108
|
+
return {
|
|
109
|
+
tag: "Badge",
|
|
110
|
+
attrs: { type: "tip" },
|
|
111
|
+
content: "Recommended",
|
|
112
|
+
};
|
|
113
|
+
},
|
|
114
|
+
},
|
|
115
|
+
],
|
|
116
|
+
sub: true,
|
|
117
|
+
sup: true,
|
|
118
|
+
tabs: true,
|
|
119
|
+
tasklist: true,
|
|
120
|
+
vPre: true,
|
|
121
|
+
|
|
122
|
+
// uncomment these if you need TeX support
|
|
123
|
+
// math: {
|
|
124
|
+
// // install katex before enabling it
|
|
125
|
+
// type: "katex",
|
|
126
|
+
// // or install mathjax-full before enabling it
|
|
127
|
+
// type: "mathjax",
|
|
90
128
|
// },
|
|
91
129
|
|
|
92
|
-
//
|
|
93
|
-
|
|
94
|
-
align: true,
|
|
95
|
-
attrs: true,
|
|
96
|
-
codetabs: true,
|
|
97
|
-
component: true,
|
|
98
|
-
demo: true,
|
|
99
|
-
figure: true,
|
|
100
|
-
imgLazyload: true,
|
|
101
|
-
imgSize: true,
|
|
102
|
-
include: true,
|
|
103
|
-
mark: true,
|
|
104
|
-
stylize: [
|
|
105
|
-
{
|
|
106
|
-
matcher: "Recommended",
|
|
107
|
-
replacer: ({ tag }) => {
|
|
108
|
-
if (tag === "em")
|
|
109
|
-
return {
|
|
110
|
-
tag: "Badge",
|
|
111
|
-
attrs: { type: "tip" },
|
|
112
|
-
content: "Recommended",
|
|
113
|
-
};
|
|
114
|
-
},
|
|
115
|
-
},
|
|
116
|
-
],
|
|
117
|
-
sub: true,
|
|
118
|
-
sup: true,
|
|
119
|
-
tabs: true,
|
|
120
|
-
vPre: true,
|
|
130
|
+
// install chart.js before enabling it
|
|
131
|
+
// chartjs: true,
|
|
121
132
|
|
|
122
|
-
|
|
123
|
-
|
|
133
|
+
// install echarts before enabling it
|
|
134
|
+
// echarts: true,
|
|
124
135
|
|
|
125
|
-
|
|
136
|
+
// install flowchart.ts before enabling it
|
|
137
|
+
// flowchart: true,
|
|
126
138
|
|
|
127
|
-
|
|
128
|
-
|
|
139
|
+
// install mermaid before enabling it
|
|
140
|
+
// mermaid: true,
|
|
129
141
|
|
|
130
|
-
|
|
131
|
-
|
|
142
|
+
// playground: {
|
|
143
|
+
// presets: ["ts", "vue"],
|
|
144
|
+
// },
|
|
132
145
|
|
|
133
|
-
|
|
134
|
-
|
|
146
|
+
// install @vue/repl before enabling it
|
|
147
|
+
// vuePlayground: true,
|
|
135
148
|
|
|
136
|
-
|
|
137
|
-
|
|
149
|
+
// install sandpack-vue3 before enabling it
|
|
150
|
+
// sandpack: true,
|
|
138
151
|
|
|
139
|
-
|
|
140
|
-
|
|
152
|
+
// install @vuepress/plugin-revealjs and uncomment these if you need slides
|
|
153
|
+
// revealjs: {
|
|
154
|
+
// plugins: ["highlight", "math", "search", "notes", "zoom"],
|
|
155
|
+
// },
|
|
156
|
+
},
|
|
141
157
|
|
|
142
|
-
|
|
143
|
-
|
|
158
|
+
plugins: {
|
|
159
|
+
blog: true,
|
|
144
160
|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
161
|
+
// Install @waline/client before enabling it
|
|
162
|
+
// Note: This is for testing ONLY!
|
|
163
|
+
// You MUST generate and use your own comment service in production.
|
|
164
|
+
// comment: {
|
|
165
|
+
// provider: "Waline",
|
|
166
|
+
// serverURL: "https://waline-comment.vuejs.press",
|
|
167
|
+
// },
|
|
148
168
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
// },
|
|
169
|
+
components: {
|
|
170
|
+
components: ["Badge", "VPCard"],
|
|
171
|
+
},
|
|
153
172
|
|
|
154
|
-
|
|
155
|
-
|
|
173
|
+
icon: {
|
|
174
|
+
prefix: "fa6-solid:",
|
|
156
175
|
},
|
|
157
176
|
|
|
158
|
-
// uncomment these if you want a PWA
|
|
177
|
+
// install @vuepress/plugin-pwa and uncomment these if you want a PWA
|
|
159
178
|
// pwa: {
|
|
160
179
|
// favicon: "/favicon.ico",
|
|
161
180
|
// cacheHTML: true,
|
|
162
|
-
//
|
|
181
|
+
// cacheImage: true,
|
|
163
182
|
// appendBase: true,
|
|
164
183
|
// apple: {
|
|
165
184
|
// icon: "/assets/icon/apple-icon-152.png",
|
|
@@ -20,7 +20,7 @@ export const enSidebar = sidebar({
|
|
|
20
20
|
{
|
|
21
21
|
text: "Slides",
|
|
22
22
|
icon: "person-chalkboard",
|
|
23
|
-
link: "https://
|
|
23
|
+
link: "https://ecosystem.vuejs.press/plugins/markdown/revealjs/demo.html",
|
|
24
24
|
},
|
|
25
25
|
],
|
|
26
26
|
});
|
|
@@ -20,7 +20,7 @@ export const zhSidebar = sidebar({
|
|
|
20
20
|
{
|
|
21
21
|
text: "幻灯片",
|
|
22
22
|
icon: "person-chalkboard",
|
|
23
|
-
link: "https://
|
|
23
|
+
link: "https://ecosystem.vuejs.press/zh/plugins/markdown/revealjs/demo.html",
|
|
24
24
|
},
|
|
25
25
|
],
|
|
26
26
|
});
|