2020-02-28 22:51:36 +01:00
|
|
|
#!/usr/bin/env node
|
|
|
|
|
|
|
|
const fs = require("fs");
|
|
|
|
const path = require("path");
|
|
|
|
const asar = require("asar");
|
|
|
|
|
|
|
|
const zero = digit => `0${digit}`.slice(-2);
|
|
|
|
|
|
|
|
const versionDate = date => {
|
|
|
|
const date_ = `${date.getFullYear()}-${zero(date.getMonth() + 1)}-${zero(
|
|
|
|
date.getDate(),
|
|
|
|
)}`;
|
|
|
|
const time = `${zero(date.getHours())}-${zero(date.getMinutes())}-${zero(
|
|
|
|
date.getSeconds(),
|
|
|
|
)}`;
|
|
|
|
return `${date_}-${time}`;
|
|
|
|
};
|
|
|
|
|
|
|
|
const now = new Date();
|
|
|
|
|
|
|
|
const data = JSON.stringify(
|
|
|
|
{
|
2020-02-29 16:23:09 +01:00
|
|
|
asar: `excalidraw.asar`,
|
2020-02-28 22:51:36 +01:00
|
|
|
version: versionDate(now),
|
|
|
|
},
|
|
|
|
undefined,
|
|
|
|
2,
|
|
|
|
);
|
|
|
|
|
|
|
|
fs.writeFileSync(path.join("build", "version.json"), data);
|
|
|
|
|
|
|
|
(async () => {
|
|
|
|
const src = "build/";
|
2020-02-29 16:23:09 +01:00
|
|
|
const dest = path.join("build", `excalidraw.asar`);
|
2020-02-28 22:51:36 +01:00
|
|
|
|
|
|
|
await asar.createPackage(src, dest);
|
|
|
|
})();
|