-
Notifications
You must be signed in to change notification settings - Fork 0
/
generate.js
77 lines (73 loc) · 1.86 KB
/
generate.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
const fs = require("fs");
const config = require("./package.json");
const browserconfig =
'<?xml version="1.0" encoding="utf-8"?><browserconfig><msapplication><tile><square70x70logo src="/icons/ms-icon-70x70.png"/><square150x150logo src="/icons/ms-icon-150x150.png"/><square310x310logo src="/icons/ms-icon-310x310.png"/><TileColor>' +
config.configuration.color +
"</TileColor></tile></msapplication></browserconfig>";
const manifest = {
short_name: config.configuration.shortName,
name: config.configuration.title,
description: config.description,
icons: [
{
src: "/icons/android-icon-36x36.png",
sizes: "36x36",
type: "image/png",
density: "0.75"
},
{
src: "/icons/android-icon-48x48.png",
sizes: "48x48",
type: "image/png",
density: "1.0"
},
{
src: "/icons/android-icon-72x72.png",
sizes: "72x72",
type: "image/png",
density: "1.5"
},
{
src: "/icons/android-icon-96x96.png",
sizes: "96x96",
type: "image/png",
density: "2.0"
},
{
src: "/icons/android-icon-144x144.png",
sizes: "144x144",
type: "image/png",
density: "3.0"
},
{
src: "/icons/android-icon-192x192.png",
sizes: "192x192",
type: "image/png",
density: "4.0"
}
],
start_url: "/",
background_color: config.configuration.color,
display: "standalone",
scope: "/",
theme_color: config.configuration.color,
orientation: "portrait"
};
fs.writeFile(__dirname + "/public/browserconfig.xml", browserconfig, function (
err
) {
if (err) {
return console.log(err);
}
console.log("browserconfig.xml created");
});
fs.writeFile(
__dirname + "/public/manifest.json",
JSON.stringify(manifest),
function (err) {
if (err) {
return console.log(err);
}
console.log("manifest.json created");
}
);