devbonzai 2.1.2 → 2.1.4
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 +21 -26
- package/package.json +1 -1
- package/templates/receiver.js +1712 -9
- package/templates/routes/ai.js +0 -497
- package/templates/routes/crud.js +0 -208
- package/templates/routes/infra.js +0 -147
- package/templates/utils/file-list.js +0 -96
- package/templates/utils/ignore-patterns.js +0 -53
- package/templates/utils/parsers.js +0 -726
package/cli.js
CHANGED
|
@@ -4,30 +4,18 @@ 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
|
-
|
|
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
|
-
}
|
|
7
|
+
// Read templates at runtime from the templates directory
|
|
8
|
+
const IGNORE_FILE_CONTENT = fs.readFileSync(
|
|
9
|
+
path.join(__dirname, 'templates', 'ignore.txt'), 'utf8'
|
|
10
|
+
);
|
|
11
|
+
const RECEIVER_JS_CONTENT = fs.readFileSync(
|
|
12
|
+
path.join(__dirname, 'templates', 'receiver.js'), 'utf8'
|
|
13
|
+
);
|
|
26
14
|
|
|
27
15
|
async function main() {
|
|
28
16
|
const currentDir = process.cwd();
|
|
29
17
|
const bonzaiDir = path.join(currentDir, 'bonzai');
|
|
30
|
-
const
|
|
18
|
+
const receiverPath = path.join(bonzaiDir, 'receiver.js');
|
|
31
19
|
|
|
32
20
|
console.log('🚀 Setting up local file server...');
|
|
33
21
|
|
|
@@ -37,14 +25,21 @@ async function main() {
|
|
|
37
25
|
fs.mkdirSync(bonzaiDir);
|
|
38
26
|
}
|
|
39
27
|
|
|
40
|
-
//
|
|
41
|
-
console.log('📝
|
|
42
|
-
|
|
28
|
+
// Write receiver.js to current directory (root level)
|
|
29
|
+
console.log('📝 Writing receiver.js...');
|
|
30
|
+
fs.writeFileSync(receiverPath, RECEIVER_JS_CONTENT);
|
|
43
31
|
|
|
44
|
-
// Make
|
|
45
|
-
const receiverPath = path.join(bonzaiDir, 'receiver.js');
|
|
32
|
+
// Make it executable
|
|
46
33
|
fs.chmodSync(receiverPath, '755');
|
|
47
34
|
|
|
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
|
+
|
|
48
43
|
console.log('📦 Installing dependencies...');
|
|
49
44
|
|
|
50
45
|
// Check if package.json exists in bonzai directory
|
|
@@ -58,7 +53,7 @@ async function main() {
|
|
|
58
53
|
name: "bonzai-server",
|
|
59
54
|
version: "1.0.0",
|
|
60
55
|
description: "Dependencies for devbonzai file server",
|
|
61
|
-
main: "receiver.js",
|
|
56
|
+
main: "../receiver.js",
|
|
62
57
|
scripts: {
|
|
63
58
|
test: "echo \"Error: no test specified\" && exit 1"
|
|
64
59
|
},
|