create-soybean 1.0.0-beta.4 → 1.0.0-beta.6

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/README.md CHANGED
@@ -4,5 +4,7 @@ SoybeanJS's command line to create different project templates
4
4
 
5
5
  ## currently support
6
6
 
7
- - template-ts-lib: use unbuild to build TypeScript library
7
+ - template-ts-lib-tsup: use tsup to build TypeScript library
8
+ - template-ts-lib-unbuild: use unbuild to build TypeScript library
9
+ - template-pnpm-monorepo: create a monorepo project with pnpm
8
10
  - template-vue: create a vue project quickly with eslint, simple-git-hooks and lint-staged
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import $ from"node:process";import{readdirSync as p,existsSync as v,rmSync as F,statSync as O,copyFileSync as V,mkdirSync as h,readFileSync as B,writeFileSync as E}from"node:fs";import o from"node:path";import{fileURLToPath as I}from"node:url";import{green as J,blue as L,cyan as k,lightBlue as G,reset as u,red as H}from"kolorist";import U from"minimist";import q from"prompts";import{consola as f}from"consola";function _(e){return e?.trim()?.replace(/\/+$/g,"")}function A(e){const t=p(e);return t.length===0||t.length===1&&t[0]===".git"}function b(e){return/^(?:@[a-z\d\-*~][a-z\d\-*._~]*\/)?[a-z\d\-~][a-z\d\-._~]*$/.test(e)}function K(e){return e.trim().toLowerCase().replace(/\s+/g,"-").replace(/^[._]/,"").replace(/[^a-z\d\-~]+/g,"-")}function M(e){if(!v(e))return;const t=p(e);for(const c of t)if(c!==".git"){const n=o.resolve(e,c);F(n,{recursive:!0,force:!0})}}function Q(e,t){h(t,{recursive:!0});const c=p(e);for(const n of c){const i=o.resolve(e,n),s=o.resolve(t,n);N(i,s)}}function N(e,t){O(e).isDirectory()?Q(e,t):V(e,t)}const P=[{type:"vue",name:"Vue 3",color:J},{type:"ts-lib",name:"TypeScript library",color:L},{type:"react",name:"React",color:k},{type:"react-native",name:"React Native",color:k},{type:"solid",name:"Solid",color:G}],z=P.map(e=>e.type),W={_editorconfig:".editorconfig",_gitattributes:".gitattributes",_gitignore:".gitignore",_npmrc:".npmrc",_prettierrc:".prettierrc"},S="create-soybean-project";async function X(){const e=$.cwd(),t=U($.argv.slice(2),{string:["_"]}),c=_(t._[0]),n=t.template||t.t;let i=c||S;function s(){return i==="."?o.basename(o.resolve()):i}let g=null;try{g=await q([{type:c?null:"text",name:"projectName",message:u("Project name:"),initial:S,onState:r=>{i=_(r.value)||S}},{type:()=>!v(i)||A(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(`${H("\u2716")} Operation cancelled`);return null},name:"overwriteChecker"},{type:()=>b(s())?null:"text",name:"packageName",message:u("Package name:"),initial:()=>K(s()),validate:r=>b(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:P.map(({type:r,name:a,color:m})=>({title:m(a),value:r}))}])}catch(r){f.error(r)}if(!g)return;const{template:D,overwrite:T,packageName:x}=g,l=o.join(e,i);T?M(l):v(l)||h(l,{recursive:!0});const C=D||n;f.info(`
3
- Scaffolding project in ${l}...`);const y=o.resolve(I(import.meta.url),"../..",`template-${C}`),w=(r,a)=>{const m=o.join(l,W[r]??r);a?E(m,a):N(o.join(y,r),m)},R=p(y);for(const r of R.filter(a=>a!=="package.json"))w(r);const j=JSON.parse(B(o.join(y,"package.json"),"utf-8"));j.name=x||s(),w("package.json",`${JSON.stringify(j,null,2)}
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
4
  `);const d=o.relative(e,l);f.info(`
5
5
  Done. Now run:
6
- `),l!==e&&f.info(` cd ${d.includes(" ")?`"${d}"`:d}`)}X();
6
+ `),l!==e&&f.info(` cd ${d.includes(" ")?`"${d}"`:d}`)}Y();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-soybean",
3
- "version": "1.0.0-beta.4",
3
+ "version": "1.0.0-beta.6",
4
4
  "description": "SoybeanJS's command line to create different project templates",
5
5
  "author": {
6
6
  "name": "Soybean",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "template-vue",
3
3
  "type": "module",
4
- "version": "1.0.0-beta.4",
4
+ "version": "1.0.0-beta.6",
5
5
  "private": true,
6
6
  "packageManager": "pnpm@8.12.0",
7
7
  "scripts": {
@@ -22,8 +22,8 @@
22
22
  "vue-router": "4.2.5"
23
23
  },
24
24
  "devDependencies": {
25
- "@soybeanjs/cli": "0.8.10",
26
- "@soybeanjs/eslint-config": "1.0.11",
25
+ "@soybeanjs/cli": "1.0.0-beta.6",
26
+ "@soybeanjs/eslint-config": "1.0.12",
27
27
  "@types/node": "20.10.4",
28
28
  "@vitejs/plugin-vue": "4.5.2",
29
29
  "@vitejs/plugin-vue-jsx": "3.1.0",
@@ -1,46 +0,0 @@
1
- name: Release
2
-
3
- on:
4
- push:
5
- tags:
6
- - "v*"
7
-
8
- jobs:
9
- release:
10
- permissions:
11
- id-token: write
12
- contents: write
13
- runs-on: ubuntu-latest
14
- steps:
15
- - uses: actions/checkout@v3
16
- with:
17
- fetch-depth: 0
18
-
19
- - name: Install pnpm
20
- uses: pnpm/action-setup@v2
21
-
22
- - name: Set node
23
- uses: actions/setup-node@v3
24
- with:
25
- node-version: lts/*
26
- cache: pnpm
27
- registry-url: "https://registry.npmjs.org"
28
-
29
- - run: npx githublogen
30
- env:
31
- GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
32
-
33
- - name: Install Dependencies
34
- run: pnpm i
35
-
36
- - name: PNPM build
37
- run: pnpm run build
38
-
39
- - name: Publish to NPM
40
- run: pnpm -r publish --access public --no-git-checks
41
- env:
42
- NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
43
- NPM_CONFIG_PROVENANCE: true
44
-
45
- - name: Sync Npmmirror
46
- run: npx syncmirror
@@ -1,13 +0,0 @@
1
- {
2
- "recommendations": [
3
- "antfu.unocss",
4
- "dbaeumer.vscode-eslint",
5
- "editorconfig.editorconfig",
6
- "esbenp.prettier-vscode",
7
- "formulahendry.auto-complete-tag",
8
- "formulahendry.auto-close-tag",
9
- "formulahendry.auto-rename-tag",
10
- "kisstkondoros.vscode-gutter-preview",
11
- "mhutchie.git-graph"
12
- ]
13
- }
@@ -1,13 +0,0 @@
1
- {
2
- "version": "1.0.0",
3
- "configurations": [
4
- {
5
- "type": "node",
6
- "request": "launch",
7
- "name": "TS debugger",
8
- "skipFiles": ["<node_internals>/**"],
9
- "runtimeArgs": ["--loader", "tsx"],
10
- "program": "${relativeFile}"
11
- }
12
- ]
13
- }
@@ -1,10 +0,0 @@
1
- {
2
- "editor.codeActionsOnSave": {
3
- "source.fixAll.eslint": "explicit",
4
- "source.organizeImports": "never"
5
- },
6
- "eslint.experimental.useFlatConfig": true,
7
- "editor.formatOnSave": false,
8
- "eslint.validate": ["json", "jsonc"],
9
- "prettier.enable": false
10
- }
@@ -1,11 +0,0 @@
1
- # Editor configuration, see http://editorconfig.org
2
-
3
- root = true
4
-
5
- [*]
6
- charset = utf-8
7
- indent_style = space
8
- indent_size = 2
9
- end_of_line = lf
10
- trim_trailing_whitespace = true
11
- insert_final_newline = true
@@ -1,21 +0,0 @@
1
- "*.js" eol=lf
2
- "*.ts" eol=lf
3
- "*.jsx" eol=lf
4
- "*.tsx" eol=lf
5
- "*.cjs" eol=lf
6
- "*.cts" eol=lf
7
- "*.mjs" eol=lf
8
- "*.mts" eol=lf
9
- "*.html" eol=lf
10
- "*.css" eol=lf
11
- "*.vue" eol=lf
12
- "*.json" eol=lf
13
- "*.less" eol=lf
14
- "*.scss" eol=lf
15
- "*.sass" eol=lf
16
- "*.styl" eol=lf
17
- "*.svelte" eol=lf
18
- "*.md" eol=lf
19
- "*.yml" eol=lf
20
- "*.astro" eol=lf
21
- "*.mdx" eol=lf
@@ -1,30 +0,0 @@
1
- # Logs
2
- logs
3
- *.log
4
- npm-debug.log*
5
- yarn-debug.log*
6
- yarn-error.log*
7
- pnpm-debug.log*
8
- lerna-debug.log*
9
-
10
- node_modules
11
- .DS_Store
12
- dist
13
- dist-ssr
14
- coverage
15
- *.local
16
-
17
- /cypress/videos/
18
- /cypress/screenshots/
19
-
20
- # Editor directories and files
21
- .vscode/*
22
- !.vscode/extensions.json
23
- !.vscode/settings.json
24
- !.vscode/launch.json
25
- .idea
26
- *.suo
27
- *.ntvs*
28
- *.njsproj
29
- *.sln
30
- *.sw?
@@ -1,2 +0,0 @@
1
- registry=https://registry.npmmirror.com/
2
- shamefully-hoist=true
File without changes
@@ -1,18 +0,0 @@
1
- import { URL, fileURLToPath } from 'node:url';
2
- import { defineBuildConfig } from 'unbuild';
3
-
4
- export default defineBuildConfig({
5
- alias: {
6
- '@': fileURLToPath(new URL('./src', import.meta.url))
7
- },
8
- entries: ['src/index'],
9
- clean: true,
10
- declaration: true,
11
- rollup: {
12
- emitCJS: true,
13
- inlineDependencies: true,
14
- esbuild: {
15
- minify: true
16
- }
17
- }
18
- });
@@ -1,3 +0,0 @@
1
- import { defineConfig } from '@soybeanjs/eslint-config';
2
-
3
- export default defineConfig();
@@ -1,58 +0,0 @@
1
- {
2
- "name": "ts-lib-starter",
3
- "type": "module",
4
- "version": "1.0.0-beta.4",
5
- "private": true,
6
- "packageManager": "pnpm@8.12.0",
7
- "exports": {
8
- ".": {
9
- "types": "./dist/index.d.ts",
10
- "import": "./dist/index.mjs",
11
- "require": "./dist/index.cjs"
12
- }
13
- },
14
- "main": "dist/index.cjs",
15
- "module": "dist/index.mjs",
16
- "types": "dist/index.d.ts",
17
- "files": [
18
- "dist"
19
- ],
20
- "scripts": {
21
- "build": "unbuild",
22
- "cleanup": "soy cleanup",
23
- "commit": "soy git-commit",
24
- "lint": "eslint . --fix",
25
- "prepare": "simple-git-hooks",
26
- "publish-pkg": "pnpm publish --access public",
27
- "release": "soy release",
28
- "typecheck": "tsc --noEmit --skipLibCheck",
29
- "update-pkg": "soy ncu"
30
- },
31
- "dependencies": {
32
- "cli-progress": "3.12.0",
33
- "consola": "3.2.3",
34
- "dayjs": "1.11.10",
35
- "execa": "8.0.1",
36
- "kolorist": "1.8.0",
37
- "ofetch": "1.3.3"
38
- },
39
- "devDependencies": {
40
- "@soybeanjs/cli": "0.8.10",
41
- "@soybeanjs/eslint-config": "1.0.11",
42
- "@types/cli-progress": "3.11.5",
43
- "@types/node": "20.10.4",
44
- "eslint": "8.55.0",
45
- "lint-staged": "15.2.0",
46
- "simple-git-hooks": "2.9.0",
47
- "tsx": "4.6.2",
48
- "typescript": "5.3.3",
49
- "unbuild": "2.0.0"
50
- },
51
- "simple-git-hooks": {
52
- "commit-msg": "pnpm soy git-commit-verify",
53
- "pre-commit": "pnpm typecheck && pnpm lint-staged"
54
- },
55
- "lint-staged": {
56
- "*": "eslint --fix"
57
- }
58
- }
@@ -1,3 +0,0 @@
1
- export function fn() {
2
- return 1;
3
- }
@@ -1,24 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "target": "ESNext",
4
- "jsx": "preserve",
5
- "lib": ["DOM", "ESNext"],
6
- "baseUrl": ".",
7
- "module": "ESNext",
8
- "moduleResolution": "node",
9
- "paths": {
10
- "@/*": ["./src/*"]
11
- },
12
- "resolveJsonModule": true,
13
- "types": ["node"],
14
- "strict": true,
15
- "strictNullChecks": true,
16
- "noUnusedLocals": true,
17
- "outDir": "./dist",
18
- "allowSyntheticDefaultImports": true,
19
- "esModuleInterop": true,
20
- "forceConsistentCasingInFileNames": true
21
- },
22
- "include": ["src/**/*"],
23
- "exclude": ["node_modules", "dist"]
24
- }