create-vuepress-theme-hope 2.0.0-beta.111 → 2.0.0-beta.112

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 (2) hide show
  1. package/lib/index.js +1 -1
  2. package/package.json +1 -1
package/lib/index.js CHANGED
@@ -63,6 +63,6 @@ node_modules/
63
63
  ${e}/.vuepress/.cache/
64
64
  ${e}/.vuepress/.temp/
65
65
  ${e}/.vuepress/dist/
66
- `,D=e=>{const r=i(process.cwd(),".gitignore"),t=h(r)?k(r,{encoding:"utf-8"}):"";u(r,`${t}${L(e)}`,{encoding:"utf-8"})},M=async(e,{packageManager:r,lang:t,message:s,preset:o})=>{const{workflow:n}=await c.prompt([{name:"workflow",type:"confirm",message:s.question.workflow,default:!0}]);if(o||(o=(await c.prompt([{name:"preset",type:"list",message:s.question.preset,choices:["blog","docs"]}])).preset),console.log(s.flow.generateTemplate),x(i(S,"../template/public"),i(process.cwd(),e,"./.vuepress/public")),x(i(S,"../template",o),i(process.cwd(),e)),n){const a=i(process.cwd(),".github/workflows");d(a),u(i(a,"deploy-docs.yml"),V(r,e,t),{encoding:"utf-8"})}if(W())D(e);else if(H()){const{git:a}=await c.prompt([{name:"git",type:"confirm",message:s.question.git,default:!0}]);a&&(p("git init"),D(e))}},T=z(import.meta.url)("create-vuepress-theme-hope/package.json").version,B=e=>({"docs:build":`vuepress build ${e}`,"docs:clean-dev":`vuepress dev ${e} --clean-cache`,"docs:dev":`vuepress dev ${e}`}),q=async(e,r,t=process.cwd())=>{const s=i(t,"package.json"),o=B(r),n={"@vuepress/client":"2.0.0-beta.51",vue:"^3.2.29",vuepress:"2.0.0-beta.51","vuepress-theme-hope":T};if(h(s)){console.log(e.flow.updatePackage);const a=JSON.parse(k(s,{encoding:"utf-8"}));y(a,{scripts:o,devDependencies:n}),u(s,`${JSON.stringify(a,null,2)}
66
+ `,D=e=>{const r=i(process.cwd(),".gitignore"),t=h(r)?k(r,{encoding:"utf-8"}):"";u(r,`${t}${L(e)}`,{encoding:"utf-8"})},M=async(e,{packageManager:r,lang:t,message:s,preset:o})=>{const{workflow:n}=await c.prompt([{name:"workflow",type:"confirm",message:s.question.workflow,default:!0}]);if(o||(o=(await c.prompt([{name:"preset",type:"list",message:s.question.preset,choices:["blog","docs"]}])).preset),console.log(s.flow.generateTemplate),x(i(S,"../template/public"),i(process.cwd(),e,"./.vuepress/public")),x(i(S,"../template",o),i(process.cwd(),e)),n){const a=i(process.cwd(),".github/workflows");d(a),u(i(a,"deploy-docs.yml"),V(r,e,t),{encoding:"utf-8"})}if(W())D(e);else if(H()){const{git:a}=await c.prompt([{name:"git",type:"confirm",message:s.question.git,default:!0}]);a&&(p("git init"),D(e))}},T=z(import.meta.url)("create-vuepress-theme-hope/package.json").version,B=e=>({"docs:build":`vuepress build ${e}`,"docs:clean-dev":`vuepress dev ${e} --clean-cache`,"docs:dev":`vuepress dev ${e}`}),q=async(e,r,t=process.cwd())=>{const s=i(t,"package.json"),o=B(r),n={"@vuepress/client":"2.0.0-beta.52",vue:"^3.2.41",vuepress:"2.0.0-beta.52","vuepress-theme-hope":T};if(h(s)){console.log(e.flow.updatePackage);const a=JSON.parse(k(s,{encoding:"utf-8"}));y(a,{scripts:o,devDependencies:n}),u(s,`${JSON.stringify(a,null,2)}
67
67
  `,{encoding:"utf-8"})}else{console.log(e.flow.createPackage);const a={...await c.prompt([{name:"name",type:"input",message:e.question.name,default:"vuepress-theme-hope-template",validate:m=>/^(?:@[a-z0-9-*~][a-z0-9-*._~]*\/)?[a-z0-9-~][a-z0-9-._~]*$/u.exec(m)?!0:e.error.name},{name:"version",type:"input",message:e.question.version,default:"2.0.0",validate:m=>/^[0-9]+\.[0-9]+\.(?:[0=9]+|[0-9]+-[a-z]+\.[0-9])$/u.exec(m)?!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:n};u(s,`${JSON.stringify(a,null,2)}
