@bogomolcompany/bogo 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +42 -1
- package/dist/cli.js +18 -1
- package/dist/cli.js.map +1 -1
- package/dist/commands/create-app.d.ts +2 -0
- package/dist/commands/create-app.d.ts.map +1 -0
- package/dist/commands/create-app.js +19 -0
- package/dist/commands/create-app.js.map +1 -0
- package/dist/templates/project.d.ts +2 -0
- package/dist/templates/project.d.ts.map +1 -0
- package/dist/templates/project.js +205 -0
- package/dist/templates/project.js.map +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -23,7 +23,48 @@ npm run build
|
|
|
23
23
|
npm link
|
|
24
24
|
```
|
|
25
25
|
|
|
26
|
-
##
|
|
26
|
+
## Создание нового проекта
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
mkdir my-api && cd my-api
|
|
30
|
+
bogo create app
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Или в подпапку:
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
bogo create app my-api
|
|
37
|
+
cd my-api
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Создаёт Express + TypeScript проект:
|
|
41
|
+
|
|
42
|
+
```
|
|
43
|
+
package.json
|
|
44
|
+
tsconfig.json
|
|
45
|
+
.env.example
|
|
46
|
+
.bogorc.json
|
|
47
|
+
src/
|
|
48
|
+
index.ts
|
|
49
|
+
types/express.d.ts
|
|
50
|
+
middlewares/
|
|
51
|
+
logger.ts
|
|
52
|
+
formatResponse.ts
|
|
53
|
+
validate.ts
|
|
54
|
+
utils/
|
|
55
|
+
getAllowedIps.ts
|
|
56
|
+
api/
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Включено: dotenv, body-parser, logger, formatResponse, IP whitelist (через `ALLOWED_IPS`), health-check `/health`, глобальный error handler.
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
cp .env.example .env
|
|
63
|
+
npm install
|
|
64
|
+
npm run dev
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## Инициализация в существующем проекте
|
|
27
68
|
|
|
28
69
|
```bash
|
|
29
70
|
cd /path/to/your-express-app
|
package/dist/cli.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
"use strict";
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
const commander_1 = require("commander");
|
|
5
|
+
const create_app_1 = require("./commands/create-app");
|
|
5
6
|
const generate_module_1 = require("./commands/generate-module");
|
|
6
7
|
const program = new commander_1.Command();
|
|
7
8
|
program.name("bogo").description("CLI generator for Express API modules").version("0.1.0");
|
|
@@ -18,7 +19,23 @@ program
|
|
|
18
19
|
}
|
|
19
20
|
});
|
|
20
21
|
program
|
|
21
|
-
.command("
|
|
22
|
+
.command("create")
|
|
23
|
+
.description("Create a new project")
|
|
24
|
+
.argument("<type>", "project type (app)")
|
|
25
|
+
.argument("[path]", "target directory", ".")
|
|
26
|
+
.action((type, path) => {
|
|
27
|
+
try {
|
|
28
|
+
if (type !== "app") {
|
|
29
|
+
throw new Error(`Unknown type "${type}". Available: app`);
|
|
30
|
+
}
|
|
31
|
+
(0, create_app_1.runCreateApp)(process.cwd(), path);
|
|
32
|
+
}
|
|
33
|
+
catch (error) {
|
|
34
|
+
console.error(error instanceof Error ? error.message : error);
|
|
35
|
+
process.exit(1);
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
program
|
|
22
39
|
.alias("g")
|
|
23
40
|
.description("Generate code scaffolding")
|
|
24
41
|
.argument("<type>", "resource type (module)")
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";;;AAEA,yCAAoC;AACpC,gEAAwE;AAExE,MAAM,OAAO,GAAG,IAAI,mBAAO,EAAE,CAAC;AAE9B,OAAO,CAAC,IAA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AiB,EAAC,OAAO,CAAC,GAAG,EAAE,EAAE,IAAI,EAAE;YACrC,OAAO,EAAE,OAAO,CAAC,MAAM;YACvB,SAAS,EAAE,OAAO,CAAC,SAAS;SAC7B,CAAC,CAAC;IACL,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;QAC9D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC,CAAC,CAAC;AAEL,SAAS,OAAO,CAAC,KAAa,EAAE,QAAkB;IAChD,OAAO,QAAQ,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;AAClC,CAAC;AAED,OAAO,CAAC,KAAK,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-app.d.ts","sourceRoot":"","sources":["../../src/commands/create-app.ts"],"names":[],"mappings":"AAGA,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,IAAI,CAelE"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.runCreateApp = runCreateApp;
|
|
4
|
+
const path_1 = require("path");
|
|
5
|
+
const project_1 = require("../templates/project");
|
|
6
|
+
function runCreateApp(cwd, targetPath) {
|
|
7
|
+
const targetDir = (0, path_1.resolve)(cwd, targetPath);
|
|
8
|
+
const projectName = (0, path_1.basename)(targetDir).replace(/[^a-z0-9-]/gi, "-").toLowerCase() || "express-api";
|
|
9
|
+
const written = (0, project_1.writeProjectFiles)(targetDir, projectName);
|
|
10
|
+
console.log(`Express API project created at ${targetDir}:\n`);
|
|
11
|
+
for (const file of written) {
|
|
12
|
+
console.log(` ${file}`);
|
|
13
|
+
}
|
|
14
|
+
const cdStep = targetPath === "." ? "" : ` cd ${targetPath}\n`;
|
|
15
|
+
console.log(`\nNext steps:\n${cdStep} copy .env.example .env
|
|
16
|
+
npm install
|
|
17
|
+
npm run dev`);
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=create-app.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-app.js","sourceRoot":"","sources":["../../src/commands/create-app.ts"],"names":[],"mappings":";;AAGA,oCAeC;AAlBD,+BAA+C;AAC/C,kDAAyD;AAEzD,SAAgB,YAAY,CAAC,GAAW,EAAE,UAAkB;IAC1D,MAAM,SAAS,GAAG,IAAA,cAAO,EAAC,GAAG,EAAE,UAAU,CAAC,CAAC;IAC3C,MAAM,WAAW,GAAG,IAAA,eAAQ,EAAC,SAAS,CAAC,CAAC,OAAO,CAAC,cAAc,EAAE,GAAG,CAAC,CAAC,WAAW,EAAE,IAAI,aAAa,CAAC;IACpG,MAAM,OAAO,GAAG,IAAA,2BAAiB,EAAC,SAAS,EAAE,WAAW,CAAC,CAAC;IAE1D,OAAO,CAAC,GAAG,CAAC,kCAAkC,SAAS,KAAK,CAAC,CAAC;IAC9D,KAAK,MAAM,IAAI,IAAI,OAAO,EAAE,CAAC;QAC3B,OAAO,CAAC,GAAG,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC;IAC3B,CAAC;IAED,MAAM,MAAM,GAAG,UAAU,KAAK,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,UAAU,IAAI,CAAC;IAEhE,OAAO,CAAC,GAAG,CAAC,kBAAkB,MAAM;;cAExB,CAAC,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"project.d.ts","sourceRoot":"","sources":["../../src/templates/project.ts"],"names":[],"mappings":"AAqLA,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM,EAAE,CA4BlF"}
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.writeProjectFiles = writeProjectFiles;
|
|
4
|
+
const fs_1 = require("fs");
|
|
5
|
+
const path_1 = require("path");
|
|
6
|
+
const config_1 = require("../utils/config");
|
|
7
|
+
const PROJECT_FILES = {
|
|
8
|
+
"package.json": `{
|
|
9
|
+
"name": "express-api",
|
|
10
|
+
"version": "0.1.0",
|
|
11
|
+
"private": true,
|
|
12
|
+
"scripts": {
|
|
13
|
+
"dev": "ts-node src/index.ts",
|
|
14
|
+
"build": "tsc",
|
|
15
|
+
"start": "node dist/index.js"
|
|
16
|
+
},
|
|
17
|
+
"dependencies": {
|
|
18
|
+
"body-parser": "^1.20.3",
|
|
19
|
+
"dotenv": "^16.4.5",
|
|
20
|
+
"express": "^4.21.0",
|
|
21
|
+
"express-ipfilter": "^1.3.2",
|
|
22
|
+
"log-timestamp": "^0.3.0",
|
|
23
|
+
"zod": "^3.23.8"
|
|
24
|
+
},
|
|
25
|
+
"devDependencies": {
|
|
26
|
+
"@types/body-parser": "^1.19.5",
|
|
27
|
+
"@types/express": "^4.17.21",
|
|
28
|
+
"@types/node": "^22.5.0",
|
|
29
|
+
"ts-node": "^10.9.2",
|
|
30
|
+
"typescript": "^5.5.4"
|
|
31
|
+
},
|
|
32
|
+
"engines": {
|
|
33
|
+
"node": ">=18"
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
`,
|
|
37
|
+
"tsconfig.json": `{
|
|
38
|
+
"compilerOptions": {
|
|
39
|
+
"target": "ES2022",
|
|
40
|
+
"module": "CommonJS",
|
|
41
|
+
"lib": ["ES2022"],
|
|
42
|
+
"outDir": "./dist",
|
|
43
|
+
"rootDir": "./src",
|
|
44
|
+
"strict": true,
|
|
45
|
+
"esModuleInterop": true,
|
|
46
|
+
"skipLibCheck": true,
|
|
47
|
+
"resolveJsonModule": true
|
|
48
|
+
},
|
|
49
|
+
"include": ["src/**/*"],
|
|
50
|
+
"exclude": ["node_modules", "dist"]
|
|
51
|
+
}
|
|
52
|
+
`,
|
|
53
|
+
".env.example": `PORT=3000
|
|
54
|
+
ALLOWED_IPS=
|
|
55
|
+
`,
|
|
56
|
+
".gitignore": `node_modules/
|
|
57
|
+
dist/
|
|
58
|
+
.env
|
|
59
|
+
*.log
|
|
60
|
+
.DS_Store
|
|
61
|
+
`,
|
|
62
|
+
"src/index.ts": `import bodyParser from "body-parser";
|
|
63
|
+
import config from "dotenv";
|
|
64
|
+
import express, { NextFunction, Request, Response } from "express";
|
|
65
|
+
import { IpDeniedError, IpFilter } from "express-ipfilter";
|
|
66
|
+
import "log-timestamp";
|
|
67
|
+
import { formatResponse } from "./middlewares/formatResponse";
|
|
68
|
+
import { logger } from "./middlewares/logger";
|
|
69
|
+
import { getAllowedIps } from "./utils/getAllowedIps";
|
|
70
|
+
|
|
71
|
+
config.config();
|
|
72
|
+
|
|
73
|
+
const app = express();
|
|
74
|
+
|
|
75
|
+
app.use(logger);
|
|
76
|
+
app.use(bodyParser.json());
|
|
77
|
+
app.use(bodyParser.urlencoded({ extended: true }));
|
|
78
|
+
app.use(formatResponse());
|
|
79
|
+
|
|
80
|
+
if (process.env.ALLOWED_IPS) {
|
|
81
|
+
const ipsInWhiteList = getAllowedIps(process.env.ALLOWED_IPS);
|
|
82
|
+
console.log("[INFO]: ALLOWED IPS:", ipsInWhiteList);
|
|
83
|
+
|
|
84
|
+
app.use((req: Request, _res: Response, next: NextFunction) => {
|
|
85
|
+
const clientIp = req.ip || req.connection.remoteAddress || "unknown";
|
|
86
|
+
console.log(\`[ACCESS ATTEMPT] IP: \${clientIp} | Method: \${req.method} | URL: \${req.originalUrl}\`);
|
|
87
|
+
next();
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
app.use(IpFilter(ipsInWhiteList, { mode: "allow" }));
|
|
91
|
+
app.use((err: unknown, _req: Request, res: Response, next: NextFunction) => {
|
|
92
|
+
if (err instanceof IpDeniedError) {
|
|
93
|
+
return res.error(err, "401", 401);
|
|
94
|
+
}
|
|
95
|
+
next(err);
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
app.get("/health", (_req, res) => res.success({ status: "ok" }));
|
|
100
|
+
|
|
101
|
+
app.use((err: unknown, _req: Request, res: Response, next: NextFunction) => {
|
|
102
|
+
console.log("[Global Error Handler] Unhandled error:", err);
|
|
103
|
+
if (!res.headersSent) {
|
|
104
|
+
return res.error(err, "INTERNAL_ERROR", 500);
|
|
105
|
+
}
|
|
106
|
+
next(err);
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
const port = process.env.PORT || 3000;
|
|
110
|
+
|
|
111
|
+
app.listen(port, () => {
|
|
112
|
+
console.log(\`[INFO]: Server started on port: \${port}\`);
|
|
113
|
+
});
|
|
114
|
+
`,
|
|
115
|
+
"src/types/express.d.ts": `declare global {
|
|
116
|
+
namespace Express {
|
|
117
|
+
interface Response {
|
|
118
|
+
success(data: unknown, statusCode?: number): Response;
|
|
119
|
+
error(error: unknown, code?: string, statusCode?: number): Response;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export {};
|
|
125
|
+
`,
|
|
126
|
+
"src/middlewares/logger.ts": `import { NextFunction, Request, Response } from "express";
|
|
127
|
+
|
|
128
|
+
export function logger(req: Request, res: Response, next: NextFunction) {
|
|
129
|
+
const start = Date.now();
|
|
130
|
+
res.on("finish", () => {
|
|
131
|
+
const duration = Date.now() - start;
|
|
132
|
+
console.log(\`[\${req.method}] \${req.originalUrl} \${res.statusCode} - \${duration}ms\`);
|
|
133
|
+
});
|
|
134
|
+
next();
|
|
135
|
+
}
|
|
136
|
+
`,
|
|
137
|
+
"src/middlewares/formatResponse.ts": `import { NextFunction, Request, Response } from "express";
|
|
138
|
+
|
|
139
|
+
export function formatResponse() {
|
|
140
|
+
return (_req: Request, res: Response, next: NextFunction) => {
|
|
141
|
+
res.success = (data, statusCode = 200) => {
|
|
142
|
+
return res.status(statusCode).json({ success: true, data });
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
res.error = (error, code = "ERROR", statusCode = 500) => {
|
|
146
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
147
|
+
return res.status(statusCode).json({ success: false, error: { code, message } });
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
next();
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
`,
|
|
154
|
+
"src/middlewares/validate.ts": `import { NextFunction, Request, Response } from "express";
|
|
155
|
+
import { ZodSchema } from "zod";
|
|
156
|
+
|
|
157
|
+
export function validate(schema: ZodSchema) {
|
|
158
|
+
return (req: Request, res: Response, next: NextFunction) => {
|
|
159
|
+
const result = schema.safeParse({
|
|
160
|
+
body: req.body,
|
|
161
|
+
query: req.query,
|
|
162
|
+
params: req.params,
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
if (!result.success) {
|
|
166
|
+
return res.error(result.error.flatten(), "VALIDATION_ERROR", 400);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
next();
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
`,
|
|
173
|
+
"src/utils/getAllowedIps.ts": `export function getAllowedIps(raw: string): string[] {
|
|
174
|
+
return raw.split(",").map(ip => ip.trim()).filter(Boolean);
|
|
175
|
+
}
|
|
176
|
+
`,
|
|
177
|
+
};
|
|
178
|
+
function renderPackageJson(projectName) {
|
|
179
|
+
const content = PROJECT_FILES["package.json"];
|
|
180
|
+
return content.replace('"name": "express-api"', `"name": "${projectName}"`);
|
|
181
|
+
}
|
|
182
|
+
function writeProjectFiles(targetDir, projectName) {
|
|
183
|
+
if ((0, fs_1.existsSync)((0, path_1.join)(targetDir, "package.json"))) {
|
|
184
|
+
throw new Error(`Directory already contains package.json: ${targetDir}`);
|
|
185
|
+
}
|
|
186
|
+
if (!(0, fs_1.existsSync)(targetDir)) {
|
|
187
|
+
(0, fs_1.mkdirSync)(targetDir, { recursive: true });
|
|
188
|
+
}
|
|
189
|
+
(0, fs_1.mkdirSync)((0, path_1.join)(targetDir, "src", "api"), { recursive: true });
|
|
190
|
+
(0, fs_1.mkdirSync)((0, path_1.join)(targetDir, "src", "middlewares"), { recursive: true });
|
|
191
|
+
(0, fs_1.mkdirSync)((0, path_1.join)(targetDir, "src", "utils"), { recursive: true });
|
|
192
|
+
(0, fs_1.mkdirSync)((0, path_1.join)(targetDir, "src", "types"), { recursive: true });
|
|
193
|
+
const written = [];
|
|
194
|
+
for (const [relativePath, content] of Object.entries(PROJECT_FILES)) {
|
|
195
|
+
const filePath = (0, path_1.join)(targetDir, relativePath);
|
|
196
|
+
const fileContent = relativePath === "package.json" ? renderPackageJson(projectName) : content;
|
|
197
|
+
(0, fs_1.writeFileSync)(filePath, fileContent, "utf-8");
|
|
198
|
+
written.push(filePath);
|
|
199
|
+
}
|
|
200
|
+
const configPath = (0, path_1.join)(targetDir, ".bogorc.json");
|
|
201
|
+
(0, fs_1.writeFileSync)(configPath, (0, config_1.getDefaultConfigContent)(), "utf-8");
|
|
202
|
+
written.push(configPath);
|
|
203
|
+
return written;
|
|
204
|
+
}
|
|
205
|
+
//# sourceMappingURL=project.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"project.js","sourceRoot":"","sources":["../../src/templates/project.ts"],"names":[],"mappings":";;AAqLA,8CA4BC;AAjND,2BAA0D;AAC1D,+BAA4B;AAC5B,4CAA0D;AAE1D,MAAM,aAAa,GAA2B;IAC5C,cAAc,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4BjB;IACC,eAAe,EAAE;;;;;;;;;;;;;;;CAelB;IACC,cAAc,EAAE;;CAEjB;IACC,YAAY,EAAE;;;;;CAKf;IACC,cAAc,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoDjB;IACC,wBAAwB,EAAE;;;;;;;;;;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