thinkncollab-cli 0.0.33 → 0.0.35
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/bin/index.js +14 -0
- package/commands/init.js +5 -0
- package/commands/pull.js +14 -24
- package/package.json +1 -1
package/bin/index.js
CHANGED
|
@@ -384,6 +384,20 @@ async function push(roomId, targetPath) {
|
|
|
384
384
|
};
|
|
385
385
|
flattenAndStore(uploadedTree);
|
|
386
386
|
saveVersions(newVersionMap);
|
|
387
|
+
const newPushRecord = {
|
|
388
|
+
version: item.version || 1,
|
|
389
|
+
pushedAt: new Date().toISOString(),
|
|
390
|
+
roomId: roomId,
|
|
391
|
+
pushedBy: email,
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
|
|
395
|
+
|
|
396
|
+
const pushFilePath = path.join(CWD, ".tnc", ".tncpush.json");
|
|
397
|
+
fs.writeFileSync(
|
|
398
|
+
pushFilePath,
|
|
399
|
+
JSON.stringify(newPushRecord, null, 2)
|
|
400
|
+
);
|
|
387
401
|
|
|
388
402
|
console.log(`💾 Saved ${Object.keys(newVersionMap).length} files to .tncversions`);
|
|
389
403
|
|
package/commands/init.js
CHANGED
|
@@ -36,6 +36,7 @@ async function projectInit() {
|
|
|
36
36
|
|
|
37
37
|
// Write metadata file
|
|
38
38
|
const metaFilePath = path.join(tncFolderPath, ".tncmeta.json");
|
|
39
|
+
const pushFilePath = path.join(tncFolderPath, ".tncpush.json");
|
|
39
40
|
fs.writeFileSync(
|
|
40
41
|
metaFilePath,
|
|
41
42
|
JSON.stringify(
|
|
@@ -50,6 +51,10 @@ async function projectInit() {
|
|
|
50
51
|
2
|
|
51
52
|
)
|
|
52
53
|
);
|
|
54
|
+
fs.writeFileSync(
|
|
55
|
+
pushFilePath,
|
|
56
|
+
" {} "
|
|
57
|
+
)
|
|
53
58
|
|
|
54
59
|
console.log("✅ Project initialized successfully!");
|
|
55
60
|
}
|
package/commands/pull.js
CHANGED
|
@@ -54,33 +54,26 @@ async function processFolderContent(content, basePath = "") {
|
|
|
54
54
|
let errorCount = 0;
|
|
55
55
|
|
|
56
56
|
for (const item of content) {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
skippedCount++;
|
|
57
|
+
// Skip folders entirely - only process files
|
|
58
|
+
if (item.type === "folder" && item.children) {
|
|
59
|
+
const result = await processFolderContent(item.children, basePath);
|
|
60
|
+
downloadedCount += result.downloadedCount;
|
|
61
|
+
skippedCount += result.skippedCount;
|
|
62
|
+
errorCount += result.errorCount;
|
|
64
63
|
continue;
|
|
65
64
|
}
|
|
66
65
|
|
|
67
|
-
//
|
|
68
|
-
if (item.type === "
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
errorCount += result.errorCount;
|
|
66
|
+
// Only process files
|
|
67
|
+
if (item.type === "file" && item.url) {
|
|
68
|
+
const itemPath = path.join(basePath, item.path);
|
|
69
|
+
|
|
70
|
+
// Skip .tnc files
|
|
71
|
+
if (itemPath.includes('.tnc')) {
|
|
72
|
+
skippedCount++;
|
|
73
|
+
continue;
|
|
76
74
|
}
|
|
77
|
-
continue; // Skip the folder itself
|
|
78
|
-
}
|
|
79
75
|
|
|
80
|
-
// ✅ ONLY FILE PROCESSING LOGIC
|
|
81
|
-
if (item.type === "file" && item.url) {
|
|
82
76
|
try {
|
|
83
|
-
// downloadFile will create necessary directories automatically
|
|
84
77
|
if (fs.existsSync(itemPath)) {
|
|
85
78
|
const existingStats = fs.statSync(itemPath);
|
|
86
79
|
if (existingStats.size === item.size) {
|
|
@@ -98,9 +91,6 @@ async function processFolderContent(content, basePath = "") {
|
|
|
98
91
|
console.error(chalk.red(`❌ Failed to download ${itemPath}: ${err.message}`));
|
|
99
92
|
errorCount++;
|
|
100
93
|
}
|
|
101
|
-
} else if (item.type === "file" && !item.url) {
|
|
102
|
-
console.log(chalk.magenta(`⚠️ No URL available for: ${itemPath}`));
|
|
103
|
-
skippedCount++;
|
|
104
94
|
}
|
|
105
95
|
}
|
|
106
96
|
|