-
Notifications
You must be signed in to change notification settings - Fork 125
/
Copy pathbuild_package.js
110 lines (100 loc) · 3.11 KB
/
build_package.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
const builder = require("electron-builder");
var packageJson = require('./package.json');
var childProcess = require('child_process');
var isWin = process.platform === "win32";
var exec = (cmd) => {
return new Promise((resolve, reject) => {
childProcess.exec(cmd, (err, stdout, stderr) => {
if (err) {
reject(err);
} else {
stdout.stderr = stderr;
resolve(stdout);
}
});
});
}
process.on('unhandledRejection', error => {
// Will print "unhandledRejection err is not defined"
console.log('unhandledRejection', error.message);
});
(async () => {
const commitsCount = (await exec("git rev-list HEAD --count")).trim();
const commitID = (await exec("git log --pretty=format:'%h' -n 1")).trim();
const buildVersion = `${commitsCount} - ${commitID}`;
console.log('build-version', buildVersion);
await builder.build({
//targets: Platform.MAC.createTarget(),
config: {
protocols: {
name: "Postgres Database",
schemes: ["postgres", "postgresql"],
role: "Editor"
},
fileAssociations: [{
ext: "sql",
name: "SQL File",
}],
npmRebuild: false, // because we changed dependency paths postgres manually
icon: isWin ? "build_files/icon.ico" : __dirname + "/build_files/icon.icns",
productName: process.platform == 'linux' ? 'postbird' : 'Postbird',
publish: null,
mac: {
category: "public.app-category.developer-tools",
target: ["dmg"],
bundleVersion: buildVersion,
bundleShortVersion: packageJson.version,
minimumSystemVersion: "10.9.0",
extendInfo: {
NSRequiresAquaSystemAppearance: false,
},
darkModeSupport: true,
asar: true,
extraFiles: ["vendor/darwin"],
asarUnpack: ["node_modules/libpq"],
files: ["!vendor"]
},
linux: {
category: "Programming",
target: ["deb", "rpm", "snap", "appImage", "pacman", "apk"],
icon: __dirname + "/build_files/icon.png",
mimeTypes: ["application/sql"],
description: "Postbird is a cross-platform PostgreSQL GUI client. Simple and efficient, with support of postgres specific features"
},
rpm: {
depends: ["postgresql"],
icon: __dirname + "/build_files/icon.png",
desktop: "Postbird",
synopsis: "PostgreSQL desktop client"
},
deb: {
depends: [
'gconf2', 'gconf-service', 'libnotify4', 'libappindicator1',
'libxtst6', 'libnss3', 'libxss1', "postgresql-client"
],
synopsis: "PostgreSQL desktop client"
},
snap: {
grade: "stable",
summary: "PostgreSQL desktop client"
},
appImage: {
synopsis: "PostgreSQL desktop client",
category: "Development",
},
pacman: { },
apk: { },
nsis: {
installerIcon: "build_files/icon.ico"
},
win: {
target: ["nsis", "zip", "portable"],
verifyUpdateCodeSignature: false,
icon: "build_files/icon.ico",
extraFiles: [
"vendor/win32"
]
}
}
})
})();