qdd-framework 0.1.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/bin/qdd.js +14 -0
- package/install.js +75 -0
- package/package.json +27 -0
package/bin/qdd.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const { spawnSync } = require('child_process');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
const os = require('os');
|
|
6
|
+
|
|
7
|
+
const binaryExt = os.platform() === 'win32' ? '.exe' : '';
|
|
8
|
+
const binaryPath = path.join(__dirname, `qdd${binaryExt}`);
|
|
9
|
+
|
|
10
|
+
const result = spawnSync(binaryPath, process.argv.slice(2), {
|
|
11
|
+
stdio: 'inherit'
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
process.exit(result.status || 0);
|
package/install.js
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
const https = require('https');
|
|
4
|
+
const { execSync } = require('child_process');
|
|
5
|
+
|
|
6
|
+
// Configuración del Release (Automático según tu GitHub)
|
|
7
|
+
const VERSION = 'v0.1.1';
|
|
8
|
+
const REPO = 'trdago/qdd-framework';
|
|
9
|
+
|
|
10
|
+
const platformMap = {
|
|
11
|
+
win32: 'windows',
|
|
12
|
+
darwin: 'darwin',
|
|
13
|
+
linux: 'linux'
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const archMap = {
|
|
17
|
+
x64: 'amd64',
|
|
18
|
+
arm64: 'arm64'
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const os = platformMap[process.platform];
|
|
22
|
+
const arch = archMap[process.arch];
|
|
23
|
+
|
|
24
|
+
if (!os || !arch) {
|
|
25
|
+
console.error(`Plataforma no soportada: ${process.platform} ${process.arch}`);
|
|
26
|
+
process.exit(1);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const ext = os === 'windows' ? 'zip' : 'tar.gz';
|
|
30
|
+
const binaryExt = os === 'windows' ? '.exe' : '';
|
|
31
|
+
const binaryName = `qdd${binaryExt}`;
|
|
32
|
+
const url = `https://github.com/${REPO}/releases/download/${VERSION}/qdd_${os}_${arch}.${ext}`;
|
|
33
|
+
|
|
34
|
+
const binDir = path.join(__dirname, 'bin');
|
|
35
|
+
const downloadDest = path.join(__dirname, `qdd-download.${ext}`);
|
|
36
|
+
|
|
37
|
+
console.log(`[QDD] Descargando binario nativo para ${os}-${arch}...`);
|
|
38
|
+
console.log(`[QDD] URL: ${url}`);
|
|
39
|
+
|
|
40
|
+
// (Para efectos de desarrollo y prueba, comentamos la descarga real
|
|
41
|
+
// hasta que el repo de GitHub tenga sus primeros Releases configurados con GoReleaser)
|
|
42
|
+
/*
|
|
43
|
+
const file = fs.createWriteStream(downloadDest);
|
|
44
|
+
https.get(url, (response) => {
|
|
45
|
+
if (response.statusCode === 301 || response.statusCode === 302) {
|
|
46
|
+
return https.get(response.headers.location, (res) => {
|
|
47
|
+
res.pipe(file);
|
|
48
|
+
file.on('finish', extractBinary);
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
response.pipe(file);
|
|
52
|
+
file.on('finish', extractBinary);
|
|
53
|
+
}).on('error', (err) => {
|
|
54
|
+
console.error('[QDD] Error descargando el binario:', err);
|
|
55
|
+
process.exit(1);
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
function extractBinary() {
|
|
59
|
+
console.log('[QDD] Extrayendo...');
|
|
60
|
+
try {
|
|
61
|
+
if (os === 'windows') {
|
|
62
|
+
execSync(`tar -xf ${downloadDest} -C ${__dirname}`);
|
|
63
|
+
} else {
|
|
64
|
+
execSync(`tar -xzf ${downloadDest} -C ${__dirname}`);
|
|
65
|
+
}
|
|
66
|
+
fs.renameSync(path.join(__dirname, binaryName), path.join(binDir, binaryName));
|
|
67
|
+
fs.chmodSync(path.join(binDir, binaryName), 0o755);
|
|
68
|
+
fs.unlinkSync(downloadDest);
|
|
69
|
+
console.log('[QDD] ¡Instalación nativa completada exitosamente!');
|
|
70
|
+
} catch (err) {
|
|
71
|
+
console.error('[QDD] Error al extraer el binario:', err);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
*/
|
|
75
|
+
console.log('[QDD] NOTA: Script preparado para producción. Descomenta la descarga cuando GoReleaser publique los binarios en GitHub Releases.');
|
package/package.json
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "qdd-framework",
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "QDD Framework: Quality-Driven Development Tool",
|
|
5
|
+
"bin": {
|
|
6
|
+
"qdd": "bin/qdd.js"
|
|
7
|
+
},
|
|
8
|
+
"scripts": {
|
|
9
|
+
"postinstall": "node install.js",
|
|
10
|
+
"lint": "echo 'No linting required for wrapper' && exit 0",
|
|
11
|
+
"test": "echo 'No tests required for wrapper' && exit 0",
|
|
12
|
+
"build": "echo 'No build required for wrapper' && exit 0"
|
|
13
|
+
},
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "https://github.com/trdago/qdd-framework.git"
|
|
17
|
+
},
|
|
18
|
+
"keywords": [
|
|
19
|
+
"qdd",
|
|
20
|
+
"framework",
|
|
21
|
+
"quality",
|
|
22
|
+
"governance"
|
|
23
|
+
],
|
|
24
|
+
"author": "QDD Team",
|
|
25
|
+
"homepage": "https://github.com/trdago/qdd-framework#readme",
|
|
26
|
+
"license": "MIT"
|
|
27
|
+
}
|