transpic-cli 0.1.1 → 0.1.4
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/Cargo.lock +1 -1
- package/Cargo.toml +1 -1
- package/bin/transpic-cli +0 -0
- package/bin/transpic-cli.exe +0 -0
- package/package.json +2 -2
- package/scripts/copy-binary.js +33 -0
package/Cargo.lock
CHANGED
package/Cargo.toml
CHANGED
package/bin/transpic-cli
ADDED
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "transpic-cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"description": "A fast image manipulation CLI tool",
|
|
5
5
|
"main": "src/cli.js",
|
|
6
6
|
"bin": {
|
|
7
7
|
"transpic": "./src/cli.js"
|
|
8
8
|
},
|
|
9
9
|
"scripts": {
|
|
10
|
-
"build": "cargo build --release && node -
|
|
10
|
+
"build": "cargo build --release && node scripts/copy-binary.js"
|
|
11
11
|
},
|
|
12
12
|
"keywords": [
|
|
13
13
|
"cli",
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
|
|
4
|
+
const binDir = path.join(__dirname, '..', 'bin');
|
|
5
|
+
const targetReleaseDir = path.join(__dirname, '..', 'target', 'release');
|
|
6
|
+
|
|
7
|
+
const binaryName = process.platform === 'win32' ? 'transpic-cli.exe' : 'transpic-cli';
|
|
8
|
+
|
|
9
|
+
const source = path.join(targetReleaseDir, binaryName);
|
|
10
|
+
const destination = path.join(binDir, binaryName);
|
|
11
|
+
|
|
12
|
+
if (!fs.existsSync(binDir)) {
|
|
13
|
+
fs.mkdirSync(binDir, { recursive: true });
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
if (!fs.existsSync(source)) {
|
|
17
|
+
console.error(`Error: Source binary not found at ${source}`);
|
|
18
|
+
console.error(`Please run 'cargo build --release' first on this platform.`);
|
|
19
|
+
process.exit(1);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
try {
|
|
23
|
+
fs.copyFileSync(source, destination);
|
|
24
|
+
console.log(`✓ Binary successfully copied to: ${destination}`);
|
|
25
|
+
|
|
26
|
+
if (process.platform !== 'win32') {
|
|
27
|
+
fs.chmodSync(destination, '755');
|
|
28
|
+
console.log(`✓ Execution permissions (chmod 755) applied.`);
|
|
29
|
+
}
|
|
30
|
+
} catch (err) {
|
|
31
|
+
console.error(`Error during binary deployment: ${err.message}`);
|
|
32
|
+
process.exit(1);
|
|
33
|
+
}
|