@rocketmakers/shell-gcloud 0.1.5 → 0.2.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/lib/gcloud.d.ts +7 -0
- package/lib/gcloud.js +12 -1
- package/package.json +10 -10
package/lib/gcloud.d.ts
CHANGED
|
@@ -82,6 +82,13 @@ export interface IRenameBucketDirOptions {
|
|
|
82
82
|
* @returns {Promise<void>}
|
|
83
83
|
*/
|
|
84
84
|
export declare function renameBucketDir(shell: IShellExecutor, options: IRenameBucketDirOptions, shellOptions?: IShellOptions): Promise<void>;
|
|
85
|
+
/**
|
|
86
|
+
* Lists the contents of a directory within a GCS bucket
|
|
87
|
+
*
|
|
88
|
+
* @param {string} bucketPath - Path to the directory within the bucket
|
|
89
|
+
* @returns {Promise<string[]>} - List of files and directories within the bucket directory
|
|
90
|
+
*/
|
|
91
|
+
export declare function listBucketDirContents(shell: IShellExecutor, bucketPath: string, shellOptions?: IShellOptions): Promise<string[]>;
|
|
85
92
|
/**
|
|
86
93
|
* Writes a google service account key to the file specified by GOOGLE_APPLICATION_CREDENTIALS.
|
|
87
94
|
*
|
package/lib/gcloud.js
CHANGED
|
@@ -7,6 +7,7 @@ exports.deactivateServiceAccount = deactivateServiceAccount;
|
|
|
7
7
|
exports.runWithActivatedServiceAccount = runWithActivatedServiceAccount;
|
|
8
8
|
exports.uploadDirectoryToBucket = uploadDirectoryToBucket;
|
|
9
9
|
exports.renameBucketDir = renameBucketDir;
|
|
10
|
+
exports.listBucketDirContents = listBucketDirContents;
|
|
10
11
|
exports.setupAuthFromEnvironment = setupAuthFromEnvironment;
|
|
11
12
|
const tslib_1 = require("tslib");
|
|
12
13
|
const logger_1 = require("@rocketmakers/shell/logger");
|
|
@@ -49,7 +50,7 @@ async function applicationDefaultLogin(shell, options) {
|
|
|
49
50
|
* Gets the path to the gcloud executable
|
|
50
51
|
* @returns The path to the gcloud executable
|
|
51
52
|
*/
|
|
52
|
-
|
|
53
|
+
function getBinFolder(shell, options) {
|
|
53
54
|
return Prerequisites.which(shell, gcloud, options);
|
|
54
55
|
}
|
|
55
56
|
/**
|
|
@@ -117,6 +118,16 @@ async function renameBucketDir(shell, options, shellOptions) {
|
|
|
117
118
|
];
|
|
118
119
|
await shell.exec(['gsutil', ...gsutilArgs.filter(arg => arg !== '')], shellOptions);
|
|
119
120
|
}
|
|
121
|
+
/**
|
|
122
|
+
* Lists the contents of a directory within a GCS bucket
|
|
123
|
+
*
|
|
124
|
+
* @param {string} bucketPath - Path to the directory within the bucket
|
|
125
|
+
* @returns {Promise<string[]>} - List of files and directories within the bucket directory
|
|
126
|
+
*/
|
|
127
|
+
async function listBucketDirContents(shell, bucketPath, shellOptions) {
|
|
128
|
+
const result = await shell.exec(['gsutil', 'ls', bucketPath], shellOptions);
|
|
129
|
+
return result.trim().split('\n');
|
|
130
|
+
}
|
|
120
131
|
/**
|
|
121
132
|
* Writes a google service account key to the file specified by GOOGLE_APPLICATION_CREDENTIALS.
|
|
122
133
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rocketmakers/shell-gcloud",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"bin": {
|
|
5
5
|
"rocketmakers-gcloud-auth": "./exec/gcloudAuth.js"
|
|
6
6
|
},
|
|
@@ -14,19 +14,19 @@
|
|
|
14
14
|
"@rocketmakers/log": "0.1.0",
|
|
15
15
|
"bunyan": "1.8.15",
|
|
16
16
|
"tslib": "2.8.1",
|
|
17
|
-
"@rocketmakers/shell": "0.
|
|
18
|
-
"@rocketmakers/shell-executor": "0.
|
|
19
|
-
"@rocketmakers/shell-fs": "0.
|
|
17
|
+
"@rocketmakers/shell": "0.2.0",
|
|
18
|
+
"@rocketmakers/shell-executor": "0.2.0",
|
|
19
|
+
"@rocketmakers/shell-fs": "0.2.0"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
22
|
"@types/jest": "29.5.14",
|
|
23
|
-
"@types/node": "22.
|
|
24
|
-
"eslint": "
|
|
23
|
+
"@types/node": "22.15.17",
|
|
24
|
+
"eslint": "9.26.0",
|
|
25
25
|
"jest": "29.7.0",
|
|
26
26
|
"jest-junit": "16.0.0",
|
|
27
|
-
"ts-jest": "29.3.
|
|
28
|
-
"typescript": "5.8.
|
|
29
|
-
"@rocketmakers/shell-tests": "0.
|
|
27
|
+
"ts-jest": "29.3.2",
|
|
28
|
+
"typescript": "5.8.3",
|
|
29
|
+
"@rocketmakers/shell-tests": "0.2.0",
|
|
30
30
|
"eslint-config-shell": "0.1.0",
|
|
31
31
|
"tsconfig-shell": "0.1.0"
|
|
32
32
|
},
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"repository": "Rocketmakers/rocketmakers-packages",
|
|
47
47
|
"scripts": {
|
|
48
48
|
"build": "tsc -p .",
|
|
49
|
-
"lint": "eslint
|
|
49
|
+
"lint": "eslint source",
|
|
50
50
|
"lint-fix": "pnpm lint --fix",
|
|
51
51
|
"test-integration": "jest --runInBand"
|
|
52
52
|
}
|