@presolve/cli 0.1.0-alpha.7

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/LICENSE ADDED
@@ -0,0 +1 @@
1
+ MIT OR Apache-2.0
package/README.md ADDED
@@ -0,0 +1,8 @@
1
+ # @presolve/cli
2
+
3
+ This package installs the `presolve` compiler command. It selects the matching
4
+ platform binary from a package published with the same Presolve release.
5
+
6
+ It supports macOS on Apple Silicon and Intel, Linux x64, and Windows x64 in the
7
+ 0.1 alpha train. The launcher never downloads or builds a compiler during an
8
+ application install; package bytes are the release artifact.
@@ -0,0 +1,40 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire } from "node:module";
3
+ import { existsSync } from "node:fs";
4
+ import { spawnSync } from "node:child_process";
5
+
6
+ const require = createRequire(import.meta.url);
7
+ const platformPackage = new Map([
8
+ ["darwin-arm64", "@presolve/cli-darwin-arm64"],
9
+ ["darwin-x64", "@presolve/cli-darwin-x64"],
10
+ ["linux-x64", "@presolve/cli-linux-x64"],
11
+ ["win32-x64", "@presolve/cli-win32-x64"],
12
+ ]).get(`${process.platform}-${process.arch}`);
13
+
14
+ const binary = process.env.PRESOLVE_BINARY || resolvePlatformBinary(platformPackage);
15
+ if (!binary) {
16
+ console.error(
17
+ `Presolve 0.1 alpha does not include a CLI binary for ${process.platform}-${process.arch}. ` +
18
+ "See https://github.com/fierstdev/presolve#supported-platforms."
19
+ );
20
+ process.exit(1);
21
+ }
22
+
23
+ const child = spawnSync(binary, process.argv.slice(2), { stdio: "inherit" });
24
+ if (child.error) {
25
+ console.error(`Unable to start Presolve: ${child.error.message}`);
26
+ process.exit(1);
27
+ }
28
+ process.exit(child.status ?? 1);
29
+
30
+ function resolvePlatformBinary(packageName) {
31
+ if (!packageName) return null;
32
+ const executable = process.platform === "win32" ? "presolve.exe" : "presolve";
33
+ try {
34
+ const manifest = require.resolve(`${packageName}/package.json`);
35
+ const binaryPath = new URL(`./bin/${executable}`, `file://${manifest}`).pathname;
36
+ return existsSync(binaryPath) ? binaryPath : null;
37
+ } catch {
38
+ return null;
39
+ }
40
+ }
package/package.json ADDED
@@ -0,0 +1,29 @@
1
+ {
2
+ "name": "@presolve/cli",
3
+ "version": "0.1.0-alpha.7",
4
+ "description": "The Presolve compiler command-line interface.",
5
+ "license": "MIT OR Apache-2.0",
6
+ "type": "module",
7
+ "bin": {
8
+ "presolve": "./bin/presolve.mjs"
9
+ },
10
+ "files": [
11
+ "bin",
12
+ "README.md"
13
+ ],
14
+ "optionalDependencies": {
15
+ "@presolve/cli-linux-x64": "0.1.0-alpha.7",
16
+ "@presolve/cli-darwin-arm64": "0.1.0-alpha.7",
17
+ "@presolve/cli-win32-x64": "0.1.0-alpha.7",
18
+ "@presolve/cli-darwin-x64": "0.1.0-alpha.7"
19
+ },
20
+ "repository": {
21
+ "type": "git",
22
+ "url": "git+https://github.com/fierstdev/presolve.git",
23
+ "directory": "packages/cli"
24
+ },
25
+ "publishConfig": {
26
+ "access": "public",
27
+ "tag": "alpha"
28
+ }
29
+ }