@carlos-burelo/wyrm 1.0.0 → 1.0.1
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 -2
- package/bin/cli.js +1 -3
- package/package.json +34 -37
- package/vendor/wyrm.exe +0 -0
- package/scripts/install.js +0 -123
package/README.md
CHANGED
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
|
|
14
14
|
```powershell
|
|
15
15
|
npm install -g @carlos-burelo/wyrm
|
|
16
|
+
# también pnpm/yarn/bun: el tarball trae el binario, sin postinstall
|
|
16
17
|
```
|
|
17
18
|
|
|
18
19
|
O desde fuente:
|
|
@@ -221,8 +222,8 @@ git push origin v0.1.0
|
|
|
221
222
|
|
|
222
223
|
CI hace: `cargo test` → build x64 release → GitHub Release con
|
|
223
224
|
`wyrm-x86_64-pc-windows-msvc.exe` + `.sha256` → sync de versión en
|
|
224
|
-
`npm/package.json` →
|
|
225
|
-
|
|
225
|
+
`npm/package.json` → mete el exe en `npm/vendor/` → `npm publish`.
|
|
226
|
+
El tarball es autocontenido (sin postinstall: funciona con npm/pnpm/yarn/bun).
|
|
226
227
|
|
|
227
228
|
Requisitos: secret `NPM_TOKEN` en el repo. Verificación local previa:
|
|
228
229
|
|
package/bin/cli.js
CHANGED
|
@@ -7,9 +7,7 @@ const path = require('path');
|
|
|
7
7
|
const binPath = path.join(__dirname, '..', 'vendor', 'wyrm.exe');
|
|
8
8
|
|
|
9
9
|
if (!fs.existsSync(binPath)) {
|
|
10
|
-
console.error(
|
|
11
|
-
'[wyrm] Falta vendor/wyrm.exe. Reinstala (npm i -g @carlos-burelo/wyrm) o compila local con `npm run build`.'
|
|
12
|
-
);
|
|
10
|
+
console.error('[wyrm] Falta vendor/wyrm.exe: instalación corrupta. Reinstala el paquete.');
|
|
13
11
|
process.exit(1);
|
|
14
12
|
}
|
|
15
13
|
|
package/package.json
CHANGED
|
@@ -1,38 +1,35 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@carlos-burelo/wyrm",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "El gestor de procesos definitivo para Windows Server escrito en Rust",
|
|
5
|
-
"main": "bin/cli.js",
|
|
6
|
-
"files": [
|
|
7
|
-
"bin/",
|
|
8
|
-
"
|
|
9
|
-
"README.md"
|
|
10
|
-
],
|
|
11
|
-
"bin": {
|
|
12
|
-
"wyrm": "bin/cli.js"
|
|
13
|
-
},
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
],
|
|
20
|
-
"
|
|
21
|
-
"
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
"
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
],
|
|
36
|
-
"author": "Carlos Burelo",
|
|
37
|
-
"license": "MIT"
|
|
1
|
+
{
|
|
2
|
+
"name": "@carlos-burelo/wyrm",
|
|
3
|
+
"version": "1.0.1",
|
|
4
|
+
"description": "El gestor de procesos definitivo para Windows Server escrito en Rust",
|
|
5
|
+
"main": "bin/cli.js",
|
|
6
|
+
"files": [
|
|
7
|
+
"bin/",
|
|
8
|
+
"vendor/",
|
|
9
|
+
"README.md"
|
|
10
|
+
],
|
|
11
|
+
"bin": {
|
|
12
|
+
"wyrm": "bin/cli.js"
|
|
13
|
+
},
|
|
14
|
+
"os": [
|
|
15
|
+
"win32"
|
|
16
|
+
],
|
|
17
|
+
"cpu": [
|
|
18
|
+
"x64"
|
|
19
|
+
],
|
|
20
|
+
"repository": {
|
|
21
|
+
"type": "git",
|
|
22
|
+
"url": "git+https://github.com/carlos-burelo/wyrm.git"
|
|
23
|
+
},
|
|
24
|
+
"keywords": [
|
|
25
|
+
"wyrm",
|
|
26
|
+
"pm2",
|
|
27
|
+
"windows-server",
|
|
28
|
+
"rust",
|
|
29
|
+
"process-manager",
|
|
30
|
+
"nextjs",
|
|
31
|
+
"astro"
|
|
32
|
+
],
|
|
33
|
+
"author": "Carlos Burelo",
|
|
34
|
+
"license": "MIT"
|
|
38
35
|
}
|
package/vendor/wyrm.exe
ADDED
|
Binary file
|
package/scripts/install.js
DELETED
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
// Postinstall de wyrm: deja vendor/wyrm.exe listo.
|
|
2
|
-
// - Versión desde package.json (la sincroniza el workflow de release).
|
|
3
|
-
// - Salta si ya hay binario local (npm run build) o WYRM_SKIP_DOWNLOAD.
|
|
4
|
-
// - Verifica SHA256 del asset .sha256 cuando existe.
|
|
5
|
-
const fs = require('fs');
|
|
6
|
-
const path = require('path');
|
|
7
|
-
const https = require('https');
|
|
8
|
-
const crypto = require('crypto');
|
|
9
|
-
|
|
10
|
-
const REPO = 'carlos-burelo/wyrm';
|
|
11
|
-
const BIN_DIR = path.join(__dirname, '..', 'vendor');
|
|
12
|
-
const BIN_NAME = 'wyrm.exe';
|
|
13
|
-
const BIN_PATH = path.join(BIN_DIR, BIN_NAME);
|
|
14
|
-
|
|
15
|
-
const TARGETS = {
|
|
16
|
-
'win32-x64': 'x86_64-pc-windows-msvc',
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
function pkgVersion() {
|
|
20
|
-
const { version } = require('../package.json');
|
|
21
|
-
if (!version) throw new Error('package.json sin version');
|
|
22
|
-
return String(version).replace(/^v/, '');
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
function targetTriple(platform = process.platform, arch = process.arch) {
|
|
26
|
-
const triple = TARGETS[`${platform}-${arch}`];
|
|
27
|
-
if (!triple) {
|
|
28
|
-
throw new Error(
|
|
29
|
-
`Plataforma no soportada: ${platform}-${arch} (wyrm v1 solo publica win32-x64)`
|
|
30
|
-
);
|
|
31
|
-
}
|
|
32
|
-
return triple;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
function assetName(triple) {
|
|
36
|
-
return `wyrm-${triple}.exe`;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
function download(url, dest, redirects = 5) {
|
|
40
|
-
return new Promise((resolve, reject) => {
|
|
41
|
-
https
|
|
42
|
-
.get(url, (res) => {
|
|
43
|
-
const { statusCode, headers } = res;
|
|
44
|
-
if ((statusCode === 301 || statusCode === 302) && headers.location) {
|
|
45
|
-
if (redirects <= 0) return reject(new Error('demasiadas redirecciones'));
|
|
46
|
-
res.resume();
|
|
47
|
-
return resolve(download(headers.location, dest, redirects - 1));
|
|
48
|
-
}
|
|
49
|
-
if (statusCode !== 200) {
|
|
50
|
-
res.resume();
|
|
51
|
-
return reject(new Error(`HTTP ${statusCode} en ${url}`));
|
|
52
|
-
}
|
|
53
|
-
const file = fs.createWriteStream(dest);
|
|
54
|
-
res.pipe(file);
|
|
55
|
-
file.on('finish', () => file.close(resolve));
|
|
56
|
-
file.on('error', reject);
|
|
57
|
-
})
|
|
58
|
-
.on('error', reject);
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
function sha256File(p) {
|
|
63
|
-
return new Promise((resolve, reject) => {
|
|
64
|
-
const h = crypto.createHash('sha256');
|
|
65
|
-
fs.createReadStream(p)
|
|
66
|
-
.on('data', (d) => h.update(d))
|
|
67
|
-
.on('end', () => resolve(h.digest('hex')))
|
|
68
|
-
.on('error', reject);
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
async function install() {
|
|
73
|
-
if (process.env.WYRM_SKIP_DOWNLOAD) {
|
|
74
|
-
console.log('[wyrm] WYRM_SKIP_DOWNLOAD=1: salto la descarga.');
|
|
75
|
-
return;
|
|
76
|
-
}
|
|
77
|
-
if (fs.existsSync(BIN_PATH)) {
|
|
78
|
-
console.log('[wyrm] Binario local existente, salto la descarga.');
|
|
79
|
-
return;
|
|
80
|
-
}
|
|
81
|
-
const version = pkgVersion();
|
|
82
|
-
const triple = targetTriple();
|
|
83
|
-
const base = `https://github.com/${REPO}/releases/download/v${version}`;
|
|
84
|
-
const asset = assetName(triple);
|
|
85
|
-
fs.mkdirSync(BIN_DIR, { recursive: true });
|
|
86
|
-
|
|
87
|
-
console.log(`[wyrm] Descargando ${asset} v${version}...`);
|
|
88
|
-
try {
|
|
89
|
-
await download(`${base}/${asset}`, BIN_PATH);
|
|
90
|
-
} catch (e) {
|
|
91
|
-
try {
|
|
92
|
-
fs.unlinkSync(BIN_PATH);
|
|
93
|
-
} catch (_) {}
|
|
94
|
-
throw new Error(
|
|
95
|
-
`No se pudo descargar el binario (${e.message}). ¿Existe el release v${version}?`
|
|
96
|
-
);
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
try {
|
|
100
|
-
await download(`${base}/${asset}.sha256`, `${BIN_PATH}.sha256`);
|
|
101
|
-
const expected = fs.readFileSync(`${BIN_PATH}.sha256`, 'utf8').trim().toLowerCase();
|
|
102
|
-
const actual = await sha256File(BIN_PATH);
|
|
103
|
-
if (expected !== actual) {
|
|
104
|
-
fs.unlinkSync(BIN_PATH);
|
|
105
|
-
throw new Error('SHA256 no coincide: binario corrupto o manipulado.');
|
|
106
|
-
}
|
|
107
|
-
fs.unlinkSync(`${BIN_PATH}.sha256`);
|
|
108
|
-
console.log('[wyrm] SHA256 verificado.');
|
|
109
|
-
} catch (e) {
|
|
110
|
-
if (/corrupto|manipulado/.test(e.message)) throw e;
|
|
111
|
-
console.warn(`[wyrm] Aviso: sin checksum (${e.message}), continúo sin verificar.`);
|
|
112
|
-
}
|
|
113
|
-
console.log('[wyrm] Instalación nativa completada.');
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
if (require.main === module) {
|
|
117
|
-
install().catch((e) => {
|
|
118
|
-
console.error(`[wyrm] ${e.message}`);
|
|
119
|
-
process.exit(1);
|
|
120
|
-
});
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
module.exports = { pkgVersion, targetTriple, assetName, REPO, BIN_PATH };
|