create-vuepress-theme-hope 2.0.0-beta.170 → 2.0.0-beta.172

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
@@ -61,6 +61,6 @@ ${e!=="pnpm"?` - name: ${t==="简体中文"?"安装依赖":"Install Deps"}
61
61
  # ${t==="简体中文"?"这是文档部署到的分支名称":"This is the branch where the docs are deployed to"}
62
62
  branch: gh-pages
63
63
  folder: ${$(s,".vuepress/dist").replace(/\\/g,"/")}
64
- `,R=Array.isArray,v=e=>Object.prototype.toString.call(e)==="[object Object]",y=(e,...s)=>{if(s.length===0)return e;const t=s.shift()||null;return t&&Object.entries(t).forEach(([r,o])=>{r==="__proto__"||r==="constructor"||(v(e[r])&&v(o)?y(e[r],o):R(o)?e[r]=[...o]:v(o)?e[r]={...o}:e[r]=t[r])}),y(e,...s)},m=e=>{try{h(e)}catch{C(e,{recursive:!0})}},S=(e,s)=>{const t=b(s);m(t);const r=N(e),o=E(s);r.pipe(o)},D=(e,s)=>{m(s),h(e,{withFileTypes:!0}).forEach(t=>{t.isFile()?S(`${e}/${t.name}`,`${s}/${t.name}`):t.isDirectory()&&D(`${e}/${t.name}`,`${s}/${t.name}`)})},M=(e,s)=>{k(e).isDirectory()?D(e,s):k(e).isFile()&&S(e,s)},Y=(e=process.cwd())=>{try{return l("git status",{cwd:e}),!0}catch{return!1}},U=()=>{try{return l("git --version"),!0}catch{return!1}},V=()=>{try{return l("pnpm --version",{stdio:"ignore"}).exitCode===0}catch{return!1}},L=()=>{try{return l("yarn --version",{stdio:"ignore"}).exitCode===0}catch{return!1}},f=["npm"];L()&&f.push("yarn"),V()&&f.push("pnpm");const B=async e=>(await p.prompt([{name:"packageManager",type:"list",message:e,choices:f}])).packageManager,K=z(import.meta.url),x=b(K),T=async(e,{cwd:s=process.cwd(),packageManager:t,lang:r,message:o,preset:a})=>{const{workflow:i}=await p.prompt([{name:"workflow",type:"confirm",message:o.question.workflow,default:!0}]);if(a||(a=(await p.prompt([{name:"preset",type:"list",message:o.question.preset,choices:["blog","docs"]}])).preset),console.log(o.flow.generateTemplate),M(n(x,"../template/public"),n(s,e,"./.vuepress/public")),M(n(x,"../template",a),n(s,e)),i){const c=n(s,".github/workflows");m(c),d(n(c,"deploy-docs.yml"),J(t,e,r),{encoding:"utf-8"})}if(Y(s))j(e,s);else if(U()){const{git:c}=await p.prompt([{name:"git",type:"confirm",message:o.question.git,default:!0}]);c&&(l("git init",{cwd:s}),j(e,s))}},G=A(import.meta.url)("create-vuepress-theme-hope/package.json").version,Q=e=>({"docs:build":`vuepress build ${e}`,"docs:clean-dev":`vuepress dev ${e} --clean-cache`,"docs:dev":`vuepress dev ${e}`}),q=async(e,s,t=process.cwd())=>{const r=n(t,"package.json"),o=Q(s),a={"@vuepress/client":"2.0.0-beta.60",vue:"^3.2.45",vuepress:"2.0.0-beta.60","vuepress-theme-hope":G};if(g(r)){console.log(e.flow.updatePackage);const i=JSON.parse(w(r,{encoding:"utf-8"}));y(i,{scripts:o,devDependencies:a}),d(r,`${JSON.stringify(i,null,2)}
64
+ `,R=Array.isArray,v=e=>Object.prototype.toString.call(e)==="[object Object]",y=(e,...s)=>{if(s.length===0)return e;const t=s.shift()||null;return t&&Object.entries(t).forEach(([r,o])=>{r==="__proto__"||r==="constructor"||(v(e[r])&&v(o)?y(e[r],o):R(o)?e[r]=[...o]:v(o)?e[r]={...o}:e[r]=t[r])}),y(e,...s)},m=e=>{try{h(e)}catch{C(e,{recursive:!0})}},S=(e,s)=>{const t=b(s);m(t);const r=N(e),o=E(s);r.pipe(o)},D=(e,s)=>{m(s),h(e,{withFileTypes:!0}).forEach(t=>{t.isFile()?S(`${e}/${t.name}`,`${s}/${t.name}`):t.isDirectory()&&D(`${e}/${t.name}`,`${s}/${t.name}`)})},M=(e,s)=>{k(e).isDirectory()?D(e,s):k(e).isFile()&&S(e,s)},Y=(e=process.cwd())=>{try{return l("git status",{cwd:e}),!0}catch{return!1}},U=()=>{try{return l("git --version"),!0}catch{return!1}},V=()=>{try{return l("pnpm --version",{stdio:"ignore"}).exitCode===0}catch{return!1}},L=()=>{try{return l("yarn --version",{stdio:"ignore"}).exitCode===0}catch{return!1}},f=["npm"];L()&&f.push("yarn"),V()&&f.push("pnpm");const B=async e=>(await p.prompt([{name:"packageManager",type:"list",message:e,choices:f}])).packageManager,K=z(import.meta.url),x=b(K),T=async(e,{cwd:s=process.cwd(),packageManager:t,lang:r,message:o,preset:a})=>{const{workflow:i}=await p.prompt([{name:"workflow",type:"confirm",message:o.question.workflow,default:!0}]);if(a||(a=(await p.prompt([{name:"preset",type:"list",message:o.question.preset,choices:["blog","docs"]}])).preset),console.log(o.flow.generateTemplate),M(n(x,"../template/public"),n(s,e,"./.vuepress/public")),M(n(x,"../template",a),n(s,e)),i){const c=n(s,".github/workflows");m(c),d(n(c,"deploy-docs.yml"),J(t,e,r),{encoding:"utf-8"})}if(Y(s))j(e,s);else if(U()){const{git:c}=await p.prompt([{name:"git",type:"confirm",message:o.question.git,default:!0}]);c&&(l("git init",{cwd:s}),j(e,s))}},G=A(import.meta.url)("create-vuepress-theme-hope/package.json").version,Q=e=>({"docs:build":`vuepress build ${e}`,"docs:clean-dev":`vuepress dev ${e} --clean-cache`,"docs:dev":`vuepress dev ${e}`}),q=async(e,s,t=process.cwd())=>{const r=n(t,"package.json"),o=Q(s),a={"@vuepress/client":"2.0.0-beta.60",vue:"^3.2.47",vuepress:"2.0.0-beta.60","vuepress-theme-hope":G};if(g(r)){console.log(e.flow.updatePackage);const i=JSON.parse(w(r,{encoding:"utf-8"}));y(i,{scripts:o,devDependencies:a}),d(r,`${JSON.stringify(i,null,2)}
65
65
  `,{encoding:"utf-8"})}else{console.log(e.flow.createPackage);const i={...await p.prompt([{name:"name",type:"input",message:e.question.name,default:"vuepress-theme-hope-template",validate:c=>/^(?:@[a-z0-9-*~][a-z0-9-*._~]*\/)?[a-z0-9-~][a-z0-9-._~]*$/u.exec(c)?!0:e.error.name},{name:"version",type:"input",message:e.question.version,default:"2.0.0",validate:c=>/^[0-9]+\.[0-9]+\.(?:[0=9]+|[0-9]+-[a-z]+\.[0-9])$/u.exec(c)?!0:e.error.version},{name:"description",type:"input",message:e.question.description,default:"A project of vuepress-theme-hope"},{name:"license",type:"input",message:e.question.license,default:"MIT"}]),type:"module",scripts:o,devDependencies:a};d(r,`${JSON.stringify(i,null,2)}
66
66
  `,{encoding:"utf-8"})}},X="https://registry.npmmirror.com/",Z=e=>l(`${e} config get registry`).stdout,ee=async(e,s)=>{const t=Z(e);if(s==="简体中文"){const{registry:r}=await p.prompt([{name:"registry",type:"list",message:"选择你想使用的源",choices:["国内镜像源","当前源"]}]);return r==="国内镜像源"?X:t}return t},_=async(e,s)=>{if(!e)return u.outputHelp();const{lang:t,message:r}=await W();if(s&&!["docs","blog"].includes(s))return console.log(r.error.preset);const o=await B(r.question.packageManager);if(e.startsWith("[")&&e.endsWith("]"))return console.log(r.error.updateDirMissing(o));const a=n(process.cwd(),e);return g(a)&&h(a).length?console.error(r.error.dirNotEmpty(e)):(m(a),{lang:t,message:r,packageManager:o})},P=async({cwd:e=process.cwd(),lang:s,message:t,packageManager:r})=>{const o=r==="pnpm"?"":await ee(r,s);console.log(t.flow.install),console.warn(t.hint.install),l(`${r} install ${o?`--registry ${o}`:""}`,{cwd:e,stdout:"inherit"}),console.log(t.hint.finish);const{choice:a}=await p.prompt([{name:"choice",type:"confirm",message:t.question.devServer,default:!0}]);a?(console.log(t.flow.devServer),await O(`${r} run docs:dev`,{cwd:e,stdout:"inherit"})):console.log(t.hint.devServer(r))},u=I("vuepress-theme-hope");u.command("[dir]","Generate a new vuepress-theme-hope project").option("-p, --preset <preset>","Choose preset to use").usage("pnpm create vuepress-theme-hope [dir] / npm init vuepress-theme-hope [dir]").example("docs").action(async(e,{preset:s=null})=>{const t=n(process.cwd(),e),r=await _(e,s);if(r){const{lang:o,message:a,packageManager:i}=r;await q(a,"src",e),await T("src",{cwd:t,packageManager:i,lang:o,message:a,preset:s}),await P({cwd:t,lang:o,message:a,packageManager:i})}}),u.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] / npm init vuepress-theme-hope add [dir]").example("docs").action(async(e,{preset:s=null})=>{const t=await _(e,s);if(t){const{lang:r,message:o,packageManager:a}=t;await q(o,e),await T(e,{packageManager:a,lang:r,message:o,preset:s}),await P({message:o,lang:r,packageManager:a})}}),u.help(()=>[{title:"pnpm 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] / npm init vuepress-theme-hope inject [dir]",body:"Add vuepress-theme-hope template in [dir] under current project"}]),u.version(G),u.parse();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-vuepress-theme-hope",
3
- "version": "2.0.0-beta.170",
3
+ "version": "2.0.0-beta.172",
4
4
  "description": "Create vuepress-theme-hope demo project helper",
5
5
  "keywords": [
6
6
  "create",
@@ -140,6 +140,13 @@ export default hopeTheme({
140
140
  */
141
141
  // provider: "Waline",
142
142
  // serverURL: "https://vuepress-theme-hope-comment.vercel.app",
143
+
144
+ /**
145
+ * Using artalk
146
+ */
147
+ // provider: "Artalk",
148
+ // site: "artalk-demo",
149
+ // server: "https://demo-artalk.jjdxb.top/",
143
150
  },
144
151
 
145
152
  // Disable features you don’t want here
@@ -88,6 +88,13 @@ export default hopeTheme({
88
88
  */
89
89
  provider: "Waline",
90
90
  serverURL: "https://vuepress-theme-hope-comment.vercel.app",
91
+
92
+ /**
93
+ * Using artalk
94
+ */
95
+ // provider: "Artalk",
96
+ // site: "artalk-demo",
97
+ // server: "https://demo-artalk.jjdxb.top/",
91
98
  },
92
99
 
93
100
  // Disable features you don’t want here