jvcs 1.1.4 → 1.1.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.
@@ -1,7 +1,7 @@
1
1
  const fs = require("fs")
2
2
  const path = require("path")
3
3
  const chalk = require("chalk")
4
- const { getDriveClient } = require("../config/drive-config");
4
+ const { getDriveClient } = require("../config/drive-config")
5
5
  const drive = getDriveClient()
6
6
  const { getGlobalConfig, checkGlobalConfig, checkforjvcs } = require("./utility")
7
7
  const getDirectoryStructure = require("./driveUtility")
@@ -39,25 +39,30 @@ function cleanCWD() {
39
39
  }
40
40
  }
41
41
 
42
- function getCommitsToDelete(commitFolder,currentCommit,targetCommit) {
43
-
44
- let toDelete = []
45
-
46
- while(currentCommit && currentCommit !== targetCommit) {
42
+ function buildCommitMap(commitFolder) {
47
43
 
48
- const commitPath = path.join(commitFolder,currentCommit)
49
- const metaPath = path.join(commitPath,"meta.json")
50
-
51
- if(!fs.existsSync(commitPath)) break
52
- toDelete.push(currentCommit)
53
-
54
- let parent = null
44
+ const map = {}
45
+ const dirs = fs.readdirSync(commitFolder)
46
+ for(const dir of dirs) {
47
+ const metaPath = path.join(commitFolder,dir,"meta.json")
55
48
  if(fs.existsSync(metaPath)) {
56
49
  const data = JSON.parse(fs.readFileSync(metaPath,"utf-8"))
57
- parent = data.parent || null
50
+ map[dir] = data.parent
58
51
  }
52
+ }
59
53
 
60
- currentCommit = parent
54
+ return map
55
+ }
56
+
57
+ function getCommitsToDelete(commitFolder,currentCommit,targetCommit) {
58
+
59
+ const commitMap = buildCommitMap(commitFolder)
60
+ console.log("Commit Map:", commitMap); // 👈 debug log
61
+ const toDelete = []
62
+
63
+ while(currentCommit && currentCommit !== targetCommit) {
64
+ toDelete.push(currentCommit)
65
+ currentCommit = commitMap[currentCommit] || null
61
66
  }
62
67
 
63
68
  return toDelete
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jvcs",
3
- "version": "1.1.4",
3
+ "version": "1.1.6",
4
4
  "bin": {
5
5
  "jvcs": "./index.js"
6
6
  },
package/.jvcs/HEAD DELETED
@@ -1 +0,0 @@
1
- 38954e15-be97-42ba-9f2a-385340973ddf
@@ -1,6 +0,0 @@
1
- {
2
- "package.json": {
3
- "hash": "df702008d62e5264f9bab745797686305122bbeb653770823df99b2ba766c6ba",
4
- "time": "2025-10-29T06:04:28.739Z"
5
- }
6
- }
@@ -1,7 +0,0 @@
1
- {
2
- "author": "jagdish",
3
- "id": "38954e15-be97-42ba-9f2a-385340973ddf",
4
- "message": "m1",
5
- "timeStamp": "2025-10-29T06:04:37.715Z",
6
- "parentId": null
7
- }
@@ -1,20 +0,0 @@
1
- {
2
- "name": "jvcs",
3
- "version": "1.1.0",
4
- "bin": {
5
- "jvcs": "./index.js"
6
- },
7
- "keywords": [],
8
- "author": "",
9
- "license": "ISC",
10
- "dependencies": {
11
- "chalk": "^4.1.2",
12
- "crypto": "^1.0.1",
13
- "dotenv": "^17.2.3",
14
- "googleapis": "^164.1.0",
15
- "inquirer": "^8.2.7",
16
- "uuid": "^13.0.0",
17
- "validator": "^13.15.20",
18
- "yargs": "^18.0.0"
19
- }
20
- }
package/.jvcs/config.json DELETED
@@ -1,9 +0,0 @@
1
- {
2
- "repoName": "backend2",
3
- "createdAt": "2025-10-29T06:04:12.977Z",
4
- "remote": null,
5
- "owner": {
6
- "username": "jagdish",
7
- "email": "pathakjijagdish1@gmail.com"
8
- }
9
- }
@@ -1,6 +0,0 @@
1
- {
2
- "package.json": {
3
- "hash": "df702008d62e5264f9bab745797686305122bbeb653770823df99b2ba766c6ba",
4
- "time": "2025-10-29T06:04:28.739Z"
5
- }
6
- }
@@ -1,20 +0,0 @@
1
- {
2
- "name": "jvcs",
3
- "version": "1.1.0",
4
- "bin": {
5
- "jvcs": "./index.js"
6
- },
7
- "keywords": [],
8
- "author": "",
9
- "license": "ISC",
10
- "dependencies": {
11
- "chalk": "^4.1.2",
12
- "crypto": "^1.0.1",
13
- "dotenv": "^17.2.3",
14
- "googleapis": "^164.1.0",
15
- "inquirer": "^8.2.7",
16
- "uuid": "^13.0.0",
17
- "validator": "^13.15.20",
18
- "yargs": "^18.0.0"
19
- }
20
- }