From 10e07e434ca9c455d026b98c36d5039e9c423661 Mon Sep 17 00:00:00 2001 From: Lipis Date: Fri, 18 Dec 2020 14:02:29 +0200 Subject: [PATCH] chore: Remove support for deprecated Excalidraw for Desktop (#2465) --- package-lock.json | 27 --------------------------- package.json | 5 ++--- public/index.html | 2 ++ scripts/build-version.js | 23 +++++++++++++++-------- 4 files changed, 19 insertions(+), 38 deletions(-) diff --git a/package-lock.json b/package-lock.json index aca6ecc2..4cf4d45d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4276,27 +4276,6 @@ "resolved": "https://registry.npmjs.org/asap/-/asap-2.0.6.tgz", "integrity": "sha1-5QNHYR1+aQlDIIu9r+vLwvuGbUY=" }, - "asar": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/asar/-/asar-3.0.3.tgz", - "integrity": "sha512-k7zd+KoR+n8pl71PvgElcoKHrVNiSXtw7odKbyNpmgKe7EGRF9Pnu3uLOukD37EvavKwVFxOUpqXTIZC5B5Pmw==", - "dev": true, - "requires": { - "@types/glob": "^7.1.1", - "chromium-pickle-js": "^0.2.0", - "commander": "^5.0.0", - "glob": "^7.1.6", - "minimatch": "^3.0.4" - }, - "dependencies": { - "commander": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-5.0.0.tgz", - "integrity": "sha512-JrDGPAKjMGSP1G0DUoaceEJ3DZgAfr/q6X7FVk4+U5KxUSKviYGM2k6zWkfyyBHy5rAtzgYJFa1ro2O9PtoxwQ==", - "dev": true - } - } - }, "asn1": { "version": "0.2.4", "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz", @@ -5699,12 +5678,6 @@ "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": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-2.0.0.tgz", diff --git a/package.json b/package.json index fb878f8a..5f193c11 100644 --- a/package.json +++ b/package.json @@ -52,7 +52,6 @@ "devDependencies": { "@types/lodash.throttle": "4.1.6", "@types/pako": "1.0.1", - "asar": "3.0.3", "eslint-config-prettier": "7.0.0", "eslint-plugin-prettier": "3.3.0", "firebase-tools": "8.19.0", @@ -84,8 +83,8 @@ "build-node": "node ./scripts/build-node.js", "build:app:docker": "REACT_APP_INCLUDE_GTAG=false REACT_APP_DISABLE_SENTRY=true react-scripts build", "build:app": "REACT_APP_INCLUDE_GTAG=true REACT_APP_GIT_SHA=$NOW_GITHUB_COMMIT_SHA react-scripts build", - "build:zip": "node ./scripts/build-version.js", - "build": "npm run build:app && npm run build:zip", + "build:version": "node ./scripts/build-version.js", + "build": "npm run build:app && npm run build:version", "eject": "react-scripts eject", "fix:code": "npm run test:code -- --fix", "fix:other": "npm run prettier -- --write", diff --git a/public/index.html b/public/index.html index 2d923da6..138dc4e0 100644 --- a/public/index.html +++ b/public/index.html @@ -55,6 +55,8 @@ + + `0${digit}`.slice(-2); @@ -20,18 +21,24 @@ const now = new Date(); const data = JSON.stringify( { - asar: "excalidraw.asar", version: versionDate(now), }, undefined, 2, ); -fs.writeFileSync(path.join("build", "version.json"), data); +fs.writeFileSync(versionFile, data); -(async () => { - const src = "build/"; - const dest = path.join("build", `excalidraw.asar`); +// https://stackoverflow.com/a/14181136/8418 +fs.readFile(indexFile, "utf8", (error, data) => { + if (error) { + return console.error(error); + } + const result = data.replace(/{version}/g, versionDate(now)); - await asar.createPackage(src, dest); -})(); + fs.writeFile(indexFile, result, "utf8", (error) => { + if (error) { + return console.error(error); + } + }); +});