@magnet-ai/cli 0.1.2 → 0.1.3
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/README.md +3 -4
- package/bin/magnet.js +13 -4
- package/package.json +1 -2
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @magnet-ai/cli
|
|
2
2
|
|
|
3
|
-
Install the **Magnet CLI** via npm. This package downloads the native binary for your platform from [GitHub Releases](https://github.com/toolkit-ai/magnet-cli/releases)
|
|
3
|
+
Install the **Magnet CLI** via npm. This package downloads the native binary for your platform from [GitHub Releases](https://github.com/toolkit-ai/magnet-cli/releases) the **first time you run `magnet`** (so `npm install -g` finishes quickly). You do not need Node.js to run the CLI after the binary is downloaded.
|
|
4
4
|
|
|
5
5
|
## Install
|
|
6
6
|
|
|
@@ -8,7 +8,7 @@ Install the **Magnet CLI** via npm. This package downloads the native binary for
|
|
|
8
8
|
npm install -g @magnet-ai/cli
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
The first time you run `magnet`, it will download the binary (~30s); after that it runs instantly. Example:
|
|
12
12
|
|
|
13
13
|
```bash
|
|
14
14
|
magnet --help
|
|
@@ -33,10 +33,9 @@ From the `npm` folder, run the download script to fetch the binary from the late
|
|
|
33
33
|
```bash
|
|
34
34
|
cd npm
|
|
35
35
|
npm run download
|
|
36
|
-
# or: node bin/download.js
|
|
37
36
|
```
|
|
38
37
|
|
|
39
|
-
To test against a specific release tag: `MAGNET_CLI_VERSION=v0.1.0
|
|
38
|
+
To test against a specific release tag: `MAGNET_CLI_VERSION=v0.1.0 npm run download`. Then run `./bin/magnet.js --help` to confirm the binary works.
|
|
40
39
|
|
|
41
40
|
## Full documentation
|
|
42
41
|
|
package/bin/magnet.js
CHANGED
|
@@ -7,10 +7,19 @@ const binDir = path.join(__dirname, '..', 'bin');
|
|
|
7
7
|
const binary = path.join(binDir, process.platform === 'win32' ? 'magnet.exe' : 'magnet');
|
|
8
8
|
|
|
9
9
|
if (!fs.existsSync(binary)) {
|
|
10
|
-
console.
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
console.info('magnet: Downloading binary...');
|
|
11
|
+
const download = spawnSync(process.execPath, [path.join(__dirname, 'download.js')], {
|
|
12
|
+
stdio: 'inherit',
|
|
13
|
+
cwd: path.join(__dirname, '..'),
|
|
14
|
+
});
|
|
15
|
+
if (download.status !== 0) {
|
|
16
|
+
console.error('magnet: download failed. Ensure a GitHub Release exists (e.g. tag v0.1.0).');
|
|
17
|
+
process.exit(1);
|
|
18
|
+
}
|
|
19
|
+
if (!fs.existsSync(binary)) {
|
|
20
|
+
console.error('magnet: binary still missing after download.');
|
|
21
|
+
process.exit(1);
|
|
22
|
+
}
|
|
14
23
|
}
|
|
15
24
|
|
|
16
25
|
const result = spawnSync(binary, process.argv.slice(2), {
|
package/package.json
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@magnet-ai/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "Magnet CLI - download the native binary for your platform",
|
|
5
5
|
"bin": {
|
|
6
6
|
"magnet": "bin/magnet.js"
|
|
7
7
|
},
|
|
8
8
|
"scripts": {
|
|
9
|
-
"postinstall": "node bin/download.js",
|
|
10
9
|
"download": "node bin/download.js"
|
|
11
10
|
},
|
|
12
11
|
"repository": {
|