@naturalcycles/backend-lib 4.19.1 → 4.19.2
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,3 +1,4 @@
|
|
|
1
|
+
import { UnixTimestampNumber } from '@naturalcycles/js-lib';
|
|
1
2
|
export interface DeployInfo {
|
|
2
3
|
gaeProject: string;
|
|
3
4
|
gaeService: string;
|
|
@@ -10,7 +11,7 @@ export interface DeployInfo {
|
|
|
10
11
|
/**
|
|
11
12
|
* Unix timestamp of deployInfo.json being generated.
|
|
12
13
|
*/
|
|
13
|
-
ts:
|
|
14
|
+
ts: UnixTimestampNumber;
|
|
14
15
|
}
|
|
15
16
|
export interface AppYaml extends Record<string, any> {
|
|
16
17
|
runtime: string;
|
|
@@ -35,7 +35,7 @@ exports.createAndSaveDeployInfo = createAndSaveDeployInfo;
|
|
|
35
35
|
async function createDeployInfo(backendCfg) {
|
|
36
36
|
const simpleGit = require('simple-git'); // lazy load
|
|
37
37
|
const git = simpleGit('.');
|
|
38
|
-
const now = (0, js_lib_1.
|
|
38
|
+
const now = (0, js_lib_1.localTimeNow)();
|
|
39
39
|
const gitBranch = (await git.status()).current;
|
|
40
40
|
const gitRev = (await git.revparse(['HEAD'])).slice(0, 7);
|
|
41
41
|
let { gaeProject, gaeProjectByBranch = {}, gaeService, gaeServiceByBranch = {}, serviceWithBranchName, prodBranch, branchesWithTimestampVersions = [], } = backendCfg;
|
|
@@ -37,6 +37,6 @@ function getServerStatusData(projectDir = process.cwd(), extra) {
|
|
|
37
37
|
}
|
|
38
38
|
exports.getServerStatusData = getServerStatusData;
|
|
39
39
|
function getStartedStr() {
|
|
40
|
-
const started = (0, js_lib_1.
|
|
40
|
+
const started = (0, js_lib_1.localTimeNow)().subtract(process.uptime(), 'second');
|
|
41
41
|
return `${started.toPretty()} (${started.fromNow()})`;
|
|
42
42
|
}
|
package/package.json
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { UnixTimestampNumber } from '@naturalcycles/js-lib'
|
|
2
|
+
|
|
1
3
|
export interface DeployInfo {
|
|
2
4
|
gaeProject: string
|
|
3
5
|
gaeService: string
|
|
@@ -11,7 +13,7 @@ export interface DeployInfo {
|
|
|
11
13
|
/**
|
|
12
14
|
* Unix timestamp of deployInfo.json being generated.
|
|
13
15
|
*/
|
|
14
|
-
ts:
|
|
16
|
+
ts: UnixTimestampNumber
|
|
15
17
|
}
|
|
16
18
|
|
|
17
19
|
export interface AppYaml extends Record<string, any> {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import fs from 'node:fs'
|
|
2
|
-
import { _mapValues, _merge, _truncate,
|
|
2
|
+
import { _mapValues, _merge, _truncate, localTimeNow } from '@naturalcycles/js-lib'
|
|
3
3
|
import { dimGrey, white } from '@naturalcycles/nodejs-lib'
|
|
4
4
|
import yaml from 'js-yaml'
|
|
5
5
|
import { BackendCfg } from './backend.cfg.util'
|
|
@@ -42,7 +42,7 @@ export async function createDeployInfo(backendCfg: BackendCfg): Promise<DeployIn
|
|
|
42
42
|
const simpleGit = require('simple-git') // lazy load
|
|
43
43
|
const git = simpleGit('.')
|
|
44
44
|
|
|
45
|
-
const now =
|
|
45
|
+
const now = localTimeNow()
|
|
46
46
|
const gitBranch = (await git.status()).current!
|
|
47
47
|
const gitRev = (await git.revparse(['HEAD'])).slice(0, 7)
|
|
48
48
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _filterNullishValues, localTime } from '@naturalcycles/js-lib'
|
|
1
|
+
import { _filterNullishValues, localTime, localTimeNow } from '@naturalcycles/js-lib'
|
|
2
2
|
import { memoryUsageFull, processSharedUtil } from '@naturalcycles/nodejs-lib'
|
|
3
3
|
import { getDeployInfo } from './deployInfo.util'
|
|
4
4
|
import { BackendRequestHandler } from './server.model'
|
|
@@ -41,6 +41,6 @@ export function getServerStatusData(
|
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
function getStartedStr(): string {
|
|
44
|
-
const started =
|
|
44
|
+
const started = localTimeNow().subtract(process.uptime(), 'second')
|
|
45
45
|
return `${started.toPretty()} (${started.fromNow()})`
|
|
46
46
|
}
|