uzdu 1.1.0 → 1.1.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.
- package/lib/{chunk-463DKYHI.js → chunk-2E5O5JIN.js} +21 -146
- package/lib/chunk-XU5JZHWK.js +133 -0
- package/lib/uzdu-exec.d.ts +2 -0
- package/lib/uzdu-exec.js +27 -0
- package/lib/uzdu-upload.js +9 -7
- package/lib/uzdu.js +6 -4
- package/package.json +1 -1
|
@@ -7,128 +7,6 @@ import {
|
|
|
7
7
|
runSequentially
|
|
8
8
|
} from "./chunk-WWXWWCCX.js";
|
|
9
9
|
|
|
10
|
-
// src/azure.ts
|
|
11
|
-
var azure_exports = {};
|
|
12
|
-
__export(azure_exports, {
|
|
13
|
-
default: () => upload
|
|
14
|
-
});
|
|
15
|
-
import { BlobServiceClient } from "@azure/storage-blob";
|
|
16
|
-
import path from "path";
|
|
17
|
-
import fs from "fs";
|
|
18
|
-
async function upload(dir, options, metadataFile = ".metadata.json") {
|
|
19
|
-
if (!options.connectionString) throw Error("Uploader needs connection string for Azure Blob Storage. Provide AZURE_STORAGE_CONNECTION_STRING environment variable!");
|
|
20
|
-
const opts = Object.assign({}, { container: "$web" }, options);
|
|
21
|
-
const blobServiceClient = BlobServiceClient.fromConnectionString(options.connectionString);
|
|
22
|
-
const isDebug = process.env.DEBUG && process.env.DEBUG.toLowerCase() === "true";
|
|
23
|
-
const containerClient = blobServiceClient.getContainerClient(opts.container);
|
|
24
|
-
let dist = path.resolve(process.cwd(), dir);
|
|
25
|
-
const files = await listFiles(dir);
|
|
26
|
-
let metadata;
|
|
27
|
-
try {
|
|
28
|
-
const metadataJson = fs.readFileSync(path.join(dir, metadataFile), { encoding: "utf-8" });
|
|
29
|
-
metadata = JSON.parse(metadataJson);
|
|
30
|
-
} catch (e) {
|
|
31
|
-
}
|
|
32
|
-
if (Object.keys(files).length == 1) {
|
|
33
|
-
const lstat = fs.lstatSync(dist);
|
|
34
|
-
if (lstat.isFile()) {
|
|
35
|
-
dist = path.dirname(dist);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
await Promise.all(Object.entries(files).map(async ([file, absFile]) => {
|
|
39
|
-
let blobObj;
|
|
40
|
-
if (metadata) {
|
|
41
|
-
blobObj = metadata[file];
|
|
42
|
-
}
|
|
43
|
-
const blockBlobClient = containerClient.getBlockBlobClient(file);
|
|
44
|
-
const blobHTTPHeaders = {};
|
|
45
|
-
if (blobObj?.headers) {
|
|
46
|
-
const { CacheControl, ContentType } = blobObj.headers;
|
|
47
|
-
blobHTTPHeaders.blobCacheControl = CacheControl;
|
|
48
|
-
blobHTTPHeaders.blobContentType = ContentType;
|
|
49
|
-
}
|
|
50
|
-
const localFilePath = absFile;
|
|
51
|
-
await blockBlobClient.uploadFile(localFilePath, { blobHTTPHeaders });
|
|
52
|
-
}));
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
// src/s3.ts
|
|
56
|
-
var s3_exports = {};
|
|
57
|
-
__export(s3_exports, {
|
|
58
|
-
default: () => upload2
|
|
59
|
-
});
|
|
60
|
-
import { S3Client } from "@aws-sdk/client-s3";
|
|
61
|
-
import { Upload } from "@aws-sdk/lib-storage";
|
|
62
|
-
import fs2 from "fs";
|
|
63
|
-
import path2 from "path";
|
|
64
|
-
async function upload2(dir, s3config, metadataFile = ".metadata.json") {
|
|
65
|
-
if (!s3config.accessKeyId || !s3config.secretAccessKey) {
|
|
66
|
-
throw new Error("AWS credentials not found in environment variables AWS_KEY_ID and AWS_SECRET_KEY.");
|
|
67
|
-
}
|
|
68
|
-
if (!s3config.region) {
|
|
69
|
-
throw new Error('Neither "region" in the bucket address nor AWS_REGION environment variable was found.');
|
|
70
|
-
}
|
|
71
|
-
if (!s3config.bucket) {
|
|
72
|
-
throw new Error("Amazon S3 bucket name is required");
|
|
73
|
-
}
|
|
74
|
-
const { accessKeyId, secretAccessKey, region, endpoint } = s3config;
|
|
75
|
-
const client = new S3Client({
|
|
76
|
-
credentials: {
|
|
77
|
-
accessKeyId,
|
|
78
|
-
secretAccessKey
|
|
79
|
-
},
|
|
80
|
-
region,
|
|
81
|
-
endpoint
|
|
82
|
-
});
|
|
83
|
-
let dist = path2.resolve(process.cwd(), dir);
|
|
84
|
-
const files = await listFiles(dist);
|
|
85
|
-
let metadata;
|
|
86
|
-
try {
|
|
87
|
-
const metadataJson = fs2.readFileSync(path2.join(dir, metadataFile), { encoding: "utf-8" });
|
|
88
|
-
metadata = JSON.parse(metadataJson);
|
|
89
|
-
} catch (e) {
|
|
90
|
-
}
|
|
91
|
-
if (Object.keys(files).length == 1) {
|
|
92
|
-
const lstat = fs2.lstatSync(dist);
|
|
93
|
-
if (lstat.isFile()) {
|
|
94
|
-
dist = path2.dirname(dist);
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
await Promise.all(Object.entries(files).map(async ([file, absFile]) => {
|
|
98
|
-
const filePath = absFile;
|
|
99
|
-
const fileContent = await new Promise((resolve, reject) => {
|
|
100
|
-
fs2.readFile(filePath, (err, data) => {
|
|
101
|
-
if (err) reject(err);
|
|
102
|
-
else resolve(data);
|
|
103
|
-
});
|
|
104
|
-
});
|
|
105
|
-
const params = {
|
|
106
|
-
Bucket: s3config.bucket,
|
|
107
|
-
Key: file,
|
|
108
|
-
Body: fileContent
|
|
109
|
-
};
|
|
110
|
-
if (metadata) {
|
|
111
|
-
const blobObj = metadata[file];
|
|
112
|
-
if (blobObj && blobObj.headers) {
|
|
113
|
-
const { CacheControl, ContentType } = blobObj.headers;
|
|
114
|
-
if (CacheControl) params.CacheControl = CacheControl;
|
|
115
|
-
if (ContentType) params.ContentType = ContentType;
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
return new Upload({
|
|
119
|
-
client,
|
|
120
|
-
params,
|
|
121
|
-
tags: [],
|
|
122
|
-
queueSize: 4,
|
|
123
|
-
// optional concurrency configuration
|
|
124
|
-
partSize: 1024 * 1024 * 5,
|
|
125
|
-
// optional size of each part, in bytes, at least 5MB
|
|
126
|
-
leavePartsOnError: false
|
|
127
|
-
// optional manually handle dropped parts
|
|
128
|
-
}).done();
|
|
129
|
-
}));
|
|
130
|
-
}
|
|
131
|
-
|
|
132
10
|
// src/ssh.ts
|
|
133
11
|
var ssh_exports = {};
|
|
134
12
|
__export(ssh_exports, {
|
|
@@ -138,15 +16,15 @@ __export(ssh_exports, {
|
|
|
138
16
|
getDirMap: () => getDirMap,
|
|
139
17
|
getMakeDirs: () => getMakeDirs,
|
|
140
18
|
getRemoteDestination: () => getRemoteDestination,
|
|
141
|
-
upload: () =>
|
|
19
|
+
upload: () => upload
|
|
142
20
|
});
|
|
143
21
|
import { Client } from "ssh2";
|
|
144
|
-
import
|
|
145
|
-
import
|
|
22
|
+
import fs from "fs";
|
|
23
|
+
import path from "path";
|
|
146
24
|
import deepmerge from "deepmerge";
|
|
147
|
-
async function
|
|
25
|
+
async function upload(source, sftpUrl, options) {
|
|
148
26
|
await new Promise((resolve, reject) => {
|
|
149
|
-
|
|
27
|
+
fs.stat(source, async (err, stats) => {
|
|
150
28
|
if (err) {
|
|
151
29
|
reject(err);
|
|
152
30
|
return;
|
|
@@ -255,7 +133,7 @@ function _uploadFile(source, destination, sftp) {
|
|
|
255
133
|
else resolve();
|
|
256
134
|
});
|
|
257
135
|
} else if (stats.isDirectory()) {
|
|
258
|
-
const f =
|
|
136
|
+
const f = path.basename(source);
|
|
259
137
|
reject(new Error(`Overwriting directory ${destination} with the file ${f} is not allowed. Remove the directory manually.`));
|
|
260
138
|
} else {
|
|
261
139
|
reject(new Error("Remote path is symlink"));
|
|
@@ -270,9 +148,9 @@ function uploadFiles(sourceFiles, source, destination, sshConnection) {
|
|
|
270
148
|
reject(err);
|
|
271
149
|
} else {
|
|
272
150
|
if (Object.keys(sourceFiles).length == 1) {
|
|
273
|
-
const lstat2 =
|
|
151
|
+
const lstat2 = fs.lstatSync(source);
|
|
274
152
|
if (lstat2.isFile()) {
|
|
275
|
-
const dest =
|
|
153
|
+
const dest = path.join(destination, Object.keys(sourceFiles)[0]).replace(/\\/g, "/");
|
|
276
154
|
const src = source;
|
|
277
155
|
await _uploadFile(src, dest, sftp).then(() => resolve()).catch((e) => {
|
|
278
156
|
reject(e);
|
|
@@ -281,13 +159,13 @@ function uploadFiles(sourceFiles, source, destination, sshConnection) {
|
|
|
281
159
|
}
|
|
282
160
|
}
|
|
283
161
|
let sourceDir = source;
|
|
284
|
-
const lstat =
|
|
162
|
+
const lstat = fs.lstatSync(source);
|
|
285
163
|
if (lstat.isSymbolicLink()) {
|
|
286
|
-
sourceDir =
|
|
164
|
+
sourceDir = fs.readlinkSync(source);
|
|
287
165
|
}
|
|
288
166
|
const promises = [];
|
|
289
167
|
Object.entries(sourceFiles).map(([baseName, absPath]) => {
|
|
290
|
-
const dest =
|
|
168
|
+
const dest = path.join(destination, baseName).replace(/\\/g, "/");
|
|
291
169
|
const promise = new Promise((res, rej) => {
|
|
292
170
|
_uploadFile(absPath, dest, sftp).then(() => res()).catch((e) => {
|
|
293
171
|
rej(e);
|
|
@@ -361,7 +239,7 @@ function getFileMap(file) {
|
|
|
361
239
|
const parts = theFile.split("/");
|
|
362
240
|
if (parts.length == 1) return { [parts[0]]: false };
|
|
363
241
|
else {
|
|
364
|
-
const aFile =
|
|
242
|
+
const aFile = path.join(...parts.slice(1)).replace(/\\/g, "/");
|
|
365
243
|
const fileMapEntry = getFileMap(aFile);
|
|
366
244
|
return { [parts[0]]: fileMapEntry };
|
|
367
245
|
}
|
|
@@ -379,7 +257,7 @@ function getCredentials(options) {
|
|
|
379
257
|
if (uzduKeyPath) {
|
|
380
258
|
const resolvedKeyPath = resolvePath(uzduKeyPath);
|
|
381
259
|
try {
|
|
382
|
-
privateKey =
|
|
260
|
+
privateKey = fs.readFileSync(resolvedKeyPath);
|
|
383
261
|
} catch (e) {
|
|
384
262
|
throw new Error(`Not found private Key file ${resolvedKeyPath}`);
|
|
385
263
|
}
|
|
@@ -421,10 +299,10 @@ function getConnectConfig(url) {
|
|
|
421
299
|
if (!host) throw new Error(`Wrong URL "${url}": host or ivp6 is not specified`);
|
|
422
300
|
const username = groups?.username;
|
|
423
301
|
const password = groups?.password;
|
|
424
|
-
const
|
|
302
|
+
const path2 = groups?.path;
|
|
425
303
|
const _port = parseInt(groups.port);
|
|
426
304
|
const port = isNaN(_port) ? void 0 : _port;
|
|
427
|
-
const connectConfig = { username, password, host, port, path:
|
|
305
|
+
const connectConfig = { username, password, host, port, path: path2 };
|
|
428
306
|
return connectConfig;
|
|
429
307
|
}
|
|
430
308
|
function getRemoteDestination(sftpUrl) {
|
|
@@ -432,14 +310,14 @@ function getRemoteDestination(sftpUrl) {
|
|
|
432
310
|
const execArray = sftpUrlRegex.exec(sftpUrl);
|
|
433
311
|
if (!execArray) throw new Error("Wrong sftp URL");
|
|
434
312
|
if (!execArray.groups) throw new Error("Wrong URL: path is not specified");
|
|
435
|
-
const
|
|
313
|
+
const path2 = execArray.groups.path;
|
|
436
314
|
return normilizeSftpPath(execArray.groups?.path) || "";
|
|
437
315
|
}
|
|
438
|
-
function normilizeSftpPath(
|
|
439
|
-
if (
|
|
316
|
+
function normilizeSftpPath(path2) {
|
|
317
|
+
if (path2 == void 0) return void 0;
|
|
440
318
|
const re = /^(?<first>[^\/]*)(?<root>\/)?(?<second>.*)?/g;
|
|
441
319
|
re.lastIndex = 0;
|
|
442
|
-
const execPathArray = re.exec(
|
|
320
|
+
const execPathArray = re.exec(path2);
|
|
443
321
|
const { groups } = execPathArray ?? {};
|
|
444
322
|
const first = groups?.first;
|
|
445
323
|
const second = groups?.second;
|
|
@@ -451,7 +329,7 @@ function normilizeSftpPath(path4) {
|
|
|
451
329
|
dest = groups2?.tild ? `${second ? second : ""}` : `/${first}${second ? `/${second}` : ""}`;
|
|
452
330
|
} else {
|
|
453
331
|
if (!root && !second) dest = "/";
|
|
454
|
-
else dest =
|
|
332
|
+
else dest = path2;
|
|
455
333
|
}
|
|
456
334
|
const destination = dest != "/" ? dest.replace(/\/+$/, "") : dest;
|
|
457
335
|
return destination;
|
|
@@ -459,9 +337,6 @@ function normilizeSftpPath(path4) {
|
|
|
459
337
|
|
|
460
338
|
export {
|
|
461
339
|
upload,
|
|
462
|
-
|
|
463
|
-
upload2,
|
|
464
|
-
s3_exports,
|
|
465
|
-
upload3,
|
|
340
|
+
execute,
|
|
466
341
|
ssh_exports
|
|
467
342
|
};
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import {
|
|
2
|
+
__export,
|
|
3
|
+
listFiles
|
|
4
|
+
} from "./chunk-WWXWWCCX.js";
|
|
5
|
+
|
|
6
|
+
// src/azure.ts
|
|
7
|
+
var azure_exports = {};
|
|
8
|
+
__export(azure_exports, {
|
|
9
|
+
default: () => upload
|
|
10
|
+
});
|
|
11
|
+
import { BlobServiceClient } from "@azure/storage-blob";
|
|
12
|
+
import path from "path";
|
|
13
|
+
import fs from "fs";
|
|
14
|
+
async function upload(dir, options, metadataFile = ".metadata.json") {
|
|
15
|
+
if (!options.connectionString) throw Error("Uploader needs connection string for Azure Blob Storage. Provide AZURE_STORAGE_CONNECTION_STRING environment variable!");
|
|
16
|
+
const opts = Object.assign({}, { container: "$web" }, options);
|
|
17
|
+
const blobServiceClient = BlobServiceClient.fromConnectionString(options.connectionString);
|
|
18
|
+
const isDebug = process.env.DEBUG && process.env.DEBUG.toLowerCase() === "true";
|
|
19
|
+
const containerClient = blobServiceClient.getContainerClient(opts.container);
|
|
20
|
+
let dist = path.resolve(process.cwd(), dir);
|
|
21
|
+
const files = await listFiles(dir);
|
|
22
|
+
let metadata;
|
|
23
|
+
try {
|
|
24
|
+
const metadataJson = fs.readFileSync(path.join(dir, metadataFile), { encoding: "utf-8" });
|
|
25
|
+
metadata = JSON.parse(metadataJson);
|
|
26
|
+
} catch (e) {
|
|
27
|
+
}
|
|
28
|
+
if (Object.keys(files).length == 1) {
|
|
29
|
+
const lstat = fs.lstatSync(dist);
|
|
30
|
+
if (lstat.isFile()) {
|
|
31
|
+
dist = path.dirname(dist);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
await Promise.all(Object.entries(files).map(async ([file, absFile]) => {
|
|
35
|
+
let blobObj;
|
|
36
|
+
if (metadata) {
|
|
37
|
+
blobObj = metadata[file];
|
|
38
|
+
}
|
|
39
|
+
const blockBlobClient = containerClient.getBlockBlobClient(file);
|
|
40
|
+
const blobHTTPHeaders = {};
|
|
41
|
+
if (blobObj?.headers) {
|
|
42
|
+
const { CacheControl, ContentType } = blobObj.headers;
|
|
43
|
+
blobHTTPHeaders.blobCacheControl = CacheControl;
|
|
44
|
+
blobHTTPHeaders.blobContentType = ContentType;
|
|
45
|
+
}
|
|
46
|
+
const localFilePath = absFile;
|
|
47
|
+
await blockBlobClient.uploadFile(localFilePath, { blobHTTPHeaders });
|
|
48
|
+
}));
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// src/s3.ts
|
|
52
|
+
var s3_exports = {};
|
|
53
|
+
__export(s3_exports, {
|
|
54
|
+
default: () => upload2
|
|
55
|
+
});
|
|
56
|
+
import { S3Client } from "@aws-sdk/client-s3";
|
|
57
|
+
import { Upload } from "@aws-sdk/lib-storage";
|
|
58
|
+
import fs2 from "fs";
|
|
59
|
+
import path2 from "path";
|
|
60
|
+
async function upload2(dir, s3config, metadataFile = ".metadata.json") {
|
|
61
|
+
if (!s3config.accessKeyId || !s3config.secretAccessKey) {
|
|
62
|
+
throw new Error("AWS credentials not found in environment variables AWS_KEY_ID and AWS_SECRET_KEY.");
|
|
63
|
+
}
|
|
64
|
+
if (!s3config.region) {
|
|
65
|
+
throw new Error('Neither "region" in the bucket address nor AWS_REGION environment variable was found.');
|
|
66
|
+
}
|
|
67
|
+
if (!s3config.bucket) {
|
|
68
|
+
throw new Error("Amazon S3 bucket name is required");
|
|
69
|
+
}
|
|
70
|
+
const { accessKeyId, secretAccessKey, region, endpoint } = s3config;
|
|
71
|
+
const client = new S3Client({
|
|
72
|
+
credentials: {
|
|
73
|
+
accessKeyId,
|
|
74
|
+
secretAccessKey
|
|
75
|
+
},
|
|
76
|
+
region,
|
|
77
|
+
endpoint
|
|
78
|
+
});
|
|
79
|
+
let dist = path2.resolve(process.cwd(), dir);
|
|
80
|
+
const files = await listFiles(dist);
|
|
81
|
+
let metadata;
|
|
82
|
+
try {
|
|
83
|
+
const metadataJson = fs2.readFileSync(path2.join(dir, metadataFile), { encoding: "utf-8" });
|
|
84
|
+
metadata = JSON.parse(metadataJson);
|
|
85
|
+
} catch (e) {
|
|
86
|
+
}
|
|
87
|
+
if (Object.keys(files).length == 1) {
|
|
88
|
+
const lstat = fs2.lstatSync(dist);
|
|
89
|
+
if (lstat.isFile()) {
|
|
90
|
+
dist = path2.dirname(dist);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
await Promise.all(Object.entries(files).map(async ([file, absFile]) => {
|
|
94
|
+
const filePath = absFile;
|
|
95
|
+
const fileContent = await new Promise((resolve, reject) => {
|
|
96
|
+
fs2.readFile(filePath, (err, data) => {
|
|
97
|
+
if (err) reject(err);
|
|
98
|
+
else resolve(data);
|
|
99
|
+
});
|
|
100
|
+
});
|
|
101
|
+
const params = {
|
|
102
|
+
Bucket: s3config.bucket,
|
|
103
|
+
Key: file,
|
|
104
|
+
Body: fileContent
|
|
105
|
+
};
|
|
106
|
+
if (metadata) {
|
|
107
|
+
const blobObj = metadata[file];
|
|
108
|
+
if (blobObj && blobObj.headers) {
|
|
109
|
+
const { CacheControl, ContentType } = blobObj.headers;
|
|
110
|
+
if (CacheControl) params.CacheControl = CacheControl;
|
|
111
|
+
if (ContentType) params.ContentType = ContentType;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
return new Upload({
|
|
115
|
+
client,
|
|
116
|
+
params,
|
|
117
|
+
tags: [],
|
|
118
|
+
queueSize: 4,
|
|
119
|
+
// optional concurrency configuration
|
|
120
|
+
partSize: 1024 * 1024 * 5,
|
|
121
|
+
// optional size of each part, in bytes, at least 5MB
|
|
122
|
+
leavePartsOnError: false
|
|
123
|
+
// optional manually handle dropped parts
|
|
124
|
+
}).done();
|
|
125
|
+
}));
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
export {
|
|
129
|
+
upload,
|
|
130
|
+
azure_exports,
|
|
131
|
+
upload2,
|
|
132
|
+
s3_exports
|
|
133
|
+
};
|
package/lib/uzdu-exec.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import {
|
|
2
|
+
execute
|
|
3
|
+
} from "./chunk-2E5O5JIN.js";
|
|
4
|
+
import {
|
|
5
|
+
outputConfiguration
|
|
6
|
+
} from "./chunk-WWXWWCCX.js";
|
|
7
|
+
|
|
8
|
+
// src/uzdu-exec.ts
|
|
9
|
+
import { Command, Option } from "commander";
|
|
10
|
+
var command = new Command();
|
|
11
|
+
command.description("Execute commands on remote machine").name("uzdu exec");
|
|
12
|
+
command.command("ssh").description("Execute commands via SSH. In addition to sshUrl consider using environment variables UZDU_SSH_KEY_PATH, UZDU_SSH_KEY, UZDU_SSH_PASSWORD").argument("<sshUrl>", "the URL format ssh://[user[:password]@]host[:port]").argument("command", "single line command").addOption(
|
|
13
|
+
new Option("-d|--dotenv [file]", 'load environment variables from a property file, i.e. a file with "key=value" lines.').preset(".env")
|
|
14
|
+
).addOption(new Option("--privateKeyPath [path to file]", "Path to SSH private key, fallback is UZDU_SSH_KEY_PATH environment variable. Also consider using UZDU_SSH_KEY to provide SSH private key content or UZDU_SSH_PASSWORD.")).action(async (sshUrl, command2, options, thisCommand) => {
|
|
15
|
+
try {
|
|
16
|
+
options.callback = (value) => {
|
|
17
|
+
if (value.message) console.log(value.message);
|
|
18
|
+
if (value.error) console.error(value.error);
|
|
19
|
+
};
|
|
20
|
+
await execute(sshUrl, [command2], options);
|
|
21
|
+
} catch (e) {
|
|
22
|
+
thisCommand.error(e.message || e, { exitCode: 127, code: "ssh.upload.error" });
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
command.configureOutput(outputConfiguration);
|
|
26
|
+
command.showHelpAfterError(true);
|
|
27
|
+
command.parse();
|
package/lib/uzdu-upload.js
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
|
-
upload as
|
|
3
|
-
upload2 as
|
|
4
|
-
|
|
5
|
-
} from "./chunk-463DKYHI.js";
|
|
2
|
+
upload as upload3,
|
|
3
|
+
upload2 as upload4
|
|
4
|
+
} from "./chunk-XU5JZHWK.js";
|
|
6
5
|
import {
|
|
7
6
|
upload
|
|
8
7
|
} from "./chunk-LFEIDM4S.js";
|
|
8
|
+
import {
|
|
9
|
+
upload as upload2
|
|
10
|
+
} from "./chunk-2E5O5JIN.js";
|
|
9
11
|
import {
|
|
10
12
|
getEnvironment,
|
|
11
13
|
initEnvironment,
|
|
@@ -40,7 +42,7 @@ command.command("aws").description("upload to AWS S3").argument("<from>", "the d
|
|
|
40
42
|
if (!config.accessKeyId) throw new Error("AWS Access Key ID is not specified. Provide an environement variable AWS_ACCESS_KEY_ID.");
|
|
41
43
|
if (!config.secretAccessKey) throw new Error("AWS Secret Key is not specified. Provide an environment variable AWS_SECRET_ACCESS_KEY.");
|
|
42
44
|
if (!config.region) throw new Error("AWS region is not specified. Provide it in a bucket address or as an envronment variable S3_REGION.");
|
|
43
|
-
await
|
|
45
|
+
await upload4(from, config);
|
|
44
46
|
} catch (e) {
|
|
45
47
|
thisCommand.error(e.message || e, { exitCode: 53, code: "aws.upload.error" });
|
|
46
48
|
}
|
|
@@ -78,7 +80,7 @@ command.command("azure").alias("az").description("upload to Azure Blob Storage")
|
|
|
78
80
|
connectionString,
|
|
79
81
|
container
|
|
80
82
|
};
|
|
81
|
-
await
|
|
83
|
+
await upload3(from, azOpt);
|
|
82
84
|
} catch (e) {
|
|
83
85
|
thisCommand.error(e.message || e, { exitCode: 43, code: "az.upload.error" });
|
|
84
86
|
}
|
|
@@ -87,7 +89,7 @@ command.command("ssh").description("upload via SFTP. In addition to sftpURL cons
|
|
|
87
89
|
new Option("-d|--dotenv [file]", 'load environment variables from a property file, i.e. a file with "key=value" lines.').preset(".env")
|
|
88
90
|
).addOption(new Option("--privateKeyPath [path to file]", "Path to SSH private key, fallback is UZDU_SSH_KEY_PATH environment variable. Also consider using UZDU_SSH_KEY to provide SSH private key content or UZDU_SSH_PASSWORD.")).action(async (source, sftpUrl, options, thisCommand) => {
|
|
89
91
|
try {
|
|
90
|
-
await
|
|
92
|
+
await upload2(resolvePath(source), sftpUrl, options);
|
|
91
93
|
} catch (e) {
|
|
92
94
|
thisCommand.error(e.message || e, { exitCode: 127, code: "ssh.upload.error" });
|
|
93
95
|
}
|
package/lib/uzdu.js
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
#! /usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
azure_exports,
|
|
4
|
-
s3_exports
|
|
5
|
-
|
|
6
|
-
} from "./chunk-463DKYHI.js";
|
|
4
|
+
s3_exports
|
|
5
|
+
} from "./chunk-XU5JZHWK.js";
|
|
7
6
|
import {
|
|
8
7
|
http_exports
|
|
9
8
|
} from "./chunk-LFEIDM4S.js";
|
|
9
|
+
import {
|
|
10
|
+
ssh_exports
|
|
11
|
+
} from "./chunk-2E5O5JIN.js";
|
|
10
12
|
import {
|
|
11
13
|
outputConfiguration,
|
|
12
14
|
utils_exports
|
|
@@ -17,7 +19,7 @@ import { Command } from "commander";
|
|
|
17
19
|
var version;
|
|
18
20
|
var description;
|
|
19
21
|
try {
|
|
20
|
-
version = "1.1.
|
|
22
|
+
version = "1.1.2";
|
|
21
23
|
description = "UZDU - universal zipper, downloader and uploader. Move files to/from zip, clouds (AWS, Azure), to HTTP PUT (e.g. Nexus) and to SSH";
|
|
22
24
|
} catch (e) {
|
|
23
25
|
if (e instanceof ReferenceError) {
|
package/package.json
CHANGED