-
Notifications
You must be signed in to change notification settings - Fork 2
/
vue.config.js
127 lines (117 loc) · 3.55 KB
/
vue.config.js
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
const webpack = require("webpack");
const { defineConfig } = require("@vue/cli-service");
const path = require("path");
const fs = require("fs");
module.exports = defineConfig({
transpileDependencies: true,
outputDir: path.resolve(__dirname, "build"),
configureWebpack: {
plugins: [
new webpack.DefinePlugin({
__VUE_OPTIONS_API__: true, // Enable Options API
__VUE_PROD_DEVTOOLS__: false, // Disable Vue DevTools in production
__VUE_PROD_HYDRATION_MISMATCH_DETAILS__: false, // Hide hydration mismatch details in production
}),
],
},
pluginOptions: {
vuetify: {
// https://github.com/vuetifyjs/vuetify-loader/tree/next/packages/vuetify-loader
},
electronBuilder: {
preload: path.resolve(__dirname, "src/preload.js"), // Ensure this path is correct
builderOptions: {
directories: {
output: "build", // Set the output directory for the built app
},
extraResources: [
{
from: path.resolve(__dirname, "src/preload.js"), // Ensure this path is correct
to: "preload.js",
filter: ["**/*"],
},
{
from: "public/sample_data",
to: "sample_data",
filter: ["**/*"],
},
{
from: "public/assets",
to: "assets",
filter: ["**/*"],
},
{
from: "resources/${os}/${arch}",
to: "bin",
filter: ["**/*"],
},
],
// // Global artifactName for all platforms
// artifactName: "${productName}-${version}-${os}-${arch}.${ext}",
// Add icon paths for different platforms
mac: {
icon: path.resolve(__dirname, "src/assets/icons/icon.icns"),
target: [
{
target: "dmg",
arch: ["universal"],
},
],
artifactName: "${productName}-${version}-MacOS-${arch}.${ext}",
},
win: {
icon: path.resolve(__dirname, "src/assets/icons/icon.ico"),
target: [
{
target: "nsis",
arch: ["x64"],
},
],
artifactName: "${productName}-${version}-Windows-${arch}.${ext}",
},
linux: {
category: "Science",
icon: path.resolve(__dirname, "src/assets/icons/icon.png"),
target: [
{
target: "AppImage",
arch: ["x64", "arm64"],
},
],
artifactName: "${productName}-${version}-Linux-${arch}.${ext}",
},
// Define the targets for the build
target: ["mac", "win", "linux"],
afterPack: async (context) => {
let resourcesPath;
const platform = context.packager.platform.name;
console.log("Target platform:", platform);
if (platform === "mac") {
const appName = context.packager.appInfo.productFilename;
resourcesPath = path.join(context.appOutDir, `${appName}.app`, "Contents", "Resources", "bin");
} else if (platform === "windows") {
resourcesPath = path.join(context.appOutDir, "resources", "bin");
} else if (platform === "linux") {
resourcesPath = path.join(context.appOutDir, "resources", "bin");
}
console.log("Resources Path:", resourcesPath);
if (!fs.existsSync(resourcesPath)) {
console.error(`Path does not exist: ${resourcesPath}`);
return;
}
const binaries = [path.join(resourcesPath, "metabuli" + (platform == "windows" ? ".bat" : ""))];
binaries.forEach((binary) => {
try {
fs.chmodSync(binary, "755");
console.log(`Permissions set for ${binary}`);
const stats = fs.statSync(binary);
console.log(`Permissions for ${binary}:`, stats.mode);
} catch (error) {
console.error(`Failed to set permissions for ${binary}: ${error.message}`);
}
});
},
},
},
},
});