Skip to content

Commit 487abf5

Browse files
committed
🐛 Permitir proyectos en Vite
1 parent 25eadc1 commit 487abf5

File tree

4 files changed

+43
-276
lines changed

4 files changed

+43
-276
lines changed

admin/componentes/ejercicios.ts

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,31 @@ function revisarPaquetes(ruta: string, respuesta: DatosEjercicio) {
1313
}
1414
}
1515

16+
function registrarCompilacion(rutaArchivos: string, respuesta: DatosEjercicio) {
17+
const archivos = readdirSync(rutaArchivos);
18+
19+
if (archivos.includes('index.html')) {
20+
// Usa package.json pero no necesita compilación
21+
respuesta.compilado = true;
22+
respuesta.rutaArchivos = rutaArchivos;
23+
} else {
24+
errores.push(`No hay archivo index.html en ${rutaArchivos}`);
25+
}
26+
}
27+
1628
function revisarCompilacion(ruta: string, respuesta: DatosEjercicio) {
17-
const rutaArchivos = resolve(ruta, 'www');
18-
const existeCarpeta = existsSync(rutaArchivos);
19-
console.log(rutaArchivos, existeCarpeta);
20-
if (existeCarpeta) {
21-
const archivos = readdirSync(rutaArchivos);
22-
23-
if (archivos.includes('index.html')) {
24-
// Usa package.json pero no necesita compilación
25-
respuesta.compilado = true;
26-
respuesta.rutaArchivos = rutaArchivos;
27-
} else {
28-
errores.push(`No hay archivo index.html en ${rutaArchivos}`);
29+
const rutaArchivosWWW = resolve(ruta, 'www');
30+
const existeCarpetaWWW = existsSync(rutaArchivosWWW);
31+
32+
if (existeCarpetaWWW) {
33+
registrarCompilacion(rutaArchivosWWW, respuesta);
34+
}
35+
{
36+
const rutaArchivosPublico = resolve(ruta, 'publico');
37+
const existeCarpetaPublico = existsSync(rutaArchivosPublico);
38+
39+
if (existeCarpetaPublico) {
40+
registrarCompilacion(rutaArchivosPublico, respuesta);
2941
}
3042
}
3143
}

admin/servidor.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,6 @@ servidor.get<ParametrosExportar>('/exportar', (request, reply) => {
102102
const entradaBd = bd.findOne({ id: `${usuario}-${nombreEjercicio}` });
103103

104104
if (exportar === 'true') {
105-
console.log('intentando exportar', datos);
106105
if (datos.info.rutaArchivos) {
107106
console.log(`Exportando ejercicio ${nombreEjercicio} de ${usuario}...`);
108107

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"scripts": {
1111
"admin": "nodemon admin/servidor.ts",
1212
"build": "webpack --config webpack.prod.js",
13-
"start": "webpack serve --config webpack.dev.js"
13+
"dev": "webpack serve --config webpack.dev.js"
1414
},
1515
"devDependencies": {
1616
"@babel/core": "^7.19.6",

0 commit comments

Comments
 (0)