@naturalcycles/dev-lib 13.27.0 → 13.28.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.
- package/dist/bin/commitlint-def.js +4 -1
- package/dist/cmd/generate-build-info.command.d.ts +1 -1
- package/dist/cmd/generate-build-info.command.js +1 -1
- package/dist/index.d.ts +1 -2
- package/dist/index.js +1 -0
- package/dist/util/buildInfo.model.d.ts +15 -5
- package/dist/util/buildInfo.util.d.ts +2 -1
- package/dist/util/buildInfo.util.js +29 -6
- package/package.json +1 -1
|
@@ -11,7 +11,10 @@ const cwd = process.cwd();
|
|
|
11
11
|
const localConfig = `${cwd}/commitlint.config.js`;
|
|
12
12
|
const sharedConfig = `${paths_cnst_1.cfgDir}/commitlint.config.js`;
|
|
13
13
|
const config = fs.existsSync(localConfig) ? localConfig : sharedConfig;
|
|
14
|
-
const env = {
|
|
14
|
+
const env = {
|
|
15
|
+
...process.env,
|
|
16
|
+
GIT_BRANCH: (0, git_util_1.gitCurrentBranchName)(),
|
|
17
|
+
};
|
|
15
18
|
// await execWithArgs(`commitlint`, [`--edit`, editMsg, `--config`, config], { env })
|
|
16
19
|
execSync(`node ./node_modules/.bin/commitlint --edit ${editMsg} --config ${config}`, {
|
|
17
20
|
env,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function generateBuildInfoCommand():
|
|
1
|
+
export declare function generateBuildInfoCommand(): void;
|
|
@@ -5,7 +5,7 @@ const fs = require("node:fs");
|
|
|
5
5
|
const path = require("node:path");
|
|
6
6
|
const yargs = require("yargs");
|
|
7
7
|
const __1 = require("..");
|
|
8
|
-
|
|
8
|
+
function generateBuildInfoCommand() {
|
|
9
9
|
const { dir } = yargs.options({
|
|
10
10
|
dir: {
|
|
11
11
|
type: 'string',
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -2,5 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
tslib_1.__exportStar(require("./cmd/build-prod.command"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./util/buildInfo.model"), exports);
|
|
5
6
|
tslib_1.__exportStar(require("./util/buildInfo.util"), exports);
|
|
6
7
|
tslib_1.__exportStar(require("./util/git.util"), exports);
|
|
@@ -1,5 +1,13 @@
|
|
|
1
|
+
import { UnixTimestampNumber } from '@naturalcycles/js-lib';
|
|
1
2
|
export interface BuildInfo {
|
|
2
|
-
|
|
3
|
+
/**
|
|
4
|
+
* Unix timestamp of when the build was made.
|
|
5
|
+
*/
|
|
6
|
+
ts: UnixTimestampNumber;
|
|
7
|
+
/**
|
|
8
|
+
* Unix timestamp of commit ("committer date", not "author date")
|
|
9
|
+
*/
|
|
10
|
+
tsCommit: UnixTimestampNumber;
|
|
3
11
|
/**
|
|
4
12
|
* Human-readable time of the build. E.g:
|
|
5
13
|
* 2019-06-21 18:35:19
|
|
@@ -11,10 +19,6 @@ export interface BuildInfo {
|
|
|
11
19
|
* GIT sha revision (first 7 characters)
|
|
12
20
|
*/
|
|
13
21
|
rev: string;
|
|
14
|
-
/**
|
|
15
|
-
* Unix timestamp of commit ("committer date", not "author date")
|
|
16
|
-
*/
|
|
17
|
-
tsCommit: number;
|
|
18
22
|
/**
|
|
19
23
|
* "Version string" in the following format:
|
|
20
24
|
* yyyyMMdd_HHmm_$repoName_$branch_$rev
|
|
@@ -27,4 +31,10 @@ export interface BuildInfo {
|
|
|
27
31
|
* Build during development.
|
|
28
32
|
*/
|
|
29
33
|
dev?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Build "environment".
|
|
36
|
+
* Normally taken from process.env.APP_ENV
|
|
37
|
+
* Can be undefined.
|
|
38
|
+
*/
|
|
39
|
+
env?: string;
|
|
30
40
|
}
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.generateBuildInfo = void 0;
|
|
3
|
+
exports.generateBuildInfoDev = exports.generateBuildInfo = void 0;
|
|
4
4
|
const js_lib_1 = require("@naturalcycles/js-lib");
|
|
5
5
|
const git_util_1 = require("./git.util");
|
|
6
|
-
function generateBuildInfo(
|
|
6
|
+
function generateBuildInfo() {
|
|
7
|
+
const { APP_ENV } = process.env;
|
|
7
8
|
const now = (0, js_lib_1.localTime)();
|
|
8
9
|
const ts = now.unix();
|
|
9
10
|
const tsStr = now.toPretty();
|
|
10
|
-
const rev =
|
|
11
|
-
const branchName =
|
|
12
|
-
const repoName =
|
|
13
|
-
const tsCommit =
|
|
11
|
+
const rev = (0, git_util_1.gitCurrentCommitSha)();
|
|
12
|
+
const branchName = (0, git_util_1.gitCurrentBranchName)();
|
|
13
|
+
const repoName = (0, git_util_1.gitCurrentRepoName)();
|
|
14
|
+
const tsCommit = (0, git_util_1.gitCurrentCommitTimestamp)();
|
|
14
15
|
const ver = [now.toStringCompact(), repoName, branchName, rev].join('_');
|
|
15
16
|
return {
|
|
16
17
|
ts,
|
|
@@ -20,6 +21,28 @@ function generateBuildInfo(dev = false) {
|
|
|
20
21
|
branchName,
|
|
21
22
|
rev,
|
|
22
23
|
ver,
|
|
24
|
+
env: APP_ENV,
|
|
23
25
|
};
|
|
24
26
|
}
|
|
25
27
|
exports.generateBuildInfo = generateBuildInfo;
|
|
28
|
+
function generateBuildInfoDev() {
|
|
29
|
+
const now = (0, js_lib_1.localTime)();
|
|
30
|
+
const ts = now.unix();
|
|
31
|
+
const tsStr = now.toPretty();
|
|
32
|
+
const rev = 'devRev';
|
|
33
|
+
const branchName = 'devBranch';
|
|
34
|
+
const repoName = 'devRepo';
|
|
35
|
+
const tsCommit = now.unix();
|
|
36
|
+
const ver = [now.toStringCompact(), repoName, branchName, rev].join('_');
|
|
37
|
+
return {
|
|
38
|
+
ts,
|
|
39
|
+
tsCommit,
|
|
40
|
+
tsStr,
|
|
41
|
+
repoName,
|
|
42
|
+
branchName,
|
|
43
|
+
rev,
|
|
44
|
+
ver,
|
|
45
|
+
env: 'dev',
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
exports.generateBuildInfoDev = generateBuildInfoDev;
|