Add version to build and the archived asar app (#854)
This commit is contained in:
parent
759df14143
commit
d2827aa40b
49
package-lock.json
generated
49
package-lock.json
generated
@ -2408,6 +2408,22 @@
|
|||||||
"resolved": "https://registry.npmjs.org/asap/-/asap-2.0.6.tgz",
|
"resolved": "https://registry.npmjs.org/asap/-/asap-2.0.6.tgz",
|
||||||
"integrity": "sha1-5QNHYR1+aQlDIIu9r+vLwvuGbUY="
|
"integrity": "sha1-5QNHYR1+aQlDIIu9r+vLwvuGbUY="
|
||||||
},
|
},
|
||||||
|
"asar": {
|
||||||
|
"version": "2.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/asar/-/asar-2.1.0.tgz",
|
||||||
|
"integrity": "sha512-d2Ovma+bfqNpvBzY/KU8oPY67ZworixTpkjSx0PCXnQi67c2cXmssaTxpFDUM0ttopXoGx/KRxNg/GDThYbXQA==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"@types/glob": "^7.1.1",
|
||||||
|
"chromium-pickle-js": "^0.2.0",
|
||||||
|
"commander": "^2.20.0",
|
||||||
|
"cuint": "^0.2.2",
|
||||||
|
"glob": "^7.1.3",
|
||||||
|
"minimatch": "^3.0.4",
|
||||||
|
"mkdirp": "^0.5.1",
|
||||||
|
"tmp-promise": "^1.0.5"
|
||||||
|
}
|
||||||
|
},
|
||||||
"asn1": {
|
"asn1": {
|
||||||
"version": "0.2.4",
|
"version": "0.2.4",
|
||||||
"resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz",
|
"resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz",
|
||||||
@ -3383,6 +3399,12 @@
|
|||||||
"tslib": "^1.9.0"
|
"tslib": "^1.9.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"chromium-pickle-js": {
|
||||||
|
"version": "0.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/chromium-pickle-js/-/chromium-pickle-js-0.2.0.tgz",
|
||||||
|
"integrity": "sha1-BKEGZywYsIWrd02YPfo+oTjyIgU=",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"ci-info": {
|
"ci-info": {
|
||||||
"version": "2.0.0",
|
"version": "2.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/ci-info/-/ci-info-2.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/ci-info/-/ci-info-2.0.0.tgz",
|
||||||
@ -4183,6 +4205,12 @@
|
|||||||
"integrity": "sha512-xz39Sb4+OaTsULgUERcCk+TJj8ylkL4aSVDQiX/ksxbELSqwkgt4d4RD7fovIdgJGSuNYqwZEiVjYY5l0ask+Q==",
|
"integrity": "sha512-xz39Sb4+OaTsULgUERcCk+TJj8ylkL4aSVDQiX/ksxbELSqwkgt4d4RD7fovIdgJGSuNYqwZEiVjYY5l0ask+Q==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"cuint": {
|
||||||
|
"version": "0.2.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/cuint/-/cuint-0.2.2.tgz",
|
||||||
|
"integrity": "sha1-QICG1AlVDCYxFVYZ6fp7ytw7mRs=",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"currently-unhandled": {
|
"currently-unhandled": {
|
||||||
"version": "0.4.1",
|
"version": "0.4.1",
|
||||||
"resolved": "https://registry.npmjs.org/currently-unhandled/-/currently-unhandled-0.4.1.tgz",
|
"resolved": "https://registry.npmjs.org/currently-unhandled/-/currently-unhandled-0.4.1.tgz",
|
||||||
@ -14810,6 +14838,27 @@
|
|||||||
"os-tmpdir": "~1.0.2"
|
"os-tmpdir": "~1.0.2"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"tmp-promise": {
|
||||||
|
"version": "1.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/tmp-promise/-/tmp-promise-1.1.0.tgz",
|
||||||
|
"integrity": "sha512-8+Ah9aB1IRXCnIOxXZ0uFozV1nMU5xiu7hhFVUSxZ3bYu+psD4TzagCzVbexUCgNNGJnsmNDQlS4nG3mTyoNkw==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"bluebird": "^3.5.0",
|
||||||
|
"tmp": "0.1.0"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"tmp": {
|
||||||
|
"version": "0.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/tmp/-/tmp-0.1.0.tgz",
|
||||||
|
"integrity": "sha512-J7Z2K08jbGcdA1kkQpJSqLF6T0tdQqpR2pnSUXsIchbPdTI9v3e85cLW0d6WDhwuAleOV71j2xWs8qMPfK7nKw==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"rimraf": "^2.6.3"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"tmpl": {
|
"tmpl": {
|
||||||
"version": "1.0.4",
|
"version": "1.0.4",
|
||||||
"resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.4.tgz",
|
"resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.4.tgz",
|
||||||
|
@ -15,8 +15,8 @@
|
|||||||
"roughjs": "4.0.4",
|
"roughjs": "4.0.4",
|
||||||
"stacktrace-js": "2.0.2"
|
"stacktrace-js": "2.0.2"
|
||||||
},
|
},
|
||||||
"description": "",
|
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"asar": "2.1.0",
|
||||||
"@testing-library/jest-dom": "5.1.1",
|
"@testing-library/jest-dom": "5.1.1",
|
||||||
"@testing-library/react": "9.4.1",
|
"@testing-library/react": "9.4.1",
|
||||||
"@types/jest": "25.1.3",
|
"@types/jest": "25.1.3",
|
||||||
@ -80,8 +80,10 @@
|
|||||||
"main": "src/index.js",
|
"main": "src/index.js",
|
||||||
"name": "excalidraw",
|
"name": "excalidraw",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "react-scripts build",
|
"build:app": "react-scripts build",
|
||||||
"build-node": "./scripts/build-node.js",
|
"build:zip": "node ./scripts/build-version.js",
|
||||||
|
"build": "npm run build:app && npm run build:zip",
|
||||||
|
"build-node": "node ./scripts/build-node.js",
|
||||||
"eject": "react-scripts eject",
|
"eject": "react-scripts eject",
|
||||||
"fix": "npm run fix:other && npm run fix:code",
|
"fix": "npm run fix:other && npm run fix:code",
|
||||||
"fix:code": "npm run test:code -- --fix",
|
"fix:code": "npm run test:code -- --fix",
|
||||||
|
37
scripts/build-version.js
Executable file
37
scripts/build-version.js
Executable file
@ -0,0 +1,37 @@
|
|||||||
|
#!/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(
|
||||||
|
{
|
||||||
|
app: `excalidraw-${versionDate(now)}.asar`,
|
||||||
|
version: versionDate(now),
|
||||||
|
},
|
||||||
|
undefined,
|
||||||
|
2,
|
||||||
|
);
|
||||||
|
|
||||||
|
fs.writeFileSync(path.join("build", "version.json"), data);
|
||||||
|
|
||||||
|
(async () => {
|
||||||
|
const src = "build/";
|
||||||
|
const dest = path.join("build", `excalidraw-${versionDate(now)}.asar`);
|
||||||
|
|
||||||
|
await asar.createPackage(src, dest);
|
||||||
|
})();
|
Loading…
x
Reference in New Issue
Block a user