-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.js
More file actions
69 lines (59 loc) · 1.82 KB
/
install.js
File metadata and controls
69 lines (59 loc) · 1.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
const child_process = require('child_process');
const fs = require('fs');
//const path = require('path');
//1. carpeta vistas
if ( !e('src/js/vistas')){
console.log('No es posible setear la carpeta Vistas')
} else {
//si si existe vistas
if ( !e('src/js/local') ){
console.log('No es posible setear la carpeta Local')
} else{
// si ambas carpetas existen
//setar bin folder
if ( !e('src/js/vistas/bin')){
//si no existe bin
console.log('No es posible setear carpeta vistas/bin')
}else{
//si existe bin
copiar('init/local/Producto.tsx', 'src/js/local/Producto.tsx')
copiar('init/vistas/Inicio.tsx', 'src/js/vistas/Inicio.tsx')
copiar('init/vistas/bin/dsn.tsx', 'src/js/vistas/bin/dsn.tsx')
copiar('init/vistas/bin/env.tsx', 'src/js/vistas/bin/env.tsx')
copiar('init/vistas/bin/app.css', 'src/js/vistas/bin/app.css')
copiar('init/vistas/bin/jappn.png', 'src/js/vistas/bin/jappn.png')
runModules()
}
}
}
function runModules(){
console.log("Instalando módulos de Node...")
child_process.exec("npm install", (error, stdout, stderr) => {
if (stderr == "" ){
console.log (stdout)
console.log("\n\nJAPP-N Instlado satisfactoriamente, para lanzar la auto transpilación incremental ejecute: node watch")
}else {
console.log( '[ERROR] ', stderr)
}
})
}
function copiar(a,b){
try {
fs.copyFileSync(a, b);
console.log(`Archivo "${a}" copiado a "${b}" exitosamente.`);
} catch (error) {
console.error(`Error al copiar el archivo "${a}":`, error);
}
}
function e(nombre){
if (!fs.existsSync(nombre)){
try {
fs.mkdirSync( nombre )
return true
} catch (error) {
return false
}
}else{
return true
}
}