qdd-framework 1.9.20 → 1.9.24
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 +2 -0
- package/bin/qdd.js +7 -1
- package/install.js +109 -74
- package/package.json +7 -2
- package/bin/qdd +0 -0
package/README.md
CHANGED
|
@@ -13,6 +13,8 @@
|
|
|
13
13
|
npm install -g qdd-framework
|
|
14
14
|
```
|
|
15
15
|
|
|
16
|
+
> **Conflicto con el paquete `qdd` de npm:** existe un paquete ajeno llamado `qdd` (no pertenece a QDD Framework) que también instala un comando `qdd`. Si lo tienes instalado globalmente, desinstálalo antes (`npm uninstall -g qdd`) para que `qdd` apunte a QDD Framework. Desde v1.9.22 su presencia ya no rompe la instalación (antes fallaba con `EISDIR`).
|
|
17
|
+
|
|
16
18
|
---
|
|
17
19
|
|
|
18
20
|
## ⚡ Comandos Principales
|
package/bin/qdd.js
CHANGED
|
@@ -11,4 +11,10 @@ const result = spawnSync(binaryPath, process.argv.slice(2), {
|
|
|
11
11
|
stdio: 'inherit'
|
|
12
12
|
});
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
if (result.error) {
|
|
15
|
+
console.error(`[QDD] No se pudo ejecutar el binario nativo ${binaryPath}: ${result.error.message}`);
|
|
16
|
+
console.error('[QDD] Reinstala el paquete con: npm install -g qdd-framework');
|
|
17
|
+
process.exit(1);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
process.exit(result.status === null ? 1 : result.status);
|
package/install.js
CHANGED
|
@@ -19,96 +19,131 @@ const archMap = {
|
|
|
19
19
|
arm64: 'arm64'
|
|
20
20
|
};
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
22
|
+
// 1. Detección de binario local para desarrollo (solo desde el repo, nunca dentro de node_modules)
|
|
23
|
+
// En una instalación de npm, `..` es la carpeta node_modules: `../qdd` puede ser la carpeta de otro
|
|
24
|
+
// paquete llamado `qdd` (p. ej. bengl/qdd), y copiar una carpeta falla con EISDIR y aborta la instalación.
|
|
25
|
+
function esArchivo(ruta) {
|
|
26
|
+
try {
|
|
27
|
+
return fs.statSync(ruta).isFile();
|
|
28
|
+
} catch (_) {
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
28
31
|
}
|
|
29
32
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
const binDir = path.join(__dirname, 'bin');
|
|
33
|
+
function estaDentroDeNodeModules(dir) {
|
|
34
|
+
return path.resolve(dir).split(path.sep).includes('node_modules');
|
|
35
|
+
}
|
|
34
36
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
+
function resolverBinarioLocal(pkgDir, nombreBinario, log = console.log) {
|
|
38
|
+
if (estaDentroDeNodeModules(pkgDir)) {
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
const candidatos = [
|
|
42
|
+
path.join(pkgDir, '..', nombreBinario),
|
|
43
|
+
path.join(pkgDir, '..', 'cli', nombreBinario)
|
|
44
|
+
];
|
|
45
|
+
for (const candidato of candidatos) {
|
|
46
|
+
if (esArchivo(candidato)) {
|
|
47
|
+
return candidato;
|
|
48
|
+
}
|
|
49
|
+
if (fs.existsSync(candidato)) {
|
|
50
|
+
log(`[QDD] Se ignora ${candidato}: existe pero no es un archivo binario.`);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
return null;
|
|
37
54
|
}
|
|
38
55
|
|
|
39
|
-
|
|
40
|
-
const
|
|
41
|
-
const
|
|
56
|
+
function main() {
|
|
57
|
+
const os = platformMap[process.platform];
|
|
58
|
+
const arch = archMap[process.arch];
|
|
42
59
|
|
|
43
|
-
if (
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
console.log('[QDD] ¡Instalación completada desde binario local!');
|
|
48
|
-
process.exit(0);
|
|
49
|
-
}
|
|
60
|
+
if (!os || !arch) {
|
|
61
|
+
console.error(`[QDD] Plataforma no soportada: ${process.platform} ${process.arch}`);
|
|
62
|
+
process.exit(1);
|
|
63
|
+
}
|
|
50
64
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
console.log('[QDD] ¡Instalación completada desde binario local!');
|
|
56
|
-
process.exit(0);
|
|
57
|
-
}
|
|
65
|
+
const ext = os === 'windows' ? 'zip' : 'tar.gz';
|
|
66
|
+
const binaryExt = os === 'windows' ? '.exe' : '';
|
|
67
|
+
const binaryName = `qdd${binaryExt}`;
|
|
68
|
+
const binDir = path.join(__dirname, 'bin');
|
|
58
69
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
70
|
+
if (!fs.existsSync(binDir)) {
|
|
71
|
+
fs.mkdirSync(binDir, { recursive: true });
|
|
72
|
+
}
|
|
62
73
|
|
|
63
|
-
|
|
64
|
-
|
|
74
|
+
const binarioLocal = resolverBinarioLocal(__dirname, binaryName);
|
|
75
|
+
if (binarioLocal) {
|
|
76
|
+
console.log(`[QDD] Binario local detectado en ${binarioLocal}. Usando copia local para desarrollo...`);
|
|
77
|
+
fs.copyFileSync(binarioLocal, path.join(binDir, binaryName));
|
|
78
|
+
fs.chmodSync(path.join(binDir, binaryName), 0o755);
|
|
79
|
+
console.log('[QDD] ¡Instalación completada desde binario local!');
|
|
80
|
+
process.exit(0);
|
|
81
|
+
}
|
|
65
82
|
|
|
66
|
-
|
|
83
|
+
descargarDesdeRelease({ os, arch, ext, binaryName, binDir });
|
|
84
|
+
}
|
|
67
85
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
86
|
+
// 2. Descarga desde GitHub Releases
|
|
87
|
+
function descargarDesdeRelease({ os, arch, ext, binaryName, binDir }) {
|
|
88
|
+
const url = `https://github.com/${REPO}/releases/download/${VERSION}/qdd_${os}_${arch}.${ext}`;
|
|
89
|
+
const downloadDest = path.join(__dirname, `qdd-download.${ext}`);
|
|
90
|
+
|
|
91
|
+
console.log(`[QDD] Descargando binario nativo para ${os}-${arch}...`);
|
|
92
|
+
console.log(`[QDD] URL: ${url}`);
|
|
93
|
+
|
|
94
|
+
downloadBinary(url);
|
|
95
|
+
|
|
96
|
+
function downloadBinary(targetUrl) {
|
|
97
|
+
const file = fs.createWriteStream(downloadDest);
|
|
98
|
+
https.get(targetUrl, (response) => {
|
|
99
|
+
if (response.statusCode === 301 || response.statusCode === 302) {
|
|
100
|
+
if (response.headers.location) {
|
|
101
|
+
return downloadBinary(response.headers.location);
|
|
102
|
+
}
|
|
74
103
|
}
|
|
75
|
-
}
|
|
76
104
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
105
|
+
if (response.statusCode !== 200) {
|
|
106
|
+
console.error(`[QDD] Error: GitHub Release devolvió HTTP ${response.statusCode} para ${targetUrl}`);
|
|
107
|
+
console.error('[QDD] Si estás instalando desde una versión no publicada aún, compila localmente con "make build"');
|
|
108
|
+
process.exit(0); // Permitir que la instalación de npm continúe sin romper builds de CI
|
|
109
|
+
}
|
|
82
110
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
111
|
+
response.pipe(file);
|
|
112
|
+
file.on('finish', () => {
|
|
113
|
+
file.close(extractBinary);
|
|
114
|
+
});
|
|
115
|
+
}).on('error', (err) => {
|
|
116
|
+
console.error('[QDD] Error de red descargando el binario:', err.message);
|
|
117
|
+
process.exit(0);
|
|
86
118
|
});
|
|
87
|
-
}
|
|
88
|
-
console.error('[QDD] Error de red descargando el binario:', err.message);
|
|
89
|
-
process.exit(0);
|
|
90
|
-
});
|
|
91
|
-
}
|
|
119
|
+
}
|
|
92
120
|
|
|
93
|
-
function extractBinary() {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
121
|
+
function extractBinary() {
|
|
122
|
+
console.log('[QDD] Extrayendo...');
|
|
123
|
+
try {
|
|
124
|
+
if (os === 'windows') {
|
|
125
|
+
execSync(`tar -xf "${downloadDest}" -C "${__dirname}"`);
|
|
126
|
+
}
|
|
127
|
+
if (os !== 'windows') {
|
|
128
|
+
execSync(`tar -xzf "${downloadDest}" -C "${__dirname}"`);
|
|
129
|
+
}
|
|
130
|
+
const extractedBin = path.join(__dirname, binaryName);
|
|
131
|
+
if (fs.existsSync(extractedBin)) {
|
|
132
|
+
fs.renameSync(extractedBin, path.join(binDir, binaryName));
|
|
133
|
+
fs.chmodSync(path.join(binDir, binaryName), 0o755);
|
|
134
|
+
}
|
|
135
|
+
if (fs.existsSync(downloadDest)) {
|
|
136
|
+
fs.unlinkSync(downloadDest);
|
|
137
|
+
}
|
|
138
|
+
console.log('[QDD] ¡Instalación nativa completada exitosamente!');
|
|
139
|
+
} catch (err) {
|
|
140
|
+
console.error('[QDD] Error al extraer el binario:', err.message);
|
|
109
141
|
}
|
|
110
|
-
console.log('[QDD] ¡Instalación nativa completada exitosamente!');
|
|
111
|
-
} catch (err) {
|
|
112
|
-
console.error('[QDD] Error al extraer el binario:', err.message);
|
|
113
142
|
}
|
|
114
143
|
}
|
|
144
|
+
|
|
145
|
+
module.exports = { esArchivo, estaDentroDeNodeModules, resolverBinarioLocal };
|
|
146
|
+
|
|
147
|
+
if (require.main === module) {
|
|
148
|
+
main();
|
|
149
|
+
}
|
package/package.json
CHANGED
|
@@ -1,14 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "qdd-framework",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.24",
|
|
4
4
|
"description": "Quality-Driven Development Framework",
|
|
5
5
|
"bin": {
|
|
6
6
|
"qdd": "bin/qdd.js"
|
|
7
7
|
},
|
|
8
|
+
"files": [
|
|
9
|
+
"bin/qdd.js",
|
|
10
|
+
"install.js",
|
|
11
|
+
"README.md"
|
|
12
|
+
],
|
|
8
13
|
"scripts": {
|
|
9
14
|
"postinstall": "node install.js",
|
|
10
15
|
"lint": "echo 'No linting required for wrapper' && exit 0",
|
|
11
|
-
"test": "
|
|
16
|
+
"test": "node --test",
|
|
12
17
|
"build": "echo 'No build required for wrapper' && exit 0"
|
|
13
18
|
},
|
|
14
19
|
"repository": {
|
package/bin/qdd
DELETED
|
Binary file
|