flash-builder 1.0.12 → 1.0.14
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 +272 -6
- package/dist/index.cjs +21 -18
- package/dist/index.js +28 -19
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,15 +1,281 @@
|
|
|
1
|
-
#
|
|
1
|
+
# ⚡ Flash Builder
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
<div align="center">
|
|
4
|
+
|
|
5
|
+
```
|
|
6
|
+
________ __ ____ _ __ __
|
|
7
|
+
/ ____/ /___ ______/ /_ / __ )__ __(_) /___/ /__ _____
|
|
8
|
+
/ /_ / / __ `/ ___/ __ \ / __ / / / / / / __ / _ \/ ___/
|
|
9
|
+
/ __/ / / /_/ (__ ) / / / / /_/ / /_/ / / / /_/ / __/ /
|
|
10
|
+
/_/ /_/\__,_/____/_/ /_/ /_____/\__,_/_/_/\__,_/\___/_/
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
**A blazingly fast CLI tool for scaffolding modern backend projects**
|
|
14
|
+
|
|
15
|
+
[](https://www.npmjs.com/package/flash-builder)
|
|
16
|
+
[](https://opensource.org/licenses/MIT)
|
|
17
|
+
|
|
18
|
+
[Installation](#-installation) • [Usage](#-usage) • [Commands](#-commands) • [Examples](#-examples)
|
|
19
|
+
|
|
20
|
+
</div>
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## ✨ Features
|
|
25
|
+
|
|
26
|
+
- 🚀 **Lightning Fast** - Built with Bun for maximum performance
|
|
27
|
+
- 📦 **Zero Configuration** - Get started immediately with sensible defaults
|
|
28
|
+
- 🎯 **Multiple Templates** - Backend (Express) and MCP Server scaffolding
|
|
29
|
+
- 🔄 **Auto Install** - Automatically installs dependencies after project creation
|
|
30
|
+
- 🎨 **Modern Stack** - TypeScript, Express, and latest best practices
|
|
31
|
+
- 🛠️ **Flexible** - Generate in current directory or create new folders
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## 📦 Installation
|
|
36
|
+
|
|
37
|
+
### Global Installation
|
|
4
38
|
|
|
5
39
|
```bash
|
|
6
|
-
bun install
|
|
40
|
+
bun install -g flash-builder@latest
|
|
7
41
|
```
|
|
8
42
|
|
|
9
|
-
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## 🚀 Usage
|
|
10
46
|
|
|
11
47
|
```bash
|
|
12
|
-
|
|
48
|
+
fbi <command> [options]
|
|
13
49
|
```
|
|
14
50
|
|
|
15
|
-
|
|
51
|
+
### Quick Start
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
# Create a new backend project
|
|
55
|
+
fbi be my-project-name
|
|
56
|
+
|
|
57
|
+
# Create in a specific subdirectory
|
|
58
|
+
fbi be my-project-name ./backend
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
# Create MCP server project
|
|
62
|
+
fbi mcp my-mcp-server
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
# Sync interface from Flash Builder
|
|
66
|
+
fbi sync
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
## 📚 Commands
|
|
72
|
+
|
|
73
|
+
### `be <project-name> [target-path]`
|
|
74
|
+
|
|
75
|
+
Initialize a new backend project with Express and TypeScript.
|
|
76
|
+
|
|
77
|
+
**Arguments:**
|
|
78
|
+
- `project-name` - Name of your project (used in package.json)
|
|
79
|
+
- `target-path` - (Optional) Target directory (`.` for current dir, `./path` for subdirectory)
|
|
80
|
+
|
|
81
|
+
**Generated Structure:**
|
|
82
|
+
```
|
|
83
|
+
my-backend/
|
|
84
|
+
├── src/
|
|
85
|
+
│ ├── routes/
|
|
86
|
+
│ ├── controllers/
|
|
87
|
+
│ ├── models/
|
|
88
|
+
│ ├── middlewares/
|
|
89
|
+
│ └── index.ts
|
|
90
|
+
├── .env
|
|
91
|
+
├── .gitignore
|
|
92
|
+
├── package.json
|
|
93
|
+
└── README.md
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
**Includes:**
|
|
97
|
+
- Express.js server setup
|
|
98
|
+
- TypeScript configuration
|
|
99
|
+
- Environment variables support
|
|
100
|
+
- Auto-installed dependencies
|
|
101
|
+
- Development scripts
|
|
102
|
+
|
|
103
|
+
---
|
|
104
|
+
|
|
105
|
+
### `mcp <project-name>`
|
|
106
|
+
|
|
107
|
+
Initialize a new MCP (Model Context Protocol) server project.
|
|
108
|
+
|
|
109
|
+
**Arguments:**
|
|
110
|
+
- `project-name` - Name of your MCP server project
|
|
111
|
+
|
|
112
|
+
**Generated Structure:**
|
|
113
|
+
```
|
|
114
|
+
my-mcp-server/
|
|
115
|
+
├── src/
|
|
116
|
+
│ ├── tools/
|
|
117
|
+
│ ├── resources/
|
|
118
|
+
│ └── index.ts
|
|
119
|
+
├── .env
|
|
120
|
+
├── .gitignore
|
|
121
|
+
├── package.json
|
|
122
|
+
└── README.md
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
**Includes:**
|
|
126
|
+
- MCP SDK setup
|
|
127
|
+
- TypeScript configuration
|
|
128
|
+
- Tools and resources directories
|
|
129
|
+
- Auto-installed dependencies
|
|
130
|
+
|
|
131
|
+
---
|
|
132
|
+
|
|
133
|
+
### `sync`
|
|
134
|
+
|
|
135
|
+
Sync the current backend interface with the application target.
|
|
136
|
+
|
|
137
|
+
**Usage:**
|
|
138
|
+
```bash
|
|
139
|
+
fbi sync
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
---
|
|
143
|
+
|
|
144
|
+
## 🎯 Examples
|
|
145
|
+
|
|
146
|
+
### Create Backend Project
|
|
147
|
+
|
|
148
|
+
```bash
|
|
149
|
+
# Standard - creates new folder
|
|
150
|
+
fbi be my-api
|
|
151
|
+
|
|
152
|
+
# In current directory
|
|
153
|
+
fbi be my-api .
|
|
154
|
+
|
|
155
|
+
# In subdirectory
|
|
156
|
+
fbi be my-api ./backend
|
|
157
|
+
|
|
158
|
+
# With verbose logging
|
|
159
|
+
fbi be my-api --verbose
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
### Create MCP Server
|
|
163
|
+
|
|
164
|
+
```bash
|
|
165
|
+
# Standard MCP server
|
|
166
|
+
fbi mcp my-mcp-server
|
|
167
|
+
|
|
168
|
+
# With verbose logging
|
|
169
|
+
fbi mcp my-mcp-server -v
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
### After Project Creation
|
|
173
|
+
|
|
174
|
+
```bash
|
|
175
|
+
cd my-api
|
|
176
|
+
bun run dev
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
---
|
|
180
|
+
|
|
181
|
+
## ⚙️ Options
|
|
182
|
+
|
|
183
|
+
| Option | Alias | Description |
|
|
184
|
+
|--------|-------|-------------|
|
|
185
|
+
| `--verbose` | `-v` | Enable verbose logging |
|
|
186
|
+
| `--help` | `-h` | Show help message |
|
|
187
|
+
| `--version` | | Show version number |
|
|
188
|
+
|
|
189
|
+
---
|
|
190
|
+
|
|
191
|
+
## 🔧 Development
|
|
192
|
+
|
|
193
|
+
### Prerequisites
|
|
194
|
+
|
|
195
|
+
- [Bun](https://bun.sh) v1.3.6 or higher
|
|
196
|
+
|
|
197
|
+
### Setup
|
|
198
|
+
|
|
199
|
+
```bash
|
|
200
|
+
# Clone the repository
|
|
201
|
+
git clone https://github.com/jefripunza/flash-builder-cli.git
|
|
202
|
+
cd flash-builder-cli
|
|
203
|
+
|
|
204
|
+
# Install dependencies
|
|
205
|
+
bun install
|
|
206
|
+
|
|
207
|
+
# Run in development
|
|
208
|
+
bun run start
|
|
209
|
+
|
|
210
|
+
# Build for production
|
|
211
|
+
bun run build
|
|
212
|
+
|
|
213
|
+
# Compile binary
|
|
214
|
+
bun run compile
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
---
|
|
218
|
+
|
|
219
|
+
## 📝 Project Templates
|
|
220
|
+
|
|
221
|
+
### Backend (Express) Template
|
|
222
|
+
|
|
223
|
+
- **Framework:** Express.js
|
|
224
|
+
- **Language:** TypeScript
|
|
225
|
+
- **Runtime:** Bun
|
|
226
|
+
- **Features:**
|
|
227
|
+
- REST API structure
|
|
228
|
+
- Environment variables
|
|
229
|
+
- Hot reload in development
|
|
230
|
+
- Production build script
|
|
231
|
+
|
|
232
|
+
### MCP Server Template
|
|
233
|
+
|
|
234
|
+
- **Driver:** [jefriherditriyanto/langchain-mcp-api](https://hub.docker.com/r/jefriherditriyanto/langchain-mcp-api)
|
|
235
|
+
- **Runtime:** Docker
|
|
236
|
+
|
|
237
|
+
---
|
|
238
|
+
|
|
239
|
+
## 🤝 Contributing
|
|
240
|
+
|
|
241
|
+
Contributions are welcome! Please feel free to submit a Pull Request.
|
|
242
|
+
|
|
243
|
+
1. Fork the repository
|
|
244
|
+
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
|
|
245
|
+
3. Commit your changes (`git commit -m 'Add some amazing feature'`)
|
|
246
|
+
4. Push to the branch (`git push origin feature/amazing-feature`)
|
|
247
|
+
5. Open a Pull Request
|
|
248
|
+
|
|
249
|
+
---
|
|
250
|
+
|
|
251
|
+
## 📄 License
|
|
252
|
+
|
|
253
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
254
|
+
|
|
255
|
+
---
|
|
256
|
+
|
|
257
|
+
## 👤 Author
|
|
258
|
+
|
|
259
|
+
<a href="https://github.com/jefripunza">
|
|
260
|
+
<img src="https://github.com/jefripunza.png" width="50" height="50" alt="Jefri Herdi Triyanto" style="border-radius: 50%;">
|
|
261
|
+
</a>
|
|
262
|
+
|
|
263
|
+
**Jefri Herdi Triyanto** ([@jefripunza](https://github.com/jefripunza))
|
|
264
|
+
|
|
265
|
+
---
|
|
266
|
+
|
|
267
|
+
## 🙏 Acknowledgments
|
|
268
|
+
|
|
269
|
+
- Built with [Bun](https://bun.sh) - A fast all-in-one JavaScript runtime
|
|
270
|
+
- Powered by [meow](https://github.com/sindresorhus/meow) - CLI helper
|
|
271
|
+
- Inspired by modern development workflows
|
|
272
|
+
|
|
273
|
+
---
|
|
274
|
+
|
|
275
|
+
<div align="center">
|
|
276
|
+
|
|
277
|
+
**⚡ Flash Builder - Build faster, ship sooner**
|
|
278
|
+
|
|
279
|
+
Made with ❤️ by [Jefri Herdi Triyanto](https://github.com/jefripunza)
|
|
280
|
+
|
|
281
|
+
</div>
|
package/dist/index.cjs
CHANGED
|
@@ -9819,7 +9819,7 @@ var meow = (helpText, options = {}) => {
|
|
|
9819
9819
|
};
|
|
9820
9820
|
|
|
9821
9821
|
// version.ts
|
|
9822
|
-
var version = "1.0.
|
|
9822
|
+
var version = "1.0.14";
|
|
9823
9823
|
var version_default = version;
|
|
9824
9824
|
|
|
9825
9825
|
// src/banner.ts
|
|
@@ -9923,39 +9923,42 @@ function beCommand(projectName, verbose, targetPath) {
|
|
|
9923
9923
|
console.log("Usage: fbi be <project-name>");
|
|
9924
9924
|
process.exit(1);
|
|
9925
9925
|
}
|
|
9926
|
-
const isCurrentDir = targetPath === "." || targetPath?.startsWith("./");
|
|
9927
9926
|
let projectPath;
|
|
9928
|
-
|
|
9929
|
-
|
|
9930
|
-
projectPath = targetPath === "." ? PWD : import_node_path3.join(PWD, targetPath.replace("./", ""));
|
|
9931
|
-
actualProjectName = projectName;
|
|
9927
|
+
if (targetPath) {
|
|
9928
|
+
projectPath = import_node_path3.join(PWD, targetPath);
|
|
9932
9929
|
} else {
|
|
9933
9930
|
projectPath = import_node_path3.join(PWD, projectName);
|
|
9934
|
-
actualProjectName = projectName;
|
|
9935
9931
|
}
|
|
9936
|
-
if (import_node_fs2.existsSync(projectPath)
|
|
9937
|
-
|
|
9938
|
-
|
|
9939
|
-
|
|
9932
|
+
if (import_node_fs2.existsSync(projectPath)) {
|
|
9933
|
+
const dirContent = import_node_fs2.readdirSync(projectPath);
|
|
9934
|
+
const hasContent = dirContent.length > 0;
|
|
9935
|
+
if (IS_NPMJS && hasContent) {
|
|
9936
|
+
console.warn(`\u26A0\uFE0F Warning: Directory '${projectName}' already exists and is not empty`);
|
|
9937
|
+
const answer = prompt("Do you want to continue and overwrite? (y/n): ");
|
|
9938
|
+
if (answer?.toLowerCase() !== "y") {
|
|
9939
|
+
console.log("\u274C Operation cancelled");
|
|
9940
|
+
process.exit(1);
|
|
9941
|
+
}
|
|
9942
|
+
console.log("\u2705 Continuing...");
|
|
9940
9943
|
}
|
|
9941
9944
|
}
|
|
9942
9945
|
if (!IS_NPMJS) {
|
|
9943
9946
|
import_node_fs2.rmSync(PWD, { recursive: true, force: true });
|
|
9944
9947
|
}
|
|
9945
|
-
log(`\uD83D\uDE80 Creating new backend project: ${
|
|
9948
|
+
log(`\uD83D\uDE80 Creating new backend project: ${projectName}`, false, verbose);
|
|
9946
9949
|
import_node_fs2.mkdirSync(projectPath, { recursive: true });
|
|
9947
9950
|
import_node_fs2.mkdirSync(import_node_path3.join(projectPath, "src"), { recursive: true });
|
|
9948
9951
|
import_node_fs2.mkdirSync(import_node_path3.join(projectPath, "src", "routes"), { recursive: true });
|
|
9949
9952
|
import_node_fs2.mkdirSync(import_node_path3.join(projectPath, "src", "controllers"), { recursive: true });
|
|
9950
9953
|
import_node_fs2.mkdirSync(import_node_path3.join(projectPath, "src", "models"), { recursive: true });
|
|
9951
9954
|
import_node_fs2.mkdirSync(import_node_path3.join(projectPath, "src", "middlewares"), { recursive: true });
|
|
9952
|
-
const packageJsonString = JSON.stringify(packageJson(
|
|
9955
|
+
const packageJsonString = JSON.stringify(packageJson(projectName), null, 2);
|
|
9953
9956
|
import_node_fs2.writeFileSync(import_node_path3.join(projectPath, "package.json"), packageJsonString);
|
|
9954
|
-
import_node_fs2.writeFileSync(import_node_path3.join(projectPath, "src", "index.ts"), indexTs(
|
|
9957
|
+
import_node_fs2.writeFileSync(import_node_path3.join(projectPath, "src", "index.ts"), indexTs(projectName));
|
|
9955
9958
|
import_node_fs2.writeFileSync(import_node_path3.join(projectPath, ".env"), envFile);
|
|
9956
9959
|
import_node_fs2.writeFileSync(import_node_path3.join(projectPath, ".gitignore"), gitignore);
|
|
9957
|
-
import_node_fs2.writeFileSync(import_node_path3.join(projectPath, "README.md"), readme(
|
|
9958
|
-
log(`\u2705 Backend project '${
|
|
9960
|
+
import_node_fs2.writeFileSync(import_node_path3.join(projectPath, "README.md"), readme(projectName));
|
|
9961
|
+
log(`\u2705 Backend project '${projectName}' created successfully!`, false, verbose);
|
|
9959
9962
|
log(`
|
|
9960
9963
|
\uD83D\uDCE6 Installing dependencies...`, false, verbose);
|
|
9961
9964
|
const installProcess = Bun.spawnSync(["bun", "install"], {
|
|
@@ -9970,8 +9973,8 @@ function beCommand(projectName, verbose, targetPath) {
|
|
|
9970
9973
|
}
|
|
9971
9974
|
log(`
|
|
9972
9975
|
Next steps:`, true, verbose);
|
|
9973
|
-
if (!
|
|
9974
|
-
log(` cd ${
|
|
9976
|
+
if (!targetPath) {
|
|
9977
|
+
log(` cd ${projectName}`, true, verbose);
|
|
9975
9978
|
}
|
|
9976
9979
|
log(` bun run dev`, true, verbose);
|
|
9977
9980
|
}
|
package/dist/index.js
CHANGED
|
@@ -9820,7 +9820,7 @@ var meow = (helpText, options = {}) => {
|
|
|
9820
9820
|
};
|
|
9821
9821
|
|
|
9822
9822
|
// version.ts
|
|
9823
|
-
var version = "1.0.
|
|
9823
|
+
var version = "1.0.14";
|
|
9824
9824
|
var version_default = version;
|
|
9825
9825
|
|
|
9826
9826
|
// src/banner.ts
|
|
@@ -9848,7 +9848,13 @@ var LLM_BASE_URL = ENV.LLM_BASE_URL;
|
|
|
9848
9848
|
var LLM_API_KEY = ENV.LLM_API_KEY || "";
|
|
9849
9849
|
|
|
9850
9850
|
// src/commands/be/index.ts
|
|
9851
|
-
import {
|
|
9851
|
+
import {
|
|
9852
|
+
existsSync,
|
|
9853
|
+
mkdirSync,
|
|
9854
|
+
writeFileSync,
|
|
9855
|
+
rmSync,
|
|
9856
|
+
readdirSync
|
|
9857
|
+
} from "fs";
|
|
9852
9858
|
import { join } from "path";
|
|
9853
9859
|
|
|
9854
9860
|
// src/utils/logger.ts
|
|
@@ -9924,39 +9930,42 @@ function beCommand(projectName, verbose, targetPath) {
|
|
|
9924
9930
|
console.log("Usage: fbi be <project-name>");
|
|
9925
9931
|
process.exit(1);
|
|
9926
9932
|
}
|
|
9927
|
-
const isCurrentDir = targetPath === "." || targetPath?.startsWith("./");
|
|
9928
9933
|
let projectPath;
|
|
9929
|
-
|
|
9930
|
-
|
|
9931
|
-
projectPath = targetPath === "." ? PWD : join(PWD, targetPath.replace("./", ""));
|
|
9932
|
-
actualProjectName = projectName;
|
|
9934
|
+
if (targetPath) {
|
|
9935
|
+
projectPath = join(PWD, targetPath);
|
|
9933
9936
|
} else {
|
|
9934
9937
|
projectPath = join(PWD, projectName);
|
|
9935
|
-
actualProjectName = projectName;
|
|
9936
9938
|
}
|
|
9937
|
-
if (existsSync(projectPath)
|
|
9938
|
-
|
|
9939
|
-
|
|
9940
|
-
|
|
9939
|
+
if (existsSync(projectPath)) {
|
|
9940
|
+
const dirContent = readdirSync(projectPath);
|
|
9941
|
+
const hasContent = dirContent.length > 0;
|
|
9942
|
+
if (IS_NPMJS && hasContent) {
|
|
9943
|
+
console.warn(`\u26A0\uFE0F Warning: Directory '${projectName}' already exists and is not empty`);
|
|
9944
|
+
const answer = prompt("Do you want to continue and overwrite? (y/n): ");
|
|
9945
|
+
if (answer?.toLowerCase() !== "y") {
|
|
9946
|
+
console.log("\u274C Operation cancelled");
|
|
9947
|
+
process.exit(1);
|
|
9948
|
+
}
|
|
9949
|
+
console.log("\u2705 Continuing...");
|
|
9941
9950
|
}
|
|
9942
9951
|
}
|
|
9943
9952
|
if (!IS_NPMJS) {
|
|
9944
9953
|
rmSync(PWD, { recursive: true, force: true });
|
|
9945
9954
|
}
|
|
9946
|
-
log(`\uD83D\uDE80 Creating new backend project: ${
|
|
9955
|
+
log(`\uD83D\uDE80 Creating new backend project: ${projectName}`, false, verbose);
|
|
9947
9956
|
mkdirSync(projectPath, { recursive: true });
|
|
9948
9957
|
mkdirSync(join(projectPath, "src"), { recursive: true });
|
|
9949
9958
|
mkdirSync(join(projectPath, "src", "routes"), { recursive: true });
|
|
9950
9959
|
mkdirSync(join(projectPath, "src", "controllers"), { recursive: true });
|
|
9951
9960
|
mkdirSync(join(projectPath, "src", "models"), { recursive: true });
|
|
9952
9961
|
mkdirSync(join(projectPath, "src", "middlewares"), { recursive: true });
|
|
9953
|
-
const packageJsonString = JSON.stringify(packageJson(
|
|
9962
|
+
const packageJsonString = JSON.stringify(packageJson(projectName), null, 2);
|
|
9954
9963
|
writeFileSync(join(projectPath, "package.json"), packageJsonString);
|
|
9955
|
-
writeFileSync(join(projectPath, "src", "index.ts"), indexTs(
|
|
9964
|
+
writeFileSync(join(projectPath, "src", "index.ts"), indexTs(projectName));
|
|
9956
9965
|
writeFileSync(join(projectPath, ".env"), envFile);
|
|
9957
9966
|
writeFileSync(join(projectPath, ".gitignore"), gitignore);
|
|
9958
|
-
writeFileSync(join(projectPath, "README.md"), readme(
|
|
9959
|
-
log(`\u2705 Backend project '${
|
|
9967
|
+
writeFileSync(join(projectPath, "README.md"), readme(projectName));
|
|
9968
|
+
log(`\u2705 Backend project '${projectName}' created successfully!`, false, verbose);
|
|
9960
9969
|
log(`
|
|
9961
9970
|
\uD83D\uDCE6 Installing dependencies...`, false, verbose);
|
|
9962
9971
|
const installProcess = Bun.spawnSync(["bun", "install"], {
|
|
@@ -9971,8 +9980,8 @@ function beCommand(projectName, verbose, targetPath) {
|
|
|
9971
9980
|
}
|
|
9972
9981
|
log(`
|
|
9973
9982
|
Next steps:`, true, verbose);
|
|
9974
|
-
if (!
|
|
9975
|
-
log(` cd ${
|
|
9983
|
+
if (!targetPath) {
|
|
9984
|
+
log(` cd ${projectName}`, true, verbose);
|
|
9976
9985
|
}
|
|
9977
9986
|
log(` bun run dev`, true, verbose);
|
|
9978
9987
|
}
|