This commit is contained in:
Jean Ouina 2020-08-20 13:42:28 +02:00
commit 87b1b4ff12
22 changed files with 33 additions and 12 deletions

5
.gitignore vendored
View File

@ -114,4 +114,7 @@ distApp
# discord_voice debug
discord-last-webrtc_0
discord-webrtc_0
discord-webrtc_0
# macOS Stuff
.DS_Store

View File

@ -1,2 +0,0 @@
{
}

View File

@ -12,6 +12,9 @@ winZip.outputStream.pipe(fs.createWriteStream(__path.join(__dirname, "builds", "
const linuxZip = new yazl.ZipFile()
linuxZip.outputStream.pipe(fs.createWriteStream(__path.join(__dirname, "builds", "lightcord-linux-x64.zip")))
const darwinZip = new yazl.ZipFile()
darwinZip.outputStream.pipe(fs.createWriteStream(__path.join(__dirname, "builds", "lightcord-darwin-x64.zip")))
async function processNextDir(dir, zip, bpath, platform){
if(!bpath)bpath = dir
if(dir.replace(bpath, ""))zip.addEmptyDirectory(dir.replace(bpath, "").slice(1))
@ -24,9 +27,14 @@ async function processNextDir(dir, zip, bpath, platform){
if(!path.includes("node_modules")){
if(platform === "win"){
if(file.name.endsWith("_linux.node"))return
if(file.name.endsWith("_darwin.node"))return
}else if(platform === "lin"){
if(file.name.endsWith(".node")){
if(!file.name.endsWith("_linux.node"))return
}else if(platform === "dar"){
if(file.name.endsWith(".node")){
if(!file.name.endsWith("_darwin.node"))return
}
}
if(file.name.endsWith(".dll"))return
}
@ -51,4 +59,10 @@ processNextDir(__path.join(__dirname, "builds", "lightcord-linux-x64"), linuxZip
.then(() => {
console.log(`Zipped linux.`)
linuxZip.end()
})
processNextDir(__path.join(__dirname, "builds", "lightcord-darwin-x64", darwinZip, undefined, "dar"))
.then(()=> {
console.log('Zipped Darwin')
darwinZip.end()
})

BIN
app_icon_darwin.icns Normal file

Binary file not shown.

View File

@ -221,6 +221,7 @@ async function main(){
let packageJSON = require("./package.json")
packageJSON.scripts["build:electron_linux"] = packageJSON.scripts["build:electron_linux"].replace("./distApp", ".")
packageJSON.scripts["build:electron_win"] = packageJSON.scripts["build:electron_win"].replace("./distApp", ".")
packageJSON.scripts["build:electron_darwin"] = packageJSON.scripts["build:electron_darwin"].replace("./distApp", ".")
fs.writeFileSync(path.join(__dirname, "distApp", "package.json"), JSON.stringify(packageJSON), "utf8")

View File

@ -2,7 +2,9 @@ const EventEmitter = require('events');
let addon = './discord_cloudsync.node'
if(process.platform === "linux"){
addon = './discord_cloudsync_linux.node'
}
}else if(process.platform === "darwin") {
addon = './discord_cloudsync_darwin.node'
}
const {CloudSync: CloudSyncNative} = require(addon);
function makeCallback(resolve, reject) {

Binary file not shown.

View File

@ -1 +1 @@
module.exports = require(process.platform === "linux" ? './discord_dispatch_linux.node' : './discord_dispatch.node');
module.exports = require((process.platform === "linux") ? './discord_dispatch_linux.node' : (process.platform === "darwin") ? './discord_dispatch_darwin.node' : './discord_dispatch.node');

Binary file not shown.

View File

@ -1 +1 @@
module.exports = require(process.platform === "linux" ? './discord_erlpack_linux.node' : './discord_erlpack.node');
module.exports = require((process.platform === "linux") ? './discord_erlpack_linux.node' : (process.platform === "darwin") ? './discord_erlpack_darwin.node' : './discord_erlpack.node');

View File

@ -1 +1 @@
module.exports = require(process.platform === "linux" ? './discord_game_utils_linux.node' : './discord_game_utils.node');
module.exports = require((process.platform === "linux") ? './discord_game_utils_linux.node' : (process.platform === "darwin") ? './discord_game_utils_darwin.node' : './discord_game_utils.node');

Binary file not shown.

View File

@ -1 +1 @@
module.exports = require(process.platform === "linux" ? './discord_modules_linux.node' : './discord_modules.node');
module.exports = require((process.platform === "linux") ? './discord_modules_linux.node' : (process.platform === "darwin") ? './discord_modules_darwin.node' : './discord_modules.node');

Binary file not shown.

View File

@ -4,6 +4,8 @@ const superagent = require('superagent');
let addon = './discord_utils.node'
if(process.platform === "linux"){
addon = './discord_utils_linux.node'
} else if (process.platform === "darwin"){
addon = './discord_utils_darwin.node'
}
module.exports = require(addon);

Binary file not shown.

View File

@ -1,4 +1,4 @@
const VoiceEngine = require(process.platform === "linux" ? './discord_voice_linux.node' : './discord_voice.node');
const VoiceEngine = require((process.platform === "linux") ? './discord_voice_linux.node' : (process.platform === "darwin") ? './discord_voice_darwin.node' : './discord_voice.node');
const ChildProcess = require('child_process');
const path = require('path');
const yargs = require('yargs');

Binary file not shown.

View File

@ -8,9 +8,10 @@
"test": "npm run compile && electron .",
"run": "electron .",
"build": "npm run build:minify && npm run build:electron && npm run build:after",
"build:electron": "npm run build:electron_win && npm run build:electron_linux",
"build:electron_win": "electron-packager ./distApp --ignore=\"(distApp|builds|\\.ts|\\.so\\.4)\" --arch=ia32 --win32metadata.ProductName=\"Lightcord\" --win32metadata.CompanyName=\"Lightcord\" --protocol=discord --platform=\"win32\" --out=builds --icon=app.ico --executable-name=\"Lightcord\" --asar.unpack=*.{node,dll} --overwrite",
"build:electron_linux": "electron-packager ./distApp --ignore=\"(distApp|builds|\\.ts|\\.dll)\" --arch=x64 --protocol=discord --platform=\"linux\" --out=builds --icon=app.ico --executable-name=\"Lightcord\" --asar.unpack=*.{node,so.4} --overwrite",
"build:electron": "npm run build:electron_win && npm run build:electron_linux && npm run build:electron_darwin",
"build:electron_win": "electron-packager ./distApp --ignore=\"(distApp|builds|\\.ts|\\.so\\.4)\" --arch=ia32 --win32metadata.ProductName=\"Lightcord\" --win32metadata.CompanyName=\"Lightcord\" --protocol=discord --platform=\"win32\" --out=builds --icon=app.ico --executable-name=\"Lightcord\" --asar.unpack='*.{node,dll}' --overwrite",
"build:electron_linux": "electron-packager ./distApp --ignore=\"(distApp|builds|\\.ts|\\.dll)\" --arch=x64 --protocol=discord --platform=\"linux\" --out=builds --icon=app.ico --executable-name=\"Lightcord\" --asar.unpack='*.{node,so.4}' --overwrite",
"build:electron_darwin": "electron-packager ./distApp --ignore\"(distApp|builds|\\.ts\\.so\\.4\\.dll )\" --arch=x64 --protocol=discord --platform=\"darwin\" --out=builds --icon=app_icon_darwin.icns --executable-name=\"Lightcord\" --asar.unpack='*.{node,dylib}' --overwrite",
"build:minify": "node build.js",
"build:after": "node afterbuild.js",
"devInstall": "npm i --save-dev --arch=ia32 electron@8.5.0 && node installSubModules.js && echo \"Everything is installed. You should be able to do `npm run test` to compile everything and launch.\"",