docx2udf 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.
- package/package.json +20 -0
- package/run.js +44 -0
package/package.json
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "docx2udf",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "DOCX/PDF to UDF converter CLI (login-gated)",
|
|
5
|
+
"bin": {
|
|
6
|
+
"docx2udf": "run.js"
|
|
7
|
+
},
|
|
8
|
+
"files": [
|
|
9
|
+
"run.js"
|
|
10
|
+
],
|
|
11
|
+
"engines": {
|
|
12
|
+
"node": ">=18"
|
|
13
|
+
},
|
|
14
|
+
"optionalDependencies": {
|
|
15
|
+
"@saidsurucu/darwin-arm64": "1.0.0",
|
|
16
|
+
"@saidsurucu/darwin-x64": "1.0.0",
|
|
17
|
+
"@saidsurucu/linux-x64": "1.0.0",
|
|
18
|
+
"@saidsurucu/win32-x64": "1.0.0"
|
|
19
|
+
}
|
|
20
|
+
}
|
package/run.js
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
const { spawnSync } = require('node:child_process');
|
|
4
|
+
const { existsSync } = require('node:fs');
|
|
5
|
+
const os = require('node:os');
|
|
6
|
+
|
|
7
|
+
// Resolve the platform binary: explicit override (dev/test) → bundled
|
|
8
|
+
// optionalDependency package (@saidsrc/<platform>-<arch>).
|
|
9
|
+
function resolveBinary() {
|
|
10
|
+
if (process.env.DOCX2UDF_BIN) return process.env.DOCX2UDF_BIN;
|
|
11
|
+
const platform = process.platform; // 'darwin' | 'linux' | 'win32'
|
|
12
|
+
const arch = process.arch; // 'arm64' | 'x64'
|
|
13
|
+
const exe = platform === 'win32' ? 'docx2udf.exe' : 'docx2udf';
|
|
14
|
+
try {
|
|
15
|
+
return require.resolve(`@saidsrc/${platform}-${arch}/bin/${exe}`);
|
|
16
|
+
} catch {
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const bin = resolveBinary();
|
|
22
|
+
if (!bin || !existsSync(bin)) {
|
|
23
|
+
process.stderr.write(
|
|
24
|
+
`docx2udf: bu platform için ikili dosya bulunamadı (${process.platform}-${process.arch}).\n` +
|
|
25
|
+
`optionalDependencies kurulmamış olabilir. 'npm install docx2udf' ile (optional dahil) yeniden kurun.\n`
|
|
26
|
+
);
|
|
27
|
+
process.exit(1);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const res = spawnSync(bin, process.argv.slice(2), {
|
|
31
|
+
stdio: 'inherit', // terminal signals reach the child via the shared process group
|
|
32
|
+
env: { ...process.env, UDF_CLI_NAME: 'docx2udf' },
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
if (res.error) {
|
|
36
|
+
process.stderr.write(`docx2udf: çalıştırılamadı: ${res.error.message}\n`);
|
|
37
|
+
process.exit(1);
|
|
38
|
+
}
|
|
39
|
+
if (res.signal) {
|
|
40
|
+
// Preserve shell convention so the caller sees signal termination.
|
|
41
|
+
const num = os.constants.signals[res.signal] || 0;
|
|
42
|
+
process.exit(128 + num);
|
|
43
|
+
}
|
|
44
|
+
process.exit(res.status === null ? 1 : res.status);
|