create-soybean 1.0.0-beta.6 → 1.0.0

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 (57) hide show
  1. package/dist/index.js +6 -0
  2. package/package.json +6 -6
  3. package/template-pnpm-monorepo/.vscode/extensions.json +13 -0
  4. package/template-pnpm-monorepo/.vscode/launch.json +13 -0
  5. package/template-pnpm-monorepo/.vscode/settings.json +10 -0
  6. package/template-pnpm-monorepo/_editorconfig +11 -0
  7. package/template-pnpm-monorepo/_gitattributes +21 -0
  8. package/template-pnpm-monorepo/_gitignore +30 -0
  9. package/template-pnpm-monorepo/_npmrc +3 -0
  10. package/template-pnpm-monorepo/_prettierrc +0 -0
  11. package/template-pnpm-monorepo/package.json +33 -0
  12. package/template-pnpm-monorepo/packages/demo-pkg/package.json +14 -0
  13. package/template-pnpm-monorepo/packages/demo-pkg/tsconfig.json +24 -0
  14. package/template-pnpm-monorepo/pnpm-workspace.yaml +2 -0
  15. package/template-pnpm-monorepo/src/index.ts +3 -0
  16. package/template-react/_eslintrc +3 -0
  17. package/template-react/_gitignore +34 -0
  18. package/template-react/_npmrc +2 -0
  19. package/template-react/package.json +6 -0
  20. package/template-react-native/_eslintrc +3 -0
  21. package/template-react-native/_gitignore +34 -0
  22. package/template-react-native/_npmrc +2 -0
  23. package/template-react-native/package.json +6 -0
  24. package/template-solid/_eslintrc +3 -0
  25. package/template-solid/_gitignore +34 -0
  26. package/template-solid/_npmrc +2 -0
  27. package/template-solid/package.json +6 -0
  28. package/template-ts-lib-tsup/.github/workflows/release.yml +46 -0
  29. package/template-ts-lib-tsup/.vscode/extensions.json +13 -0
  30. package/template-ts-lib-tsup/.vscode/launch.json +13 -0
  31. package/template-ts-lib-tsup/.vscode/settings.json +10 -0
  32. package/template-ts-lib-tsup/_editorconfig +11 -0
  33. package/template-ts-lib-tsup/_gitattributes +21 -0
  34. package/template-ts-lib-tsup/_gitignore +30 -0
  35. package/template-ts-lib-tsup/_npmrc +2 -0
  36. package/template-ts-lib-tsup/_prettierrc +0 -0
  37. package/template-ts-lib-tsup/eslint.config.js +3 -0
  38. package/template-ts-lib-tsup/package.json +58 -0
  39. package/template-ts-lib-tsup/src/index.ts +3 -0
  40. package/template-ts-lib-tsup/tsconfig.json +24 -0
  41. package/template-ts-lib-tsup/tsup.config.ts +14 -0
  42. package/template-ts-lib-unbuild/.github/workflows/release.yml +46 -0
  43. package/template-ts-lib-unbuild/.vscode/extensions.json +13 -0
  44. package/template-ts-lib-unbuild/.vscode/launch.json +13 -0
  45. package/template-ts-lib-unbuild/.vscode/settings.json +10 -0
  46. package/template-ts-lib-unbuild/_editorconfig +11 -0
  47. package/template-ts-lib-unbuild/_gitattributes +21 -0
  48. package/template-ts-lib-unbuild/_gitignore +30 -0
  49. package/template-ts-lib-unbuild/_npmrc +2 -0
  50. package/template-ts-lib-unbuild/_prettierrc +0 -0
  51. package/template-ts-lib-unbuild/build.config.ts +19 -0
  52. package/template-ts-lib-unbuild/eslint.config.js +3 -0
  53. package/template-ts-lib-unbuild/package.json +57 -0
  54. package/template-ts-lib-unbuild/src/index.ts +3 -0
  55. package/template-ts-lib-unbuild/tsconfig.json +24 -0
  56. package/template-vue/package.json +10 -10
  57. 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,6 +1,7 @@
