create-web-kit 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.
- package/README.md +216 -0
- package/dist/config/frameworks.d.ts +5 -0
- package/dist/config/frameworks.js +1 -0
- package/dist/config/help.d.ts +1 -0
- package/dist/config/help.js +1 -0
- package/dist/generators/project.d.ts +4 -0
- package/dist/generators/project.js +1 -0
- package/dist/generators/template.d.ts +1 -0
- package/dist/generators/template.js +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/types/index.d.ts +29 -0
- package/dist/types/index.js +1 -0
- package/dist/utils/file.d.ts +10 -0
- package/dist/utils/file.js +1 -0
- package/dist/utils/package-manager.d.ts +2 -0
- package/dist/utils/package-manager.js +1 -0
- package/package.json +60 -0
package/README.md
ADDED
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
# Create Starter Kit
|
|
2
|
+
|
|
3
|
+
一个强大的前端项目脚手架工具,支持多种框架和模板。
|
|
4
|
+
|
|
5
|
+
## 特性
|
|
6
|
+
|
|
7
|
+
- 🚀 支持多种主流框架:Next.js、Vue 3、Electron
|
|
8
|
+
- 🎨 内置精美 UI 组件库集成
|
|
9
|
+
- 📦 智能包管理器检测 (npm, pnpm, yarn, bun)
|
|
10
|
+
- 🔧 多步骤自动化项目设置
|
|
11
|
+
- 🎯 交互式命令行界面
|
|
12
|
+
- 🔒 代码保护和混淆
|
|
13
|
+
|
|
14
|
+
## 支持的模板
|
|
15
|
+
|
|
16
|
+
| 模板 | 描述 | 技术栈 |
|
|
17
|
+
| -------------- | ------------------ | ------------------------------- |
|
|
18
|
+
| nextjs-csr | Next.js 客户端渲染 | Next.js + ShadcnUI + TypeScript |
|
|
19
|
+
| nextjs-ssr | Next.js 服务端渲染 | Next.js + ShadcnUI + TypeScript |
|
|
20
|
+
| vue3 | Vue 3 现代化开发 | Vue 3 + TypeScript + Vite |
|
|
21
|
+
| electron-react | Electron + React | Electron + React + TypeScript |
|
|
22
|
+
| electron-vue | Electron + Vue | Electron + Vue 3 + TypeScript |
|
|
23
|
+
|
|
24
|
+
## Usage
|
|
25
|
+
|
|
26
|
+
You can use this scaffolding tool in several ways:
|
|
27
|
+
|
|
28
|
+
### Interactive Mode
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
npm create starter-kit
|
|
32
|
+
# or
|
|
33
|
+
npx create-starter-kit
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### With Project Name
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
npm create starter-kit my-project
|
|
40
|
+
# or
|
|
41
|
+
npx create-starter-kit my-project
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### With Template
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
npm create starter-kit my-project --template react-ts
|
|
48
|
+
# or
|
|
49
|
+
npx create-starter-kit my-project -t vue-ts
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### Help
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
npx create-starter-kit --help
|
|
56
|
+
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Available Templates
|
|
60
|
+
|
|
61
|
+
### Frontend Templates
|
|
62
|
+
|
|
63
|
+
- **vanilla** - Vanilla JavaScript
|
|
64
|
+
- **vanilla-ts** - Vanilla TypeScript
|
|
65
|
+
- **react** - React with JavaScript
|
|
66
|
+
- **react-ts** - React with TypeScript
|
|
67
|
+
- **vue** - Vue with JavaScript
|
|
68
|
+
- **vue-ts** - Vue with TypeScript
|
|
69
|
+
|
|
70
|
+
### Next.js Templates (Multi-Step Setup)
|
|
71
|
+
|
|
72
|
+
- **nextjs-csr** - Next.js + CSR + ShadcnUI + TanStack
|
|
73
|
+
- Creates Next.js project with TypeScript and Tailwind
|
|
74
|
+
- Installs and configures ShadcnUI
|
|
75
|
+
- Adds @tanstack/react-table and @tanstack/react-query
|
|
76
|
+
- Sets up ESLint and Prettier configuration
|
|
77
|
+
- **nextjs-app** - Next.js App Router (basic setup)
|
|
78
|
+
|
|
79
|
+
### Vue Templates (Multi-Step Setup)
|
|
80
|
+
|
|
81
|
+
- **vue** - Vue with JavaScript
|
|
82
|
+
- **vue-ts** - Vue with TypeScript
|
|
83
|
+
- **nuxt3-full** - Nuxt 3 + UI + State Management
|
|
84
|
+
- Creates Nuxt 3 project with TypeScript
|
|
85
|
+
- Installs @nuxt/ui, @pinia/nuxt, @vueuse/nuxt
|
|
86
|
+
- Sets up development tools and configuration
|
|
87
|
+
|
|
88
|
+
### Backend Templates
|
|
89
|
+
|
|
90
|
+
- **node** - Node.js with JavaScript
|
|
91
|
+
- **node-ts** - Node.js with TypeScript
|
|
92
|
+
- **express** - Express with JavaScript
|
|
93
|
+
- **express-ts** - Express with TypeScript
|
|
94
|
+
- **express-full** - Express + TypeScript + Full Stack
|
|
95
|
+
- Complete Express setup with TypeScript
|
|
96
|
+
- Includes middleware (cors, helmet, compression)
|
|
97
|
+
- Database ready with Prisma
|
|
98
|
+
- Environment configuration
|
|
99
|
+
|
|
100
|
+
### Library Templates
|
|
101
|
+
|
|
102
|
+
- **vite-lib** - Vite Library with JavaScript
|
|
103
|
+
- **vite-lib-ts** - Vite Library with TypeScript
|
|
104
|
+
|
|
105
|
+
## Examples
|
|
106
|
+
|
|
107
|
+
### Creating a Next.js project with full setup
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
npx create-starter-kit my-nextjs-app --template nextjs-csr
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
This will:
|
|
114
|
+
|
|
115
|
+
1. Create a Next.js project with TypeScript and Tailwind
|
|
116
|
+
2. Install and configure ShadcnUI
|
|
117
|
+
3. Add TanStack Table and Query libraries
|
|
118
|
+
4. Set up ESLint and Prettier
|
|
119
|
+
5. Create configuration files
|
|
120
|
+
|
|
121
|
+
### Creating a Nuxt 3 project
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
npx create-starter-kit my-nuxt-app --template nuxt3-full
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
This will:
|
|
128
|
+
|
|
129
|
+
1. Create a Nuxt 3 project
|
|
130
|
+
2. Install UI library and state management
|
|
131
|
+
3. Set up development tools
|
|
132
|
+
4. Create project structure
|
|
133
|
+
|
|
134
|
+
### Creating a full-stack Express API
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
npx create-starter-kit my-api --template express-full
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
This will:
|
|
141
|
+
|
|
142
|
+
1. Create an Express project with TypeScript
|
|
143
|
+
2. Install essential middleware
|
|
144
|
+
3. Set up Prisma for database
|
|
145
|
+
4. Create starter API endpoints
|
|
146
|
+
5. Configure environment variables
|
|
147
|
+
|
|
148
|
+
## Features
|
|
149
|
+
|
|
150
|
+
- 🚀 **Fast** - Quick project setup with modern tooling
|
|
151
|
+
- 🎨 **Multiple Templates** - Choose from various frontend and backend templates
|
|
152
|
+
- 📦 **Package Manager Agnostic** - Works with npm, yarn, pnpm, and bun
|
|
153
|
+
- 🛠️ **TypeScript Support** - First-class TypeScript support
|
|
154
|
+
- 📋 **Interactive Prompts** - User-friendly CLI with beautiful prompts
|
|
155
|
+
- 🎯 **Modern Tooling** - Uses latest versions of popular tools
|
|
156
|
+
|
|
157
|
+
## Development
|
|
158
|
+
|
|
159
|
+
### Prerequisites
|
|
160
|
+
|
|
161
|
+
- Node.js 18 or higher
|
|
162
|
+
- npm, yarn, or pnpm
|
|
163
|
+
|
|
164
|
+
### Setup
|
|
165
|
+
|
|
166
|
+
```bash
|
|
167
|
+
# Clone the repository
|
|
168
|
+
git clone <repository-url>
|
|
169
|
+
cd create-starter-kit
|
|
170
|
+
|
|
171
|
+
# Install dependencies
|
|
172
|
+
npm install
|
|
173
|
+
|
|
174
|
+
# Build the project
|
|
175
|
+
npm run build
|
|
176
|
+
|
|
177
|
+
# Test locally
|
|
178
|
+
npm start
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
### Adding New Templates
|
|
182
|
+
|
|
183
|
+
1. Create a new template directory: `template-{name}`
|
|
184
|
+
2. Add template files inside the directory
|
|
185
|
+
3. Update the `FRAMEWORKS` array in `src/index.ts`
|
|
186
|
+
4. Files starting with `_` will be renamed (e.g., `_gitignore` → `.gitignore`)
|
|
187
|
+
|
|
188
|
+
### Project Structure
|
|
189
|
+
|
|
190
|
+
```
|
|
191
|
+
src/
|
|
192
|
+
├── index.ts # Main CLI logic
|
|
193
|
+
template-react-ts/ # React TypeScript template
|
|
194
|
+
├── package.json
|
|
195
|
+
├── src/
|
|
196
|
+
│ ├── App.tsx
|
|
197
|
+
│ └── main.tsx
|
|
198
|
+
├── index.html
|
|
199
|
+
└── ...
|
|
200
|
+
template-node-ts/ # Node.js TypeScript template
|
|
201
|
+
├── package.json
|
|
202
|
+
├── src/
|
|
203
|
+
│ └── index.ts
|
|
204
|
+
└── ...
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
## Publishing
|
|
208
|
+
|
|
209
|
+
```bash
|
|
210
|
+
npm run build
|
|
211
|
+
npm publish
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
## License
|
|
215
|
+
|
|
216
|
+
MIT
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const j=b;(function(d,e){const i=b,f=d();while(!![]){try{const g=-parseInt(i(0x1e4))/0x1+parseInt(i(0x1d7))/0x2*(-parseInt(i(0x1d6))/0x3)+-parseInt(i(0x1d2))/0x4+-parseInt(i(0x1d5))/0x5*(parseInt(i(0x1dd))/0x6)+-parseInt(i(0x1e8))/0x7+-parseInt(i(0x1e0))/0x8+parseInt(i(0x1de))/0x9*(parseInt(i(0x1e7))/0xa);if(g===e)break;else f['push'](f['shift']());}catch(h){f['push'](f['shift']());}}}(a,0x9a2f4));function a(){const k=['vue3','36008890IftuiV','2034879CsYFPb','pnpm\x20add\x20@tanstack/react-query\x20zustand','concat','variants','pnpm\x20add\x20-D\x20@types/node\x20prettier','4514172cmQxLd','Vue','Electron\x20+\x20Vue\x203\x20+\x20TypeScript','10RBjBhl','123ULKMPI','1234ZwglIj','nextjs-ssr','Next.js','Next.js\x20CSR\x20+\x20ShadcnUI','Installing\x20development\x20dependencies','root','625506hrZoZZ','9mtPUGe','pnpm\x20add\x20@tanstack/react-query\x20next-auth\x20prisma','9709936FjGzwx','Installing\x20ShadcnUI\x20components','target','pnpm\x20add\x20-D\x20@types/node\x20prettier\x20eslint','102568cPJKvJ','map'];a=function(){return k;};return a();}import c from'picocolors';const {blue,cyan,green,magenta}=c;export const FRAMEWORKS=[{'name':'nextjs','display':j(0x1d9),'color':cyan,'variants':[{'name':'nextjs-csr','display':j(0x1da),'color':cyan,'multiStepCommands':[{'command':'pnpx\x20create-next-app@latest\x20TARGET_DIR\x20--typescript\x20--tailwind\x20--eslint\x20--app\x20--src-dir\x20--import-alias\x20\x27@/*\x27','description':'Creating\x20Next.js\x20project\x20with\x20TypeScript\x20and\x20Tailwind','workingDir':'root'},{'command':'pnpm\x20dlx\x20shadcn@latest\x20init\x20-y','description':'Installing\x20ShadcnUI\x20components','workingDir':j(0x1e2)},{'command':'pnpm\x20add\x20@tanstack/react-table\x20@tanstack/react-query','description':'Installing\x20TanStack\x20Table\x20and\x20Query','workingDir':'target'},{'command':'pnpm\x20add\x20-D\x20prettier\x20@types/node','description':j(0x1db),'workingDir':'target'}]},{'name':j(0x1d8),'display':'Next.js\x20SSR\x20+\x20ShadcnUI','color':blue,'multiStepCommands':[{'command':'pnpx\x20create-next-app@latest\x20TARGET_DIR\x20--typescript\x20--tailwind\x20--eslint\x20--app\x20--src-dir\x20--import-alias\x20\x27@/*\x27','description':'Creating\x20Next.js\x20SSR\x20project\x20with\x20TypeScript\x20and\x20Tailwind','workingDir':'root'},{'command':'pnpm\x20dlx\x20shadcn@latest\x20init\x20-y','description':j(0x1e1),'workingDir':'target'},{'command':j(0x1df),'description':'Installing\x20SSR\x20dependencies','workingDir':'target'},{'command':'pnpm\x20add\x20-D\x20@types/node\x20prettier\x20prisma','description':'Installing\x20development\x20dependencies','workingDir':'target'}]}]},{'name':'vue','display':j(0x1d3),'color':green,'variants':[{'name':j(0x1e6),'display':'Vue\x203\x20+\x20TypeScript\x20+\x20Vite','color':green,'multiStepCommands':[{'command':'pnpm\x20create\x20vue@latest\x20TARGET_DIR','description':'Creating\x20Vue\x203\x20project\x20with\x20TypeScript','workingDir':'root'},{'command':'pnpm\x20add\x20pinia\x20@vueuse/core','description':'Installing\x20Vue\x20ecosystem\x20packages','workingDir':'target'},{'command':j(0x1e3),'description':'Installing\x20development\x20tools','workingDir':'target'}]}]},{'name':'electron','display':'Electron','color':magenta,'variants':[{'name':'electron-react','display':'Electron\x20+\x20React\x20+\x20TypeScript','color':cyan,'multiStepCommands':[{'command':'pnpm\x20create\x20electron-vite@latest\x20TARGET_DIR\x20--template\x20react-ts','description':'Creating\x20Electron\x20React\x20project','workingDir':j(0x1dc)},{'command':j(0x1ce),'description':'Installing\x20React\x20state\x20management','workingDir':'target'},{'command':'pnpm\x20add\x20-D\x20@types/node\x20prettier','description':'Installing\x20development\x20dependencies','workingDir':'target'}]},{'name':'electron-vue','display':j(0x1d4),'color':green,'multiStepCommands':[{'command':'pnpm\x20create\x20electron-vite@latest\x20TARGET_DIR\x20--template\x20vue-ts','description':'Creating\x20Electron\x20Vue\x20project','workingDir':'root'},{'command':'pnpm\x20add\x20pinia\x20@vueuse/core','description':'Installing\x20Vue\x20ecosystem\x20packages','workingDir':'target'},{'command':j(0x1d1),'description':j(0x1db),'workingDir':'target'}]}]}];export const TEMPLATES=FRAMEWORKS[j(0x1e5)](d=>d[j(0x1d0)][j(0x1e5)](e=>e['name']))['reduce']((d,e)=>d[j(0x1cf)](e),[]);function b(c,d){const e=a();return b=function(f,g){f=f-0x1ce;let h=e[f];return h;},b(c,d);}export const renameFiles={'_gitignore':'.gitignore','_eslintrc':'.eslintrc.js','_npmrc':'.npmrc'};export const defaultTargetDir='my-app';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const helpMessage: string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const j=b;function b(c,d){const e=a();return b=function(f,g){f=f-0x1a4;let h=e[f];return h;},b(c,d);}(function(d,e){const i=b,f=d();while(!![]){try{const g=-parseInt(i(0x1ab))/0x1*(-parseInt(i(0x1ac))/0x2)+-parseInt(i(0x1aa))/0x3*(-parseInt(i(0x1ad))/0x4)+-parseInt(i(0x1a9))/0x5*(-parseInt(i(0x1b2))/0x6)+parseInt(i(0x1a6))/0x7*(parseInt(i(0x1a4))/0x8)+parseInt(i(0x1a7))/0x9*(-parseInt(i(0x1a5))/0xa)+-parseInt(i(0x1ae))/0xb*(parseInt(i(0x1b0))/0xc)+parseInt(i(0x1af))/0xd*(parseInt(i(0x1b1))/0xe);if(g===e)break;else f['push'](f['shift']());}catch(h){f['push'](f['shift']());}}}(a,0xdeaf6));import c from'picocolors';const {blue,cyan,green,magenta,redBright,yellow}=c;function a(){const k=['4aiIifj','11tgkoeD','13yTCOqV','11630820QrFKSs','10806180qujDkW','1333464ZAsbnO','8kFBqKR','18191010OabvCk','343182wpoQaS','9MguWSf','vue3\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Vue\x203\x20+\x20TypeScript\x20+\x20Vite','35NMVQXn','2584614CpsIkz','231156EGapIt','4avZpmB'];a=function(){return k;};return a();}export const helpMessage='Usage:\x20create-starter-kit\x20[OPTION]...\x20[DIRECTORY]\x0a\x0aCreate\x20a\x20new\x20starter\x20project\x20with\x20various\x20templates.\x0aWith\x20no\x20arguments,\x20start\x20the\x20CLI\x20in\x20interactive\x20mode.\x0a\x0aOptions:\x0a\x20\x20-t,\x20--template\x20NAME\x20\x20\x20\x20\x20\x20\x20\x20use\x20a\x20specific\x20template\x0a\x0aAvailable\x20templates:\x0a'+cyan('nextjs-csr\x20\x20\x20\x20\x20Next.js\x20CSR\x20+\x20ShadcnUI')+'\x0a'+blue('nextjs-ssr\x20\x20\x20\x20\x20Next.js\x20SSR\x20+\x20ShadcnUI')+'\x0a'+green(j(0x1a8))+'\x0a'+cyan('electron-react\x20Electron\x20+\x20React\x20+\x20TS')+'\x0a'+green('electron-vue\x20\x20\x20Electron\x20+\x20Vue\x203\x20+\x20TS');
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { FrameworkVariant } from "../types/index.js";
|
|
2
|
+
export declare function executeMultiStepCommands(variant: FrameworkVariant, targetDir: string, root: string, cwd: string): Promise<void>;
|
|
3
|
+
export declare function createProjectFiles(template: string, root: string): void;
|
|
4
|
+
export declare function generateSuccessMessage(targetDir: string, pkgManager: string): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(g,h){const q=b,i=g();while(!![]){try{const j=-parseInt(q(0x135))/0x1*(parseInt(q(0x140))/0x2)+parseInt(q(0x13f))/0x3+-parseInt(q(0x130))/0x4*(-parseInt(q(0x13e))/0x5)+-parseInt(q(0x132))/0x6+parseInt(q(0x136))/0x7+parseInt(q(0x145))/0x8+parseInt(q(0x13a))/0x9;if(j===h)break;else i['push'](i['shift']());}catch(k){i['push'](i['shift']());}}}(a,0x200e2));function a(){const y=['NEXTAUTH_URL=http://localhost:3000\x0aNEXTAUTH_SECRET=your-secret-key\x0aDATABASE_URL=\x22your-database-url\x22','error','12NoVkDm','1142414usdiqm','electron-react','.prettierrc','step','674145mvPZPz','module.exports\x20=\x20{\x0a\x20\x20extends:\x20[\x27electron\x27,\x20\x27@electron-toolkit/eslint-config-ts\x27,\x20\x27prettier\x27],\x0a\x20\x20rules:\x20{\x0a\x20\x20\x20\x20\x27@typescript-eslint/no-unused-vars\x27:\x20\x27error\x27,\x0a\x20\x20\x20\x20\x27@typescript-eslint/no-explicit-any\x27:\x20\x27warn\x27,\x0a\x20\x20},\x0a};','Failed\x20to\x20execute:\x20','nextjs-csr','2330RhqoyM','422856EguuMh','22786dMydPH','join','log','Error\x20executing\x20command:\x20','import\x20{\x20defineConfig\x20}\x20from\x20\x27vite\x27\x0aimport\x20vue\x20from\x20\x27@vitejs/plugin-vue\x27\x0aimport\x20{\x20resolve\x20}\x20from\x20\x27path\x27\x0a\x0aexport\x20default\x20defineConfig({\x0a\x20\x20plugins:\x20[vue()],\x0a\x20\x20resolve:\x20{\x0a\x20\x20\x20\x20alias:\x20{\x0a\x20\x20\x20\x20\x20\x20\x27@\x27:\x20resolve(__dirname,\x20\x27src\x27),\x0a\x20\x20\x20\x20},\x0a\x20\x20},\x0a})','168368vWJkiq','152gHrFSV','writeFileSync','898794oeRZQy'];a=function(){return y;};return a();}import c from'node:fs';function b(c,d){const e=a();return b=function(f,g){f=f-0x130;let h=e[f];return h;},b(c,d);}import d from'node:path';import e from'cross-spawn';import*as f from'@clack/prompts';export async function executeMultiStepCommands(g,h,i,cwd){const r=b;if(!g['multiStepCommands'])return;f['log']['step']('Setting\x20up\x20'+g['display']+'\x20project...');for(const j of g['multiStepCommands']){f['log'][r(0x139)](j['description']);const k=j['workingDir']==='target'?i:cwd,l=j['command']['replace'](/TARGET_DIR/g,h),[m,...n]=l['split']('\x20');try{const o=e['sync'](m,n,{'stdio':'inherit','cwd':k});o['status']!==0x0&&(f[r(0x142)]['error'](r(0x13c)+l),process['exit'](o['status']??0x1));}catch(p){f['log']['error'](r(0x143)+l),console[r(0x134)](p),process['exit'](0x1);}}}export function createProjectFiles(g,h){const s=b;g===s(0x13d)&&createNextjsCSRFiles(h),g==='nextjs-ssr'&&createNextjsSSRFiles(h),g==='vue3'&&createVue3Files(h),g===s(0x137)&&createElectronReactFiles(h),g==='electron-vue'&&createElectronVueFiles(h);}function createNextjsCSRFiles(g){const t=b,h={'semi':!![],'trailingComma':'es5','singleQuote':!![],'printWidth':0x50,'tabWidth':0x2,'useTabs':![]};c['writeFileSync'](d['join'](g,'.prettierrc'),JSON['stringify'](h,null,0x2));const i='module.exports\x20=\x20{\x0a\x20\x20extends:\x20[\x27next/core-web-vitals\x27,\x20\x27prettier\x27],\x0a\x20\x20rules:\x20{\x0a\x20\x20\x20\x20\x27@typescript-eslint/no-unused-vars\x27:\x20\x27error\x27,\x0a\x20\x20\x20\x20\x27@typescript-eslint/no-explicit-any\x27:\x20\x27warn\x27,\x0a\x20\x20},\x0a};';c[t(0x131)](d[t(0x141)](g,'.eslintrc.js'),i);}function createNextjsSSRFiles(g){const u=b,h={'semi':!![],'trailingComma':'es5','singleQuote':!![],'printWidth':0x50,'tabWidth':0x2,'useTabs':![]};c[u(0x131)](d['join'](g,'.prettierrc'),JSON['stringify'](h,null,0x2));const i='module.exports\x20=\x20{\x0a\x20\x20extends:\x20[\x27next/core-web-vitals\x27,\x20\x27prettier\x27],\x0a\x20\x20rules:\x20{\x0a\x20\x20\x20\x20\x27@typescript-eslint/no-unused-vars\x27:\x20\x27error\x27,\x0a\x20\x20\x20\x20\x27@typescript-eslint/no-explicit-any\x27:\x20\x27warn\x27,\x0a\x20\x20},\x0a};';c['writeFileSync'](d['join'](g,'.eslintrc.js'),i);const envLocal=u(0x133);c[u(0x131)](d[u(0x141)](g,'.env.local'),envLocal),c['writeFileSync'](d['join'](g,'.env.example'),envLocal);}function createVue3Files(g){const v=b,h={'semi':!![],'trailingComma':'es5','singleQuote':!![],'printWidth':0x50,'tabWidth':0x2,'useTabs':![]};c['writeFileSync'](d['join'](g,v(0x138)),JSON['stringify'](h,null,0x2));const i=v(0x144);c['writeFileSync'](d['join'](g,'vite.config.ts'),i);}function createElectronReactFiles(g){const w=b,h={'semi':!![],'trailingComma':'es5','singleQuote':!![],'printWidth':0x50,'tabWidth':0x2,'useTabs':![]};c['writeFileSync'](d['join'](g,'.prettierrc'),JSON['stringify'](h,null,0x2));const i='module.exports\x20=\x20{\x0a\x20\x20extends:\x20[\x27electron\x27,\x20\x27@electron-toolkit/eslint-config-ts\x27,\x20\x27prettier\x27],\x0a\x20\x20rules:\x20{\x0a\x20\x20\x20\x20\x27@typescript-eslint/no-unused-vars\x27:\x20\x27error\x27,\x0a\x20\x20\x20\x20\x27@typescript-eslint/no-explicit-any\x27:\x20\x27warn\x27,\x0a\x20\x20},\x0a};';c['writeFileSync'](d[w(0x141)](g,'.eslintrc.js'),i);}function createElectronVueFiles(g){const x=b,h={'semi':!![],'trailingComma':'es5','singleQuote':!![],'printWidth':0x50,'tabWidth':0x2,'useTabs':![]};c['writeFileSync'](d['join'](g,'.prettierrc'),JSON['stringify'](h,null,0x2));const i=x(0x13b);c['writeFileSync'](d['join'](g,'.eslintrc.js'),i);}export function generateSuccessMessage(g,h){return'🎉\x20Project\x20created\x20successfully!\x0a\x20\x20\x20\x20\x0aNext\x20steps:\x0a\x20\x20cd\x20'+g+'\x0a\x20\x20'+(h==='yarn'?'yarn\x20dev':h+'\x20run\x20dev');}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function generateTemplateProject(template: string, root: string, packageName: string, pkgManager: string, cwd: string): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(f,g){const s=b,h=f();while(!![]){try{const i=-parseInt(s(0x184))/0x1+parseInt(s(0x188))/0x2*(-parseInt(s(0x186))/0x3)+-parseInt(s(0x18b))/0x4+parseInt(s(0x18a))/0x5*(-parseInt(s(0x185))/0x6)+-parseInt(s(0x17f))/0x7*(parseInt(s(0x177))/0x8)+parseInt(s(0x175))/0x9*(parseInt(s(0x181))/0xa)+parseInt(s(0x17c))/0xb*(parseInt(s(0x18c))/0xc);if(i===g)break;else h['push'](h['shift']());}catch(j){h['push'](h['shift']());}}}(a,0xa9410));function a(){const v=['75aSocgY','stringify','47382Hlwmhh','\x0a\x20\x20','15XgzPlu','4963944lKOADE','1869444YKORhV','readFileSync','join','1723419KBPZBz','includes','1912056hgHSyn','package.json','Done.\x20Now\x20run:\x0a','log','\x20run\x20dev','253XXnuxS','relative','utf-8','7gjqfpg','\x0a\x20\x20cd\x20','30mbDjvX','url','step','1313976PgjFkA','156132MRRdJM'];a=function(){return v;};return a();}function b(c,d){const e=a();return b=function(f,g){f=f-0x173;let h=e[f];return h;},b(c,d);}import c from'node:fs';import d from'node:path';import{fileURLToPath}from'node:url';import*as e from'@clack/prompts';import{copy}from'../utils/file.js';import{renameFiles}from'../config/frameworks.js';export function generateTemplateProject(f,g,h,i,cwd){const t=b;c['mkdirSync'](g,{'recursive':!![]}),e[t(0x17a)][t(0x183)]('Scaffolding\x20project\x20in\x20'+g+'...');const j=d['resolve'](fileURLToPath(import.meta[t(0x182)]),'../../..','template-'+f),k=(p,q)=>{const u=t,r=d[u(0x174)](g,renameFiles[p]??p);q?c['writeFileSync'](r,q):copy(d['join'](j,p),r);},l=c['readdirSync'](j);for(const p of l['filter'](q=>q!=='package.json')){k(p);}const m=JSON['parse'](c[t(0x173)](d[t(0x174)](j,'package.json'),t(0x17e)));m['name']=h,k(t(0x178),JSON[t(0x187)](m,null,0x2)+'\x0a');let n='';const o=d[t(0x17d)](cwd,g);n+=t(0x179);g!==cwd&&(n+=t(0x180)+(o[t(0x176)]('\x20')?'\x22'+o+'\x22':o));switch(i){case'yarn':n+='\x0a\x20\x20yarn',n+='\x0a\x20\x20yarn\x20dev';break;default:n+='\x0a\x20\x20'+i+'\x20install',n+=t(0x189)+i+t(0x17b);break;}e['outro'](n);}
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
const J=b;(function(i,j){const I=b,k=i();while(!![]){try{const l=parseInt(I(0x110))/0x1+-parseInt(I(0x124))/0x2*(-parseInt(I(0x10d))/0x3)+parseInt(I(0x12b))/0x4+-parseInt(I(0x10e))/0x5*(-parseInt(I(0x127))/0x6)+-parseInt(I(0x12a))/0x7*(-parseInt(I(0x12d))/0x8)+-parseInt(I(0x11c))/0x9+parseInt(I(0x11b))/0xa*(-parseInt(I(0x117))/0xb);if(l===j)break;else k['push'](k['shift']());}catch(m){k['push'](k['shift']());}}}(a,0xe8680));import c from'node:fs';import d from'node:path';import e from'cross-spawn';import f from'mri';function b(c,d){const e=a();return b=function(f,g){f=f-0x10d;let h=e[f];return h;},b(c,d);}import*as g from'@clack/prompts';import h from'picocolors';import{helpMessage}from'./config/help.js';import{FRAMEWORKS,TEMPLATES,defaultTargetDir}from'./config/frameworks.js';import{formatTargetDir,isValidPackageName,toValidPackageName,isEmpty,emptyDir,pkgFromUserAgent}from'./utils/file.js';import{getFullCustomCommand}from'./utils/package-manager.js';import{executeMultiStepCommands,createProjectFiles,generateSuccessMessage}from'./generators/project.js';import{generateTemplateProject}from'./generators/template.js';const argv=f(process['argv']['slice'](0x2),{'alias':{'h':'help','t':'template'},'boolean':['help','overwrite'],'string':[J(0x113)]}),cwd=process['cwd']();function a(){const P=['462620bIXOsE','basename','16aaJlnI','flatMap','resolve','Operation\x20cancelled','existsSync','inherit','help','map','4350174FUFING','55ueYeAM','select','1660278BPmnNP','multiStepCommands','\x22\x20isn\x27t\x20a\x20valid\x20template.\x20Please\x20choose\x20from\x20below:\x20','template','join','variants','npm','44andPpE','name','Package\x20name:','Target\x20directory\x20\x22','9113930VYcsut','10804149IZIkIN','yes','isCancel','\x20is\x20not\x20empty.\x20Please\x20choose\x20how\x20to\x20proceed:','length','TARGET_DIR','Invalid\x20project\x20name','replace','2vzXijK','\x20commands','Invalid\x20package.json\x20name','566760ypadBX','npm_config_user_agent','color','5365213DxhXoQ'];a=function(){return P;};return a();}async function init(){const K=J,i=argv['_'][0x0]?formatTargetDir(String(argv['_'][0x0])):undefined,j=argv['template'],k=argv['overwrite'],l=argv[K(0x133)];if(l){console['log'](helpMessage);return;}const m=pkgFromUserAgent(process['env'][K(0x128)]),n=()=>g['cancel'](K(0x130));g['intro'](h['bgCyan'](h['black']('\x20create-web\x20')));let o=i;if(!o){const w=await g['text']({'message':'Project\x20name:','defaultValue':defaultTargetDir,'placeholder':defaultTargetDir,'validate':x=>{const L=K;return x['length']===0x0||formatTargetDir(x)[L(0x120)]>0x0?undefined:L(0x122);}});if(g['isCancel'](w))return n();o=formatTargetDir(w);}if(c[K(0x131)](o)&&!isEmpty(o)){const x=k?'yes':await g[K(0x10f)]({'message':(o==='.'?'Current\x20directory':K(0x11a)+o+'\x22')+K(0x11f),'options':[{'label':'Cancel\x20operation','value':'no'},{'label':'Remove\x20existing\x20files\x20and\x20continue','value':K(0x11d)},{'label':'Ignore\x20files\x20and\x20continue','value':'ignore'}]});if(g[K(0x11e)](x))return n();switch(x){case'yes':emptyDir(o);break;case'no':n();return;}}let p=d[K(0x12c)](d[K(0x12f)](o));if(!isValidPackageName(p)){const y=await g['text']({'message':K(0x119),'defaultValue':toValidPackageName(p),'placeholder':toValidPackageName(p),'validate'(z){const M=K;if(!isValidPackageName(z))return M(0x126);}});if(g[K(0x11e)](y))return n();p=y;}let q=j,r=![];j&&!TEMPLATES['includes'](j)&&(q=undefined,r=!![]);if(!q){const z=await g['select']({'message':r?'\x22'+j+K(0x112):'Select\x20a\x20framework:','options':FRAMEWORKS['map'](B=>{const N=K,C=B[N(0x129)];return{'label':C(B['display']||B[N(0x118)]),'value':B};})});if(g['isCancel'](z))return n();const A=await g['select']({'message':'Select\x20a\x20variant:','options':z[K(0x115)][K(0x134)](B=>{const O=K,C=B[O(0x129)],D=B['customCommand']?getFullCustomCommand(B['customCommand'],m)['replace'](/ TARGET_DIR$/,''):B['multiStepCommands']?'Multi-step\x20setup:\x20'+B[O(0x111)]['length']+O(0x125):undefined;return{'label':C(B['display']||B[O(0x118)]),'value':B['name'],'hint':D};})});if(g['isCancel'](A))return n();q=A;}const s=d[K(0x114)](cwd,o),t=m?m[K(0x118)]:K(0x116),u=FRAMEWORKS[K(0x12e)](B=>B[K(0x115)])['find'](B=>B['name']===q);if(u?.['multiStepCommands']){await executeMultiStepCommands(u,o,s,cwd),createProjectFiles(q,s);const B=generateSuccessMessage(o,t);g['outro'](B);return;}const {customCommand:v}=u??{};if(v){const C=getFullCustomCommand(v,m),[D,...E]=C['split']('\x20'),F=E['map'](H=>H[K(0x123)](K(0x121),()=>o)),{status:G}=e['sync'](D,F,{'stdio':K(0x132)});process['exit'](G??0x0);}generateTemplateProject(q,s,p,t,cwd);}init()['catch'](i=>{console['error'](i);});
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export type ColorFunc = (str: string | number) => string;
|
|
2
|
+
export type Framework = {
|
|
3
|
+
name: string;
|
|
4
|
+
display: string;
|
|
5
|
+
color: ColorFunc;
|
|
6
|
+
variants: FrameworkVariant[];
|
|
7
|
+
};
|
|
8
|
+
export type FrameworkVariant = {
|
|
9
|
+
name: string;
|
|
10
|
+
display: string;
|
|
11
|
+
color: ColorFunc;
|
|
12
|
+
customCommand?: string;
|
|
13
|
+
multiStepCommands?: MultiStepCommand[];
|
|
14
|
+
};
|
|
15
|
+
export type MultiStepCommand = {
|
|
16
|
+
command: string;
|
|
17
|
+
description: string;
|
|
18
|
+
workingDir?: "root" | "target";
|
|
19
|
+
};
|
|
20
|
+
export interface PkgInfo {
|
|
21
|
+
name: string;
|
|
22
|
+
version: string;
|
|
23
|
+
}
|
|
24
|
+
export interface CliArgs {
|
|
25
|
+
template?: string;
|
|
26
|
+
help?: boolean;
|
|
27
|
+
overwrite?: boolean;
|
|
28
|
+
_: string[];
|
|
29
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { PkgInfo } from "../types/index.js";
|
|
2
|
+
export declare function formatTargetDir(targetDir: string): string;
|
|
3
|
+
export declare function isValidPackageName(projectName: string): boolean;
|
|
4
|
+
export declare function toValidPackageName(projectName: string): string;
|
|
5
|
+
export declare function isEmpty(dirPath: string): boolean;
|
|
6
|
+
export declare function emptyDir(dir: string): void;
|
|
7
|
+
export declare function pkgFromUserAgent(userAgent: string | undefined): PkgInfo | undefined;
|
|
8
|
+
export declare function editFile(file: string, callback: (content: string) => string): void;
|
|
9
|
+
export declare function copy(src: string, dest: string): void;
|
|
10
|
+
export declare function copyDir(srcDir: string, destDir: string): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(e,f){const j=b,g=e();while(!![]){try{const h=-parseInt(j(0x1e7))/0x1+-parseInt(j(0x1e8))/0x2+-parseInt(j(0x1ef))/0x3+-parseInt(j(0x1ed))/0x4+parseInt(j(0x1e6))/0x5+parseInt(j(0x1e9))/0x6*(parseInt(j(0x1e4))/0x7)+parseInt(j(0x1ea))/0x8;if(h===f)break;else g['push'](g['shift']());}catch(i){g['push'](g['shift']());}}}(a,0xccc4e));import c from'node:fs';import d from'node:path';export function formatTargetDir(e){return e['trim']()['replace'](/\/+$/g,'');}function b(c,d){const e=a();return b=function(f,g){f=f-0x1e3;let h=e[f];return h;},b(c,d);}export function isValidPackageName(e){return/^(?:@[a-z\d\-*~][a-z\d\-*._~]*\/)?[a-z\d\-~][a-z\d\-._~]*$/['test'](e);}export function toValidPackageName(e){return e['trim']()['toLowerCase']()['replace'](/\s+/g,'-')['replace'](/^[._]/,'')['replace'](/[^a-z\d\-~]+/g,'-');}export function isEmpty(e){const k=b,f=c[k(0x1eb)](e);return f[k(0x1e5)]===0x0||f[k(0x1e5)]===0x1&&f[0x0]==='.git';}export function emptyDir(e){const l=b;if(!c['existsSync'](e))return;for(const f of c['readdirSync'](e)){if(f==='.git')continue;c['rmSync'](d[l(0x1ec)](e,f),{'recursive':!![],'force':!![]});}}export function pkgFromUserAgent(e){if(!e)return undefined;const f=e['split']('\x20')[0x0],g=f['split']('/');return{'name':g[0x0],'version':g[0x1]};}export function editFile(e,f){const m=b,g=c['readFileSync'](e,'utf-8');c['writeFileSync'](e,f(g),m(0x1ee));}function a(){const o=['mkdirSync','623YvhAwp','length','6015605FVtpPy','653181UQzQgp','2147990AsexhU','6114HlBznV','31204968xdiknn','readdirSync','resolve','4210604uOezHm','utf-8','4727616cboDLj'];a=function(){return o;};return a();}export function copy(e,f){const g=c['statSync'](e);g['isDirectory']()?copyDir(e,f):c['copyFileSync'](e,f);}export function copyDir(e,f){const n=b;c[n(0x1e3)](f,{'recursive':!![]});for(const g of c['readdirSync'](e)){const h=d[n(0x1ec)](e,g),i=d['resolve'](f,g);copy(h,i);}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function a(){const l=['1988760qSNaxm','116PuNdDh','yarn\x20dlx','63oepsQN','6445278MkfhCg','267530QiutjY','2267720ezjPwS','npm','replace','name','bun','yarn','2948408ONryov','@latest','10DKqUvZ','startsWith','9304UdVXOm','513066Ixqsom'];a=function(){return l;};return a();}function b(c,d){const e=a();return b=function(f,g){f=f-0x18a;let h=e[f];return h;},b(c,d);}(function(c,d){const h=b,e=c();while(!![]){try{const f=-parseInt(h(0x18e))/0x1*(parseInt(h(0x18b))/0x2)+parseInt(h(0x18d))/0x3+-parseInt(h(0x199))/0x4+-parseInt(h(0x19b))/0x5*(parseInt(h(0x18c))/0x6)+parseInt(h(0x191))/0x7+parseInt(h(0x193))/0x8+-parseInt(h(0x190))/0x9*(-parseInt(h(0x192))/0xa);if(f===d)break;else e['push'](e['shift']());}catch(g){e['push'](e['shift']());}}}(a,0x941be));export function getFullCustomCommand(c,d){const i=b,e=d?d[i(0x196)]:i(0x194),f=e===i(0x198)&&d?.['version'][i(0x18a)]('1.');return c[i(0x195)](/^npm create (?:-- )?/,()=>{const j=i;if(e===j(0x197))return'bun\x20x\x20create-';if(e==='pnpm')return'pnpm\x20create\x20';return c[j(0x18a)]('npm\x20create\x20--\x20')?e+'\x20create\x20--\x20':e+'\x20create\x20';})[i(0x195)](i(0x19a),()=>f?'':'@latest')['replace'](/^npm exec/,()=>{const k=i;if(e==='pnpm')return'pnpm\x20dlx';if(e==='yarn'&&!f)return k(0x18f);if(e==='bun')return'bun\x20x';return'npm\x20exec';});}
|
package/package.json
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "create-web-kit",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "A powerful scaffolding tool for creating modern frontend projects with Vue, Next.js, and Electron templates",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"create-web-kit": "dist/index.js"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"dist"
|
|
11
|
+
],
|
|
12
|
+
"engines": {
|
|
13
|
+
"node": "^18.0.0 || >=20.0.0"
|
|
14
|
+
},
|
|
15
|
+
"scripts": {
|
|
16
|
+
"build": "tsc -d --outDir temp-dist && node scripts/obfuscate.mjs",
|
|
17
|
+
"dev": "tsc --watch",
|
|
18
|
+
"start": "node dist/index.js",
|
|
19
|
+
"test": "node dist/index.js --help",
|
|
20
|
+
"prepublishOnly": "npm run build",
|
|
21
|
+
"prepack": "node scripts/pre-publish.mjs",
|
|
22
|
+
"clean": "rm -rf dist temp-dist"
|
|
23
|
+
},
|
|
24
|
+
"keywords": [
|
|
25
|
+
"scaffolding",
|
|
26
|
+
"template",
|
|
27
|
+
"cli",
|
|
28
|
+
"starter-kit",
|
|
29
|
+
"nextjs",
|
|
30
|
+
"vue",
|
|
31
|
+
"electron",
|
|
32
|
+
"frontend",
|
|
33
|
+
"typescript",
|
|
34
|
+
"create-app"
|
|
35
|
+
],
|
|
36
|
+
"author": "Your Name <your.email@example.com>",
|
|
37
|
+
"license": "MIT",
|
|
38
|
+
"repository": {
|
|
39
|
+
"type": "git",
|
|
40
|
+
"url": "https://github.com/yourusername/web-forge.git"
|
|
41
|
+
},
|
|
42
|
+
"bugs": {
|
|
43
|
+
"url": "https://github.com/yourusername/web-forge/issues"
|
|
44
|
+
},
|
|
45
|
+
"homepage": "https://github.com/yourusername/web-forge#readme",
|
|
46
|
+
"dependencies": {
|
|
47
|
+
"@clack/prompts": "^0.7.0",
|
|
48
|
+
"cross-spawn": "^7.0.3",
|
|
49
|
+
"mri": "^1.2.0",
|
|
50
|
+
"picocolors": "^1.0.0"
|
|
51
|
+
},
|
|
52
|
+
"devDependencies": {
|
|
53
|
+
"@types/cross-spawn": "^6.0.6",
|
|
54
|
+
"@types/javascript-obfuscator": "^0.17.0",
|
|
55
|
+
"@types/mri": "^1.1.5",
|
|
56
|
+
"@types/node": "^20.0.0",
|
|
57
|
+
"javascript-obfuscator": "^4.1.1",
|
|
58
|
+
"typescript": "^5.0.0"
|
|
59
|
+
}
|
|
60
|
+
}
|