@naturalcycles/nodejs-lib 13.40.0 → 13.41.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.
@@ -4,5 +4,9 @@ export interface GenerateBuildInfoOptions {
4
4
  * If set - this timestamp will be used, instead of "current time".
5
5
  */
6
6
  overrideTimestamp?: UnixTimestamp;
7
+ /**
8
+ * Defaults to currently checked out git branch.
9
+ */
10
+ overrideBranchName?: string;
7
11
  }
8
12
  export declare function generateBuildInfo(opt?: GenerateBuildInfoOptions): BuildInfo;
@@ -8,7 +8,7 @@ function generateBuildInfo(opt = {}) {
8
8
  const now = js_lib_1.localTime.orNow(opt.overrideTimestamp);
9
9
  const ts = now.unix;
10
10
  const rev = git2_1.git2.getCurrentCommitSha();
11
- const branchName = git2_1.git2.getCurrentBranchName();
11
+ const branchName = opt.overrideBranchName || git2_1.git2.getCurrentBranchName();
12
12
  const repoName = git2_1.git2.getCurrentRepoName();
13
13
  const tsCommit = git2_1.git2.getCurrentCommitTimestamp();
14
14
  const ver = [now.toStringCompact(), repoName, branchName, rev].join('_');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@naturalcycles/nodejs-lib",
3
- "version": "13.40.0",
3
+ "version": "13.41.0",
4
4
  "scripts": {
5
5
  "prepare": "husky",
6
6
  "build": "dev-lib build",
@@ -13,6 +13,11 @@ export interface GenerateBuildInfoOptions {
13
13
  * If set - this timestamp will be used, instead of "current time".
14
14
  */
15
15
  overrideTimestamp?: UnixTimestamp
16
+
17
+ /**
18
+ * Defaults to currently checked out git branch.
19
+ */
20
+ overrideBranchName?: string
16
21
  }
17
22
 
18
23
  export function generateBuildInfo(opt: GenerateBuildInfoOptions = {}): BuildInfo {
@@ -20,7 +25,7 @@ export function generateBuildInfo(opt: GenerateBuildInfoOptions = {}): BuildInfo
20
25
  const ts = now.unix
21
26
 
22
27
  const rev = git2.getCurrentCommitSha()
23
- const branchName = git2.getCurrentBranchName()
28
+ const branchName = opt.overrideBranchName || git2.getCurrentBranchName()
24
29
  const repoName = git2.getCurrentRepoName()
25
30
  const tsCommit = git2.getCurrentCommitTimestamp()
26
31