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 CHANGED
@@ -1165,7 +1165,7 @@ dependencies = [
1165
1165
 
1166
1166
  [[package]]
1167
1167
  name = "transpic-cli"
1168
- version = "0.1.1"
1168
+ version = "0.1.4"
1169
1169
  dependencies = [
1170
1170
  "clap",
1171
1171
  "transpic-core",
package/Cargo.toml CHANGED
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "transpic-cli"
3
- version = "0.1.1"
3
+ version = "0.1.4"
4
4
  edition = "2024"
5
5
  publish = false
6
6
 
Binary file
Binary file
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "transpic-cli",
3
- "version": "0.1.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 -e \"const fs = require('fs'); if (!fs.existsSync('./bin')) fs.mkdirSync('./bin'); const b = process.platform === 'win32' ? 'transpic-cli.exe' : 'transpic-cli'; fs.copyFileSync('./target/release/' + b, './bin/' + b);\""
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
+ }