Skip to content

Commit 7ed5863

Browse files
committed
Add support for Windows
1 parent 759eb9a commit 7ed5863

File tree

3 files changed

+17
-10
lines changed

3 files changed

+17
-10
lines changed

index.cjs

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@ const fs = require('fs');
55
const axios = require('axios');
66
const os = require('os');
77

8-
const binaryPath = path.join(__dirname, 'bin', 'simplelocalize');
8+
let binaryPath = path.join(__dirname, 'bin', 'simplelocalize');
9+
if (os.platform() === 'win32') {
10+
binaryPath += '.exe';
11+
}
912

1013
const isBinaryInstalled = () => {
1114
try {
@@ -69,18 +72,20 @@ async function installBinary() {
6972
writer.on('error', reject);
7073
});
7174

72-
console.log('SimpleLocalize CLI downloaded successfully!');
73-
7475
// Make it executable (only on Unix-based systems)
7576
if (os.platform() !== 'win32') {
77+
console.log('Making binary executable...');
7678
fs.chmodSync(binaryPath, 0o755);
7779
}
78-
79-
console.log('Binary is now executable.');
8080
}
8181

8282
const linkToNodeModulesBin = () => {
83-
const nodeModulesBinPath = path.join(__dirname, '..', '..', '.bin', 'simplelocalize');
83+
let nodeModulesBinPath = path.join(__dirname, '..', '..', '.bin', 'simplelocalize');
84+
85+
if (os.platform() === 'win32') {
86+
nodeModulesBinPath += '.exe';
87+
}
88+
8489
if (fs.existsSync(nodeModulesBinPath)) {
8590
fs.unlinkSync(nodeModulesBinPath);
8691
}

package-lock.json

Lines changed: 3 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@simplelocalize/cli",
3-
"version": "1.0.6",
3+
"version": "1.0.7",
44
"description": "SimpleLocalize CLI for NPM",
55
"main": "index.cjs",
66
"type": "module",
@@ -9,7 +9,8 @@
99
"postinstall": "node index.cjs install"
1010
},
1111
"bin": {
12-
"install": "index.cjs"
12+
"install": "index.cjs",
13+
"simplelocalize": "bin/simplelocalize"
1314
},
1415
"dependencies": {
1516
"axios": "^1.8.3"

0 commit comments

Comments
 (0)