ihub-cli 1.0.4 → 1.1.5

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.
Files changed (2) hide show
  1. package/index.js +31 -8
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -16,7 +16,7 @@ const FILE_TO_STORE_LOGIN = path.join(IHUB_DIR, "login.txt");
16
16
 
17
17
 
18
18
 
19
- async function UpdateRepo(folder,cid,pinata) {
19
+ async function UpdateRepo(cid,pinata) {
20
20
 
21
21
 
22
22
  const result = await pinata.gateways.public.get(cid)
@@ -32,15 +32,38 @@ async function UpdateRepo(folder,cid,pinata) {
32
32
 
33
33
  fs.writeFileSync(`${bpath}`,buffer);
34
34
 
35
- const absolutePath = path.resolve(folder);
35
+ //const absolutePath = path.resolve(folder);
36
+ const absoluteBundlePath = path.resolve(bpath);
36
37
 
37
- execSync(`git pull ${bpath} ${absolutePath}`, {
38
- cwd: ".",
38
+ execSync(`git fetch ${absoluteBundlePath} refs/heads/*:refs/remotes/bundle/*`, {
39
+ cwd: `.`,
39
40
  stdio: 'inherit'
40
41
  });
42
+
43
+ const currentBranch = execSync(
44
+ `git branch --show-current`,
45
+ {
46
+ cwd: '.',
47
+ encoding: 'utf8',
48
+ shell: true
49
+ }
50
+ ).trim();
51
+
52
+ const bundleBranch = `bundle/${currentBranch}`;
53
+
54
+ console.log(`🔀 Merging ${bundleBranch} → ${currentBranch}`);
55
+ execSync(
56
+ `git merge ${bundleBranch} --allow-unrelated-histories --no-edit`,
57
+ {
58
+ cwd: '.',
59
+ stdio: 'inherit',
60
+ shell: true
61
+ }
62
+ );
63
+
41
64
  console.log("pulled successfully")
42
65
 
43
- }
66
+ }
44
67
 
45
68
 
46
69
 
@@ -85,7 +108,7 @@ async function Pull(folder,pinata,client){
85
108
 
86
109
  }}
87
110
 
88
- await UpdateRepo(folder,bundle,pinata)
111
+ await UpdateRepo(bundle,pinata)
89
112
 
90
113
  }}
91
114
 
@@ -482,7 +505,7 @@ yargs(hideBin(process.argv))
482
505
  console.log('Push operation finished.');
483
506
 
484
507
  }catch(e){
485
- console.log(str(e))
508
+ console.log(String(e))
486
509
  }finally{
487
510
  await client.close()
488
511
  }
@@ -509,7 +532,7 @@ yargs(hideBin(process.argv))
509
532
 
510
533
 
511
534
  }catch(e){
512
- console.log(str(e))
535
+ console.log(String(e))
513
536
  }finally{
514
537
  await client.close()
515
538
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ihub-cli",
3
- "version": "1.0.4",
3
+ "version": "1.1.5",
4
4
  "description": "immutablehub cli to push and clone repos",
5
5
  "main": "index.js",
6
6
  "type": "module",