supatypes 1.0.1 → 1.0.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/generate.js +8 -11
- package/package.json +1 -1
package/lib/generate.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import fs from "node:fs";
|
|
2
2
|
import path from "node:path";
|
|
3
|
-
import {
|
|
3
|
+
import { execFileSync } from "node:child_process";
|
|
4
4
|
import { fileURLToPath } from "node:url";
|
|
5
5
|
|
|
6
6
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
@@ -148,19 +148,16 @@ function buildScpBase(server, sshKey, sshPassword) {
|
|
|
148
148
|
}
|
|
149
149
|
|
|
150
150
|
function ssh(base, command) {
|
|
151
|
-
const
|
|
152
|
-
return
|
|
151
|
+
const [bin, ...args] = base;
|
|
152
|
+
return execFileSync(bin, [...args, command], {
|
|
153
|
+
encoding: "utf8",
|
|
154
|
+
maxBuffer: 50 * 1024 * 1024,
|
|
155
|
+
});
|
|
153
156
|
}
|
|
154
157
|
|
|
155
158
|
function scp(base, src, dest) {
|
|
156
|
-
const
|
|
157
|
-
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
function shellEscape(arg) {
|
|
161
|
-
// Don't escape if it looks safe
|
|
162
|
-
if (/^[a-zA-Z0-9_./:@~=-]+$/.test(arg)) return arg;
|
|
163
|
-
return `'${arg.replace(/'/g, "'\\''")}'`;
|
|
159
|
+
const [bin, ...args] = base;
|
|
160
|
+
execFileSync(bin, [...args, src, dest], { encoding: "utf8" });
|
|
164
161
|
}
|
|
165
162
|
|
|
166
163
|
function formatBytes(bytes) {
|