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