gitignore, compile, node_options and canary fixes
This commit is contained in:
parent
c39247c09a
commit
1f012e586c
|
@ -109,3 +109,4 @@ builds
|
|||
# must build typescript itself
|
||||
dist
|
||||
|
||||
distApp
|
|
@ -1 +0,0 @@
|
|||
SET NODE_OPTIONS="--no-force-async-hooks-checks"
|
43
compile.js
43
compile.js
|
@ -1,6 +1,5 @@
|
|||
const child_process = require("child_process")
|
||||
const path = require("path")
|
||||
const bytenode = require("bytenode")
|
||||
const terser = require("terser")
|
||||
const util = require("util")
|
||||
var rimraf = require("rimraf");
|
||||
|
@ -54,9 +53,9 @@ async function main(){
|
|||
await processNextDir(startDir, {
|
||||
startDir,
|
||||
newDir
|
||||
}, ((filepath) => filepath.endsWith(".js") && !filepath.endsWith("launcher.js")), (filepath, newpath) => {
|
||||
console.info(`Compiling ${filepath} to ${newpath}c`)
|
||||
bytenode.compileFile(filepath, newpath+"c")
|
||||
}, ((filepath) => filepath.endsWith(".js")), async (filepath, newpath) => {
|
||||
console.info(`Minifying ${filepath} to ${newpath}`)
|
||||
await fs.promises.writeFile(newpath, terser.minify(await fs.promises.readFile(filepath, "utf8")).code, "utf8")
|
||||
}).then(() => {
|
||||
console.info(`Copied files and minified them from ${startDir}.`)
|
||||
}).catch(console.error)
|
||||
|
@ -65,44 +64,20 @@ async function main(){
|
|||
startDir: path.join(__dirname, "modules"),
|
||||
newDir: path.join(__dirname, "distApp", "modules")
|
||||
}, (filepath) => {
|
||||
if(filepath.includes("node_modules"))return false
|
||||
if(filepath.endsWith(".node"))return false
|
||||
if(filepath.endsWith(".json"))return false
|
||||
if(filepath.endsWith(".js")){
|
||||
if(filepath.endsWith("mainScreenPreload.js"))return false
|
||||
for(let file of [
|
||||
"discord_cloudsync\\index.js",
|
||||
"discord_desktop_core\\index.js",
|
||||
"discord_dispatch\\index.js",
|
||||
"discord_erlpack\\index.js",
|
||||
"discord_game_utils\\index.js",
|
||||
"discord_krisp\\index.js",
|
||||
"discord_media\\index.js",
|
||||
"discord_modules\\index.js",
|
||||
"discord_overlay2\\index.js",
|
||||
"discord_rpc\\index.js",
|
||||
"discord_spellcheck\\index.js",
|
||||
"discord_utils\\index.js",
|
||||
"discord_voice\\index.js",
|
||||
"discord_desktop_core\\core\\app\\index.js"
|
||||
]){
|
||||
if(filepath.endsWith(file))return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
if(filepath.endsWith(".js"))return true
|
||||
return false
|
||||
}, (filepath, newpath) => {
|
||||
console.info(`Compiling ${filepath} to ${newpath}c`)
|
||||
bytenode.compileFile(filepath, newpath+"c")
|
||||
}, async (filepath, newpath) => {
|
||||
console.info(`Minifying ${filepath} to ${newpath}`)
|
||||
await fs.promises.writeFile(newpath, terser.minify(await fs.promises.readFile(filepath, "utf8")).code, "utf8")
|
||||
}).then(() => {
|
||||
console.info(`Copied files and minified them from ${path.join(__dirname, "modules")}.`)
|
||||
})
|
||||
})/*
|
||||
await processNextDir(startDir, {
|
||||
startDir,
|
||||
newDir
|
||||
}, ((filepath) => false), ()=>{}).then(() => {
|
||||
console.info(`Copied files and minified them from ${startDir}.`)
|
||||
}).catch(console.error)
|
||||
}).catch(console.error)*/
|
||||
|
||||
let packageJSON = require("./package.json")
|
||||
packageJSON.scripts.build = packageJSON.scripts.build.replace("./distApp", ".")
|
||||
|
|
|
@ -349,7 +349,8 @@ function launchMainAppWindow(isVisible) {
|
|||
blinkFeatures: 'EnumerateDevices,AudioOutputDevices',
|
||||
nodeIntegration: false,
|
||||
preload: _path2.default.join(__dirname, 'mainScreenPreload.js'),
|
||||
nativeWindowOpen: true
|
||||
nativeWindowOpen: true,
|
||||
enableRemoteModule: true // canary shit, just enable it
|
||||
},
|
||||
icon: _path2.default.join(__dirname, 'discord.png')
|
||||
};
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
// we turned off node integration.
|
||||
|
||||
process.on("uncaughtException", console.error)
|
||||
const bytenode = require("bytenode")// enable .jsc files
|
||||
|
||||
const ipcRenderer = require('./discord_native/ipc');
|
||||
const electron = require("electron")
|
||||
|
|
|
@ -172,11 +172,6 @@
|
|||
"integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==",
|
||||
"dev": true
|
||||
},
|
||||
"bytenode": {
|
||||
"version": "1.1.6",
|
||||
"resolved": "https://registry.npmjs.org/bytenode/-/bytenode-1.1.6.tgz",
|
||||
"integrity": "sha512-hhJqv1GMtTa2q4wlfCWEnC5zWFflbJhh1qaYgaqbs8ta6mQUri2eTD76jER8XlAYPtc7IEw2lc36B3H1GTQRpQ=="
|
||||
},
|
||||
"cacheable-request": {
|
||||
"version": "6.1.0",
|
||||
"resolved": "https://registry.npmjs.org/cacheable-request/-/cacheable-request-6.1.0.tgz",
|
||||
|
@ -1086,9 +1081,9 @@
|
|||
}
|
||||
},
|
||||
"terser": {
|
||||
"version": "4.6.13",
|
||||
"resolved": "https://registry.npmjs.org/terser/-/terser-4.6.13.tgz",
|
||||
"integrity": "sha512-wMvqukYgVpQlymbnNbabVZbtM6PN63AzqexpwJL8tbh/mRT9LE5o+ruVduAGL7D6Fpjl+Q+06U5I9Ul82odAhw==",
|
||||
"version": "4.7.0",
|
||||
"resolved": "https://registry.npmjs.org/terser/-/terser-4.7.0.tgz",
|
||||
"integrity": "sha512-Lfb0RiZcjRDXCC3OSHJpEkxJ9Qeqs6mp2v4jf2MHfy8vGERmVDuvjXdd/EnP5Deme5F2yBRBymKmKHCBg2echw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"commander": "^2.20.0",
|
||||
|
|
11
package.json
11
package.json
|
@ -2,17 +2,16 @@
|
|||
"name": "lightcord",
|
||||
"version": "0.1.0",
|
||||
"description": "",
|
||||
"main": "dist/launcher.js",
|
||||
"main": "dist/index.js",
|
||||
"scripts": {
|
||||
"test": "tsc && NODE_OPTIONS.bat && electron .",
|
||||
"run": "NODE_OPTIONS.bat && electron .",
|
||||
"build": "electron-packager . --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",
|
||||
"test": "tsc && electron .",
|
||||
"run": "electron .",
|
||||
"build": "electron compile.js && 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",
|
||||
"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": "",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"bytenode": "^1.1.6",
|
||||
"custom-electron-titlebar": "^3.2.2-hotfix62",
|
||||
"glasstron": "0.0.3",
|
||||
"mkdirp": "^1.0.4",
|
||||
|
@ -29,6 +28,6 @@
|
|||
"@types/rimraf": "^3.0.0",
|
||||
"@types/yauzl": "^2.9.1",
|
||||
"electron": "8.3.0",
|
||||
"terser": "^4.6.13"
|
||||
"terser": "^4.7.0"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,6 +29,7 @@ if (process.platform === 'linux') {
|
|||
|
||||
paths.init(buildInfo)
|
||||
electron.app.commandLine.appendSwitch('autoplay-policy', 'no-user-gesture-required');
|
||||
electron.app.commandLine.appendSwitch("no-force-async-hooks-checks");
|
||||
|
||||
function setupHardwareAcceleration() {
|
||||
const settings = appSettings();
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
require("bytenode")
|
||||
|
||||
require("./index")
|
Loading…
Reference in New Issue