tiefrun 1.0.0 → 1.0.2-next.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/tiefrun.js +21 -23
- package/package.json +10 -12
- package/bin/tiefrun-darwin-arm64 +0 -0
- package/bin/tiefrun-darwin-x64 +0 -0
- package/bin/tiefrun-linux-arm64 +0 -0
- package/bin/tiefrun-linux-x64 +0 -0
- package/bin/tiefrun-win32-x64.exe +0 -0
package/bin/tiefrun.js
CHANGED
|
@@ -1,37 +1,35 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
// TR-33: resolve the per-platform package npm installed for this host (each
|
|
3
|
+
// sub-package is os/cpu-gated, so only one is present) and exec its binary as
|
|
4
|
+
// `tiefrun` (argv0) so --help/usage shows the right program name.
|
|
2
5
|
const { spawn } = require('child_process');
|
|
3
6
|
const path = require('path');
|
|
4
|
-
const os = require('os');
|
|
5
|
-
const fs = require('fs');
|
|
6
7
|
|
|
7
|
-
function
|
|
8
|
-
const platform =
|
|
9
|
-
const arch =
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
name = arch === 'arm64' ? 'tiefrun-linux-arm64' : 'tiefrun-linux-x64';
|
|
17
|
-
} else {
|
|
18
|
-
throw new Error(`Unsupported platform: ${platform}/${arch}`);
|
|
19
|
-
}
|
|
20
|
-
const p = path.join(__dirname, name);
|
|
21
|
-
if (!fs.existsSync(p)) {
|
|
8
|
+
function binaryPath() {
|
|
9
|
+
const platform = process.platform; // darwin | linux | win32
|
|
10
|
+
const arch = process.arch; // x64 | arm64
|
|
11
|
+
const pkg = `@microrapid/tiefrun-${platform}-${arch}`;
|
|
12
|
+
const exe = platform === 'win32' ? 'tiefrun.exe' : 'tiefrun';
|
|
13
|
+
let pkgJson;
|
|
14
|
+
try {
|
|
15
|
+
pkgJson = require.resolve(`${pkg}/package.json`);
|
|
16
|
+
} catch (e) {
|
|
22
17
|
throw new Error(
|
|
23
|
-
`
|
|
24
|
-
`
|
|
18
|
+
`Missing platform package '${pkg}'. Reinstall tiefrun with optional ` +
|
|
19
|
+
`dependencies enabled (npm install --include=optional), or download a ` +
|
|
20
|
+
`binary from https://github.com/microrapids/api-runtime/releases`
|
|
25
21
|
);
|
|
26
22
|
}
|
|
27
|
-
return
|
|
23
|
+
return path.join(path.dirname(pkgJson), 'bin', exe);
|
|
28
24
|
}
|
|
29
25
|
|
|
30
26
|
try {
|
|
31
|
-
const
|
|
32
|
-
const child = spawn(binary, process.argv.slice(2), { stdio: 'inherit' });
|
|
27
|
+
const child = spawn(binaryPath(), process.argv.slice(2), { stdio: 'inherit', argv0: 'tiefrun' });
|
|
33
28
|
child.on('error', (err) => { console.error('tiefrun:', err.message); process.exit(1); });
|
|
34
|
-
child.on('exit', (code) =>
|
|
29
|
+
child.on('exit', (code, signal) => {
|
|
30
|
+
if (signal) process.kill(process.pid, signal);
|
|
31
|
+
else process.exit(code === null ? 1 : code);
|
|
32
|
+
});
|
|
35
33
|
} catch (err) {
|
|
36
34
|
console.error('tiefrun:', err.message);
|
|
37
35
|
process.exit(1);
|
package/package.json
CHANGED
|
@@ -1,21 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tiefrun",
|
|
3
|
-
"version": "1.0.0",
|
|
3
|
+
"version": "1.0.2-next.0",
|
|
4
4
|
"description": "MicroRapids API Runtime - executable OpenAPI specifications",
|
|
5
|
-
"bin": {
|
|
6
|
-
"tiefrun": "./bin/tiefrun.js"
|
|
7
|
-
},
|
|
5
|
+
"bin": { "tiefrun": "./bin/tiefrun.js" },
|
|
8
6
|
"files": ["bin/**/*"],
|
|
9
|
-
"
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
"
|
|
13
|
-
"
|
|
7
|
+
"optionalDependencies": {
|
|
8
|
+
"@microrapid/tiefrun-linux-x64": "1.0.2-next.0",
|
|
9
|
+
"@microrapid/tiefrun-linux-arm64": "1.0.2-next.0",
|
|
10
|
+
"@microrapid/tiefrun-darwin-x64": "1.0.2-next.0",
|
|
11
|
+
"@microrapid/tiefrun-darwin-arm64": "1.0.2-next.0",
|
|
12
|
+
"@microrapid/tiefrun-win32-x64": "1.0.2-next.0"
|
|
14
13
|
},
|
|
14
|
+
"repository": { "type": "git", "url": "https://github.com/microrapids/api-runtime.git" },
|
|
15
15
|
"keywords": ["cli", "api", "openapi", "testing", "rest", "graphql"],
|
|
16
16
|
"author": "MicroRapids Team",
|
|
17
17
|
"license": "MIT",
|
|
18
|
-
"engines": {
|
|
19
|
-
"node": ">=14.0.0"
|
|
20
|
-
}
|
|
18
|
+
"engines": { "node": ">=14.0.0" }
|
|
21
19
|
}
|
package/bin/tiefrun-darwin-arm64
DELETED
|
Binary file
|
package/bin/tiefrun-darwin-x64
DELETED
|
Binary file
|
package/bin/tiefrun-linux-arm64
DELETED
|
Binary file
|
package/bin/tiefrun-linux-x64
DELETED
|
Binary file
|
|
Binary file
|