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.
- package/codehub-ghx-cli-1.0.6.tgz +0 -0
- package/commands/push.js +27 -8
- package/package.json +1 -1
|
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
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
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
|
|