@simplelocalize/cli 1.0.6 → 1.0.8

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.
Files changed (3) hide show
  1. package/README.md +41 -0
  2. package/index.cjs +11 -6
  3. package/package.json +7 -2
package/README.md ADDED
@@ -0,0 +1,41 @@
1
+ # SimpleLocalize CLI via npm (work in progress)
2
+
3
+ The main goal of this project is to give fronted developers
4
+ an easier way to use [SimpleLocalize CLI](https://github.com/simplelocalize/simplelocalize-cli)
5
+ in their workflows.
6
+
7
+ ## Installation
8
+
9
+ ```
10
+ npm install @simplelocalize/cli@1.0.8
11
+ ```
12
+
13
+ After installing the package, it should automatically choose the right binary for
14
+ your system and install it into `node_modules/.bin` directory, to make it available for your
15
+ scripts in `package.json`.
16
+
17
+ > The work on this package is in progress, and at time of writing this documentation, the plugin installs the newest version of the CLI, which is 2.8.0
18
+
19
+ ## Usage
20
+
21
+ Package SimpleLocalize CLI in your project and makes it available in `package.json` scripts.
22
+
23
+
24
+ ```
25
+ {
26
+ "name": "My project",
27
+ "version": "1.0.0",
28
+ "private": true,
29
+ "dependencies": {
30
+ "@simplelocalize/cli": "^1.0.8",
31
+ },
32
+ "scripts": {
33
+ "start": "react-scripts start",
34
+ "sl:download": "simplelocalize downlaod",
35
+ "sl:upload": "simplelocalize upload",
36
+ "sl:autotranslate": "simplelocalize autotranslate"
37
+ },
38
+ }
39
+ ```
40
+
41
+ Learn more about [SimpleLocalize CLI commands](https://github.com/simplelocalize/simplelocalize-cli)
package/index.cjs CHANGED
@@ -5,7 +5,10 @@ const fs = require('fs');
5
5
  const axios = require('axios');
6
6
  const os = require('os');
7
7
 
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
+ }
9
12
 
10
13
  const isBinaryInstalled = () => {
11
14
  try {
@@ -69,18 +72,20 @@ async function installBinary() {
69
72
  writer.on('error', reject);
70
73
  });
71
74
 
72
- console.log('SimpleLocalize CLI downloaded successfully!');
73
-
74
75
  // Make it executable (only on Unix-based systems)
75
76
  if (os.platform() !== 'win32') {
77
+ console.log('Making binary executable...');
76
78
  fs.chmodSync(binaryPath, 0o755);
77
79
  }
78
-
79
- console.log('Binary is now executable.');
80
80
  }
81
81
 
82
82
  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
+
84
89
  if (fs.existsSync(nodeModulesBinPath)) {
85
90
  fs.unlinkSync(nodeModulesBinPath);
86
91
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@simplelocalize/cli",
3
- "version": "1.0.6",
3
+ "version": "1.0.8",
4
4
  "description": "SimpleLocalize CLI for NPM",
5
5
  "main": "index.cjs",
6
6
  "type": "module",
@@ -8,8 +8,13 @@
8
8
  "start": "node index.cjs",
9
9
  "postinstall": "node index.cjs install"
10
10
  },
11
+ "repository": {
12
+ "type": "git",
13
+ "url": "https://github.com/simplelocalize/simplelicalize-cli-npm.git"
14
+ },
11
15
  "bin": {
12
- "install": "index.cjs"
16
+ "install": "index.cjs",
17
+ "simplelocalize": "bin/simplelocalize"
13
18
  },
14
19
  "dependencies": {
15
20
  "axios": "^1.8.3"