@naturalcycles/nodejs-lib 15.62.1 → 15.63.0

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.
@@ -20,6 +20,7 @@ declare class Git2 {
20
20
  getCurrentCommitTimestamp(): UnixTimestamp;
21
21
  getCurrentBranchName(): string;
22
22
  getCurrentRepoName(): string;
23
+ getAllBranchesNames(): string[];
23
24
  }
24
25
  export declare const git2: Git2;
25
26
  export {};
package/dist/util/git2.js CHANGED
@@ -86,5 +86,30 @@ class Git2 {
86
86
  const originUrl = exec2.exec('git config --get remote.origin.url');
87
87
  return basename(originUrl, '.git');
88
88
  }
89
+ getAllBranchesNames() {
90
+ /**
91
+ * Raw output example from this repository:
92
+ * $ git branch -r
93
+ * origin/DEV-22569-zod-isoDate-params
94
+ * origin/DEV-23052-git2-add-method
95
+ * origin/HEAD -> origin/main
96
+ * origin/add-requiredpick-type-helper
97
+ * origin/better-object-keys
98
+ * origin/feat/immutable-j-1
99
+ * origin/feat/immutable-j-2
100
+ * origin/feat/random-string-util
101
+ * origin/fix-vsc-red-line
102
+ * origin/generic-cachekey-function-2
103
+ * origin/gh-pages
104
+ * origin/main
105
+ * origin/stringify-or-undefined
106
+ */
107
+ return exec2
108
+ .exec('git branch -r')
109
+ .split('\n')
110
+ .map(s => s.trim())
111
+ .filter(s => !s.includes(' -> '))
112
+ .map(s => s.split('/')[1]);
113
+ }
89
114
  }
90
115
  export const git2 = new Git2();
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@naturalcycles/nodejs-lib",
3
3
  "type": "module",
4
- "version": "15.62.1",
4
+ "version": "15.63.0",
5
5
  "dependencies": {
6
6
  "@naturalcycles/js-lib": "^15",
7
7
  "@types/js-yaml": "^4",
package/src/util/git2.ts CHANGED
@@ -99,6 +99,32 @@ class Git2 {
99
99
  const originUrl = exec2.exec('git config --get remote.origin.url')
100
100
  return basename(originUrl, '.git')
101
101
  }
102
+
103
+ getAllBranchesNames(): string[] {
104
+ /**
105
+ * Raw output example from this repository:
106
+ * $ git branch -r
107
+ * origin/DEV-22569-zod-isoDate-params
108
+ * origin/DEV-23052-git2-add-method
109
+ * origin/HEAD -> origin/main
110
+ * origin/add-requiredpick-type-helper
111
+ * origin/better-object-keys
112
+ * origin/feat/immutable-j-1
113
+ * origin/feat/immutable-j-2
114
+ * origin/feat/random-string-util
115
+ * origin/fix-vsc-red-line
116
+ * origin/generic-cachekey-function-2
117
+ * origin/gh-pages
118
+ * origin/main
119
+ * origin/stringify-or-undefined
120
+ */
121
+ return exec2
122
+ .exec('git branch -r')
123
+ .split('\n')
124
+ .map(s => s.trim())
125
+ .filter(s => !s.includes(' -> '))
126
+ .map(s => s.split('/')[1]!)
127
+ }
102
128
  }
103
129
 
104
130
  export const git2 = new Git2()