Skip to content

Commit

Permalink
Some minior fixes.
Browse files Browse the repository at this point in the history
- Fixed (#18) and (#19) issues.
  - Added the icons for the MacOS/Windows builds.
- Some syntax changes.
- Copyright year isn't updated automatically based on the current year from now.
- Splitted electron-forge configuration lines to the new JavaScript file.
- Moved the application documentation to the "docs/" folder.
- Improved building on Linux hosts (with additional BASH script).
  • Loading branch information
SpacingBat3 committed Feb 15, 2021
1 parent e07175b commit f1717ad
Show file tree
Hide file tree
Showing 13 changed files with 252 additions and 167 deletions.
File renamed without changes.
30 changes: 30 additions & 0 deletions build/linux/make-linux.sh
@@ -0,0 +1,30 @@
#!/bin/bash
SOURCES="$(readlink -f "$(dirname "$(which "$0")")/../..")";
case "$(uname -m)" in
'x86_64') HOST='x64' ;;
'x86'|'i'?'86'|'pentium4') HOST='ia32' ;;
'armv7h') HOST='armv7l' ;;
'aarch64') HOST='arm64' ;;
'mips'*) HOST='mips64el' ;;
*) HOST="$(uname -m)" ;;
esac;
ARCH=("x64" "ia32" "armv7l" "arm64" "mips64el");
# Makers that can be used to cross-package on any host arch:
MAKERS=("electron-forge-maker-appimage" # AppImage maker
"@electron-forge/maker-deb"); # DEB package maker

# Package native:
src="$SOURCES" bash -c 'cd "$src"; npm run make';

