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.
Files changed (48) hide show
  1. package/README.md +3 -3
  2. package/lib/index.js +44 -34
  3. package/package.json +12 -11
  4. package/template/blog/config/base/styles/config.scss +1 -2
  5. package/template/blog/config/base/styles/palette.scss +0 -1
  6. package/template/blog/config/en/config.ts +1 -0
  7. package/template/blog/config/en/sidebar.ts +1 -1
  8. package/template/blog/config/en/theme.ts +88 -69
  9. package/template/blog/config/multi/config.ts +1 -0
  10. package/template/blog/config/multi/sidebar/en.ts +1 -1
  11. package/template/blog/config/multi/sidebar/zh.ts +1 -1
  12. package/template/blog/config/multi/theme.ts +92 -70
  13. package/template/blog/config/zh/config.ts +2 -1
  14. package/template/blog/config/zh/sidebar.ts +1 -1
  15. package/template/blog/config/zh/theme.ts +95 -72
  16. package/template/blog/en/README.md +7 -7
  17. package/template/blog/en/demo/README.md +1 -1
  18. package/template/blog/en/demo/markdown.md +151 -111
  19. package/template/blog/zh/README.md +7 -7
  20. package/template/blog/zh/demo/README.md +1 -1
  21. package/template/blog/zh/demo/markdown.md +159 -99
  22. package/template/blog/zh/demo/page.md +1 -1
  23. package/template/docs/config/base/styles/config.scss +1 -2
  24. package/template/docs/config/base/styles/palette.scss +0 -1
  25. package/template/docs/config/en/config.ts +1 -0
  26. package/template/docs/config/en/navbar.ts +1 -0
  27. package/template/docs/config/en/sidebar.ts +2 -1
  28. package/template/docs/config/en/theme.ts +82 -67
  29. package/template/docs/config/multi/config.ts +1 -0
  30. package/template/docs/config/multi/navbar/en.ts +1 -0
  31. package/template/docs/config/multi/navbar/zh.ts +1 -0
  32. package/template/docs/config/multi/sidebar/en.ts +2 -1
  33. package/template/docs/config/multi/sidebar/zh.ts +2 -1
  34. package/template/docs/config/multi/theme.ts +86 -68
  35. package/template/docs/config/zh/config.ts +2 -1
  36. package/template/docs/config/zh/navbar.ts +1 -0
  37. package/template/docs/config/zh/sidebar.ts +2 -1
  38. package/template/docs/config/zh/theme.ts +92 -71
  39. package/template/docs/en/README.md +100 -54
  40. package/template/docs/en/demo/README.md +1 -1
  41. package/template/docs/en/demo/markdown.md +151 -111
  42. package/template/docs/en/portfolio.md +23 -0
  43. package/template/docs/zh/README.md +111 -60
  44. package/template/docs/zh/demo/README.md +1 -1
  45. package/template/docs/zh/demo/markdown.md +159 -99
  46. package/template/docs/zh/demo/page.md +1 -1
  47. package/template/docs/zh/portfolio.md +24 -0
  48. 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
