@enjoypi/media-summ 1.0.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.
Files changed (2) hide show
  1. package/bin/media-summ +48 -0
  2. package/package.json +21 -0
package/bin/media-summ ADDED
@@ -0,0 +1,48 @@
1
+ #!/usr/bin/env node
2
+
3
+ "use strict";
4
+
5
+ const { execFileSync } = require("child_process");
6
+ const os = require("os");
7
+ const path = require("path");
8
+
9
+ const PLATFORMS = {
10
+ "linux-x64": "@enjoypi/media-summ-linux-x64",
11
+ "darwin-arm64": "@enjoypi/media-summ-darwin-arm64",
12
+ "win32-x64": "@enjoypi/media-summ-win32-x64",
13
+ };
14
+
15
+ const platformKey = `${process.platform}-${os.arch()}`;
16
+ const pkg = PLATFORMS[platformKey];
17
+
18
+ if (!pkg) {
19
+ console.error(
20
+ `@enjoypi/media-summ: unsupported platform ${platformKey}.\n` +
21
+ `Supported: ${Object.keys(PLATFORMS).join(", ")}`
22
+ );
23
+ process.exit(1);
24
+ }
25
+
26
+ const binName = process.platform === "win32" ? "media-summ.exe" : "media-summ";
27
+
28
+ let binPath;
29
+ try {
30
+ const pkgDir = path.dirname(require.resolve(`${pkg}/package.json`));
31
+ binPath = path.join(pkgDir, "bin", binName);
32
+ } catch {
33
+ console.error(
34
+ `@enjoypi/media-summ: could not find ${pkg}.\n` +
35
+ `Try reinstalling: npm install -g @enjoypi/media-summ`
36
+ );
37
+ process.exit(1);
38
+ }
39
+
40
+ try {
41
+ execFileSync(binPath, process.argv.slice(2), { stdio: "inherit" });
42
+ } catch (err) {
43
+ if (err && typeof err === "object" && "status" in err && err.status !== null) {
44
+ process.exitCode = err.status;
45
+ } else {
46
+ process.exitCode = 1;
47
+ }
48
+ }
package/package.json ADDED
@@ -0,0 +1,21 @@
1
+ {
2
+ "name": "@enjoypi/media-summ",
3
+ "version": "1.0.0",
4
+ "description": "Media subtitle downloader and summarizer",
5
+ "bin": {
6
+ "media-summ": "bin/media-summ"
7
+ },
8
+ "files": [
9
+ "bin/media-summ"
10
+ ],
11
+ "optionalDependencies": {
12
+ "@enjoypi/media-summ-linux-x64": "1.0.0",
13
+ "@enjoypi/media-summ-darwin-arm64": "1.0.0",
14
+ "@enjoypi/media-summ-win32-x64": "1.0.0"
15
+ },
16
+ "repository": {
17
+ "type": "git",
18
+ "url": "https://github.com/enjoypi/media-summ"
19
+ },
20
+ "license": "ISC"
21
+ }