forked from dbuezas/lgt8fx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmake.js
executable file
·50 lines (44 loc) · 1.41 KB
/
make.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
#!/usr/bin/env node
const fs = require("fs"); //Load the filesystem module
const { execSync } = require("child_process");
const package = "package_lgt8fx_index.json";
const folder = "lgt8f";
const json = JSON.parse(fs.readFileSync(package));
const { platforms } = json.packages[0];
const [major, minor, patch] = platforms[0].version.split(".");
const newVersion = [major, minor, parseFloat(patch) + 1].join(".");
const archiveFileName = `${folder}-${newVersion}.zip`;
execSync(`zip -r ${archiveFileName} ${folder}`);
console.warn(`zipped ${archiveFileName}`);
const size = fs.statSync(archiveFileName).size.toString();
console.warn(`size ${size}`);
const checksum =
"SHA-256:" +
execSync(`shasum -a 256 ${archiveFileName}`).toString().split(" ")[0];
console.warn(`checksum ${checksum}`);
platforms.unshift({
name: "LGT8fx Boards",
architecture: "avr",
version: newVersion,
category: "lgt8fx",
url:
"https://github.com/dbuezas/lgt8fx/releases/download/v" +
newVersion +
"/" +
archiveFileName,
archiveFileName,
checksum,
size,
help: {
online: "https://github.com/dbuezas/LGT8fx/issues",
},
boards: [
{ name: "LGT8F328P-LQFP32 MiniEVB" },
{ name: "LGT8F328P-LQFP48 MiniEVB" },
{ name: "LGT8F328P-LQFP32 wemos-TTGO-XI" },
{ name: "LGT8F328P-SSOP20" },
{ name: "LGT8F328D-LQFP32" },
],
});
fs.writeFileSync(package, JSON.stringify(json, 0, 2));
console.log(newVersion);