1
1
  {
2
2
  "name": "create-soybean",
3
- "version": "1.0.0-beta.6",
3
+ "type": "module",
4
+ "version": "1.0.0",
4
5
  "description": "SoybeanJS's command line to create different project templates",
5
6
  "author": {
6
7
  "name": "Soybean",
@@ -24,8 +25,7 @@
24
25
  },
25
26
  "files": [
26
27
  "dist",
27
- "template-ts-lib",
28
- "template-vue"
28
+ "template-*"
29
29
  ],
30
30
  "dependencies": {
31
31
  "consola": "3.2.3",
@@ -36,12 +36,12 @@
36
36
  "devDependencies": {
37
37
  "@types/minimist": "1.2.5",
38
38
  "@types/prompts": "2.4.9",
39
- "typescript": "5.3.3",
40
- "unbuild": "2.0.0"
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": "unbuild",
44
+ "build-only": "tsup",
45
45
  "publish-pkg": "pnpm publish --access public --no-git-checks",
46
46
  "typecheck": "tsc --noEmit --skipLibCheck"
47
47
  }
@@ -0,0 +1,13 @@
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
+ }
@@ -0,0 +1,13 @@
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
+ }
@@ -0,0 +1,10 @@
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
+ }
@@ -0,0 +1,11 @@
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
@@ -0,0 +1,21 @@
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
@@ -0,0 +1,30 @@
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?
@@ -0,0 +1,3 @@
1
+ registry=https://registry.npmmirror.com/
2
+ shamefully-hoist=true
3
+ ignore-workspace-root-check=true
File without changes
@@ -0,0 +1,33 @@
1
+ {
2
+ "name": "pnpm-monorepo",
3
+ "type": "module",
4
+ "version": "1.0.0",
5
+ "private": true,
6
+ "packageManager": "pnpm@8.13.1",
7
+ "scripts": {
8
+ "cleanup": "soy cleanup",
9
+ "commit": "soy git-commit",
10
+ "lint": "eslint . --fix",
11
+ "prepare": "simple-git-hooks",
12
+ "release": "soy release",
13
+ "typecheck": "tsc --noEmit --skipLibCheck",
14
+ "update-pkg": "soy ncu"
15
+ },
16
+ "dependencies": {},
17
+ "devDependencies": {
18
+ "@soybeanjs/cli": "1.0.0",
19
+ "@soybeanjs/eslint-config": "1.1.4",
20
+ "eslint": "8.56.0",
21
+ "lint-staged": "15.2.0",
22
+ "simple-git-hooks": "2.9.0",
23
+ "tsx": "4.7.0",
24
+ "typescript": "5.3.3"
25
+ },
26
+ "simple-git-hooks": {
27
+ "commit-msg": "pnpm soy git-commit-verify",
28
+ "pre-commit": "pnpm typecheck && pnpm lint-staged"
29
+ },
30
+ "lint-staged": {
31
+ "*": "eslint --fix"
32
+ }
33
+ }
@@ -0,0 +1,14 @@
1
+ {
2
+ "name": "demo-pkg",
3
+ "type": "module",
4
+ "version": "1.0.0",
5
+ "private": true,
6
+ "packageManager": "pnpm@8.13.1",
7
+ "scripts": {
8
+ "typecheck": "tsc --noEmit --skipLibCheck"
9
+ },
10
+ "dependencies": {},
11
+ "devDependencies": {
12
+ "typescript": "5.3.3"
13
+ }
14
+ }
@@ -0,0 +1,24 @@
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
+ }
@@ -0,0 +1,2 @@
1
+ packages:
2
+ - 'packages/*'
@@ -0,0 +1,3 @@
1
+ export function fn() {
2
+ return 1;
3
+ }
@@ -0,0 +1,3 @@
1
+ {
2
+ "extends": "soybeanjs/react"
3
+ }
@@ -0,0 +1,34 @@
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?
31
+
32
+ package-lock.json
33
+ yarn.lock
34
+ pnpm-lock.yaml
@@ -0,0 +1,2 @@
1
+ registry=https://registry.npmmirror.com/
2
+ shamefully-hoist=true
@@ -0,0 +1,6 @@
1
+ {
2
+ "name": "template-react",
3
+ "type": "module",
4
+ "version": "1.0.0",
5
+ "scripts": {}
6
+ }
@@ -0,0 +1,3 @@
1
+ {
2
+ "extends": "soybeanjs/react-native"
3
+ }
@@ -0,0 +1,34 @@
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?
31
+
32
+ package-lock.json
33
+ yarn.lock
34
+ pnpm-lock.yaml
@@ -0,0 +1,2 @@
1
+ registry=https://registry.npmmirror.com/
2
+ shamefully-hoist=true
@@ -0,0 +1,6 @@
1
+ {
2
+ "name": "template-react-native",
3
+ "type": "module",
4
+ "version": "1.0.0",
5
+ "scripts": {}
6
+ }
@@ -0,0 +1,3 @@
1
+ {
2
+ "extends": "soybeanjs/solid"
3
+ }
@@ -0,0 +1,34 @@
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?
31
+
32
+ package-lock.json
33
+ yarn.lock
34
+ pnpm-lock.yaml
@@ -0,0 +1,2 @@
1
+ registry=https://registry.npmmirror.com/
2
+ shamefully-hoist=true
@@ -0,0 +1,6 @@
1
+ {
2
+ "name": "template-solid",
3
+ "type": "module",
4
+ "version": "1.0.0",
5
+ "scripts": {}
6
+ }
@@ -0,0 +1,46 @@
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 install --no-frozen-lockfile
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
@@ -0,0 +1,13 @@
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
+ }
@@ -0,0 +1,13 @@
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
+ }
@@ -0,0 +1,10 @@
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
+ }
@@ -0,0 +1,11 @@
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
@@ -0,0 +1,21 @@
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
@@ -0,0 +1,30 @@
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?
@@ -0,0 +1,2 @@
1
+ registry=https://registry.npmmirror.com/
2
+ shamefully-hoist=true
File without changes
@@ -0,0 +1,3 @@
1
+ import { defineConfig } from '@soybeanjs/eslint-config';
2
+
3
+ export default defineConfig();
@@ -0,0 +1,58 @@
1
+ {
2
+ "name": "ts-lib-tsup",
3
+ "type": "module",
4
+ "version": "1.0.0",
5
+ "private": true,
6
+ "packageManager": "pnpm@8.13.1",
7
+ "sideEffects": false,
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.js",
12
+ "require": "./dist/index.cjs"
13
+ }
14
+ },
15
+ "main": "dist/index.cjs",
16
+ "module": "dist/index.js",
17
+ "types": "dist/index.d.ts",
18
+ "files": ["dist"],
19
+ "scripts": {
20
+ "build": "tsup",
21
+ "cleanup": "soy cleanup",
22
+ "commit": "soy git-commit",
23
+ "dev": "tsup --watch",
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": "1.0.0",
41
+ "@soybeanjs/eslint-config": "1.1.4",
42
+ "@types/cli-progress": "3.11.5",
43
+ "@types/node": "20.10.5",
44
+ "eslint": "8.56.0",
45
+ "lint-staged": "15.2.0",
46
+ "simple-git-hooks": "2.9.0",
47
+ "tsup": "8.0.1",
48
+ "tsx": "4.7.0",
49
+ "typescript": "5.3.3"
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
+ }
@@ -0,0 +1,3 @@
1
+ export function fn() {
2
+ return 1;
3
+ }
@@ -0,0 +1,24 @@
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
+ }
@@ -0,0 +1,14 @@
1
+ import { defineConfig } from 'tsup';
2
+
3
+ export default defineConfig({
4
+ entry: ['src/index.ts'],
5
+ clean: true,
6
+ dts: true,
7
+ format: ['cjs', 'esm'],
8
+ external: [],
9
+ shims: true,
10
+ cjsInterop: true,
11
+ sourcemap: false,
12
+ target: 'es6',
13
+ minify: true
14
+ });
@@ -0,0 +1,46 @@
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 install --no-frozen-lockfile
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
@@ -0,0 +1,13 @@
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
+ }
@@ -0,0 +1,13 @@
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
+ }
@@ -0,0 +1,10 @@
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
+ }
@@ -0,0 +1,11 @@
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
@@ -0,0 +1,21 @@
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
@@ -0,0 +1,30 @@
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?
@@ -0,0 +1,2 @@
1
+ registry=https://registry.npmmirror.com/
2
+ shamefully-hoist=true
File without changes
@@ -0,0 +1,19 @@
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
+ sourcemap: false
19
+ });
@@ -0,0 +1,3 @@
1
+ import { defineConfig } from '@soybeanjs/eslint-config';
2
+
3
+ export default defineConfig();
@@ -0,0 +1,57 @@
1
+ {
2
+ "name": "ts-lib-unbuild",
3
+ "type": "module",
4
+ "version": "1.0.0",
5
+ "private": true,
6
+ "packageManager": "pnpm@8.13.1",
7
+ "sideEffects": false,
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.mjs",
12
+ "require": "./dist/index.cjs"
13
+ }
14
+ },
15
+ "main": "dist/index.cjs",
16
+ "module": "dist/index.mjs",
17
+ "types": "dist/index.d.ts",
18
+ "files": ["dist"],
19
+ "scripts": {
20
+ "build": "unbuild",
21
+ "cleanup": "soy cleanup",
22
+ "commit": "soy git-commit",
23
+ "lint": "eslint . --fix",
24
+ "prepare": "simple-git-hooks",
25
+ "publish-pkg": "pnpm publish --access public",
26
+ "release": "soy release",
27
+ "typecheck": "tsc --noEmit --skipLibCheck",
28
+ "update-pkg": "soy ncu"
29
+ },
30
+ "dependencies": {
31
+ "cli-progress": "3.12.0",
32
+ "consola": "3.2.3",
33
+ "dayjs": "1.11.10",
34
+ "execa": "8.0.1",
35
+ "kolorist": "1.8.0",
36
+ "ofetch": "1.3.3"
37
+ },
38
+ "devDependencies": {
39
+ "@soybeanjs/cli": "1.0.0",
40
+ "@soybeanjs/eslint-config": "1.1.4",
41
+ "@types/cli-progress": "3.11.5",
42
+ "@types/node": "20.10.5",
43
+ "eslint": "8.56.0",
44
+ "lint-staged": "15.2.0",
45
+ "simple-git-hooks": "2.9.0",
46
+ "tsx": "4.7.0",
47
+ "typescript": "5.3.3",
48
+ "unbuild": "2.0.0"
49
+ },
50
+ "simple-git-hooks": {
51
+ "commit-msg": "pnpm soy git-commit-verify",
52
+ "pre-commit": "pnpm typecheck && pnpm lint-staged"
53
+ },
54
+ "lint-staged": {
55
+ "*": "eslint --fix"
56
+ }
57
+ }
@@ -0,0 +1,3 @@
1
+ export function fn() {
2
+ return 1;
3
+ }
@@ -0,0 +1,24 @@
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
+ }
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "template-vue",
3
3
  "type": "module",
4
- "version": "1.0.0-beta.6",
4
+ "version": "1.0.0",
5
5
  "private": true,
6
- "packageManager": "pnpm@8.12.0",
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.11",
21
+ "vue": "3.3.13",
22
22
  "vue-router": "4.2.5"
23
23
  },
24
24
  "devDependencies": {
25
- "@soybeanjs/cli": "1.0.0-beta.6",
26
- "@soybeanjs/eslint-config": "1.0.12",
27
- "@types/node": "20.10.4",
28
- "@vitejs/plugin-vue": "4.5.2",
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.55.0",
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.7",
35
+ "vite": "5.0.10",
36
36
  "vue-eslint-parser": "9.3.2",
37
- "vue-tsc": "1.8.25"
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();