@naturalcycles/backend-lib 7.1.0 → 7.1.1

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,14 +1,12 @@
1
1
  #!/usr/bin/env node
2
2
  "use strict";
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- const tslib_1 = require("tslib");
5
4
  const nodejs_lib_1 = require("@naturalcycles/nodejs-lib");
6
- const yargs_1 = tslib_1.__importDefault(require("yargs"));
7
5
  const deployGae_1 = require("../deploy/deployGae");
8
6
  const deployHealthCheck_1 = require("../deploy/deployHealthCheck");
9
7
  const deployPrepare_1 = require("../deploy/deployPrepare");
10
8
  (0, nodejs_lib_1.runScript)(async () => {
11
- const opt = yargs_1.default.options({
9
+ const opt = (0, nodejs_lib_1._yargs)().options({
12
10
  ...deployPrepare_1.deployPrepareYargsOptions,
13
11
  ...deployHealthCheck_1.deployHealthCheckYargsOptions,
14
12
  }).argv;
@@ -9,12 +9,10 @@ yarn deploy-health-check --url https://service-dot-yourproject.appspot.com
9
9
 
10
10
  */
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- const tslib_1 = require("tslib");
13
12
  const nodejs_lib_1 = require("@naturalcycles/nodejs-lib");
14
- const yargs_1 = tslib_1.__importDefault(require("yargs"));
15
13
  const deployHealthCheck_1 = require("../deploy/deployHealthCheck");
16
14
  (0, nodejs_lib_1.runScript)(async () => {
17
- const { url, ...opt } = yargs_1.default.options({
15
+ const { url, ...opt } = (0, nodejs_lib_1._yargs)().options({
18
16
  ...deployHealthCheck_1.deployHealthCheckYargsOptions,
19
17
  url: {
20
18
  type: 'string',
@@ -6,12 +6,10 @@ yarn deploy-prepare
6
6
 
7
7
  */
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
- const tslib_1 = require("tslib");
10
9
  const nodejs_lib_1 = require("@naturalcycles/nodejs-lib");
11
- const yargs_1 = tslib_1.__importDefault(require("yargs"));
12
10
  const deployPrepare_1 = require("../deploy/deployPrepare");
13
11
  (0, nodejs_lib_1.runScript)(async () => {
14
- const opt = yargs_1.default.options(deployPrepare_1.deployPrepareYargsOptions).argv;
12
+ const opt = (0, nodejs_lib_1._yargs)().options(deployPrepare_1.deployPrepareYargsOptions).argv;
15
13
  await (0, deployPrepare_1.deployPrepare)(opt);
16
14
  });
17
15
  // deploy strategy
@@ -1,12 +1,10 @@
1
1
  #!/usr/bin/env node
2
2
  "use strict";
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- const tslib_1 = require("tslib");
5
4
  const nodejs_lib_1 = require("@naturalcycles/nodejs-lib");
6
- const yargs_1 = tslib_1.__importDefault(require("yargs"));
7
5
  const deployGae_1 = require("../deploy/deployGae");
8
6
  (0, nodejs_lib_1.runScript)(async () => {
9
- const { branch } = yargs_1.default.options({
7
+ const { branch } = (0, nodejs_lib_1._yargs)().options({
10
8
  branch: {
11
9
  type: 'string',
12
10
  demandOption: true,
@@ -60,7 +60,7 @@ function logMiddleware() {
60
60
  if (isCloudRun) {
61
61
  // Cloud Run, return simple logger, similar to CI logger
62
62
  return function cloudRunLogHandler(req, _res, next) {
63
- req.log = req.warn = req.error = logToCI;
63
+ req.log = req.warn = req.error = (...args) => logToCI(args);
64
64
  next();
65
65
  };
66
66
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@naturalcycles/backend-lib",
3
- "version": "7.1.0",
3
+ "version": "7.1.1",
4
4
  "scripts": {
5
5
  "prepare": "husky",
6
6
  "build": "dev-lib build",
@@ -11,11 +11,11 @@
11
11
  "dev": "APP_ENV=dev node -r ts-node/register --watch ./src/test/server/server.ts",
12
12
  "docs-serve": "NODE_OPTIONS=--openssl-legacy-provider vuepress dev docs",
13
13
  "docs-build": "NODE_OPTIONS=--openssl-legacy-provider vuepress build docs",
14
- "deploy-gae": "yarn tsn ./src/bin/deploy-gae.ts",
15
- "deploy-prepare": "yarn tsn ./src/bin/deploy-prepare.ts",
16
- "deploy-prepare-debug": "AA=AA1 BB=BB1 yarn tsn ./src/bin/deploy-prepare.ts --projectDir ./src/test/project",
17
- "deploy-health-check-debug1": "yarn tsn ./src/bin/deploy-health-check.ts --url https://api-master.naturalcycles.com",
18
- "deploy-health-check-debug2": "yarn tsn ./src/bin/deploy-health-check.ts --url https://api-master2.naturalcycles.com --thresholdUnhealthy 5"
14
+ "deploy-gae": "yarn tsx ./src/bin/deploy-gae.ts",
15
+ "deploy-prepare": "yarn tsx ./src/bin/deploy-prepare.ts",
16
+ "deploy-prepare-debug": "AA=AA1 BB=BB1 yarn tsx ./src/bin/deploy-prepare.ts --projectDir ./src/test/project",
17
+ "deploy-health-check-debug1": "yarn tsx ./src/bin/deploy-health-check.ts --url https://api-master.naturalcycles.com",
18
+ "deploy-health-check-debug2": "yarn tsx ./src/bin/deploy-health-check.ts --url https://api-master2.naturalcycles.com --thresholdUnhealthy 5"
19
19
  },
20
20
  "peerDependencies": {
21
21
  "@sentry/node": "^9"
@@ -37,8 +37,7 @@
37
37
  "firebase-admin": "^13",
38
38
  "helmet": "^8",
39
39
  "on-finished": "^2",
40
- "simple-git": "^3",
41
- "yargs": "^17"
40
+ "simple-git": "^3"
42
41
  },
43
42
  "devDependencies": {
44
43
  "@naturalcycles/bench-lib": "^3",
@@ -46,9 +45,9 @@
46
45
  "@sentry/node": "^9",
47
46
  "@types/ejs": "^3",
48
47
  "@types/node": "^22",
49
- "@types/yargs": "^16",
50
48
  "@vitest/coverage-v8": "^3",
51
49
  "fastify": "^5",
50
+ "tsx": "^4",
52
51
  "vitest": "^3"
53
52
  },
54
53
  "files": [
@@ -1,13 +1,12 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import { runScript } from '@naturalcycles/nodejs-lib'
4
- import yargs from 'yargs'
3
+ import { _yargs, runScript } from '@naturalcycles/nodejs-lib'
5
4
  import { deployGae } from '../deploy/deployGae'
6
5
  import { deployHealthCheckYargsOptions } from '../deploy/deployHealthCheck'
7
6
  import { deployPrepareYargsOptions } from '../deploy/deployPrepare'
8
7
 
9
8
  runScript(async () => {
10
- const opt = yargs.options({
9
+ const opt = _yargs().options({
11
10
  ...deployPrepareYargsOptions,
12
11
  ...deployHealthCheckYargsOptions,
13
12
  }).argv
@@ -9,12 +9,11 @@ yarn deploy-health-check --url https://service-dot-yourproject.appspot.com
9
9
 
10
10
  */
11
11
 
12
- import { runScript } from '@naturalcycles/nodejs-lib'
13
- import yargs from 'yargs'
12
+ import { _yargs, runScript } from '@naturalcycles/nodejs-lib'
14
13
  import { deployHealthCheck, deployHealthCheckYargsOptions } from '../deploy/deployHealthCheck'
15
14
 
16
15
  runScript(async () => {
17
- const { url, ...opt } = yargs.options({
16
+ const { url, ...opt } = _yargs().options({
18
17
  ...deployHealthCheckYargsOptions,
19
18
  url: {
20
19
  type: 'string',
@@ -6,12 +6,11 @@ yarn deploy-prepare
6
6
 
7
7
  */
8
8
 
9
- import { runScript } from '@naturalcycles/nodejs-lib'
10
- import yargs from 'yargs'
9
+ import { _yargs, runScript } from '@naturalcycles/nodejs-lib'
11
10
  import { deployPrepare, deployPrepareYargsOptions } from '../deploy/deployPrepare'
12
11
 
13
12
  runScript(async () => {
14
- const opt = yargs.options(deployPrepareYargsOptions).argv
13
+ const opt = _yargs().options(deployPrepareYargsOptions).argv
15
14
 
16
15
  await deployPrepare(opt)
17
16
  })
@@ -1,11 +1,10 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import { runScript } from '@naturalcycles/nodejs-lib'
4
- import yargs from 'yargs'
3
+ import { _yargs, runScript } from '@naturalcycles/nodejs-lib'
5
4
  import { undeployGae } from '../deploy/deployGae'
6
5
 
7
6
  runScript(async () => {
8
- const { branch } = yargs.options({
7
+ const { branch } = _yargs().options({
9
8
  branch: {
10
9
  type: 'string',
11
10
  demandOption: true,
@@ -71,7 +71,7 @@ export function logMiddleware(): BackendRequestHandler {
71
71
  if (isCloudRun) {
72
72
  // Cloud Run, return simple logger, similar to CI logger
73
73
  return function cloudRunLogHandler(req, _res, next) {
74
- req.log = req.warn = req.error = logToCI
74
+ req.log = req.warn = req.error = (...args: any[]) => logToCI(args)
75
75
  next()
76
76
  }
77
77
  }