devbonzai 2.1.1 → 2.1.2
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/cli.js +26 -21
- package/package.json +1 -1
- package/templates/receiver.js +9 -1712
- package/templates/routes/ai.js +497 -0
- package/templates/routes/crud.js +208 -0
- package/templates/routes/infra.js +147 -0
- package/templates/utils/file-list.js +96 -0
- package/templates/utils/ignore-patterns.js +53 -0
- package/templates/utils/parsers.js +726 -0
package/cli.js
CHANGED
|
@@ -4,18 +4,30 @@ const fs = require('fs');
|
|
|
4
4
|
const path = require('path');
|
|
5
5
|
const { spawn, exec } = require('child_process');
|
|
6
6
|
|
|
7
|
-
//
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
);
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
);
|
|
7
|
+
// Helper to copy directory recursively
|
|
8
|
+
function copyDirSync(src, dest) {
|
|
9
|
+
if (!fs.existsSync(dest)) {
|
|
10
|
+
fs.mkdirSync(dest, { recursive: true });
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const entries = fs.readdirSync(src, { withFileTypes: true });
|
|
14
|
+
|
|
15
|
+
for (const entry of entries) {
|
|
16
|
+
const srcPath = path.join(src, entry.name);
|
|
17
|
+
const destPath = path.join(dest, entry.name);
|
|
18
|
+
|
|
19
|
+
if (entry.isDirectory()) {
|
|
20
|
+
copyDirSync(srcPath, destPath);
|
|
21
|
+
} else {
|
|
22
|
+
fs.copyFileSync(srcPath, destPath);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
14
26
|
|
|
15
27
|
async function main() {
|
|
16
28
|
const currentDir = process.cwd();
|
|
17
29
|
const bonzaiDir = path.join(currentDir, 'bonzai');
|
|
18
|
-
const
|
|
30
|
+
const templatesDir = path.join(__dirname, 'templates');
|
|
19
31
|
|
|
20
32
|
console.log('🚀 Setting up local file server...');
|
|
21
33
|
|
|
@@ -25,21 +37,14 @@ async function main() {
|
|
|
25
37
|
fs.mkdirSync(bonzaiDir);
|
|
26
38
|
}
|
|
27
39
|
|
|
28
|
-
//
|
|
29
|
-
console.log('📝
|
|
30
|
-
|
|
40
|
+
// Copy all template files to bonzai directory
|
|
41
|
+
console.log('📝 Copying server files...');
|
|
42
|
+
copyDirSync(templatesDir, bonzaiDir);
|
|
31
43
|
|
|
32
|
-
// Make
|
|
44
|
+
// Make receiver.js executable
|
|
45
|
+
const receiverPath = path.join(bonzaiDir, 'receiver.js');
|
|
33
46
|
fs.chmodSync(receiverPath, '755');
|
|
34
47
|
|
|
35
|
-
// Write .ignore file in bonzai directory
|
|
36
|
-
const ignoreTargetPath = path.join(bonzaiDir, '.ignore');
|
|
37
|
-
|
|
38
|
-
if (!fs.existsSync(ignoreTargetPath)) {
|
|
39
|
-
console.log('📝 Writing .ignore file...');
|
|
40
|
-
fs.writeFileSync(ignoreTargetPath, IGNORE_FILE_CONTENT);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
48
|
console.log('📦 Installing dependencies...');
|
|
44
49
|
|
|
45
50
|
// Check if package.json exists in bonzai directory
|
|
@@ -53,7 +58,7 @@ async function main() {
|
|
|
53
58
|
name: "bonzai-server",
|
|
54
59
|
version: "1.0.0",
|
|
55
60
|
description: "Dependencies for devbonzai file server",
|
|
56
|
-
main: "
|
|
61
|
+
main: "receiver.js",
|
|
57
62
|
scripts: {
|
|
58
63
|
test: "echo \"Error: no test specified\" && exit 1"
|
|
59
64
|
},
|