feat(maker): add the flatpak maker for the linux target
This commit is contained in:
Родитель
aea80d91ab
Коммит
218518ef1e
|
@ -1,2 +1,4 @@
|
|||
src
|
||||
test
|
||||
.travis.yml
|
||||
ci
|
||||
|
|
12
.travis.yml
12
.travis.yml
|
@ -4,17 +4,15 @@ node_js:
|
|||
os:
|
||||
- linux
|
||||
- osx
|
||||
dist: trusty
|
||||
sudo: required
|
||||
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- rpm
|
||||
services:
|
||||
- docker
|
||||
|
||||
env:
|
||||
matrix:
|
||||
- NODE_INSTALLER=npm
|
||||
- NODE_INSTALLER=yarn
|
||||
|
||||
script:
|
||||
- if [[ "$NODE_INSTALLER" = "yarn" ]]; then npm i -g yarn; fi
|
||||
- npm run test -- --installer=$NODE_INSTALLER
|
||||
script: ci/script.sh
|
||||
|
|
16
README.md
16
README.md
|
@ -107,14 +107,14 @@ Once you have generated a project your `package.json` file will have some defaul
|
|||
|
||||
## Possible `make` targets
|
||||
|
||||
| Target Name | Available Platforms | Description | Configurable Options | Requirements |
|
||||
|-------------|---------------------|-------------|----------------------|--------------|
|
||||
| `zip` | All | Zips your packaged application | None | `zip` on Darwin/Linux |
|
||||
| `squirrel` | Windows | Generates an installer and `.nupkg` files for Squirrel.Windows | [`electronWinstallerConfig`](https://github.com/electron/windows-installer#usage) |
|
||||
| `dmg` | Darwin | Generates a DMG file | [`electronInstallerDMG`](https://github.com/mongodb-js/electron-installer-dmg#api) |
|
||||
| `deb` | Linux | Generates a Debian installer | [`electronInstallerDebian`](https://github.com/unindented/electron-installer-debian#options) | [`fakeroot` and `dpkg`](https://github.com/unindented/electron-installer-debian#requirements) |
|
||||
| `rpm` | Linux | Generates a Redhat installer | [`electronInstallerRedhat`](https://github.com/unindented/electron-installer-redhat#options) | [`rpm`](https://github.com/unindented/electron-installer-redhatn#requirements) |
|
||||
| `flatpak` | Linux | Generates a `flatpak` file | [`electronInstallerFlatpak`](https://github.com/endlessm/electron-installer-flatpak#options) | [`flatpak`](https://github.com/endlessm/electron-installer-flatpak#requirements) |
|
||||
| Target Name | Available Platforms | Description | Configurable Options | Default? | Requirements |
|
||||
|-------------|---------------------|-------------|----------------------|----------|--------------|
|
||||
| `zip` | All | Zips your packaged application | None | Yes | `zip` on Darwin/Linux |
|
||||
| `squirrel` | Windows | Generates an installer and `.nupkg` files for Squirrel.Windows | [`electronWinstallerConfig`](https://github.com/electron/windows-installer#usage) | Yes | |
|
||||
| `dmg` | Darwin | Generates a DMG file | [`electronInstallerDMG`](https://github.com/mongodb-js/electron-installer-dmg#api) | No | |
|
||||
| `deb` | Linux | Generates a Debian installer | [`electronInstallerDebian`](https://github.com/unindented/electron-installer-debian#options) | Yes | [`fakeroot` and `dpkg`](https://github.com/unindented/electron-installer-debian#requirements) |
|
||||
| `rpm` | Linux | Generates a Redhat installer | [`electronInstallerRedhat`](https://github.com/unindented/electron-installer-redhat#options) | Yes | [`rpm`](https://github.com/unindented/electron-installer-redhatn#requirements) |
|
||||
| `flatpak` | Linux | Generates a `flatpak` file | [`electronInstallerFlatpak`](https://github.com/endlessm/electron-installer-flatpak#options) | No | [`flatpak-builder`](https://github.com/endlessm/electron-installer-flatpak#requirements) |
|
||||
|
||||
## Configuring `package`
|
||||
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
FROM malept/electron-forge-container:latest
|
||||
|
||||
RUN mkdir /code
|
||||
WORKDIR /code
|
||||
ADD . /code/
|
|
@ -0,0 +1,6 @@
|
|||
#!/bin/bash
|
||||
|
||||
NODE_INSTALLER="$1"
|
||||
|
||||
if [[ "$NODE_INSTALLER" = "yarn" ]]; then npm i -g yarn; fi
|
||||
npm run test -- --installer=$NODE_INSTALLER
|
|
@ -0,0 +1,9 @@
|
|||
#!/bin/bash
|
||||
|
||||
if [[ "$TRAVIS_OS_NAME" = "linux" ]]; then
|
||||
sudo docker build -f ci/Dockerfile . -t electron-forge-ci
|
||||
sudo docker run -it electron-forge-ci ci/docker.sh $NODE_INSTALLER
|
||||
else
|
||||
if [[ "$NODE_INSTALLER" = "yarn" ]]; then npm i -g yarn; fi
|
||||
npm run test -- --installer=$NODE_INSTALLER
|
||||
fi
|
|
@ -83,6 +83,7 @@
|
|||
},
|
||||
"optionalDependencies": {
|
||||
"electron-installer-debian": "^0.4.0",
|
||||
"electron-installer-flatpak": "^0.4.0",
|
||||
"electron-installer-redhat": "^0.3.0"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
import installer from 'electron-installer-flatpak';
|
||||
import path from 'path';
|
||||
import pify from 'pify';
|
||||
|
||||
import { ensureFile } from '../../util/ensure-output';
|
||||
|
||||
function flatpakArch(nodeArch) {
|
||||
switch (nodeArch) {
|
||||
case 'ia32': return 'i386';
|
||||
case 'x64': return 'x86_64';
|
||||
// arm => arm
|
||||
default: return nodeArch;
|
||||
}
|
||||
}
|
||||
|
||||
export default async (dir, appName, forgeConfig, packageJSON) => { // eslint-disable-line
|
||||
const arch = flatpakArch(process.arch);
|
||||
const outPath = path.resolve(dir, '../make', `${packageJSON.name}_${packageJSON.version}_${arch}.flatpak`);
|
||||
|
||||
await ensureFile(outPath);
|
||||
const flatpakDefaults = {
|
||||
arch,
|
||||
dest: path.dirname(outPath),
|
||||
src: dir,
|
||||
};
|
||||
const flatpakConfig = Object.assign({}, forgeConfig.electronInstallerFlatpak, flatpakDefaults);
|
||||
|
||||
await pify(installer)(flatpakConfig);
|
||||
};
|
Загрузка…
Ссылка в новой задаче