@cloudcommerce/cli 0.0.52 → 0.0.55
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/.turbo/turbo-build.log +5 -5
- package/lib/config-gcloud.js +9 -0
- package/package.json +2 -2
- package/src/config-gcloud.ts +11 -4
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
[
|
|
2
|
-
[
|
|
3
|
-
[
|
|
4
|
-
[
|
|
5
|
-
[
|
|
1
|
+
[33m@cloudcommerce/cli:build[0m: cache hit, replaying output [2ma3052fcaee232aba[0m
|
|
2
|
+
[33m@cloudcommerce/cli:build: [0m
|
|
3
|
+
[33m@cloudcommerce/cli:build: [0m> @cloudcommerce/cli@0.0.54 build /home/leo/code/ecomplus/cloud-commerce/packages/cli
|
|
4
|
+
[33m@cloudcommerce/cli:build: [0m> sh ../../scripts/build-lib.sh
|
|
5
|
+
[33m@cloudcommerce/cli:build: [0m
|
package/lib/config-gcloud.js
CHANGED
|
@@ -30,6 +30,7 @@ const siginGcloudAndSetIAM = async (projectId, pwd) => {
|
|
|
30
30
|
'roles/iam.serviceAccountUser',
|
|
31
31
|
'roles/run.viewer',
|
|
32
32
|
'roles/serviceusage.apiKeysViewer',
|
|
33
|
+
'roles/serviceusage.serviceUsageAdmin',
|
|
33
34
|
];
|
|
34
35
|
const serviceAccount = await checkServiceAccountExists(projectId);
|
|
35
36
|
if (!serviceAccount) {
|
|
@@ -53,6 +54,14 @@ const siginGcloudAndSetIAM = async (projectId, pwd) => {
|
|
|
53
54
|
],
|
|
54
55
|
role,
|
|
55
56
|
};
|
|
57
|
+
if (role === 'roles/serviceusage.serviceUsageAdmin') {
|
|
58
|
+
const roleExpiration = Date.now() + 1000 * 60 * 60 * 12;
|
|
59
|
+
newBinding.condition = {
|
|
60
|
+
expression: `request.time < timestamp("${new Date(roleExpiration).toISOString()}")`,
|
|
61
|
+
title: 'Enable APIs on first deploy',
|
|
62
|
+
description: null,
|
|
63
|
+
};
|
|
64
|
+
}
|
|
56
65
|
bindings.push(newBinding);
|
|
57
66
|
mustUpdatePolicy = true;
|
|
58
67
|
} else {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudcommerce/cli",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.55",
|
|
5
5
|
"description": "E-Com Plus Cloud Commerce CLI tools",
|
|
6
6
|
"bin": {
|
|
7
7
|
"cloudcommerce": "./bin/run.mjs"
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
},
|
|
24
24
|
"homepage": "https://github.com/ecomplus/cloud-commerce/tree/main/packages/cli#readme",
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@cloudcommerce/api": "0.0.
|
|
26
|
+
"@cloudcommerce/api": "0.0.55",
|
|
27
27
|
"md5": "^2.3.0",
|
|
28
28
|
"zx": "^7.0.8"
|
|
29
29
|
},
|
package/src/config-gcloud.ts
CHANGED
|
@@ -32,6 +32,7 @@ const siginGcloudAndSetIAM = async (projectId: string, pwd: string) => {
|
|
|
32
32
|
'roles/iam.serviceAccountUser',
|
|
33
33
|
'roles/run.viewer',
|
|
34
34
|
'roles/serviceusage.apiKeysViewer',
|
|
35
|
+
'roles/serviceusage.serviceUsageAdmin',
|
|
35
36
|
];
|
|
36
37
|
const serviceAccount = await checkServiceAccountExists(projectId);
|
|
37
38
|
if (!serviceAccount) {
|
|
@@ -47,17 +48,23 @@ const siginGcloudAndSetIAM = async (projectId: string, pwd: string) => {
|
|
|
47
48
|
|
|
48
49
|
let mustUpdatePolicy = false;
|
|
49
50
|
roles.forEach((role) => {
|
|
50
|
-
const roleFound = bindings.find(
|
|
51
|
-
(binding: { [key: string]: string | string[] }) => binding.role === role,
|
|
52
|
-
);
|
|
51
|
+
const roleFound = bindings.find((binding) => binding.role === role);
|
|
53
52
|
const memberServiceAccount = `serviceAccount:${getAccountEmail(projectId)}`;
|
|
54
53
|
if (!roleFound) {
|
|
55
|
-
const newBinding = {
|
|
54
|
+
const newBinding: { [key: string]: any } = {
|
|
56
55
|
members: [
|
|
57
56
|
memberServiceAccount,
|
|
58
57
|
],
|
|
59
58
|
role,
|
|
60
59
|
};
|
|
60
|
+
if (role === 'roles/serviceusage.serviceUsageAdmin') {
|
|
61
|
+
const roleExpiration = Date.now() + 1000 * 60 * 60 * 12;
|
|
62
|
+
newBinding.condition = {
|
|
63
|
+
expression: `request.time < timestamp("${new Date(roleExpiration).toISOString()}")`,
|
|
64
|
+
title: 'Enable APIs on first deploy',
|
|
65
|
+
description: null,
|
|
66
|
+
};
|
|
67
|
+
}
|
|
61
68
|
bindings.push(newBinding);
|
|
62
69
|
mustUpdatePolicy = true;
|
|
63
70
|
} else {
|