mirror of
https://github.com/PreMiD/PreMiD.git
synced 2026-04-06 04:41:58 +02:00
Compare commits
128 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8c7fee9f6d | ||
|
|
e9a245b144 | ||
|
|
2eb2514e74 | ||
|
|
7e69bf8ac3 | ||
|
|
53dbe582ac | ||
|
|
30e94a8964 | ||
|
|
c89bfcd4f9 | ||
|
|
ed3bbc5032 | ||
|
|
855618d926 | ||
|
|
26fcdc4b6e | ||
|
|
7e9b5582c0 | ||
|
|
a850aba829 | ||
|
|
e672acac43 | ||
|
|
0e39061f1b | ||
|
|
c0ed81298d | ||
|
|
dffed32515 | ||
|
|
a679908c6b | ||
|
|
63fac649d9 | ||
|
|
78a78340a0 | ||
|
|
1f1f3efb43 | ||
|
|
4bc8ea068e | ||
|
|
a85b73b935 | ||
|
|
e4b01de2b5 | ||
|
|
b21be7d2c9 | ||
|
|
d410c4699b | ||
|
|
e7b259f764 | ||
|
|
0405098dcc | ||
|
|
6aa7b2afe7 | ||
|
|
255edefa03 | ||
|
|
32e8538e88 | ||
|
|
5bb697bb85 | ||
|
|
46d8e1ecf5 | ||
|
|
53e4615a7a | ||
|
|
7b9eae280d | ||
|
|
e5934f9e85 | ||
|
|
26fae1dd06 | ||
|
|
c0aaba73de | ||
|
|
e849d230e7 | ||
|
|
2c23822ace | ||
|
|
342e44a20f | ||
|
|
121891f825 | ||
|
|
1da64adca1 | ||
|
|
96c8fecb9d | ||
|
|
178858d67c | ||
|
|
18b2899b25 | ||
|
|
8f6c324267 | ||
|
|
9fad4423f4 | ||
|
|
f82f03a06f | ||
|
|
73b82b12a7 | ||
|
|
f49c9ea60d | ||
|
|
f0c53c54b7 | ||
|
|
ab2547cfa0 | ||
|
|
496512f84c | ||
|
|
b954427f1a | ||
|
|
aaebe5e65f | ||
|
|
7fc6cefba1 | ||
|
|
a30ed090c4 | ||
|
|
d60d22d0ec | ||
|
|
890cf02a5e | ||
|
|
af68656310 | ||
|
|
21203685ba | ||
|
|
9caca125d0 | ||
|
|
cb182ac1b2 | ||
|
|
58bebf1b33 | ||
|
|
0ee1d67122 | ||
|
|
e44da5e088 | ||
|
|
18e2801bf8 | ||
|
|
c0dc7fec56 | ||
|
|
2ceba8a949 | ||
|
|
a4b9a1f415 | ||
|
|
3bb7e12a1c | ||
|
|
1704c31a85 | ||
|
|
65cf34b3e0 | ||
|
|
c17e9238a7 | ||
|
|
e56d281631 | ||
|
|
0361dbe153 | ||
|
|
25f0ed2b29 | ||
|
|
ddae09fe85 | ||
|
|
ac9b1369da | ||
|
|
7422c27c7d | ||
|
|
ccc133046c | ||
|
|
bf0e4abece | ||
|
|
e7abd2bebe | ||
|
|
a18ec8a20f | ||
|
|
4b58daac14 | ||
|
|
e76c1ecaf1 | ||
|
|
df4a4b1dce | ||
|
|
028f155268 | ||
|
|
0ccf272a1a | ||
|
|
b2442b3702 | ||
|
|
47d50d0500 | ||
|
|
7c69006e60 | ||
|
|
38bd00212e | ||
|
|
f3a1c5f569 | ||
|
|
6961907eec | ||
|
|
5b66cdd8d4 | ||
|
|
06d5a08dd0 | ||
|
|
6cf14a099b | ||
|
|
93cee61bfb | ||
|
|
82c8262a2c | ||
|
|
b455c5aa2c | ||
|
|
df352a53bc | ||
|
|
2546d38fce | ||
|
|
68984fa817 | ||
|
|
804ff2d2c7 | ||
|
|
da5db665eb | ||
|
|
a457a69c21 | ||
|
|
0d4fb97292 | ||
|
|
b39fa254b9 | ||
|
|
8e7996424c | ||
|
|
2b10984921 | ||
|
|
ba6cb75501 | ||
|
|
d792a73dcf | ||
|
|
dc3477b4cd | ||
|
|
45655ed3cc | ||
|
|
e0a0048d39 | ||
|
|
39c842c026 | ||
|
|
d4e3b4d40f | ||
|
|
7aac2586ef | ||
|
|
fe56d63258 | ||
|
|
79d05914bd | ||
|
|
cb336f47fe | ||
|
|
c95d54c2e9 | ||
|
|
0b47b11601 | ||
|
|
eed3895f1b | ||
|
|
fd6c4d0bf6 | ||
|
|
e50d5a4a88 | ||
|
|
7770fb81d1 |
3
.devScript.json
Normal file
3
.devScript.json
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"outDir": "dist/app"
|
||||
}
|
||||
131
.github/workflows/deploy.yml
vendored
131
.github/workflows/deploy.yml
vendored
@@ -2,8 +2,10 @@ name: DePloY
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
- ".github/**/*"
|
||||
- "src/**/*"
|
||||
- "**.ts"
|
||||
- "package.json"
|
||||
env:
|
||||
NODE_ENV: DePloY
|
||||
jobs:
|
||||
@@ -11,78 +13,87 @@ jobs:
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
os: [windows-latest, macOS-latest]
|
||||
os: [macOS-latest, windows-latest, ubuntu-latest]
|
||||
steps:
|
||||
- uses: actions/checkout@master
|
||||
- uses: actions/setup-node@master
|
||||
- name: Install Dependencies
|
||||
run: npm i -g yarn
|
||||
run: npm i
|
||||
- name: Prepare to package
|
||||
run: |
|
||||
yarn
|
||||
yarn run init
|
||||
run: npm run init
|
||||
- name: Package
|
||||
run: yarn pkg
|
||||
- name: Upload to server
|
||||
env:
|
||||
SSH_HOST: ${{ secrets.SSHHOST }}
|
||||
SSH_USERNAME: ${{ secrets.SSHUSERNAME }}
|
||||
SSH_PASSWORD: ${{ secrets.SSHPASSWORD }}
|
||||
run: yarn deploy
|
||||
run: |
|
||||
npm run pkg
|
||||
rm -r dist/app
|
||||
node util/zip dist ${{ matrix.os }}.zip --zip
|
||||
- uses: actions/upload-artifact@master
|
||||
with:
|
||||
name: ${{ matrix.os }}
|
||||
path: ${{ matrix.os }}.zip
|
||||
installer:
|
||||
needs: package
|
||||
runs-on: "ubuntu-latest"
|
||||
steps:
|
||||
- name: Prepare for installer
|
||||
uses: appleboy/ssh-action@master
|
||||
- uses: actions/checkout@master
|
||||
- uses: actions/setup-node@master
|
||||
- uses: actions/download-artifact@master
|
||||
with:
|
||||
host: ${{ secrets.SSHHOST }}
|
||||
username: ${{ secrets.SSHUSERNAME }}
|
||||
password: ${{ secrets.SSHPASSWORD }}
|
||||
script: |
|
||||
cd /home/PreMiD/builds
|
||||
unzip darwin.zip
|
||||
unzip win32.zip
|
||||
mv darwin/PreMiD-darwin-x64 PreMiD-darwin-x64
|
||||
mv win32/PreMiD-win32-ia32 PreMiD-win32-ia32
|
||||
mv win32/PreMiD-win32-x64 PreMiD-win32-x64
|
||||
rm -r win32.zip darwin.zip darwin win32
|
||||
- name: Create installer (Windows 32bit)
|
||||
uses: appleboy/ssh-action@master
|
||||
name: macOS-latest
|
||||
- uses: actions/download-artifact@master
|
||||
with:
|
||||
host: ${{ secrets.SSHHOST }}
|
||||
username: ${{ secrets.SSHUSERNAME }}
|
||||
password: ${{ secrets.SSHPASSWORD }}
|
||||
script: |
|
||||
cd /home/PreMiD/builds
|
||||
node prepare.js PreMiD-win32-ia32
|
||||
/opt/installbuilder-19.9.0/bin/builder build installer.xml windows
|
||||
name: windows-latest
|
||||
- name: Unzip MacOS
|
||||
run: |
|
||||
mkdir dist/
|
||||
unzip macOS-latest/macOS-latest.zip
|
||||
mv macOS-latest/* dist/
|
||||
ls -ls dist/
|
||||
- name: Unzip Windows
|
||||
run: |
|
||||
unzip windows-latest/windows-latest.zip
|
||||
mv windows-latest/** dist/
|
||||
- name: Download InstallBuilder
|
||||
run: |
|
||||
wget https://clients.bitrock.com/installbuilder/installbuilder-enterprise-19.10.0-linux-x64-installer.run
|
||||
chmod u+x installbuilder-enterprise-19.10.0-linux-x64-installer.run
|
||||
- name: Install InstallBuilder
|
||||
run: |
|
||||
./installbuilder-enterprise-19.10.0-linux-x64-installer.run --installer-language en --prefix ./installbuilder --mode unattended
|
||||
echo "${{ secrets.IBLICENSE }}" > ./installbuilder/license.xml
|
||||
- name: Install Dependencies
|
||||
run: |
|
||||
npm i -D
|
||||
tsc util/prepare
|
||||
- name: Create Updaters
|
||||
run: |
|
||||
installbuilder/autoupdate/bin/customize.run build installer_assets/updater.xml osx
|
||||
installbuilder/autoupdate/bin/customize.run build installer_assets/updater.xml windows
|
||||
- name: Create installer (MacOS 64bit)
|
||||
run: |
|
||||
node util/prepare PreMiD-darwin-x64
|
||||
installbuilder/bin/builder build installer.xml osx
|
||||
zip -r PreMiD-darwin-x64.zip dist/installer
|
||||
- uses: actions/upload-artifact@master
|
||||
with:
|
||||
name: PreMiD-darwin-x64
|
||||
path: PreMiD-darwin-x64.zip
|
||||
- name: Create installer (Windows 64bit)
|
||||
uses: appleboy/ssh-action@master
|
||||
run: |
|
||||
rm -r dist/installer/*
|
||||
node util/prepare PreMiD-win32-x64
|
||||
installbuilder/bin/builder build installer.xml windows
|
||||
zip -r PreMiD-win32-x64.zip dist/installer
|
||||
- uses: actions/upload-artifact@master
|
||||
with:
|
||||
host: ${{ secrets.SSHHOST }}
|
||||
username: ${{ secrets.SSHUSERNAME }}
|
||||
password: ${{ secrets.SSHPASSWORD }}
|
||||
script: |
|
||||
cd /home/PreMiD/builds
|
||||
node prepare.js PreMiD-win32-x64
|
||||
/opt/installbuilder-19.9.0/bin/builder build installer.xml windows
|
||||
- name: Create installer (MacOS)
|
||||
uses: appleboy/ssh-action@master
|
||||
name: PreMiD-win32-x64
|
||||
path: PreMiD-win32-x64.zip
|
||||
- name: Create installer (Windows 32bit)
|
||||
run: |
|
||||
rm -r dist/installer/*
|
||||
node util/prepare PreMiD-win32-ia32
|
||||
installbuilder/bin/builder build installer.xml windows
|
||||
zip -r PreMiD-win32-ia32.zip dist/installer
|
||||
- uses: actions/upload-artifact@master
|
||||
with:
|
||||
host: ${{ secrets.SSHHOST }}
|
||||
username: ${{ secrets.SSHUSERNAME }}
|
||||
password: ${{ secrets.SSHPASSWORD }}
|
||||
script: |
|
||||
cd /home/PreMiD/builds
|
||||
node prepare.js PreMiD-darwin-x64
|
||||
/opt/installbuilder-19.9.0/bin/builder build installer.xml osx
|
||||
- name: Cleanup
|
||||
uses: appleboy/ssh-action@master
|
||||
with:
|
||||
host: ${{ secrets.SSHHOST }}
|
||||
username: ${{ secrets.SSHUSERNAME }}
|
||||
password: ${{ secrets.SSHPASSWORD }}
|
||||
script: |
|
||||
cd /home/PreMiD/builds
|
||||
rm -r PreMiD-darwin-x64 PreMiD-win32-ia32 PreMiD-win32-x64
|
||||
name: PreMiD-win32-ia32
|
||||
path: PreMiD-win32-ia32.zip
|
||||
|
||||
112
devMode.ts
112
devMode.ts
@@ -1,112 +0,0 @@
|
||||
import * as ts from "typescript";
|
||||
import chalk from "chalk";
|
||||
import { ChildProcess, spawn } from "child_process";
|
||||
import { removeSync, writeFileSync, copySync } from "fs-extra";
|
||||
import { extname } from "path";
|
||||
import * as glob from "fast-glob";
|
||||
|
||||
//* Current child process = null
|
||||
var currChild: ChildProcess = null;
|
||||
|
||||
//* Format Host
|
||||
const formatHost: ts.FormatDiagnosticsHost = {
|
||||
getCanonicalFileName: path => path,
|
||||
getCurrentDirectory: ts.sys.getCurrentDirectory,
|
||||
getNewLine: () => ts.sys.newLine
|
||||
};
|
||||
|
||||
//* Create ts program
|
||||
const createProgram = ts.createSemanticDiagnosticsBuilderProgram;
|
||||
|
||||
//* Create Watch compoile host
|
||||
const host = ts.createWatchCompilerHost(
|
||||
"./tsconfig.json",
|
||||
{},
|
||||
ts.sys,
|
||||
createProgram,
|
||||
null,
|
||||
fileChange
|
||||
);
|
||||
|
||||
if (process.argv.length == 3 && process.argv[2] == "compile")
|
||||
prepareDist().then(() => process.exit());
|
||||
//* Create watch program
|
||||
else ts.createWatchProgram(host);
|
||||
|
||||
async function fileChange(diagnostic: ts.Diagnostic) {
|
||||
//* TS compilation != done
|
||||
if (diagnostic.code !== 6194) {
|
||||
//* If error
|
||||
if ([6031, 6032].includes(diagnostic.code))
|
||||
console.log(
|
||||
chalk.blueBright(ts.formatDiagnostic(diagnostic, formatHost))
|
||||
);
|
||||
else
|
||||
console.log(chalk.redBright(ts.formatDiagnostic(diagnostic, formatHost)));
|
||||
return;
|
||||
} else
|
||||
console.log(chalk.greenBright(ts.formatDiagnostic(diagnostic, formatHost)));
|
||||
|
||||
console.log(currChild && currChild.killed);
|
||||
//* Kill old child if exists && alive
|
||||
if (currChild && !currChild.killed) currChild.kill();
|
||||
|
||||
//* Run devMode script
|
||||
prepareDist();
|
||||
|
||||
//* Clear console
|
||||
console.clear();
|
||||
|
||||
//* Run child
|
||||
currChild = spawn("yarn start", {
|
||||
shell: true,
|
||||
stdio: "inherit"
|
||||
});
|
||||
}
|
||||
|
||||
//* Prepare dist folder
|
||||
async function prepareDist() {
|
||||
//* Select files
|
||||
var dist = await glob("dist/app/**/*", { onlyFiles: true }),
|
||||
src = await glob("src/**/*", { onlyFiles: true });
|
||||
|
||||
//* Filter file differences
|
||||
var nDist = dist.map(f => [f.replace("dist/app/", ""), f]);
|
||||
src = src
|
||||
.map(f => f.replace("src/", "").split(".")[0])
|
||||
.filter(sf => nDist.find(d => d[0].split(".")[0] == sf));
|
||||
|
||||
//* Old files, delete
|
||||
Promise.all(
|
||||
dist
|
||||
.filter(f => !src.includes(f.replace("dist/app/", "").split(".")[0]))
|
||||
.map(f => removeSync(f))
|
||||
);
|
||||
|
||||
//* Copy package.json (minified)
|
||||
var packageJSON = require("./package.json"),
|
||||
srcPackageJSON = packageJSON;
|
||||
|
||||
//* Delete scripts, not needed
|
||||
delete srcPackageJSON.scripts;
|
||||
|
||||
//* only electron as devDependency
|
||||
srcPackageJSON.devDependencies = {
|
||||
electron: packageJSON.devDependencies.electron
|
||||
};
|
||||
|
||||
//* Write file
|
||||
await writeFileSync(
|
||||
"./src/package.json",
|
||||
JSON.stringify(srcPackageJSON, null, 2)
|
||||
);
|
||||
|
||||
//* Copy files from src to dist
|
||||
copySync("src", "dist/app", {
|
||||
filter: function(path) {
|
||||
if (path.includes("node_modules")) return false;
|
||||
return extname(path) !== ".ts";
|
||||
console.log(path);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
<project>
|
||||
<shortName>PreMiD</shortName>
|
||||
<fullName>PreMiD</fullName>
|
||||
<version>{{VERSION}}</version>
|
||||
<version>VERSION</version>
|
||||
<installerFilename>${product_fullname}-${product_version}-installer_64bit.${platform_exec_suffix}</installerFilename>
|
||||
<wrapLicenseFileText>0</wrapLicenseFileText>
|
||||
<logoImage>../installer_assets/appIcon.png</logoImage>
|
||||
|
||||
41
package.json
41
package.json
@@ -2,50 +2,53 @@
|
||||
"name": "premid",
|
||||
"productName": "PreMiD",
|
||||
"description": "Discord Rich Presence for websites.",
|
||||
"version": "2.0.3",
|
||||
"version": "2.0.5",
|
||||
"repository": "https://github.com/PreMiD/PreMiD",
|
||||
"scripts": {
|
||||
"init": "tsc && tsc pkg devMode && node devMode.js compile",
|
||||
"init": "tsc && tsc pkg util/prepare util/zip && devScript --copyOnly",
|
||||
"start": "electron dist/app/.",
|
||||
"dev": "node devMode.js",
|
||||
"pkg": "rimraf dist && tsc && node devMode compile && cd dist/app/ && yarn && cd ../../ && node pkg",
|
||||
"dev": "devScript",
|
||||
"pkg": "rimraf dist && tsc && devScript --copyOnly && cd dist/app/ && yarn && cd ../../ && node pkg",
|
||||
"deploy": "tsc .github/deploy && cd .github && node deploy.js"
|
||||
},
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"@timeraa/devscript": "Timeraa/DevScript",
|
||||
"@types/archiver": "3.0.0",
|
||||
"@types/auto-launch": "5.0.1",
|
||||
"@types/discord-rpc": "3.0.2",
|
||||
"@types/electron-packager": "14.0.0",
|
||||
"@types/fs-extra": "8.0.1",
|
||||
"@types/ini": "1.3.30",
|
||||
"@types/node": "^12.11.7",
|
||||
"@types/prompts": "2.0.2",
|
||||
"@types/node": "^12.12.14",
|
||||
"@types/prompts": "2.0.3",
|
||||
"@types/request-promise-native": "1.0.17",
|
||||
"@types/rimraf": "2.0.3",
|
||||
"@types/socket.io": "2.1.4",
|
||||
"@types/ssh2-sftp-client": "4.1.0",
|
||||
"@types/ssh2-sftp-client": "4.1.1",
|
||||
"@types/unzipper": "^0.10.1",
|
||||
"archiver": "3.1.1",
|
||||
"chalk": "2.4.2",
|
||||
"electron": "7.0.0",
|
||||
"electron-packager": "14.0.6",
|
||||
"chalk": "3.0.0",
|
||||
"electron": "7.1.2",
|
||||
"electron-packager": "14.1.1",
|
||||
"fast-glob": "3.1.0",
|
||||
"fs-extra": "8.1.0",
|
||||
"ini": "1.3.5",
|
||||
"nodemon": "1.19.4",
|
||||
"ora": "4.0.2",
|
||||
"prompts": "2.2.1",
|
||||
"nodemon": "2.0.1",
|
||||
"ora": "4.0.3",
|
||||
"prompts": "2.3.0",
|
||||
"rimraf": "3.0.0",
|
||||
"source-map-support": "0.5.13",
|
||||
"ssh2-sftp-client": "4.2.2",
|
||||
"typescript": "3.6.4",
|
||||
"yarn": "^1.19.1"
|
||||
"source-map-support": "0.5.16",
|
||||
"ssh2-sftp-client": "4.2.4",
|
||||
"typescript": "3.7.2",
|
||||
"unzipper": "^0.10.5",
|
||||
"yarn": "^1.19.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"auto-launch": "5.0.5",
|
||||
"discord-rpc": "github:discordjs/RPC",
|
||||
"electron-store": "5.0.0",
|
||||
"electron-store": "5.1.0",
|
||||
"socket.io": "2.3.0",
|
||||
"sudo-prompt": "9.0.0"
|
||||
"sudo-prompt": "9.1.1"
|
||||
}
|
||||
}
|
||||
|
||||
BIN
src/assets/appIcon.icns
Normal file
BIN
src/assets/appIcon.icns
Normal file
Binary file not shown.
@@ -98,7 +98,11 @@ export function update() {
|
||||
|
||||
sudoPrompt.exec(
|
||||
`\"${updaterPath}\" --mode unattended --unattendedmodebehavior download`,
|
||||
(error: Error) => {
|
||||
{
|
||||
name: app.name,
|
||||
icns: "assets/appIcon.icns"
|
||||
},
|
||||
error => {
|
||||
dialog.showErrorBox(
|
||||
"Error while updating",
|
||||
`${app.name} was unable to update itself. Please try again later.`
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
},
|
||||
"include": ["src/**/*"],
|
||||
"exclude": [
|
||||
"devMode.ts",
|
||||
"pkg.ts",
|
||||
"util/**/*",
|
||||
"installer_assets/builder.ts",
|
||||
".github/deploy.ts"
|
||||
]
|
||||
|
||||
23
util/prepare.ts
Normal file
23
util/prepare.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import { readFileSync, writeFileSync } from "fs";
|
||||
import { parse, stringify } from "ini";
|
||||
|
||||
let file = readFileSync("installer_assets/installer.xml", "utf-8");
|
||||
|
||||
file = file.replace("VERSION", require("../package.json").version);
|
||||
file = file.replace(/(PACKAGEDNAME)/g, process.argv[2]);
|
||||
|
||||
if (process.argv[2].includes("ia32"))
|
||||
file = file.replace(/(installer_64bit)/g, "installer_32bit");
|
||||
|
||||
file = file.replace(/(\.\.\/)/g, "");
|
||||
|
||||
writeFileSync("installer.xml", file);
|
||||
|
||||
let versionId = (require("../package.json").version as string)
|
||||
.replace(/[.]/g, "")
|
||||
.padStart(4, "0"),
|
||||
updateIni = parse(readFileSync("installer_assets/update.ini", "utf-8"));
|
||||
|
||||
updateIni.Update.version_id = versionId;
|
||||
|
||||
writeFileSync("update.ini", stringify(updateIni));
|
||||
16
util/zip.ts
Normal file
16
util/zip.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import * as archiver from "archiver";
|
||||
import { Extract } from "unzipper";
|
||||
import { createWriteStream, createReadStream } from "fs";
|
||||
import { basename } from "path";
|
||||
|
||||
if (process.argv.includes("--zip")) {
|
||||
const archive = archiver("zip"),
|
||||
output = createWriteStream(process.argv[3]);
|
||||
|
||||
archive.pipe(output);
|
||||
archive.directory(process.argv[2], basename(process.argv[3], ".zip"));
|
||||
|
||||
archive.finalize();
|
||||
} else {
|
||||
createReadStream(process.argv[2]).pipe(Extract({ path: process.cwd() }));
|
||||
}
|
||||
Reference in New Issue
Block a user