- [![Version](https://img.shields.io/npm/v/create-vuepress-theme-hope.svg?style=flat-square&logo=npm) ![Downloads](https://img.shields.io/npm/dm/create-vuepress-theme-hope.svg?style=flat-square&logo=npm)](https://www.npmjs.com/package/create-vuepress-theme-hope)
3
+ [![Version](https://img.shields.io/npm/v/create-vuepress-theme-hope.svg?style=flat-square&logo=npm)![Downloads](https://img.shields.io/npm/dm/create-vuepress-theme-hope.svg?style=flat-square&logo=npm)](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 S,writeFileSync as v,readdirSync as w,mkdirSync as A,statSync as j,createReadStream as C,createWriteStream as I}from"node:fs";import{resolve as o,join as x,dirname as D}from"node:path";import{cac as O}from"cac";import{execaCommandSync as c,execaCommand as R}from"execa";import m from"inquirer";import{createRequire as F}from"node:module";import{fileURLToPath as W}from"node:url";const H={简体中文:{flow:{getVersion:"获取依赖的最新版本...",createPackage:"生成 package.json...",updatePackage:"更新 package.json...",generateTemplate:"生成模板...",install:"安装依赖...",devServer:`启动开发服务器...
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
- `,M=(e,t=process.cwd())=>{const s=o(t,".gitignore"),r=f(s)?S(s,{encoding:"utf-8"}):"";v(s,`${r}${Y(e)}`,{encoding:"utf-8"})},U=(e,t,s)=>`
16
- name: ${s==="简体中文"?"部署文档":"Deploy Docs"}
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
- # ${s==="简体中文"?"确保这是你正在使用的分支名称":"make sure this is the branch you are using"}
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@v3
23
+ uses: actions/checkout@v4
33
24
  with:
34
25
  fetch-depth: 0
35
- # ${s==="简体中文"?"如果你文档需要 Git 子模块,取消注释下一行":"if your docs needs submodules, uncomment the following line"}
26
+ # ${s.submodule}
36
27
  # submodules: true
37
28
 
38
- ${e==="pnpm"?` - name: ${s==="简体中文"?"安装 pnpm":"Install pnpm"}
39
- uses: pnpm/action-setup@v2
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==="简体中文"?"设置 Node.js":"Setup Node.js"}
46
- uses: actions/setup-node@v3
33
+ - name: ${s.setupNode}
34
+ uses: actions/setup-node@v4
47
35
  with:
48
- node-version: 20
36
+ node-version: 22
49
37
  cache: ${e}
50
38
 
51
- ${e!=="pnpm"?` - name: ${s==="简体中文"?"安装依赖":"Install Deps"}
52
- run: ${e==="npm"?"npm ci":`${e} install --frozen-lockfile`}
53
- `:""}
54
- - name: ${s==="简体中文"?"构建文档":"Build Docs"}
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
- > ${x(t,".vuepress/dist/.nojekyll").replace(/\\/g,"/")}
49
+ > ${T(o,".vuepress/dist/.nojekyll").replace(/\\/g,"/")}
60
50
 
61
- - name: ${s==="简体中文"?"部署文档":"Deploy Docs"}
51
+ - name: ${s.deploy}
62
52
  uses: JamesIves/github-pages-deploy-action@v4
63
53
  with:
64
- # ${s==="简体中文"?"这是文档部署到的分支名称":"This is the branch where the docs are deployed to"}
54
+ # ${s.deploy}
65
55
  branch: gh-pages
66
- folder: ${x(t,".vuepress/dist").replace(/\\/g,"/")}
67
- `,V=/^(?:@[a-z0-9-*~][a-z0-9-*._~]*\/)?[a-z0-9-~][a-z0-9-._~]*$/u,L=/^[0-9]+\.[0-9]+\.(?:[0=9]+|[0-9]+-[a-z]+\.[0-9])$/u,B=Array.isArray,$=e=>Object.prototype.toString.call(e)==="[object Object]",k=(e,...t)=>{if(t.length===0)return e;const s=t.shift()||null;return s&&Object.entries(s).forEach(([r,a])=>{r==="__proto__"||r==="constructor"||($(e[r])&&$(a)?k(e[r],a):B(a)?e[r]=[...a]:$(a)?e[r]={...a}:e[r]=s[r])}),k(e,...t)},y=e=>{try{w(e)}catch{try{A(e,{recursive:!0})}catch{}}},G=(e,t)=>{const s=D(t);y(s);const r=C(e),a=I(t);r.pipe(a)},T=(e,t)=>{y(t),w(e,{withFileTypes:!0}).forEach(s=>{s.isFile()?G(`${e}/${s.name}`,`${t}/${s.name}`):s.isDirectory()&&T(`${e}/${s.name}`,`${t}/${s.name}`)})},p=(e,t)=>{j(e).isDirectory()?T(e,t):j(e).isFile()&&G(e,t)},K=(e=process.cwd())=>{try{return c("git status",{cwd:e}),!0}catch{return!1}},Q=()=>{try{return c("git --version"),!0}catch{return!1}},X=()=>{try{return c("pnpm --version",{stdio:"ignore"}).exitCode===0}catch{return!1}},Z=()=>{try{return c("yarn --version",{stdio:"ignore"}).exitCode===0}catch{return!1}},b=["npm"];Z()&&b.push("yarn"),X()&&b.push("pnpm");const ee=async e=>(await m.prompt([{name:"packageManager",type:"list",message:e,choices:b}])).packageManager,te=W(import.meta.url),l=D(te),_=async(e,{cwd:t=process.cwd(),packageManager:s,lang:r,message:a,preset:n})=>{const{i18n:u,workflow:d}=await m.prompt([{name:"i18n",type:"confirm",message:a.question.i18n,default:!1},{name:"workflow",type:"confirm",message:a.question.workflow,default:!0}]);n||(n=(await m.prompt([{name:"preset",type:"list",message:a.question.preset,choices:["blog","docs"]}])).preset),console.log(a.flow.generateTemplate);const i=n;if(p(o(l,"../template/public"),o(t,e,"./.vuepress/public")),p(o(l,"../template",i,"config/base"),o(t,e,".vuepress")),u?(p(o(l,"../template",i,"en"),o(t,e)),p(o(l,"../template",i,"zh"),o(t,e,"zh")),p(o(l,"../template",i,"config/multi"),o(t,e,".vuepress"))):r==="简体中文"?(p(o(l,"../template",i,"zh"),o(t,e)),p(o(l,"../template",i,"config/zh"),o(t,e,".vuepress"))):(p(o(l,"../template",i,"en"),o(t,e)),p(o(l,"../template",i,"config/en"),o(t,e,".vuepress"))),d){const h=o(t,".github/workflows");y(h),v(o(h,"deploy-docs.yml"),U(s,e,r),{encoding:"utf-8"})}if(K(t))M(e,t);else if(Q()){const{git:h}=await m.prompt([{name:"git",type:"confirm",message:a.question.git,default:!0}]);h&&(c("git init",{cwd:t}),M(e,t))}},E=F(import.meta.url)("create-vuepress-theme-hope/package.json").version,se=(e,t)=>({"docs:build":`vuepress build ${t}`,"docs:clean-dev":`vuepress dev ${t} --clean-cache`,"docs:dev":`vuepress dev ${t}`,"docs:update-package":`${e==="npm"?"npx":`${e} dlx`} vp-update`}),q=async(e,t,s,r=process.cwd())=>{const a=o(r,"package.json"),n=se(e,s),u={"@vuepress/client":"2.0.0-rc.0",vue:"^3.3.12",vuepress:"2.0.0-rc.0","vuepress-theme-hope":E};if(f(a)){console.log(t.flow.updatePackage);const d=JSON.parse(S(a,{encoding:"utf-8"}));k(d,{scripts:n,devDependencies:u}),v(a,`${JSON.stringify(d,null,2)}
68
- `,{encoding:"utf-8"})}else{console.log(t.flow.createPackage);const d={...await m.prompt([{name:"name",type:"input",message:t.question.name,default:"vuepress-theme-hope-template",validate:i=>V.exec(i)?!0:t.error.name},{name:"version",type:"input",message:t.question.version,default:"2.0.0",validate:i=>L.exec(i)?!0:t.error.version},{name:"description",type:"input",message:t.question.description,default:"A project of vuepress-theme-hope"},{name:"license",type:"input",message:t.question.license,default:"MIT"}]),type:"module",scripts:n,devDependencies:u};v(a,`${JSON.stringify(d,null,2)}
69
- `,{encoding:"utf-8"})}},P="https://registry.npmmirror.com/",re=(e,t)=>c(`${e} config get ${t?"npmRegistryServer":"registry"}`).stdout,ae=async(e,t)=>{const s=e==="yarn"&&!c("yarn --version").stdout.startsWith("1"),r=re(e,s);if(/https:\/\/registry\.npm\.taobao\.org\/?/.test(r)&&(console.error("npm.taobao.org is no longer available, resetting it to npmmirror.com"),c(`${e} config set ${s?"npmRegistryServer":"registry"}} ${P}`)),t==="简体中文"){const{registry:a}=await m.prompt([{name:"registry",type:"list",message:"选择你想使用的源",choices:["国内镜像源","当前源"]}]);return a==="国内镜像源"?P:r}return r},z=async(e,t)=>{if(!e)return g.outputHelp();const{lang:s,message:r}=await J();if(t&&!["docs","blog"].includes(t))return console.log(r.error.preset);const a=o(process.cwd(),e);if(f(a)&&w(a).length)return console.error(r.error.dirNotEmpty(e));const n=await ee(r.question.packageManager);return e.startsWith("[")&&e.endsWith("]")?console.log(r.error.updateDirMissing(n)):(y(a),{lang:s,message:r,packageManager:n})},N=async({cwd:e=process.cwd(),lang:t,message:s,packageManager:r})=>{const a=r==="pnpm"?"":await ae(r,t);console.log(s.flow.install),console.warn(s.hint.install),c(`${r} install ${a?`--registry ${a}`:""}`,{cwd:e,stdout:"inherit"}),console.log(s.hint.finish);const{choice:n}=await m.prompt([{name:"choice",type:"confirm",message:s.question.devServer,default:!0}]);n?(console.log(s.flow.devServer),await R(`${r} run docs:dev`,{cwd:e,stdout:"inherit"})):console.log(s.hint.devServer(r))},g=O("vuepress-theme-hope");g.command("[dir]","Generate a new vuepress-theme-hope project").option("-p, --preset <preset>","Choose preset to use").usage("pnpm create vuepress-theme-hope [dir] / yarn create vuepress-theme-hope [dir] / npm init vuepress-theme-hope [dir]").example("docs").action(async(e,{preset:t=null})=>{const s=o(process.cwd(),e),r=await z(e,t);if(r){const{lang:a,message:n,packageManager:u}=r;await q(u,n,"src",e),await _("src",{cwd:s,packageManager:u,lang:a,message:n,preset:t}),await N({cwd:s,lang:a,message:n,packageManager:u})}}),g.command("add [dir]","Add vuepress template to dir").alias("inject").option("-p, --preset <preset>","Choose preset to use").usage("pnpm create vuepress-theme-hope add [dir] / yarn create vuepress-theme-hope add [dir] / npm init vuepress-theme-hope add [dir]").example("docs").action(async(e,{preset:t=null})=>{const s=await z(e,t);if(s){const{lang:r,message:a,packageManager:n}=s;await q(n,a,e),await _(e,{packageManager:n,lang:r,message:a,preset:t}),await N({message:a,lang:r,packageManager:n})}}),g.help(()=>[{title:"pnpm create vuepress-theme-hope [dir] / yarn create vuepress-theme-hope [dir] / npm init vuepress-theme-hope [dir]",body:"Create a vuepress-theme-hope template in [dir]"},{title:"pnpm create vuepress-theme-hope inject [dir] / yarn create vuepress-theme-hope add [dir] / npm init vuepress-theme-hope inject [dir]",body:"Add vuepress-theme-hope template in [dir] under current project"}]),g.version(E),g.parse();
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.7",
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.16.0",
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,3 +1,2 @@
1
1
  // you can change config here
2
- $colors: #c0392b, #d35400, #f39c12, #27ae60, #16a085, #2980b9, #8e44ad, #2c3e50,
3
- #7f8c8d !default;
2
+ $theme-color: #096dd9;
@@ -1,2 +1 @@
1
1
  // you can change colors here
2
- $theme-color: #096dd9;
@@ -1,4 +1,5 @@
1
1
  import { defineUserConfig } from "vuepress";
2
+
2
3
  import theme from "./theme.js";
3
4
 
4
5
  export default defineUserConfig({
@@ -20,7 +20,7 @@ export default sidebar({
20
20
  {
21
21
  text: "Slides",
22
22
  icon: "person-chalkboard",
23
- link: "https://plugin-md-enhance.vuejs.press/guide/content/revealjs/demo.html",
23
+ link: "https://ecosystem.vuejs.press/plugins/markdown/revealjs/demo.html",
24
24
  },
25
25
  ],
26
26
  });
@@ -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": ["1234"],
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
- MrHope: ["https://mister-hope.com", MR_HOPE_AVATAR],
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
- plugins: {
82
- blog: true,
83
-
84
- // install @waline/client before enabling it
85
- // WARNING: This is a test server for demo only.
86
- // You should create and use your own comment service in production.
87
- // comment: {
88
- // provider: "Waline",
89
- // serverURL: "https://waline-comment.vuejs.press",
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
- // all features are enabled for demo, only preserve features you need here
93
- mdEnhance: {
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
- // install chart.js before enabling it
123
- // chart: true,
133
+ // install echarts before enabling it
134
+ // echarts: true,
124
135
 
125
- // insert component easily
136
+ // install flowchart.ts before enabling it
137
+ // flowchart: true,
126
138
 
127
- // install echarts before enabling it
128
- // echarts: true,
139
+ // install mermaid before enabling it
140
+ // mermaid: true,
129
141
 
130
- // install flowchart.ts before enabling it
131
- // flowchart: true,
142
+ // playground: {
143
+ // presets: ["ts", "vue"],
144
+ // },
132
145
 
133
- // gfm requires mathjax-full to provide tex support
134
- // gfm: true,
146
+ // install @vue/repl before enabling it
147
+ // vuePlayground: true,
135
148
 
136
- // install katex before enabling it
137
- // katex: true,
149
+ // install sandpack-vue3 before enabling it
150
+ // sandpack: true,
138
151
 
139
- // install mathjax-full before enabling it
140
- // mathjax: true,
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
- // install mermaid before enabling it
143
- // mermaid: true,
158
+ plugins: {
159
+ blog: true,
144
160
 
145
- // playground: {
146
- // presets: ["ts", "vue"],
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
- // install reveal.js before enabling it
150
- // revealJs: {
151
- // plugins: ["highlight", "math", "search", "notes", "zoom"],
152
- // },
169
+ components: {
170
+ components: ["Badge", "VPCard"],
171
+ },
153
172
 
154
- // install @vue/repl before enabling it
155
- // vuePlayground: true,
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
- // cachePic: true,
181
+ // cacheImage: true,
163
182
  // appendBase: true,
164
183
  // apple: {
165
184
  // icon: "/assets/icon/apple-icon-152.png",
@@ -1,4 +1,5 @@
1
1
  import { defineUserConfig } from "vuepress";
2
+
2
3
  import theme from "./theme.js";
3
4
 
4
5
  export default defineUserConfig({
@@ -20,7 +20,7 @@ export const enSidebar = sidebar({
20
20
  {
21
21
  text: "Slides",
22
22
  icon: "person-chalkboard",
23
- link: "https://plugin-md-enhance.vuejs.press/guide/content/revealjs/demo.html",
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://plugin-md-enhance.vuejs.press/zh/guide/content/revealjs/demo.html",
23
+ link: "https://ecosystem.vuejs.press/zh/plugins/markdown/revealjs/demo.html",
24
24
  },
25
25
  ],
26
26
  });