From 943aadb29da78248c2c3810f31ddb0e33aca323c Mon Sep 17 00:00:00 2001 From: Jean Ouina Date: Wed, 10 Jun 2020 16:25:17 +0200 Subject: [PATCH] no longer using bytenode, so we can just use node --- compile.js | 19 +++---------------- package.json | 4 ++-- remove.js | 3 --- 3 files changed, 5 insertions(+), 21 deletions(-) delete mode 100644 remove.js diff --git a/compile.js b/compile.js index 8257e77..618680a 100644 --- a/compile.js +++ b/compile.js @@ -5,13 +5,7 @@ const util = require("util") const production = true -let electron -try{ - electron = require("electron") -}catch(e){ - electron = null -} -let fs = electron ? require("original-fs") : require("fs") +let fs = require("fs") console.log = (...args) => { process.stdout.write(Buffer.from(util.formatWithOptions({colors: true}, ...args)+"\n", "binary").toString("utf8")) @@ -21,12 +15,10 @@ console.info = (...args) => { } async function main(){ - if(electron)await electron.app.whenReady() - console.log(__dirname, process.cwd()) console.info("Reseting existent directory...") - child_process.execSync("node remove.js") // why can't electron remove directory ? it just doesn't work and I am required to use electron for the .jsc compilation. + await fs.promises.rmdir("./distApp", {"recursive": true}) await fs.promises.mkdir(__dirname+"/distApp/dist", {"recursive": true}) console.info("Executing command `tsc`") @@ -114,9 +106,4 @@ async function main(){ cwd: path.join(__dirname, "distApp") })) } -main() -.then(() => { - if(electron){ - electron.app.exit() - } -}) \ No newline at end of file +main() \ No newline at end of file diff --git a/package.json b/package.json index 579f774..3c3dbff 100644 --- a/package.json +++ b/package.json @@ -7,8 +7,8 @@ "test": "tsc && electron .", "run": "electron .", "build": "npm run build:minify && npm run build:electron", - "build:electron": "electron-packager ./distApp --ignore=\"(distApp|builds|\\.ts)\" --arch=ia32 --win32metadata.ProductName=\"Lightcord\" --win32metadata.CompanyName=\"Lightcord Inc.\" --protocol=discord --platform=\"win32\" --out=builds --icon=app.ico --executable-name=\"Lightcord\" --asar.unpack=*.{node,dll} --overwrite", - "build:minify": "electron compile.js", + "build:electron": "electron-packager ./distApp --ignore=\"(distApp|builds|\\.ts)\" --arch=ia32 --win32metadata.ProductName=\"Lightcord\" --win32metadata.CompanyName=\"Lightcord Inc.\" --protocol=discord --platform=\"win32,linux\" --out=builds --icon=app.ico --executable-name=\"Lightcord\" --asar.unpack=*.{node,dll} --overwrite", + "build:minify": "node compile.js", "devInstall": "npm i -g --arch=ia32 electron@8.3.0 && npm i -g typescript && npm i --save-dev @types/node@12.12.39 && npm i --save-dev --arch=ia32 electron@8.3.0 && node installSubModules.js && echo \"Everything is installed. You should be able to do `npm run test` to compile everything and launch.\"" }, "author": "", diff --git a/remove.js b/remove.js deleted file mode 100644 index 162e388..0000000 --- a/remove.js +++ /dev/null @@ -1,3 +0,0 @@ -const fs = require("fs") - -fs.rmdirSync("./distApp", {"recursive": true}) \ No newline at end of file