pgplan 1.0.0 → 1.1.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/bin/pgplan +31 -44
- package/package.json +11 -19
package/bin/pgplan
CHANGED
|
@@ -1,58 +1,45 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
3
2
|
"use strict";
|
|
4
3
|
|
|
5
4
|
const { execFileSync } = require("child_process");
|
|
6
|
-
const path = require("path");
|
|
7
|
-
const os = require("os");
|
|
8
5
|
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
"linux-arm64": { pkg: "@pgplan/linux-arm64", bin: "pgplan" },
|
|
12
|
-
"darwin-x64": { pkg: "@pgplan/darwin-x64", bin: "pgplan" },
|
|
13
|
-
"darwin-arm64": { pkg: "@pgplan/darwin-arm64", bin: "pgplan" },
|
|
14
|
-
"win32-x64": { pkg: "@pgplan/win32-x64", bin: "pgplan.exe" },
|
|
15
|
-
};
|
|
6
|
+
const BIN_NAME = "pgplan";
|
|
7
|
+
const ORG_NAME = "pgplan";
|
|
16
8
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
9
|
+
const platforms = {
|
|
10
|
+
"linux-x64": `@${ORG_NAME}/${BIN_NAME}-linux-x64`,
|
|
11
|
+
"linux-arm64": `@${ORG_NAME}/${BIN_NAME}-linux-arm64`,
|
|
12
|
+
"darwin-x64": `@${ORG_NAME}/${BIN_NAME}-darwin-x64`,
|
|
13
|
+
"darwin-arm64": `@${ORG_NAME}/${BIN_NAME}-darwin-arm64`,
|
|
14
|
+
"win32-x64": `@${ORG_NAME}/${BIN_NAME}-win32-x64`,
|
|
15
|
+
"win32-arm64": `@${ORG_NAME}/${BIN_NAME}-win32-arm64`,
|
|
16
|
+
};
|
|
22
17
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
const entry = PLATFORMS[key];
|
|
26
|
-
if (!entry) {
|
|
27
|
-
const supported = Object.keys(PLATFORMS).join(", ");
|
|
28
|
-
console.error(
|
|
29
|
-
`pgplan: unsupported platform ${key}\nSupported: ${supported}`
|
|
30
|
-
);
|
|
31
|
-
process.exit(1);
|
|
32
|
-
}
|
|
18
|
+
const key = `${process.platform}-${process.arch === "x64" ? "x64" : process.arch}`;
|
|
19
|
+
const pkg = platforms[key];
|
|
33
20
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
`Try reinstalling: npm install pgplan`
|
|
41
|
-
);
|
|
42
|
-
process.exit(1);
|
|
43
|
-
}
|
|
21
|
+
if (!pkg) {
|
|
22
|
+
console.error(
|
|
23
|
+
`${BIN_NAME}: unsupported platform ${process.platform}/${process.arch}\n` +
|
|
24
|
+
`supported platforms: ${Object.keys(platforms).join(", ")}`
|
|
25
|
+
);
|
|
26
|
+
process.exit(1);
|
|
44
27
|
}
|
|
45
28
|
|
|
46
|
-
|
|
29
|
+
let binPath;
|
|
30
|
+
try {
|
|
31
|
+
const binFile = process.platform === "win32" ? `${BIN_NAME}.exe` : BIN_NAME;
|
|
32
|
+
binPath = require.resolve(`${pkg}/bin/${binFile}`);
|
|
33
|
+
} catch (e) {
|
|
34
|
+
console.error(
|
|
35
|
+
`${BIN_NAME}: could not find platform package ${pkg}\n` +
|
|
36
|
+
`try reinstalling: npm install -g ${BIN_NAME}`
|
|
37
|
+
);
|
|
38
|
+
process.exit(1);
|
|
39
|
+
}
|
|
47
40
|
|
|
48
41
|
try {
|
|
49
|
-
|
|
50
|
-
stdio: "inherit",
|
|
51
|
-
env: process.env,
|
|
52
|
-
});
|
|
42
|
+
execFileSync(binPath, process.argv.slice(2), { stdio: "inherit" });
|
|
53
43
|
} catch (e) {
|
|
54
|
-
|
|
55
|
-
process.exit(e.status);
|
|
56
|
-
}
|
|
57
|
-
throw e;
|
|
44
|
+
process.exit(e.status ?? 1);
|
|
58
45
|
}
|
package/package.json
CHANGED
|
@@ -1,29 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pgplan",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "Analyze and compare PostgreSQL query plans",
|
|
5
|
-
"repository": {
|
|
6
|
-
"type": "git",
|
|
7
|
-
"url": "git+https://github.com/JacobArthurs/pgplan.git"
|
|
8
|
-
},
|
|
9
|
-
"author": "Jacob Arthurs",
|
|
10
5
|
"license": "MIT",
|
|
11
|
-
"
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
6
|
+
"repository": "https://github.com/JacobArthurs/pgplan",
|
|
7
|
+
"files": [
|
|
8
|
+
"bin"
|
|
9
|
+
],
|
|
15
10
|
"bin": {
|
|
16
11
|
"pgplan": "bin/pgplan"
|
|
17
12
|
},
|
|
18
|
-
"files": [
|
|
19
|
-
"bin/**",
|
|
20
|
-
"README.md"
|
|
21
|
-
],
|
|
22
13
|
"optionalDependencies": {
|
|
23
|
-
"@pgplan/
|
|
24
|
-
"@pgplan/
|
|
25
|
-
"@pgplan/
|
|
26
|
-
"@pgplan/
|
|
27
|
-
"@pgplan/win32-
|
|
14
|
+
"@pgplan/pgplan-darwin-arm64": "1.1.0",
|
|
15
|
+
"@pgplan/pgplan-darwin-x64": "1.1.0",
|
|
16
|
+
"@pgplan/pgplan-linux-arm64": "1.1.0",
|
|
17
|
+
"@pgplan/pgplan-linux-x64": "1.1.0",
|
|
18
|
+
"@pgplan/pgplan-win32-arm64": "1.1.0",
|
|
19
|
+
"@pgplan/pgplan-win32-x64": "1.1.0"
|
|
28
20
|
}
|
|
29
21
|
}
|