@jamicaw56/yopes 0.1.54 → 0.1.56
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 +12 -12
- package/bin/yopes.js +30 -30
- package/install.js +116 -116
- package/package.json +25 -25
package/README.md
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
# yopes (npm)
|
|
2
|
-
|
|
3
|
-
`npm install -g yopes` installs the yopes coding CLI.
|
|
4
|
-
|
|
5
|
-
The package is a thin wrapper: `postinstall` downloads the release binary for
|
|
6
|
-
your platform from [GitHub Releases](https://github.com/Jamicaw56/YopesCLI/releases),
|
|
7
|
-
verifies its SHA256 checksum against `SHA256SUMS`, and drops it next to the
|
|
8
|
-
`bin` shim. Supported platforms: `win32-x64` and `linux-x64`.
|
|
9
|
-
|
|
10
|
-
The `yopes` command then runs the binary directly. If the postinstall step was
|
|
11
|
-
skipped (`npm install --ignore-scripts`), the shim says so and points at the
|
|
12
|
-
releases page.
|
|
1
|
+
# yopes (npm)
|
|
2
|
+
|
|
3
|
+
`npm install -g @jamicaw56/yopes` installs the yopes coding CLI.
|
|
4
|
+
|
|
5
|
+
The package is a thin wrapper: `postinstall` downloads the release binary for
|
|
6
|
+
your platform from [GitHub Releases](https://github.com/Jamicaw56/YopesCLI/releases),
|
|
7
|
+
verifies its SHA256 checksum against `SHA256SUMS`, and drops it next to the
|
|
8
|
+
`bin` shim. Supported platforms: `win32-x64` and `linux-x64`.
|
|
9
|
+
|
|
10
|
+
The `yopes` command then runs the binary directly. If the postinstall step was
|
|
11
|
+
skipped (`npm install --ignore-scripts`), the shim says so and points at the
|
|
12
|
+
releases page.
|
package/bin/yopes.js
CHANGED
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
// npm bin shim: npm links this file, then it execs the release binary the
|
|
3
|
-
// postinstall script downloaded. Works whether or not scripts ran.
|
|
4
|
-
const { spawn } = require('child_process');
|
|
5
|
-
const fs = require('fs');
|
|
6
|
-
const path = require('path');
|
|
7
|
-
|
|
8
|
-
const binary = path.join(__dirname, process.platform === 'win32' ? 'yopes.exe' : 'yopes');
|
|
9
|
-
|
|
10
|
-
if (!fs.existsSync(binary)) {
|
|
11
|
-
console.error(
|
|
12
|
-
'The yopes binary is missing. The postinstall step either failed or was skipped\n' +
|
|
13
|
-
'(npm install --ignore-scripts). Run `npm rebuild yopes` or install from\n' +
|
|
14
|
-
'https://github.com/Jamicaw56/YopesCLI/releases'
|
|
15
|
-
);
|
|
16
|
-
process.exit(1);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
const child = spawn(binary, process.argv.slice(2), { stdio: 'inherit' });
|
|
20
|
-
child.on('error', (error) => {
|
|
21
|
-
console.error(`could not run ${binary}: ${error.message}`);
|
|
22
|
-
process.exit(1);
|
|
23
|
-
});
|
|
24
|
-
child.on('exit', (code, signal) => {
|
|
25
|
-
if (signal) {
|
|
26
|
-
process.kill(process.pid, signal);
|
|
27
|
-
} else {
|
|
28
|
-
process.exit(code === null || code === undefined ? 0 : code);
|
|
29
|
-
}
|
|
30
|
-
});
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// npm bin shim: npm links this file, then it execs the release binary the
|
|
3
|
+
// postinstall script downloaded. Works whether or not scripts ran.
|
|
4
|
+
const { spawn } = require('child_process');
|
|
5
|
+
const fs = require('fs');
|
|
6
|
+
const path = require('path');
|
|
7
|
+
|
|
8
|
+
const binary = path.join(__dirname, process.platform === 'win32' ? 'yopes.exe' : 'yopes');
|
|
9
|
+
|
|
10
|
+
if (!fs.existsSync(binary)) {
|
|
11
|
+
console.error(
|
|
12
|
+
'The yopes binary is missing. The postinstall step either failed or was skipped\n' +
|
|
13
|
+
'(npm install --ignore-scripts). Run `npm rebuild yopes` or install from\n' +
|
|
14
|
+
'https://github.com/Jamicaw56/YopesCLI/releases'
|
|
15
|
+
);
|
|
16
|
+
process.exit(1);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const child = spawn(binary, process.argv.slice(2), { stdio: 'inherit' });
|
|
20
|
+
child.on('error', (error) => {
|
|
21
|
+
console.error(`could not run ${binary}: ${error.message}`);
|
|
22
|
+
process.exit(1);
|
|
23
|
+
});
|
|
24
|
+
child.on('exit', (code, signal) => {
|
|
25
|
+
if (signal) {
|
|
26
|
+
process.kill(process.pid, signal);
|
|
27
|
+
} else {
|
|
28
|
+
process.exit(code === null || code === undefined ? 0 : code);
|
|
29
|
+
}
|
|
30
|
+
});
|
package/install.js
CHANGED
|
@@ -1,116 +1,116 @@
|
|
|
1
|
-
// postinstall: fetch the release binary for this platform from GitHub
|
|
2
|
-
// Releases, verify its SHA256 checksum, and drop it next to bin/yopes.js.
|
|
3
|
-
//
|
|
4
|
-
// ponytail: relies on the system `curl` (ships with Windows 10+ and most
|
|
5
|
-
// Linux) and the system `tar` (bsdtar on Windows reads zip). Upgrade path:
|
|
6
|
-
// an https fetch with redirect handling plus a zip reader when one is needed.
|
|
7
|
-
'use strict';
|
|
8
|
-
|
|
9
|
-
const { spawnSync } = require('child_process');
|
|
10
|
-
const crypto = require('crypto');
|
|
11
|
-
const fs = require('fs');
|
|
12
|
-
const os = require('os');
|
|
13
|
-
const path = require('path');
|
|
14
|
-
|
|
15
|
-
const REPO = 'Jamicaw56/YopesCLI';
|
|
16
|
-
|
|
17
|
-
// One asset per released platform; macOS is excluded from releases.
|
|
18
|
-
const ASSETS = {
|
|
19
|
-
'win32-x64': 'yopes-Windows-X64.zip',
|
|
20
|
-
'linux-x64': 'yopes-Linux-X64.tar.gz',
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
function fail(message) {
|
|
24
|
-
console.error(`yopes postinstall: ${message}`);
|
|
25
|
-
console.error('Install from https://github.com/Jamicaw56/YopesCLI/releases instead.');
|
|
26
|
-
process.exit(1);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
function run(command, args) {
|
|
30
|
-
const result = spawnSync(command, args, { stdio: ['ignore', 'pipe', 'pipe'] });
|
|
31
|
-
if (result.error) {
|
|
32
|
-
fail(`could not run ${command}: ${result.error.message}`);
|
|
33
|
-
}
|
|
34
|
-
return result;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
const asset = ASSETS[`${process.platform}-${process.arch}`];
|
|
38
|
-
if (!asset) {
|
|
39
|
-
fail(
|
|
40
|
-
`no release build for ${process.platform}-${process.arch}. ` +
|
|
41
|
-
'Supported: win32-x64, linux-x64.'
|
|
42
|
-
);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
const version = require('./package.json').version;
|
|
46
|
-
const tag = `v${version}`;
|
|
47
|
-
const base = `https://github.com/${REPO}/releases/download/${tag}`;
|
|
48
|
-
const target = path.join(__dirname, 'bin', process.platform === 'win32' ? 'yopes.exe' : 'yopes');
|
|
49
|
-
|
|
50
|
-
if (fs.existsSync(target)) {
|
|
51
|
-
console.log(`yopes ${version} already installed.`);
|
|
52
|
-
process.exit(0);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
const temporary = fs.mkdtempSync(path.join(os.tmpdir(), 'yopes-install-'));
|
|
56
|
-
try {
|
|
57
|
-
const archive = path.join(temporary, asset);
|
|
58
|
-
const sums = path.join(temporary, 'SHA256SUMS');
|
|
59
|
-
|
|
60
|
-
console.log(`Downloading ${asset} (${tag})...`);
|
|
61
|
-
const download = run('curl', ['-fsSL', '-o', archive, `${base}/${asset}`]);
|
|
62
|
-
if (download.status !== 0) {
|
|
63
|
-
fail(`download failed: ${String(download.stderr).trim()}`);
|
|
64
|
-
}
|
|
65
|
-
const checksums = run('curl', ['-fsSL', '-o', sums, `${base}/SHA256SUMS`]);
|
|
66
|
-
if (checksums.status !== 0) {
|
|
67
|
-
fail(`checksum list download failed: ${String(checksums.stderr).trim()}`);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
// An unverified binary is the one thing we must never install.
|
|
71
|
-
const expected = String(fs.readFileSync(sums, 'utf8'))
|
|
72
|
-
.split(/\r?\n/)
|
|
73
|
-
.filter((line) => line.trimEnd().endsWith(asset))
|
|
74
|
-
.map((line) => line.split(/\s+/)[0].trim())
|
|
75
|
-
.find((hash) => /^[0-9A-Fa-f]{64}$/.test(hash));
|
|
76
|
-
if (!expected) {
|
|
77
|
-
fail(`SHA256SUMS has no line for ${asset}.`);
|
|
78
|
-
}
|
|
79
|
-
const actual = crypto
|
|
80
|
-
.createHash('sha256')
|
|
81
|
-
.update(fs.readFileSync(archive))
|
|
82
|
-
.digest('hex');
|
|
83
|
-
if (actual !== expected) {
|
|
84
|
-
fail(`checksum mismatch for ${asset} (${actual}, expected ${expected}).`);
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
const extracted = path.join(temporary, 'extracted');
|
|
88
|
-
fs.mkdirSync(extracted, { recursive: true });
|
|
89
|
-
// Windows: Expand-Archive (built-in, reads zip). The system tar is either
|
|
90
|
-
// GNU tar, which cannot read zip and reads the drive colon as a remote
|
|
91
|
-
// host, or bsdtar — not worth telling apart. Linux: tar -xzf.
|
|
92
|
-
if (process.platform === 'win32') {
|
|
93
|
-
const script = `Expand-Archive -Path '${archive}' -DestinationPath '${extracted}' -Force`;
|
|
94
|
-
const unzip = run('powershell', ['-NoProfile', '-Command', script]);
|
|
95
|
-
if (unzip.status !== 0) {
|
|
96
|
-
fail(`extraction failed: ${String(unzip.stderr).trim()}`);
|
|
97
|
-
}
|
|
98
|
-
} else {
|
|
99
|
-
const untar = run('tar', ['-xzf', archive, '-C', extracted]);
|
|
100
|
-
if (untar.status !== 0) {
|
|
101
|
-
fail(`extraction failed: ${String(untar.stderr).trim()}`);
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
const binary = path.join(extracted, process.platform === 'win32' ? 'yopes.exe' : 'yopes');
|
|
106
|
-
if (!fs.existsSync(binary)) {
|
|
107
|
-
fail('the release archive does not contain the yopes binary.');
|
|
108
|
-
}
|
|
109
|
-
fs.copyFileSync(binary, target);
|
|
110
|
-
if (process.platform !== 'win32') {
|
|
111
|
-
fs.chmodSync(target, 0o755);
|
|
112
|
-
}
|
|
113
|
-
console.log(`Installed yopes ${version}.`);
|
|
114
|
-
} finally {
|
|
115
|
-
fs.rmSync(temporary, { recursive: true, force: true });
|
|
116
|
-
}
|
|
1
|
+
// postinstall: fetch the release binary for this platform from GitHub
|
|
2
|
+
// Releases, verify its SHA256 checksum, and drop it next to bin/yopes.js.
|
|
3
|
+
//
|
|
4
|
+
// ponytail: relies on the system `curl` (ships with Windows 10+ and most
|
|
5
|
+
// Linux) and the system `tar` (bsdtar on Windows reads zip). Upgrade path:
|
|
6
|
+
// an https fetch with redirect handling plus a zip reader when one is needed.
|
|
7
|
+
'use strict';
|
|
8
|
+
|
|
9
|
+
const { spawnSync } = require('child_process');
|
|
10
|
+
const crypto = require('crypto');
|
|
11
|
+
const fs = require('fs');
|
|
12
|
+
const os = require('os');
|
|
13
|
+
const path = require('path');
|
|
14
|
+
|
|
15
|
+
const REPO = 'Jamicaw56/YopesCLI';
|
|
16
|
+
|
|
17
|
+
// One asset per released platform; macOS is excluded from releases.
|
|
18
|
+
const ASSETS = {
|
|
19
|
+
'win32-x64': 'yopes-Windows-X64.zip',
|
|
20
|
+
'linux-x64': 'yopes-Linux-X64.tar.gz',
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
function fail(message) {
|
|
24
|
+
console.error(`yopes postinstall: ${message}`);
|
|
25
|
+
console.error('Install from https://github.com/Jamicaw56/YopesCLI/releases instead.');
|
|
26
|
+
process.exit(1);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function run(command, args) {
|
|
30
|
+
const result = spawnSync(command, args, { stdio: ['ignore', 'pipe', 'pipe'] });
|
|
31
|
+
if (result.error) {
|
|
32
|
+
fail(`could not run ${command}: ${result.error.message}`);
|
|
33
|
+
}
|
|
34
|
+
return result;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const asset = ASSETS[`${process.platform}-${process.arch}`];
|
|
38
|
+
if (!asset) {
|
|
39
|
+
fail(
|
|
40
|
+
`no release build for ${process.platform}-${process.arch}. ` +
|
|
41
|
+
'Supported: win32-x64, linux-x64.'
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const version = require('./package.json').version;
|
|
46
|
+
const tag = `v${version}`;
|
|
47
|
+
const base = `https://github.com/${REPO}/releases/download/${tag}`;
|
|
48
|
+
const target = path.join(__dirname, 'bin', process.platform === 'win32' ? 'yopes.exe' : 'yopes');
|
|
49
|
+
|
|
50
|
+
if (fs.existsSync(target)) {
|
|
51
|
+
console.log(`yopes ${version} already installed.`);
|
|
52
|
+
process.exit(0);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const temporary = fs.mkdtempSync(path.join(os.tmpdir(), 'yopes-install-'));
|
|
56
|
+
try {
|
|
57
|
+
const archive = path.join(temporary, asset);
|
|
58
|
+
const sums = path.join(temporary, 'SHA256SUMS');
|
|
59
|
+
|
|
60
|
+
console.log(`Downloading ${asset} (${tag})...`);
|
|
61
|
+
const download = run('curl', ['-fsSL', '-o', archive, `${base}/${asset}`]);
|
|
62
|
+
if (download.status !== 0) {
|
|
63
|
+
fail(`download failed: ${String(download.stderr).trim()}`);
|
|
64
|
+
}
|
|
65
|
+
const checksums = run('curl', ['-fsSL', '-o', sums, `${base}/SHA256SUMS`]);
|
|
66
|
+
if (checksums.status !== 0) {
|
|
67
|
+
fail(`checksum list download failed: ${String(checksums.stderr).trim()}`);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// An unverified binary is the one thing we must never install.
|
|
71
|
+
const expected = String(fs.readFileSync(sums, 'utf8'))
|
|
72
|
+
.split(/\r?\n/)
|
|
73
|
+
.filter((line) => line.trimEnd().endsWith(asset))
|
|
74
|
+
.map((line) => line.split(/\s+/)[0].trim())
|
|
75
|
+
.find((hash) => /^[0-9A-Fa-f]{64}$/.test(hash));
|
|
76
|
+
if (!expected) {
|
|
77
|
+
fail(`SHA256SUMS has no line for ${asset}.`);
|
|
78
|
+
}
|
|
79
|
+
const actual = crypto
|
|
80
|
+
.createHash('sha256')
|
|
81
|
+
.update(fs.readFileSync(archive))
|
|
82
|
+
.digest('hex');
|
|
83
|
+
if (actual !== expected) {
|
|
84
|
+
fail(`checksum mismatch for ${asset} (${actual}, expected ${expected}).`);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
const extracted = path.join(temporary, 'extracted');
|
|
88
|
+
fs.mkdirSync(extracted, { recursive: true });
|
|
89
|
+
// Windows: Expand-Archive (built-in, reads zip). The system tar is either
|
|
90
|
+
// GNU tar, which cannot read zip and reads the drive colon as a remote
|
|
91
|
+
// host, or bsdtar — not worth telling apart. Linux: tar -xzf.
|
|
92
|
+
if (process.platform === 'win32') {
|
|
93
|
+
const script = `Expand-Archive -Path '${archive}' -DestinationPath '${extracted}' -Force`;
|
|
94
|
+
const unzip = run('powershell', ['-NoProfile', '-Command', script]);
|
|
95
|
+
if (unzip.status !== 0) {
|
|
96
|
+
fail(`extraction failed: ${String(unzip.stderr).trim()}`);
|
|
97
|
+
}
|
|
98
|
+
} else {
|
|
99
|
+
const untar = run('tar', ['-xzf', archive, '-C', extracted]);
|
|
100
|
+
if (untar.status !== 0) {
|
|
101
|
+
fail(`extraction failed: ${String(untar.stderr).trim()}`);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
const binary = path.join(extracted, process.platform === 'win32' ? 'yopes.exe' : 'yopes');
|
|
106
|
+
if (!fs.existsSync(binary)) {
|
|
107
|
+
fail('the release archive does not contain the yopes binary.');
|
|
108
|
+
}
|
|
109
|
+
fs.copyFileSync(binary, target);
|
|
110
|
+
if (process.platform !== 'win32') {
|
|
111
|
+
fs.chmodSync(target, 0o755);
|
|
112
|
+
}
|
|
113
|
+
console.log(`Installed yopes ${version}.`);
|
|
114
|
+
} finally {
|
|
115
|
+
fs.rmSync(temporary, { recursive: true, force: true });
|
|
116
|
+
}
|
package/package.json
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@jamicaw56/yopes",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "A better coding CLI, built with Rust, Ratatui, and Tokio.",
|
|
5
|
-
"license": "GPL-3.0-only",
|
|
6
|
-
"repository": {
|
|
7
|
-
"type": "git",
|
|
8
|
-
"url": "
|
|
9
|
-
},
|
|
10
|
-
"bin": {
|
|
11
|
-
"yopes": "bin/yopes.js"
|
|
12
|
-
},
|
|
13
|
-
"scripts": {
|
|
14
|
-
"postinstall": "node install.js"
|
|
15
|
-
},
|
|
16
|
-
"engines": {
|
|
17
|
-
"node": ">=16"
|
|
18
|
-
},
|
|
19
|
-
"files": [
|
|
20
|
-
"bin/yopes.js",
|
|
21
|
-
"install.js",
|
|
22
|
-
"package.json",
|
|
23
|
-
"README.md"
|
|
24
|
-
]
|
|
25
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@jamicaw56/yopes",
|
|
3
|
+
"version": "0.1.56",
|
|
4
|
+
"description": "A better coding CLI, built with Rust, Ratatui, and Tokio.",
|
|
5
|
+
"license": "GPL-3.0-only",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/jamicaw56/YopesCLI"
|
|
9
|
+
},
|
|
10
|
+
"bin": {
|
|
11
|
+
"yopes": "bin/yopes.js"
|
|
12
|
+
},
|
|
13
|
+
"scripts": {
|
|
14
|
+
"postinstall": "node install.js"
|
|
15
|
+
},
|
|
16
|
+
"engines": {
|
|
17
|
+
"node": ">=16"
|
|
18
|
+
},
|
|
19
|
+
"files": [
|
|
20
|
+
"bin/yopes.js",
|
|
21
|
+
"install.js",
|
|
22
|
+
"package.json",
|
|
23
|
+
"README.md"
|
|
24
|
+
]
|
|
25
|
+
}
|