@idiomatic-sh/tastemaker 0.0.0-stage → 0.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/LICENSE +21 -0
- package/launcher.js +44 -0
- package/package.json +24 -4
- package/README.md +0 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Jon Young
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/launcher.js
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Runs the native tastemaker binary from the platform package npm installed for this
|
|
3
|
+
// machine, one of this package's optionalDependencies, passing its arguments, standard
|
|
4
|
+
// streams, signals and exit status through.
|
|
5
|
+
"use strict";
|
|
6
|
+
|
|
7
|
+
const { spawn } = require("node:child_process");
|
|
8
|
+
const { optionalDependencies } = require("./package.json");
|
|
9
|
+
|
|
10
|
+
const executable = process.platform === "win32" ? "tm.exe" : "tm";
|
|
11
|
+
|
|
12
|
+
function binary() {
|
|
13
|
+
for (const name of Object.keys(optionalDependencies ?? {})) {
|
|
14
|
+
try {
|
|
15
|
+
return require.resolve(`${name}/bin/${executable}`);
|
|
16
|
+
} catch {
|
|
17
|
+
// Not this machine's platform: npm skipped the package.
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
throw new Error(
|
|
21
|
+
`@idiomatic-sh/tastemaker: no platform package is installed for ${process.platform}-${process.arch}; reinstall without --omit=optional`,
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const forwarded = ["SIGINT", "SIGTERM", "SIGHUP"];
|
|
26
|
+
const child = spawn(binary(), process.argv.slice(2), { stdio: "inherit" });
|
|
27
|
+
for (const signal of forwarded) {
|
|
28
|
+
// A signal sent to this process alone reaches the binary too.
|
|
29
|
+
process.on(signal, () => child.kill(signal));
|
|
30
|
+
}
|
|
31
|
+
child.on("error", (error) => {
|
|
32
|
+
throw error;
|
|
33
|
+
});
|
|
34
|
+
child.on("exit", (status, signal) => {
|
|
35
|
+
if (signal) {
|
|
36
|
+
// End the way the binary ended, so the caller sees the same signal.
|
|
37
|
+
for (const name of forwarded) {
|
|
38
|
+
process.removeAllListeners(name);
|
|
39
|
+
}
|
|
40
|
+
process.kill(process.pid, signal);
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
process.exit(status ?? 1);
|
|
44
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,26 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@idiomatic-sh/tastemaker",
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
|
|
6
|
-
}
|
|
3
|
+
"description": "The tastemaker command line: runs the native binary from the platform package npm installs for this machine.",
|
|
4
|
+
"bin": {
|
|
5
|
+
"tm": "launcher.js"
|
|
6
|
+
},
|
|
7
|
+
"files": [
|
|
8
|
+
"launcher.js"
|
|
9
|
+
],
|
|
10
|
+
"engines": {
|
|
11
|
+
"node": ">=18"
|
|
12
|
+
},
|
|
13
|
+
"version": "0.1.0",
|
|
14
|
+
"license": "MIT",
|
|
15
|
+
"repository": "https://github.com/idiomatic-sh/idiomatic",
|
|
16
|
+
"optionalDependencies": {
|
|
17
|
+
"@idiomatic-sh/tastemaker-aarch64-apple-darwin": "0.1.0",
|
|
18
|
+
"@idiomatic-sh/tastemaker-aarch64-pc-windows-msvc": "0.1.0",
|
|
19
|
+
"@idiomatic-sh/tastemaker-aarch64-unknown-linux-gnu": "0.1.0",
|
|
20
|
+
"@idiomatic-sh/tastemaker-aarch64-unknown-linux-musl": "0.1.0",
|
|
21
|
+
"@idiomatic-sh/tastemaker-x86_64-apple-darwin": "0.1.0",
|
|
22
|
+
"@idiomatic-sh/tastemaker-x86_64-pc-windows-msvc": "0.1.0",
|
|
23
|
+
"@idiomatic-sh/tastemaker-x86_64-unknown-linux-gnu": "0.1.0",
|
|
24
|
+
"@idiomatic-sh/tastemaker-x86_64-unknown-linux-musl": "0.1.0"
|
|
25
|
+
}
|
|
26
|
+
}
|
package/README.md
DELETED