create-vuepress-theme-hope 2.0.0-rc.0 → 2.0.0-rc.2

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/lib/index.js CHANGED
@@ -64,6 +64,6 @@ ${e!=="pnpm"?` - name: ${s==="简体中文"?"安装依赖":"Install Deps"}
64
64
  # ${s==="简体中文"?"这是文档部署到的分支名称":"This is the branch where the docs are deployed to"}
65
65
  branch: gh-pages
66
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.8",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)}
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.9",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
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=await ee(r.question.packageManager);if(e.startsWith("[")&&e.endsWith("]"))return console.log(r.error.updateDirMissing(a));const n=o(process.cwd(),e);return f(n)&&w(n).length?console.error(r.error.dirNotEmpty(e)):(y(n),{lang:s,message:r,packageManager:a})},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();
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();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-vuepress-theme-hope",
3
- "version": "2.0.0-rc.0",
3
+ "version": "2.0.0-rc.2",
4
4
  "description": "Create vuepress-theme-hope demo project helper",
5
5
  "keywords": [
6
6
  "create",
@@ -42,7 +42,7 @@ For these extensions, please read [Markdown extensions in VuePress](https://them
42
42
 
43
43
  By using [`vuepress-plugin-md-enhance`][md-enhance], the theme extends more Markdown syntax and provides richer writing functions.
44
44
 
45
- #### Custom Container
45
+ #### Hint box
46
46
 
47
47
  ::: v-pre
48
48
 
@@ -52,7 +52,7 @@ Safely use {{ variable }} in Markdown.
52
52
 
53
53
  ::: info Custom Title
54
54
 
55
- A custom information container with `code`, [link](#custom-container).
55
+ A custom information container with `code`, [link](#hint-box).
56
56
 
57
57
  ```js
58
58
  const a = 1;
@@ -72,9 +72,9 @@ A custom warning container
72
72
 
73
73
  :::
74
74
 
75
- ::: danger Custom Title
75
+ ::: caution Custom Title
76
76
 
77
- A custom danger container
77
+ A custom caution container
78
78
 
79
79
  :::
80
80
 
@@ -84,7 +84,7 @@ A custom details container
84
84
 
85
85
  :::
86
86
 
87
- - [View Detail](https://theme-hope.vuejs.press/guide/markdown/container.html)
87
+ - [View Detail](https://theme-hope.vuejs.press/guide/markdown/hint.html)
88
88
 
89
89
  #### Tabs
90
90
 
@@ -42,7 +42,7 @@ VuePress 会使用 [markdown-it](https://github.com/markdown-it/markdown-it) 来
42
42
 
43
43
  通过 [`vuepress-plugin-md-enhance`][md-enhance],主题扩展了更多 Markdown 语法,提供更加丰富的写作功能。
44
44
 
45
- #### 自定义容器
45
+ #### 提示容器
46
46
 
47
47
  ::: v-pre
48
48
 
@@ -52,7 +52,7 @@ VuePress 会使用 [markdown-it](https://github.com/markdown-it/markdown-it) 来
52
52
 
53
53
  ::: info 自定义标题
54
54
 
55
- 信息容器,包含 `代码` 与 [链接](#自定义容器)。
55
+ 信息容器,包含 `代码` 与 [链接](#提示容器)。
56
56
 
57
57
  ```js
58
58
  const a = 1;
@@ -72,7 +72,7 @@ const a = 1;
72
72
 
73
73
  :::
74
74
 
75
- ::: danger 自定义标题
75
+ ::: caution 自定义标题
76
76
 
77
77
  危险容器
78
78
 
@@ -84,7 +84,7 @@ const a = 1;
84
84
 
85
85
  :::
86
86
 
87
- - [查看详情](https://theme-hope.vuejs.press/zh/guide/markdown/container.html)
87
+ - [查看详情](https://theme-hope.vuejs.press/zh/guide/markdown/hint.html)
88
88
 
89
89
  #### 代码块
90
90
 
@@ -41,10 +41,15 @@ highlights:
41
41
  details: Check markdown links
42
42
  link: https://theme-hope.vuejs.press/guide/markdown/others.html#link-check
43
43
 
44
- - title: Custom Container
44
+ - title: Hint box
45
45
  icon: box-archive
46
46
  details: Decorate Markdown content with styles
47
- link: https://theme-hope.vuejs.press/guide/markdown/container.html
47
+ link: https://theme-hope.vuejs.press/guide/markdown/hint.html
48
+
49
+ - title: GFM alerts
50
+ icon: bell
51
+ details: GFM alert box
52
+ link: https://theme-hope.vuejs.press/guide/markdown/alert.html
48
53
 
49
54
  - title: Tabs
50
55
  icon: table-columns
@@ -42,7 +42,7 @@ For these extensions, please read [Markdown extensions in VuePress](https://them
42
42
 
43
43
  By using [`vuepress-plugin-md-enhance`][md-enhance], the theme extends more Markdown syntax and provides richer writing functions.
44
44
 
45
- #### Custom Container
45
+ #### Hint box
46
46
 
47
47
  ::: v-pre
48
48
 
@@ -52,7 +52,7 @@ Safely use {{ variable }} in Markdown.
52
52
 
53
53
  ::: info Custom Title
54
54
 
55
- A custom information container with `code`, [link](#custom-container).
55
+ A custom information container with `code`, [link](#hint-box).
56
56
 
57
57
  ```js
58
58
  const a = 1;
@@ -72,9 +72,9 @@ A custom warning container
72
72
 
73
73
  :::
74
74
 
75
- ::: danger Custom Title
75
+ ::: caution Custom Title
76
76
 
77
- A custom danger container
77
+ A custom caution container
78
78
 
79
79
  :::
80
80
 
@@ -84,7 +84,7 @@ A custom details container
84
84
 
85
85
  :::
86
86
 
87
- - [View Detail](https://theme-hope.vuejs.press/guide/markdown/container.html)
87
+ - [View Detail](https://theme-hope.vuejs.press/guide/markdown/hint.html)
88
88
 
89
89
  #### Tabs
90
90
 
@@ -41,10 +41,15 @@ highlights:
41
41
  details: 检查 Markdown 链接
42
42
  link: https://theme-hope.vuejs.press/zh/guide/markdown/others.html#link-check
43
43
 
44
- - title: 自定义容器支持
44
+ - title: 提示容器支持
45
45
  icon: box-archive
46
46
  details: 用样式装饰 Markdown 内容
47
- link: https://theme-hope.vuejs.press/zh/guide/markdown/container.html
47
+ link: https://theme-hope.vuejs.press/zh/guide/markdown/hint.html
48
+
49
+ - title: GFM 警告
50
+ icon: bell
51
+ details: GFM 风格的警告容器
52
+ link: https://theme-hope.vuejs.press/zh/guide/markdown/alert.html
48
53
 
49
54
  - title: 选项卡
50
55
  icon: table-columns
@@ -220,7 +225,7 @@ highlights:
220
225
 
221
226
  - title: 博客主页
222
227
  icon: home
223
- details: 全新播客主页
228
+ details: 全新博客主页
224
229
  link: https://theme-hope.vuejs.press/zh/guide/blog/home.html
225
230
 
226
231
  - title: 博主信息
@@ -42,7 +42,7 @@ VuePress 会使用 [markdown-it](https://github.com/markdown-it/markdown-it) 来
42
42
 
43
43
  通过 [`vuepress-plugin-md-enhance`][md-enhance],主题扩展了更多 Markdown 语法,提供更加丰富的写作功能。
44
44
 
45
- #### 自定义容器
45
+ #### 提示容器
46
46
 
47
47
  ::: v-pre
48
48
 
@@ -52,7 +52,7 @@ VuePress 会使用 [markdown-it](https://github.com/markdown-it/markdown-it) 来
52
52
 
53
53
  ::: info 自定义标题
54
54
 
55
- 信息容器,包含 `代码` 与 [链接](#自定义容器)。
55
+ 信息容器,包含 `代码` 与 [链接](#提示容器)。
56
56
 
57
57
  ```js
58
58
  const a = 1;
@@ -72,7 +72,7 @@ const a = 1;
72
72
 
73
73
  :::
74
74
 
75
- ::: danger 自定义标题
75
+ ::: caution 自定义标题
76
76
 
77
77
  危险容器
78
78
 
@@ -84,7 +84,7 @@ const a = 1;
84
84
 
85
85
  :::
86
86
 
87
- - [查看详情](https://theme-hope.vuejs.press/zh/guide/markdown/container.html)
87
+ - [查看详情](https://theme-hope.vuejs.press/zh/guide/markdown/hint.html)
88
88
 
89
89
  #### 代码块
90
90