68
68
  `,{encoding:"utf-8"})}},K="https://registry.npmmirror.com/",Q=e=>p(`${e} config get registry`).stdout,X=async(e,r)=>{const t=Q(e);if(r==="简体中文"){const{registry:s}=await c.prompt([{name:"registry",type:"list",message:"选择你想使用的源",choices:["国内镜像源","当前源"]}]);return s==="国内镜像源"?K:t}return t},G=async(e,r)=>{if(!e)return l.outputHelp();const{lang:t,message:s}=await O();if(r&&!["docs","blog"].includes(r))return console.log(s.error.preset);const o=await Y(s.question.packageManager);if(e.startsWith("[")&&e.endsWith("]"))return console.log(s.error.updateDirMissing(o));const n=i(process.cwd(),e);return h(n)&&g(n).length?console.error(s.error.dirNotEmpty(e)):(d(n),{lang:t,message:s,packageManager:o})},A=async({cwd:e=process.cwd(),lang:r,message:t,packageManager:s})=>{const o=s==="pnpm"?"":await X(s,r);console.log(t.flow.install),console.warn(t.hint.install),p(`${s} install ${o?`--registry ${o}`:""}`,{cwd:e,stdout:"inherit"}),console.log(t.hint.finish);const{choice:n}=await c.prompt([{name:"choice",type:"confirm",message:t.question.devServer,default:!0}]);n?(console.log(t.flow.devServer),await I(`${s} run docs:dev`,{cwd:e,stdout:"inherit"})):console.log(t.hint.devServer(s))},l=E("vuepress-theme-hope");l.command("[dir]","Generate a new vuepress-theme-hope project").option("-p, --preset <preset>","Choose preset to use").usage("pnpm create vuepress-theme-hope@next [dir] / npm init vuepress-theme-hope@next [dir]").example("docs").action(async(e,{preset:r=null})=>{const t=i(process.cwd(),e),s=await G(e,r);if(s){const{lang:o,message:n,packageManager:a}=s;await q(n,"src",e),await M(v(e,"src"),{packageManager:a,lang:o,message:n,preset:r}),await A({cwd:t,lang:o,message:n,packageManager:a})}}),l.command("inject [dir]","Add vuepress template to dir").option("-p, --preset <preset>","Choose preset to use").usage("pnpm create vuepress-theme-hope@next inject [dir] / npm init vuepress-theme-hope@next inject [dir]").example("docs").action(async(e,{preset:r=null})=>{const t=await G(e,r);if(t){const{lang:s,message:o,packageManager:n}=t;await q(o,e),await M(e,{packageManager:n,lang:s,message:o,preset:r}),await A({message:o,lang:s,packageManager:n})}}),l.help(()=>[{title:"pnpm create vuepress-theme-hope@next [dir] / npm init vuepress-theme-hope@next [dir]",body:"Create a vuepress-theme-hope template in [dir]"},{title:"pnpm create vuepress-theme-hope@next inject [dir] / npm init vuepress-theme-hope@next inject [dir]",body:"Add vuepress-theme-hope template in [dir] under currect project"}]),l.version(T),l.parse();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-vuepress-theme-hope",
3
- "version": "2.0.0-beta.111",
3
+ "version": "2.0.0-beta.112",
4
4
  "description": "Create vuepress-theme-hope demo project helper",
5
5
  "keywords": [
6
6
  "create",