mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-07-27 10:02:59 +08:00
refactor(electron-forge/deb): make desktop.ejs easier to read
in theory we could use variables in ejs, but unfortunately electron uses lodash template to create the file, which itself DOES NOT like any let/const/var assignments – wasted a bit of time finding this out, before coming up with this solution
This commit is contained in:
parent
a2f1d71754
commit
61e56023d4
@ -1,12 +1,17 @@
|
|||||||
[Desktop Entry]
|
[Desktop Entry]
|
||||||
<% if (productName) { %>Name=<%= productName %>
|
<%=
|
||||||
<% } %><% if (description) { %>Comment=<%= description %>
|
Object.entries({
|
||||||
<% } %><% if (genericName) { %>GenericName=<%= genericName %>
|
"Name": productName,
|
||||||
<% } %><% if (name) { %>Exec=<%= name %> %U
|
"Comment": description,
|
||||||
Icon=<%= name %>
|
"GenericName": genericName,
|
||||||
<% } %>Type=Application
|
"Exec": name ? `${name} %U` : undefined,
|
||||||
StartupNotify=true
|
"Icon": name,
|
||||||
<% if (productName) { %>StartupWMClass=<%= productName %>
|
"Type": "Application",
|
||||||
<% } if (categories && categories.length) { %>Categories=<%= categories.join(';') %>;
|
"StartupNotify": "true",
|
||||||
<% } %><% if (mimeType && mimeType.length) { %>MimeType=<%= mimeType.join(';') %>;
|
"StartupWMClass": productName,
|
||||||
<% } %>
|
"Categories": categories?.length ? `${categories.join(";")};` : undefined,
|
||||||
|
"MimeType": mimeType?.length ? `${mimeType.join(";")};` : undefined
|
||||||
|
})
|
||||||
|
.map(line => line[1] ? line.join("=") : undefined)
|
||||||
|
.filter(line => !!line)
|
||||||
|
.join("\n")%>
|
Loading…
x
Reference in New Issue
Block a user