thinkncollab-cli 0.0.35 → 0.0.37
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/Readme.md +1 -1
- package/bin/index.js +16 -5
- package/commands/whoami.js +19 -0
- package/package.json +1 -1
package/Readme.md
CHANGED
package/bin/index.js
CHANGED
|
@@ -9,6 +9,7 @@ import FormData from "form-data";
|
|
|
9
9
|
import projectInit from "../commands/init.js";
|
|
10
10
|
import Status from "../commands/status.js";
|
|
11
11
|
import pull from "../commands/pull.js";
|
|
12
|
+
import whoami from "../commands/whoami.js";
|
|
12
13
|
|
|
13
14
|
const RC_FILE = path.join(os.homedir(), ".tncrc");
|
|
14
15
|
const VERSION_FILE = path.join(process.cwd(), ".tncversions");
|
|
@@ -384,12 +385,18 @@ async function push(roomId, targetPath) {
|
|
|
384
385
|
};
|
|
385
386
|
flattenAndStore(uploadedTree);
|
|
386
387
|
saveVersions(newVersionMap);
|
|
388
|
+
|
|
389
|
+
// Determine latest version number from uploaded files
|
|
390
|
+
const versionNumbers = Object.values(newVersionMap).map(f => f.version || 1);
|
|
391
|
+
const latestVersion = versionNumbers.length > 0 ? Math.max(...versionNumbers) : 1;
|
|
392
|
+
|
|
387
393
|
const newPushRecord = {
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
394
|
+
version: latestVersion,
|
|
395
|
+
pushedAt: new Date().toISOString(),
|
|
396
|
+
roomId: roomId,
|
|
397
|
+
pushedBy: email,
|
|
398
|
+
projectId: projectId
|
|
399
|
+
};
|
|
393
400
|
|
|
394
401
|
|
|
395
402
|
|
|
@@ -458,6 +465,10 @@ async function main() {
|
|
|
458
465
|
await pull(roomId, version);
|
|
459
466
|
break;
|
|
460
467
|
}
|
|
468
|
+
|
|
469
|
+
case "whoami":
|
|
470
|
+
await whoami();
|
|
471
|
+
break;
|
|
461
472
|
|
|
462
473
|
default:
|
|
463
474
|
console.log("✅ TNC CLI ready!");
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import fs from "fs";
|
|
2
|
+
import os from "os";
|
|
3
|
+
import path from "path";
|
|
4
|
+
|
|
5
|
+
const RC_FILE = path.join(os.homedir(), ".tncrc");
|
|
6
|
+
|
|
7
|
+
async function whoami() {
|
|
8
|
+
try{
|
|
9
|
+
if(fs.existsSync(RC_FILE)) {
|
|
10
|
+
const rcData = fs.readFileSync(RC_FILE, "utf-8");
|
|
11
|
+
const {email} = JSON.parse(rcData);
|
|
12
|
+
console.log('You are logged in by the email:', email);
|
|
13
|
+
}
|
|
14
|
+
} catch (error) {
|
|
15
|
+
console.error('Error reading .tncrc file:', error);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export default whoami;
|