@naturalcycles/backend-lib 9.0.7 → 9.0.8
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/deploy/deployGae.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { _anyToError, _objectAssign, pRetry } from '@naturalcycles/js-lib';
|
|
2
|
-
import { appendToGithubSummary, exec2 } from '@naturalcycles/nodejs-lib';
|
|
2
|
+
import { appendToGithubSummary, exec2, fs2 } from '@naturalcycles/nodejs-lib';
|
|
3
3
|
import { getBackendCfg } from './backend.cfg.util.js';
|
|
4
4
|
import { createDeployInfo } from './deploy.util.js';
|
|
5
5
|
import { deployHealthCheck } from './deployHealthCheck.js';
|
|
@@ -7,7 +7,8 @@ import { deployPrepare } from './deployPrepare.js';
|
|
|
7
7
|
export async function deployGae(opt = {}) {
|
|
8
8
|
const { logOnFailure, logOnSuccess } = opt;
|
|
9
9
|
// 1. build
|
|
10
|
-
|
|
10
|
+
const packageManager = detectPackageManager();
|
|
11
|
+
exec2.spawn(`${packageManager} build`);
|
|
11
12
|
// 2. deploy-prepare
|
|
12
13
|
const deployInfo = await deployPrepare();
|
|
13
14
|
const targetDir = './tmp/deploy';
|
|
@@ -76,3 +77,10 @@ function logs(gaeProject, gaeService, gaeVersion) {
|
|
|
76
77
|
}
|
|
77
78
|
catch { }
|
|
78
79
|
}
|
|
80
|
+
function detectPackageManager() {
|
|
81
|
+
const pj = fs2.readText('package.json');
|
|
82
|
+
if (pj.includes('pnpm')) {
|
|
83
|
+
return 'pnpm';
|
|
84
|
+
}
|
|
85
|
+
return 'yarn'; // yarn is still the default
|
|
86
|
+
}
|
|
@@ -39,8 +39,9 @@ const DEFAULT_FILES = [
|
|
|
39
39
|
'package.json',
|
|
40
40
|
'yarn.lock',
|
|
41
41
|
'.yarnrc',
|
|
42
|
-
'
|
|
43
|
-
'tsconfig.
|
|
42
|
+
'pnpm-lock.yaml',
|
|
43
|
+
// 'tsconfig.json', // for path-mapping to work!
|
|
44
|
+
// 'tsconfig.dist.json',
|
|
44
45
|
'.gcloudignore',
|
|
45
46
|
'app.yaml',
|
|
46
47
|
'patches', // to allow patch-package
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@naturalcycles/backend-lib",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "9.0.
|
|
4
|
+
"version": "9.0.8",
|
|
5
5
|
"peerDependencies": {
|
|
6
6
|
"@sentry/node": "^9"
|
|
7
7
|
},
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"simple-git": "^3"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
|
-
"@naturalcycles/dev-lib": "
|
|
27
|
+
"@naturalcycles/dev-lib": "*",
|
|
28
28
|
"@sentry/node": "^9",
|
|
29
29
|
"@types/ejs": "^3",
|
|
30
30
|
"fastify": "^5"
|
|
@@ -70,10 +70,10 @@
|
|
|
70
70
|
"dev": "APP_ENV=dev tsx watch src/test/server/server.ts",
|
|
71
71
|
"docs-serve": "NODE_OPTIONS=--openssl-legacy-provider vuepress dev docs",
|
|
72
72
|
"docs-build": "NODE_OPTIONS=--openssl-legacy-provider vuepress build docs",
|
|
73
|
-
"deploy-gae": "
|
|
74
|
-
"deploy-prepare": "
|
|
75
|
-
"deploy-prepare-debug": "AA=AA1 BB=BB1
|
|
76
|
-
"deploy-health-check-debug1": "
|
|
77
|
-
"deploy-health-check-debug2": "
|
|
73
|
+
"deploy-gae": "tsx src/bin/deploy-gae.ts",
|
|
74
|
+
"deploy-prepare": "tsx src/bin/deploy-prepare.ts",
|
|
75
|
+
"deploy-prepare-debug": "AA=AA1 BB=BB1 tsx src/bin/deploy-prepare.ts --projectDir ./src/test/project",
|
|
76
|
+
"deploy-health-check-debug1": "tsx src/bin/deploy-health-check.ts --url https://api-master.naturalcycles.com",
|
|
77
|
+
"deploy-health-check-debug2": "tsx src/bin/deploy-health-check.ts --url https://api-master2.naturalcycles.com --thresholdUnhealthy 5"
|
|
78
78
|
}
|
|
79
79
|
}
|
package/src/deploy/deployGae.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { _anyToError, _objectAssign, pRetry } from '@naturalcycles/js-lib'
|
|
2
|
-
import { appendToGithubSummary, exec2 } from '@naturalcycles/nodejs-lib'
|
|
2
|
+
import { appendToGithubSummary, exec2, fs2 } from '@naturalcycles/nodejs-lib'
|
|
3
3
|
import { getBackendCfg } from './backend.cfg.util.js'
|
|
4
4
|
import { createDeployInfo } from './deploy.util.js'
|
|
5
5
|
import type { DeployHealthCheckOptions } from './deployHealthCheck.js'
|
|
@@ -14,7 +14,9 @@ export async function deployGae(opt: DeployGaeOptions = {}): Promise<void> {
|
|
|
14
14
|
|
|
15
15
|
// 1. build
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
const packageManager = detectPackageManager()
|
|
18
|
+
|
|
19
|
+
exec2.spawn(`${packageManager} build`)
|
|
18
20
|
|
|
19
21
|
// 2. deploy-prepare
|
|
20
22
|
|
|
@@ -111,3 +113,11 @@ function logs(gaeProject: string, gaeService: string, gaeVersion: string): void
|
|
|
111
113
|
)
|
|
112
114
|
} catch {}
|
|
113
115
|
}
|
|
116
|
+
|
|
117
|
+
function detectPackageManager(): string {
|
|
118
|
+
const pj = fs2.readText('package.json')
|
|
119
|
+
if (pj.includes('pnpm')) {
|
|
120
|
+
return 'pnpm'
|
|
121
|
+
}
|
|
122
|
+
return 'yarn' // yarn is still the default
|
|
123
|
+
}
|
|
@@ -54,8 +54,9 @@ const DEFAULT_FILES = [
|
|
|
54
54
|
'package.json',
|
|
55
55
|
'yarn.lock',
|
|
56
56
|
'.yarnrc',
|
|
57
|
-
'
|
|
58
|
-
'tsconfig.
|
|
57
|
+
'pnpm-lock.yaml',
|
|
58
|
+
// 'tsconfig.json', // for path-mapping to work!
|
|
59
|
+
// 'tsconfig.dist.json',
|
|
59
60
|
'.gcloudignore',
|
|
60
61
|
'app.yaml',
|
|
61
62
|
'patches', // to allow patch-package
|