# Package for non-native arch:
err=0
for maker in "${MAKERS[@]}"; do
[[ -z "$maker_list" ]] || maker_list="${maker_list},";
maker_list="${maker_list}${maker}";
done;
for cpu_arch in "${ARCH[@]}"; do
[[ "$cpu_arch" == "$HOST" || "$err" != 0 ]] && break;
makers="$maker_list" arch="$cpu_arch" src="$SOURCES" bash -c 'cd "$src"; npm run make -- -p linux -a "$arch" --targets "$makers"';
err=$?;
done;
exit $err;
5 changes: 5 additions & 0 deletions CONTRIBUTIONS.md → docs/CONTRIBUTING.md
Expand Up @@ -20,6 +20,11 @@ npm i && npm run make
```
Type `npm run make -- --help` in the Terminal for more advanced usage.

To package for all supported architectures for Linux (on Linux hosts):
```sh
npm i && npm run make:linux
```

## Packaging
Sometimes you don't want to package the application (to quickly debug the application after packaging it) or there's no standard for your OS supported by the Electron Forge. Fortunately, you can still produce the directory containing the electron binary for your OS and architecture and packaged sources in `app.asar` with the Electron Forge.

Expand Down
File renamed without changes.
28 changes: 14 additions & 14 deletions README.md → docs/README.md
@@ -1,25 +1,25 @@
# Electron Discord WebApp
[![MIT license](https://img.shields.io/badge/License-MIT-C23939.svg)](./LICENSE.md)
[![MIT license](https://img.shields.io/badge/License-MIT-C23939.svg)](LICENSE.md)
[![Electron](https://img.shields.io/badge/Made%20with-Electron-486F8F.svg)](https://www.electronjs.org/)
[![GitHub release](https://img.shields.io/github/release/SpacingBat3/electron-discord-webapp.svg)](../../tags)
[![Github downloads](https://img.shields.io/github/downloads/SpacingBat3/electron-discord-webapp/total.svg)](../../releases)
[![GitHub contributors](https://img.shields.io/github/contributors/SpacingBat3/electron-discord-webapp.svg)](../../graphs/contributors)
[![GitHub release](https://img.shields.io/github/release/SpacingBat3/electron-discord-webapp.svg)](../../../tags)
[![Github downloads](https://img.shields.io/github/downloads/SpacingBat3/electron-discord-webapp/total.svg)](../../../releases)
[![GitHub contributors](https://img.shields.io/github/contributors/SpacingBat3/electron-discord-webapp.svg)](../../../graphs/contributors)
[![PRs/Translations Welcome](https://img.shields.io/badge/PRs/Translations-welcome-brightgreen.svg)](#want-to-contribute-to-my-project)
[![Pi-Apps badge](https://badgen.net/badge/Pi-Apps%3F/Yes!/c51a4a?icon=https://raw.githubusercontent.com/Botspot/pi-apps/3d61f713573ba591aba50c32dd95c9df2f845b37/icons/logo.svg)](https://github.com/Botspot/pi-apps)
[![Pi-Apps badge](https://badgen.net/badge/Pi-Apps%3F/Yes!/c51a4a?icon=http://raw.githubusercontent.com/Botspot/pi-apps/3d61f713573ba591aba50c32dd95c9df2f845b37/icons/logo.svg)](https://github.com/Botspot/pi-apps)

A Discord Web App based on the [Electron](https://github.com/electron/electron) engine, tweaked with the [Electron Forge]().
A Discord Web App based on the [Electron](https://github.com/electron/electron) engine, enchanced with the [Electron Forge](https://github.com/electron-userland/electron-forge).

It is completely indpenendent from [Discord-Electron](https://github.com/GyozaGuy/Discord-Electron), but I used it to learn why my previous attempts of doing electron discord app have failed – so I really apprieciate that someone wrote that code. I've previously forked his work, but right now I've made a seperate one – this fixed some issues that the fork had and overall improved multiple things a lot.

## Docs:
- [Contribution](./CONTRIBUTIONS.md)
- [Run from the sources](./CONTRIBUTIONS.md#run)
- [Creating the distributables](./CONTRIBUTIONS.md#creating-distributables)
- [Packaging the application](./CONTRIBUTIONS.md#packaging)
- [Translating the application](./TRANSLATE.md)
- [JSON basics](./TRANSLATE.md#dont-know-the-json-syntax)
- [Credits](./TRANSLATE.md#the-people-that-hepled-me-with-the-app-translation)
- [License](./LICENSE.md)
- [Contributing](CONTRIBUTING.md)
- [Run from the sources](CONTRIBUTING.md#run)
- [Creating the distributables](CONTRIBUTING.md#creating-distributables)
- [Packaging the application](CONTRIBUTING.md#packaging)
- [Translating the application](TRANSLATE.md)
- [JSON basics](TRANSLATE.md#dont-know-the-json-syntax)
- [Credits](TRANSLATE.md#the-people-that-hepled-me-with-the-app-translation)
- [License](LICENSE.md)

## License
This project is redistributed under the [MIT License](LICENSE.md).
Expand Down
File renamed without changes.
Binary file added icons/app.icns
Binary file not shown.
Binary file added icons/app.ico
Binary file not shown.
47 changes: 4 additions & 43 deletions package.json
@@ -1,13 +1,14 @@
{
"name": "electron-discord-webapp",
"productName": "Electron Discord Web App",
"version": "1.0.0",
"version": "1.0.1",
"description": "A Discord Web App based on the Electron Engine.",
"main": "src/js/main.js",
"scripts": {
"start": "electron-forge start",
"package": "electron-forge package",
"make": "electron-forge make"
"make": "electron-forge make",
"make:linux": "bash ./build/linux/make-linux.sh"
},
"keywords": [
"discord",
Expand Down Expand Up @@ -43,46 +44,6 @@
"electron-squirrel-startup": "^1.0.0"
},
"config": {
"forge": {
"packagerConfig": {
"executableName": "electron-discord-webapp"
},
"makers": [
{
"name": "@electron-forge/maker-squirrel",
"config": {
"name": "electron_discord_webapp"
}
},
{
"name": "@electron-forge/maker-zip",
"platforms": [
"darwin"
]
},
{
"name": "@electron-forge/maker-deb",
"config": {}
},
{
"name": "@electron-forge/maker-rpm",
"config": {}
},
{
"name": "electron-forge-maker-appimage",
"config": {
"icon": "icons/app.png"
}
}
],
"publishers": [
{
"name": "@electron-forge/publisher-github",
"config": {
"prerelease": true
}
}
]
}
"forge": "./src/js/configForge.js"
}
}
69 changes: 69 additions & 0 deletions src/js/configForge.js
@@ -0,0 +1,69 @@
/*
* Electron Forge Config (configForge.js)
*/

// Let's import some keys from the package.json:
const packageJson = require(`../../package.json`);
// Global variables in the config:
const iconFile = "icons/app.png"

module.exports = {
packagerConfig: {
executableName: packageJson.name, // name instead of the productName
asar: true,
icon: iconFile, // used in Windows and MacOS binaries
extraResource: [
"docs/LICENSE.md",
iconFile
],
quiet: true,
ignore:[
"docs",
"build"
]
},
makers: [
{
name: "@electron-forge/maker-squirrel",
config: {
name: "electron_discord_webapp"
}
},
{
name: "@electron-forge/maker-zip",
platforms: [
"darwin"
]
},
{
name: "electron-forge-maker-appimage",
config: {
icon: iconFile
}
},
{
name: "@electron-forge/maker-deb",
config: {
options: {
icon: iconFile
}
}
},
{
name: "@electron-forge/maker-rpm",
config: {
options: {
icon: iconFile
}
}
}
],
publishers: [
{
name: "@electron-forge/publisher-github",
config: {
prerelease: true
}
}
]
}

0 comments on commit f1717ad

Please sign in to comment.