@shumai-one/shumai-transcode 0.0.1

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.
@@ -0,0 +1,66 @@
1
+ #!/usr/bin/env node
2
+ import { spawn } from 'node:child_process'
3
+ import { join, dirname } from 'node:path'
4
+ import { fileURLToPath } from 'node:url'
5
+ import { existsSync } from 'node:fs'
6
+
7
+ const __dirname = dirname(fileURLToPath(import.meta.url))
8
+ const platform = process.platform
9
+ const arch = process.arch
10
+
11
+ let pkgName = ''
12
+ let binaryName = ''
13
+
14
+ if (platform === 'darwin' && arch === 'arm64') {
15
+ pkgName = '@shumai-one/shumai-transcode-darwin-arm64'
16
+ binaryName = 'shumai-transcode'
17
+ } else if (platform === 'darwin' && arch === 'x64') {
18
+ pkgName = '@shumai-one/shumai-transcode-darwin-x64'
19
+ binaryName = 'shumai-transcode'
20
+ } else if (platform === 'linux' && arch === 'arm64') {
21
+ pkgName = '@shumai-one/shumai-transcode-linux-arm64'
22
+ binaryName = 'shumai-transcode'
23
+ } else if (platform === 'linux' && arch === 'x64') {
24
+ pkgName = '@shumai-one/shumai-transcode-linux-x64'
25
+ binaryName = 'shumai-transcode'
26
+ } else if (platform === 'win32' && arch === 'arm64') {
27
+ pkgName = '@shumai-one/shumai-transcode-win32-arm64'
28
+ binaryName = 'shumai-transcode.exe'
29
+ } else if (platform === 'win32' && arch === 'x64') {
30
+ pkgName = '@shumai-one/shumai-transcode-win32-x64'
31
+ binaryName = 'shumai-transcode.exe'
32
+ } else {
33
+ console.error(`Unsupported platform/architecture: ${platform}/${arch}`)
34
+ process.exit(1)
35
+ }
36
+
37
+ const pathsToTry = [
38
+ join(__dirname, '..', '..', '..', pkgName, 'bin', binaryName), // Flat node_modules
39
+ join(__dirname, '..', '..', 'node_modules', pkgName, 'bin', binaryName), // Nested node_modules
40
+ ]
41
+
42
+ let binaryPath = ''
43
+ for (const p of pathsToTry) {
44
+ if (existsSync(p)) {
45
+ binaryPath = p
46
+ break
47
+ }
48
+ }
49
+
50
+ if (!binaryPath) {
51
+ console.error(`Could not find binary for platform package "${pkgName}". Please ensure optional dependencies are installed.`)
52
+ process.exit(1)
53
+ }
54
+
55
+ const child = spawn(binaryPath, process.argv.slice(2), {
56
+ stdio: 'inherit',
57
+ })
58
+
59
+ child.on('close', (code) => {
60
+ process.exit(code ?? 0)
61
+ })
62
+
63
+ child.on('error', (err) => {
64
+ console.error(`Failed to start child process:`, err)
65
+ process.exit(1)
66
+ })
package/package.json ADDED
@@ -0,0 +1,33 @@
1
+ {
2
+ "name": "@shumai-one/shumai-transcode",
3
+ "version": "0.0.1",
4
+ "description": "Media transcoding worker for the shumai media workspace",
5
+ "type": "module",
6
+ "bin": {
7
+ "shumai-transcode": "./bin/shumai-transcode.js"
8
+ },
9
+ "files": [
10
+ "bin"
11
+ ],
12
+ "dependencies": {
13
+ "@prisma/client": "7.8.0",
14
+ "@prisma/adapter-pg": "7.8.0",
15
+ "pg": "8.21.0",
16
+ "sharp": "0.34.5",
17
+ "pino": "10.3.1",
18
+ "pino-pretty": "13.1.3",
19
+ "@temporalio/activity": "1.17.2",
20
+ "@temporalio/client": "1.17.2",
21
+ "@temporalio/worker": "1.17.2",
22
+ "@temporalio/workflow": "1.17.2",
23
+ "prisma": "7.8.0"
24
+ },
25
+ "optionalDependencies": {
26
+ "@shumai-one/shumai-transcode-darwin-arm64": "0.0.1",
27
+ "@shumai-one/shumai-transcode-darwin-x64": "0.0.1",
28
+ "@shumai-one/shumai-transcode-linux-arm64": "0.0.1",
29
+ "@shumai-one/shumai-transcode-linux-x64": "0.0.1",
30
+ "@shumai-one/shumai-transcode-win32-arm64": "0.0.1",
31
+ "@shumai-one/shumai-transcode-win32-x64": "0.0.1"
32
+ }
33
+ }