create-soybean 1.0.0-beta.7 → 1.0.1
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/dist/index.js +6 -0
- package/package.json +6 -6
- package/template-pnpm-monorepo/package.json +6 -6
- package/template-pnpm-monorepo/packages/demo-pkg/package.json +2 -2
- package/template-react/package.json +1 -1
- package/template-react-native/package.json +1 -1
- package/template-solid/package.json +1 -1
- package/template-ts-lib-tsup/package.json +7 -7
- package/template-ts-lib-tsup/tsup.config.ts +1 -0
- package/template-ts-lib-unbuild/package.json +7 -7
- package/template-vue/package.json +10 -10
- package/dist/index.mjs +0 -6
package/dist/index.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import x from"node:process";import{existsSync as $,mkdirSync as U,readFileSync as q,readdirSync as G,writeFileSync as H}from"node:fs";import a from"node:path";import{fileURLToPath as K}from"node:url";import{blue as _,cyan as D,green as Q,lightBlue as W,red as X,reset as m,yellow as Y}from"kolorist";import Z from"minimist";import ee from"prompts";import{consola as g}from"consola";import{copyFileSync as L,existsSync as O,mkdirSync as J,readdirSync as v,rmSync as B,statSync as I}from"node:fs";import d from"node:path";function b(e){return e?.trim()?.replace(/\/+$/g,"")}function h(e){let t=v(e);return t.length===0||t.length===1&&t[0]===".git"}function S(e){return/^(?:@[a-z\d\-*~][a-z\d\-*._~]*\/)?[a-z\d\-~][a-z\d\-._~]*$/.test(e)}function j(e){return e.trim().toLowerCase().replace(/\s+/g,"-").replace(/^[._]/,"").replace(/[^a-z\d\-~]+/g,"-")}function N(e){if(!O(e))return;let s=v(e);for(let n of s)if(n!==".git"){let i=d.resolve(e,n);B(i,{recursive:!0,force:!0})}}function M(e,t){J(t,{recursive:!0});let s=v(e);for(let n of s){let i=d.resolve(e,n),l=d.resolve(t,n);T(i,l)}}function T(e,t){I(e).isDirectory()?M(e,t):L(e,t)}var F=[{type:"ts-lib-tsup",name:"TypeScript library by tsup",color:_},{type:"ts-lib-unbuild",name:"TypeScript library by unbuild",color:_},{type:"pnpm-monorepo",name:"Pnpm monorepo",color:Y},{type:"vue",name:"Vue 3",color:Q},{type:"react",name:"React",color:D},{type:"react-native",name:"React Native",color:D},{type:"solid",name:"Solid",color:W}],C=F.map(e=>e.type),te={_editorconfig:".editorconfig",_gitattributes:".gitattributes",_gitignore:".gitignore",_npmrc:".npmrc",_prettierrc:".prettierrc"},w="create-soybean-project";async function re(){let e=x.cwd(),t=Z(x.argv.slice(2),{string:["_"]}),s=b(t._[0]),n=t.template||t.t,i=s||w;function l(){return i==="."?a.basename(a.resolve()):i}let u=null;try{u=await ee([{type:s?null:"text",name:"projectName",message:m("Project name:"),initial:w,onState:r=>{i=b(r.value)||w}},{type:()=>!$(i)||h(i)?null:"confirm",name:"overwrite",message:()=>`${i==="."?"Current directory":`Target directory "${i}"`} is not empty. Remove existing files and continue?`},{type:(r,{overwrite:o})=>{if(o===!1)throw new Error(`${X("\u2716")} Operation cancelled`);return null},name:"overwriteChecker"},{type:()=>S(l())?null:"text",name:"packageName",message:m("Package name:"),initial:()=>j(l()),validate:r=>S(r)||"Invalid package.json name"},{type:n&&C.includes(n)?null:"select",name:"template",message:typeof n=="string"&&!C.includes(n)?m(`"${n}" isn't a valid template. Please choose from below: `):m("Select a template:"),initial:0,choices:F.map(({type:r,name:o,color:p})=>({title:p(o),value:r}))}])}catch(r){g.error(r)}if(!u)return;let{template:E,overwrite:z,packageName:A}=u,c=a.join(e,i);z?N(c):$(c)||U(c,{recursive:!0});let R=E||n;g.info(`
|
|
3
|
+
Scaffolding project in ${c}...`);let f=a.resolve(K(import.meta.url),"../..",`template-${R}`),k=(r,o)=>{let p=a.join(c,te[r]??r);o?H(p,o):T(a.join(f,r),p)},V=G(f);for(let r of V.filter(o=>o!=="package.json"))k(r);let P=JSON.parse(q(a.join(f,"package.json"),"utf-8"));P.name=A||l(),k("package.json",`${JSON.stringify(P,null,2)}
|
|
4
|
+
`);let y=a.relative(e,c);g.info(`
|
|
5
|
+
Done. Now run:
|
|
6
|
+
`),c!==e&&g.info(` cd ${y.includes(" ")?`"${y}"`:y}`)}re();
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-soybean",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.1",
|
|
5
5
|
"description": "SoybeanJS's command line to create different project templates",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Soybean",
|
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
"registry": "https://registry.npmjs.org/"
|
|
21
21
|
},
|
|
22
22
|
"bin": {
|
|
23
|
-
"create-soybean": "dist/index.
|
|
24
|
-
"create-soy": "dist/index.
|
|
23
|
+
"create-soybean": "dist/index.js",
|
|
24
|
+
"create-soy": "dist/index.js"
|
|
25
25
|
},
|
|
26
26
|
"files": [
|
|
27
27
|
"dist",
|
|
@@ -36,12 +36,12 @@
|
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@types/minimist": "1.2.5",
|
|
38
38
|
"@types/prompts": "2.4.9",
|
|
39
|
-
"
|
|
40
|
-
"
|
|
39
|
+
"tsup": "8.0.1",
|
|
40
|
+
"typescript": "5.3.3"
|
|
41
41
|
},
|
|
42
42
|
"scripts": {
|
|
43
43
|
"build": "pnpm typecheck && pnpm build-only",
|
|
44
|
-
"build-only": "
|
|
44
|
+
"build-only": "tsup",
|
|
45
45
|
"publish-pkg": "pnpm publish --access public --no-git-checks",
|
|
46
46
|
"typecheck": "tsc --noEmit --skipLibCheck"
|
|
47
47
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pnpm-monorepo",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.1",
|
|
5
5
|
"private": true,
|
|
6
|
-
"packageManager": "pnpm@8.
|
|
6
|
+
"packageManager": "pnpm@8.13.1",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"cleanup": "soy cleanup",
|
|
9
9
|
"commit": "soy git-commit",
|
|
@@ -15,12 +15,12 @@
|
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {},
|
|
17
17
|
"devDependencies": {
|
|
18
|
-
"@soybeanjs/cli": "1.0.0
|
|
19
|
-
"@soybeanjs/eslint-config": "1.
|
|
20
|
-
"eslint": "8.
|
|
18
|
+
"@soybeanjs/cli": "1.0.0",
|
|
19
|
+
"@soybeanjs/eslint-config": "1.1.4",
|
|
20
|
+
"eslint": "8.56.0",
|
|
21
21
|
"lint-staged": "15.2.0",
|
|
22
22
|
"simple-git-hooks": "2.9.0",
|
|
23
|
-
"tsx": "4.
|
|
23
|
+
"tsx": "4.7.0",
|
|
24
24
|
"typescript": "5.3.3"
|
|
25
25
|
},
|
|
26
26
|
"simple-git-hooks": {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ts-lib-tsup",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.1",
|
|
5
5
|
"private": true,
|
|
6
|
-
"packageManager": "pnpm@8.
|
|
6
|
+
"packageManager": "pnpm@8.13.1",
|
|
7
7
|
"sideEffects": false,
|
|
8
8
|
"exports": {
|
|
9
9
|
".": {
|
|
@@ -37,15 +37,15 @@
|
|
|
37
37
|
"ofetch": "1.3.3"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@soybeanjs/cli": "1.0.0
|
|
41
|
-
"@soybeanjs/eslint-config": "1.
|
|
40
|
+
"@soybeanjs/cli": "1.0.0",
|
|
41
|
+
"@soybeanjs/eslint-config": "1.1.4",
|
|
42
42
|
"@types/cli-progress": "3.11.5",
|
|
43
|
-
"@types/node": "20.10.
|
|
44
|
-
"eslint": "8.
|
|
43
|
+
"@types/node": "20.10.5",
|
|
44
|
+
"eslint": "8.56.0",
|
|
45
45
|
"lint-staged": "15.2.0",
|
|
46
46
|
"simple-git-hooks": "2.9.0",
|
|
47
47
|
"tsup": "8.0.1",
|
|
48
|
-
"tsx": "4.
|
|
48
|
+
"tsx": "4.7.0",
|
|
49
49
|
"typescript": "5.3.3"
|
|
50
50
|
},
|
|
51
51
|
"simple-git-hooks": {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ts-lib-unbuild",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.1",
|
|
5
5
|
"private": true,
|
|
6
|
-
"packageManager": "pnpm@8.
|
|
6
|
+
"packageManager": "pnpm@8.13.1",
|
|
7
7
|
"sideEffects": false,
|
|
8
8
|
"exports": {
|
|
9
9
|
".": {
|
|
@@ -36,14 +36,14 @@
|
|
|
36
36
|
"ofetch": "1.3.3"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@soybeanjs/cli": "1.0.0
|
|
40
|
-
"@soybeanjs/eslint-config": "1.
|
|
39
|
+
"@soybeanjs/cli": "1.0.0",
|
|
40
|
+
"@soybeanjs/eslint-config": "1.1.4",
|
|
41
41
|
"@types/cli-progress": "3.11.5",
|
|
42
|
-
"@types/node": "20.10.
|
|
43
|
-
"eslint": "8.
|
|
42
|
+
"@types/node": "20.10.5",
|
|
43
|
+
"eslint": "8.56.0",
|
|
44
44
|
"lint-staged": "15.2.0",
|
|
45
45
|
"simple-git-hooks": "2.9.0",
|
|
46
|
-
"tsx": "4.
|
|
46
|
+
"tsx": "4.7.0",
|
|
47
47
|
"typescript": "5.3.3",
|
|
48
48
|
"unbuild": "2.0.0"
|
|
49
49
|
},
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "template-vue",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.1",
|
|
5
5
|
"private": true,
|
|
6
|
-
"packageManager": "pnpm@8.
|
|
6
|
+
"packageManager": "pnpm@8.13.1",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"build": "run-s typecheck build-only",
|
|
9
9
|
"build-only": "vite build",
|
|
@@ -18,23 +18,23 @@
|
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"pinia": "2.1.7",
|
|
21
|
-
"vue": "3.3.
|
|
21
|
+
"vue": "3.3.13",
|
|
22
22
|
"vue-router": "4.2.5"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
|
-
"@soybeanjs/cli": "1.0.0
|
|
26
|
-
"@soybeanjs/eslint-config": "1.
|
|
27
|
-
"@types/node": "20.10.
|
|
28
|
-
"@vitejs/plugin-vue": "
|
|
25
|
+
"@soybeanjs/cli": "1.0.0",
|
|
26
|
+
"@soybeanjs/eslint-config": "1.1.4",
|
|
27
|
+
"@types/node": "20.10.5",
|
|
28
|
+
"@vitejs/plugin-vue": "5.0.0",
|
|
29
29
|
"@vitejs/plugin-vue-jsx": "3.1.0",
|
|
30
|
-
"eslint": "8.
|
|
30
|
+
"eslint": "8.56.0",
|
|
31
31
|
"eslint-plugin-vue": "9.19.2",
|
|
32
32
|
"lint-staged": "15.2.0",
|
|
33
33
|
"simple-git-hooks": "2.9.0",
|
|
34
34
|
"typescript": "5.3.3",
|
|
35
|
-
"vite": "5.0.
|
|
35
|
+
"vite": "5.0.10",
|
|
36
36
|
"vue-eslint-parser": "9.3.2",
|
|
37
|
-
"vue-tsc": "1.8.
|
|
37
|
+
"vue-tsc": "1.8.27"
|
|
38
38
|
},
|
|
39
39
|
"simple-git-hooks": {
|
|
40
40
|
"commit-msg": "pnpm soy git-commit-verify",
|
package/dist/index.mjs
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import j from"node:process";import{readdirSync as p,existsSync as v,rmSync as O,statSync as V,copyFileSync as E,mkdirSync as $,readFileSync as I,writeFileSync as J}from"node:fs";import o from"node:path";import{fileURLToPath as L}from"node:url";import{blue as h,yellow as A,green as B,cyan as k,lightBlue as H,reset as u,red as K}from"kolorist";import M from"minimist";import U from"prompts";import{consola as f}from"consola";function _(e){return e?.trim()?.replace(/\/+$/g,"")}function q(e){const t=p(e);return t.length===0||t.length===1&&t[0]===".git"}function N(e){return/^(?:@[a-z\d\-*~][a-z\d\-*._~]*\/)?[a-z\d\-~][a-z\d\-._~]*$/.test(e)}function G(e){return e.trim().toLowerCase().replace(/\s+/g,"-").replace(/^[._]/,"").replace(/[^a-z\d\-~]+/g,"-")}function Q(e){if(!v(e))return;const t=p(e);for(const c of t)if(c!==".git"){const n=o.resolve(e,c);O(n,{recursive:!0,force:!0})}}function W(e,t){$(t,{recursive:!0});const c=p(e);for(const n of c){const i=o.resolve(e,n),s=o.resolve(t,n);P(i,s)}}function P(e,t){V(e).isDirectory()?W(e,t):E(e,t)}const T=[{type:"ts-lib-tsup",name:"TypeScript library by tsup",color:h},{type:"ts-lib-unbuild",name:"TypeScript library by unbuild",color:h},{type:"pnpm-monorepo",name:"Pnpm monorepo",color:A},{type:"vue",name:"Vue 3",color:B},{type:"react",name:"React",color:k},{type:"react-native",name:"React Native",color:k},{type:"solid",name:"Solid",color:H}],z=T.map(e=>e.type),X={_editorconfig:".editorconfig",_gitattributes:".gitattributes",_gitignore:".gitignore",_npmrc:".npmrc",_prettierrc:".prettierrc"},b="create-soybean-project";async function Y(){const e=j.cwd(),t=M(j.argv.slice(2),{string:["_"]}),c=_(t._[0]),n=t.template||t.t;let i=c||b;function s(){return i==="."?o.basename(o.resolve()):i}let y=null;try{y=await U([{type:c?null:"text",name:"projectName",message:u("Project name:"),initial:b,onState:r=>{i=_(r.value)||b}},{type:()=>!v(i)||q(i)?null:"confirm",name:"overwrite",message:()=>`${i==="."?"Current directory":`Target directory "${i}"`} is not empty. Remove existing files and continue?`},{type:(r,{overwrite:a})=>{if(a===!1)throw new Error(`${K("\u2716")} Operation cancelled`);return null},name:"overwriteChecker"},{type:()=>N(s())?null:"text",name:"packageName",message:u("Package name:"),initial:()=>G(s()),validate:r=>N(r)||"Invalid package.json name"},{type:n&&z.includes(n)?null:"select",name:"template",message:typeof n=="string"&&!z.includes(n)?u(`"${n}" isn't a valid template. Please choose from below: `):u("Select a template:"),initial:0,choices:T.map(({type:r,name:a,color:m})=>({title:m(a),value:r}))}])}catch(r){f.error(r)}if(!y)return;const{template:D,overwrite:x,packageName:C}=y,l=o.join(e,i);x?Q(l):v(l)||$(l,{recursive:!0});const R=D||n;f.info(`
|
|
3
|
-
Scaffolding project in ${l}...`);const g=o.resolve(L(import.meta.url),"../..",`template-${R}`),S=(r,a)=>{const m=o.join(l,X[r]??r);a?J(m,a):P(o.join(g,r),m)},F=p(g);for(const r of F.filter(a=>a!=="package.json"))S(r);const w=JSON.parse(I(o.join(g,"package.json"),"utf-8"));w.name=C||s(),S("package.json",`${JSON.stringify(w,null,2)}
|
|
4
|
-
`);const d=o.relative(e,l);f.info(`
|
|
5
|
-
Done. Now run:
|
|
6
|
-
`),l!==e&&f.info(` cd ${d.includes(" ")?`"${d}"`:d}`)}Y();
|