create-valaxy 0.15.10 → 0.15.11-beta.1
Sign up to get free protection for your applications and to get access to all the features.
- package/bin/index.mjs +0 -0
- package/dist/index.mjs +1 -1
- package/package.json +10 -9
- package/template-blog/_gitignore +3 -1
- package/template-blog/package.json +3 -3
- package/LICENSE +0 -21
package/bin/index.mjs
CHANGED
File without changes
|
package/dist/index.mjs
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import S from"node:process";import a from"node:fs";import i from"node:path";import{fileURLToPath as U}from"node:url";import{execa as k}from"execa";import{red as j,dim as m,gray as J,blue as y,yellow as u,bold as C,green as g,cyan as f,reset as x}from"kolorist";import B from"minimist";import v from"prompts";const G="0.15.
|
1
|
+
import S from"node:process";import a from"node:fs";import i from"node:path";import{fileURLToPath as U}from"node:url";import{execa as k}from"execa";import{red as j,dim as m,gray as J,blue as y,yellow as u,bold as C,green as g,cyan as f,reset as x}from"kolorist";import B from"minimist";import v from"prompts";const G="0.15.11-beta.1";function D(e){return e?.trim().replace(/\/+$/g,"")}function H(e){const o=a.readdirSync(e);return o.length===0||o.length===1&&o[0]===".git"}function I(e,o){a.statSync(e).isDirectory()?K(e,o):a.copyFileSync(e,o)}function K(e,o){a.mkdirSync(o,{recursive:!0});for(const n of a.readdirSync(e)){const c=i.resolve(e,n),p=i.resolve(o,n);I(c,p)}}function Y(e){if(console.log(`
|
2
2
|
${j("Removing")} ${m(e)}`),!!a.existsSync(e))for(const o of a.readdirSync(e))o!==".git"&&a.rmSync(i.resolve(e,o),{recursive:!0,force:!0})}function P(e){return/^(?:@[a-z\d\-*~][a-z\d\-*._~]*\/)?[a-z\d\-~][a-z\d\-._~]*$/.test(e)}function q(e){return e.trim().toLowerCase().replace(/\s+/g,"-").replace(/^[._]/,"").replace(/[^a-z\d\-~]+/g,"-")}function Q(e){if(!e)return;const o=e.split(" ")[0].split("/");return{name:o[0],version:o[1]}}const b={name:"starter",display:"Starter",repo:"https://github.com/valaxyjs/valaxy-theme-starter"};async function W(e){const o=b.name;let n=e.themeName||o;if(!n){const{theme:p}=await v({type:"text",name:"theme",message:"Theme name: valaxy-theme-",initial:o});n=p||o}const c=`valaxy-theme-${n.trim()}`;return console.log(` ${m("npx")} ${J("degit")} ${y(b.repo)} ${u(c)}`),await k("npx",["degit",b.repo,c],{stdio:"inherit"}),console.log(),console.log(` ${C("Check it")}:`),console.log(),console.log(`- Change ${C("author")} name in ${u("LICENSE")} & ${g("package.json")} & ${y(".github")}`),console.log(`- Change ${y("valaxy.config.ts")} theme: ${u("starter")} to ${f(`${n}`)}`),console.log(`- Rename ${u(`valaxy-theme-${n}`)} to ${f(`valaxy-theme-${n}`)}`),console.log(),console.log(` ${f("\u2728")}`),console.log(),`valaxy-theme-${n}`}const X={_gitignore:".gitignore",_npmrc:".npmrc"},A=[{name:"blog",display:"Blog",desc:"For Most Users",message:"Project name:",initial:"valaxy-blog",color:f},{name:"theme",display:"Theme",desc:"For Theme Developers",message:"Theme name: valaxy-theme-",initial:"starter",prefix:"valaxy-theme-",color:g,customInit:async e=>W(e).catch(o=>{console.error(o)})},{name:"addon",display:"Addon",desc:"For Addon Developers",message:"Addon name: valaxy-addon-",initial:"template",prefix:"valaxy-addon-",color:u}],O=A.map(e=>e.name),T=B(S.argv.slice(2)),E=S.cwd(),Z="valaxy-blog",ee=U(import.meta.url);async function oe(){console.log(),console.log(` ${C("\u{1F30C} Valaxy")} ${y(`v${G}`)}`),console.log();const e=D(T._[0]),o=T.template||T.t;let n=e||Z;const c=()=>n==="."?i.basename(i.resolve()):n;let p;const{template:r}=await v({type:o&&O.includes(o)?null:"select",name:"template",message:typeof o=="string"&&!O.includes(o)?x(`"${o}" isn't a valid template. Please choose from below: `):x("Select a type:"),initial:0,choices:A.map(t=>{const s=t.color;return{title:s(t.display||t.name)+m(` - ${t.desc}`),value:t}})});try{p=await v([{type:e?null:"text",name:"projectName",message:x(r.message),initial:r.initial,onState:t=>{n=D(r.prefix?r.prefix+t.value:t.value)||r.initial}},{type:()=>!a.existsSync(n)||H(n)?null:"confirm",name:"overwrite",message:()=>`${n==="."?"Current directory":`Target directory "${n}"`} is not empty. Remove existing files and continue?`},{type:(t,{overwrite:s})=>{if(s===!1)throw new Error(`${j("\u2716")} Operation cancelled`);return null},name:"overwriteChecker"},{type:()=>P(c())?null:"text",name:"packageName",message:x("Package name:"),initial:()=>q(c()),validate:t=>P(t)||"Invalid package.json name"}],{onCancel:()=>{throw new Error(`${j("\u2716")} Operation cancelled`)}})}catch(t){console.log(t.message);return}const{projectName:$,overwrite:z}=p,L=r.prefix?r.prefix+$:$,l=i.join(E,L);if(z?Y(l):a.existsSync(l)||a.mkdirSync(l,{recursive:!0}),r.customInit)await r.customInit({themeName:$});else{const t=i.resolve(ee,"../..",`template-${r.name}`),s=(d,h)=>{const _=i.join(l,X[d]??d);h?a.writeFileSync(_,h):I(i.join(t,d),_)},M=a.readdirSync(t);for(const d of M.filter(h=>h!=="package.json"))s(d);const N=JSON.parse(a.readFileSync(i.join(t,"package.json"),"utf-8"));N.name=$||c(),s("package.json",`${JSON.stringify(N,null,2)}
|
3
3
|
`)}console.log(` ${m("\u{1F4C1}")} ${m(l)}`),console.log(),console.log(m(" Scaffolding project in ")+n+m(" ..."));const F=Q(S.env.npm_config_user_agent),w=F?F.name:"npm",R=i.relative(E,l);if(console.log(g(` Done.
|
4
4
|
`)),r.name==="addon")return;const{yes:V}=await v({type:"confirm",name:"yes",initial:"Y",message:"Install and start it now?"});if(V){const{agent:t}=await v({name:"agent",type:"select",message:"Choose the agent",choices:["npm","yarn","pnpm"].map(s=>({value:s,title:s})),initial:2});if(!t)return;await k(t,["install"],{stdio:"inherit",cwd:l}),await k(t,["run","dev"],{stdio:"inherit",cwd:l})}else{switch(console.log(m(`
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "create-valaxy",
|
3
3
|
"type": "module",
|
4
|
-
"version": "0.15.
|
4
|
+
"version": "0.15.11-beta.1",
|
5
5
|
"description": "Create Starter Template for Valaxy",
|
6
6
|
"author": {
|
7
7
|
"email": "me@yunyoujun.cn",
|
@@ -21,21 +21,22 @@
|
|
21
21
|
"files": [
|
22
22
|
"bin",
|
23
23
|
"dist",
|
24
|
-
"template
|
24
|
+
"template-*/**/*"
|
25
25
|
],
|
26
26
|
"engines": {
|
27
27
|
"node": "^18.0.0 || >=20.0.0"
|
28
28
|
},
|
29
|
-
"dependencies": {
|
30
|
-
"execa": "8.0.1",
|
31
|
-
"kolorist": "^1.8.0",
|
32
|
-
"minimist": "^1.2.8",
|
33
|
-
"prompts": "^2.4.2"
|
34
|
-
},
|
35
29
|
"scripts": {
|
36
30
|
"build": "unbuild",
|
37
31
|
"dev": "unbuild --stub",
|
32
|
+
"prepublishOnly": "npm run build",
|
38
33
|
"start": "tsx src/index.ts",
|
39
34
|
"typecheck": "tsc --noEmit"
|
35
|
+
},
|
36
|
+
"dependencies": {
|
37
|
+
"execa": "8.0.1",
|
38
|
+
"kolorist": "^1.8.0",
|
39
|
+
"minimist": "^1.2.8",
|
40
|
+
"prompts": "^2.4.2"
|
40
41
|
}
|
41
|
-
}
|
42
|
+
}
|
package/template-blog/_gitignore
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
"version": "0.0.0",
|
5
5
|
"private": true,
|
6
6
|
"scripts": {
|
7
|
-
"build": "npm run build:ssg
|
7
|
+
"build": "npm run build:ssg",
|
8
8
|
"build:spa": "valaxy build",
|
9
9
|
"build:ssg": "valaxy build --ssg",
|
10
10
|
"dev": "valaxy",
|
@@ -12,8 +12,8 @@
|
|
12
12
|
"serve": "vite preview"
|
13
13
|
},
|
14
14
|
"dependencies": {
|
15
|
-
"valaxy": "0.15.
|
16
|
-
"valaxy-theme-yun": "0.15.
|
15
|
+
"valaxy": "0.15.11",
|
16
|
+
"valaxy-theme-yun": "0.15.11"
|
17
17
|
},
|
18
18
|
"devDependencies": {
|
19
19
|
"typescript": "^5.2.2"
|
package/LICENSE
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
MIT License
|
2
|
-
|
3
|
-
Copyright (c) 2022 云游君 YunYouJun <me@yunyoujun.cn>
|
4
|
-
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
7
|
-
in the Software without restriction, including without limitation the rights
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
10
|
-
furnished to do so, subject to the following conditions:
|
11
|
-
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
13
|
-
copies or substantial portions of the Software.
|
14
|
-
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
-
SOFTWARE.
|