codehub-ghx-cli 1.0.5 → 1.0.6

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.
Binary file
package/commands/push.js CHANGED
@@ -20,7 +20,7 @@ require('dotenv').config;
20
20
 
21
21
 
22
22
 
23
- async function uploadRecursive(localPath, baseDir, commitId, collectedFiles) {
23
+ async function uploadRecursive(localPath, baseDir, commitId, collectedFiles, repoId) {
24
24
 
25
25
  const relative = path.relative(baseDir, localPath).replace(/\\/g, "/");
26
26
 
@@ -55,12 +55,31 @@ async function uploadRecursive(localPath, baseDir, commitId, collectedFiles) {
55
55
  const fileIdPath = cleanPath;
56
56
  const fileContent = await fs.readFile(localPath);
57
57
 
58
-
59
- await s3.upload({
60
- Bucket: s3_BUCKET,
61
- Key: s3Key,
62
- Body: fileContent
63
- }).promise();
58
+
59
+
60
+ const fileBase64 = fileContent.toString("base64");
61
+
62
+ await axios.post(
63
+ "https://codehub-backend-jj4b.onrender.com/push/upload",
64
+ {
65
+ repoId, // ✅ use actual repoId
66
+ s3Key,
67
+ content: fileBase64,
68
+ filename: path.basename(localPath),
69
+ folder: path.dirname(relative).replace(/\\/g, "/") === "." ? "" : path.dirname(relative).replace(/\\/g, "/"),
70
+ isFolder: false
71
+ }
72
+ );
73
+
74
+
75
+
76
+
77
+
78
+ // await s3.upload({
79
+ // Bucket: s3_BUCKET,
80
+ // Key: s3Key,
81
+ // Body: fileContent
82
+ // }).promise();
64
83
 
65
84
  const filename = path.basename(localPath);
66
85
  const folder = path.dirname(relative).replace(/\\/g, "/");
@@ -142,7 +161,7 @@ async function pushRepo() {
142
161
  commitFolder,
143
162
  commitFolder,
144
163
  commitId,
145
- newFiles
164
+ newFiles,repoId,
146
165
  );
147
166
  }
148
167
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codehub-ghx-cli",
3
- "version": "1.0.5",
3
+ "version": "1.0.6",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "bin": {