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.
Files changed (2) hide show
  1. package/lib/generate.js +8 -11
  2. 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 { execSync } from "node:child_process";
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 cmd = [...base, command].map(shellEscape).join(" ");
152
- return execSync(cmd, { encoding: "utf8", maxBuffer: 50 * 1024 * 1024 });
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 cmd = [...base, src, dest].map(shellEscape).join(" ");
157
- execSync(cmd, { encoding: "utf8" });
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) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "supatypes",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "Generate TypeScript types from a remote Supabase PostgreSQL database via SSH",
5
5
  "license": "MIT",
6
6
  "author": "MadStoneDev",