-
-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathbuild.js
More file actions
128 lines (122 loc) · 4.29 KB
/
Copy pathbuild.js
File metadata and controls
128 lines (122 loc) · 4.29 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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
const builder = require('electron-builder');
const obfuscator = require('javascript-obfuscator');
const fs = require('fs-extra');
const path = require('path');
const { productname } = require('./package.json');
// Función para obfuscar un archivo
async function obfuscateFile(filePath) {
try {
const code = await fs.readFile(filePath, 'utf-8');
const obfuscatedCode = obfuscator.obfuscate(code, { /* opciones de obfuscator */ }).getObfuscatedCode();
await fs.writeFile(filePath, obfuscatedCode);
console.log(`✅ Código obfuscado correctamente: ${filePath}`);
} catch (error) {
console.error(`Error al obfuscar el archivo ${filePath}`, error);
}
}
// Función para obfuscar todos los archivos .js en el directorio src
async function obfuscateSrc() {
try {
const srcPath = './src';
const files = await fs.readdir(srcPath);
// Filtrar solo archivos .js
const jsFiles = files.filter(file => path.extname(file) === '.js');
// Obfuscar cada archivo .js
//await Promise.all(jsFiles.map(file => obfuscateFile(path.join(srcPath, file))));
} catch (error) {
console.error('Error al obfuscar el código', error);
}
}
// Ejecutar la obfuscación antes de construir
obfuscateSrc().then(() => {
builder.build({
config: {
publish: [
{
provider: "github",
owner: "1ly4s0",
repo: "battlylauncher",
releaseType: "release"
}
],
generateUpdatesFilesForAllChannels: true,
appId: productname,
productName: productname,
artifactName: '${productName}-${os}-${arch}.${ext}',
files: ["src/**/*", "package.json", "LICENSE.md"],
directories: { "output": "dist" },
compression: 'maximum',
asar: false,
win: {
icon: "./src/assets/images/icon.ico",
target: [
{
target: "nsis",
arch: ["x64", "ia32"]
},
// {
// target: "appx",
// arch: ["x64", "arm64"]
// }
]
},
nsis: {
oneClick: false,
allowToChangeInstallationDirectory: true,
createDesktopShortcut: true,
runAfterFinish: true,
installerLanguages: ['es'],
multiLanguageInstaller: true,
license: "./LICENSE.md",
},
mac: {
icon: "./src/assets/images/icon.icns",
category: "public.app-category.games",
target: [{
target: "dmg",
arch: ["x64", "arm64"]
}]
},
linux: {
icon: "./src/assets/images/icon.png",
target: [
{
target: "AppImage",
arch: ["x64"]
}, {
target: "tar.gz",
arch: ["x64"]
},
{
target: "deb",
arch: ["x64"]
},
{
target: "rpm",
arch: ["x64"]
},
{
target: "AppImage",
arch: ["armv7l"]
},
{
target: "tar.gz",
arch: ["armv7l"]
},
{
target: "deb",
arch: ["armv7l"]
},
{
target: "rpm",
arch: ["armv7l"]
}
]
}
}
}).then(() => {
console.log('✅ El build se ha realizado correctamente.')
}).catch(err => {
console.error('Error al realizar el build', err)
})
});