Security News
Maven Central Adds Sigstore Signature Validation
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
@malept/flatpak-bundler
Advanced tools
Build flatpaks from Node.js.
Install @malept/flatpak-bundler
.
$ npm install @malept/flatpak-bundler
Build a flatpak with a Node script.
Install and run it!
$ flatpak install --user --bundle hello.flatpak
$ flatpak run org.world.Hello
Hello, world!
This modules allows building flatpaks programmatically from Node. It requires Node 10 or above and flatpak >= 0.6.13 to be installed on your system.
Under the hood, this is just a wrapper for the flatpak-builder tool with some extra sugar added.
With flatpak-builder
, you specify a runtime, sandbox permissions and software
modules to build into your application, and build a flatpak from start to finish.
This module provides a few additional features:
/app
The latter is particularly useful for Electron and nw.js style Node applications, which often create packages from prebuilt binaries and do not attempt to follow an autotools-like build api.
This module should make it easy to plug flatpak support into an Electron or nw.js app packaging phase.
Used to translate a Node-style arch (e.g., x64
) into a Flatpak-compatible arch (e.g., x86_64
).
If the arch is unknown, it will pass through the input value.
Takes an app manifest and a build options object. It returns a Promise.
Both the manifest and options objects support both camelCase and dash-separated variants of any option.
The promise is returned with a finalBuildOptions
value. It contains the build
options after default values have been applied. Useful to read out the
workingDir
, for example.
This matches the format for flatpak-builder
app
manifests, with a few extra
options added and camelCase variants supported.
/app
contents.flatpak build-finish
. Use this to
add sandbox permissions. See the Electron app example for
some common app permissions.flatpak-builder
from.
Defaults to a new tmp directory.${workingDir}/build
${workingDir}/repo
/share/applications/
)To turn on debugging output, set the DEBUG environment variable:
DEBUG=flatpak-bundler npm run my-flatpak-command
const flatpakBundler = require('@malept/flatpak-bundler')
const fs = require('fs-extra')
// Write a hello world script to disk
await fs.writeFile('hello',
`#!/bin/bash
echo "Hello, world!"`, { mode: 0o755 })
// Make a flatpak with it!
try {
await flatpakBundler.bundle({
id: 'org.world.Hello',
runtime: 'org.freedesktop.Platform',
runtimeVersion: '1.4',
sdk: 'org.freedesktop.Sdk',
}, {
bundlePath: 'hello.flatpak',
files: [
['hello', '/bin/hello']
],
runtimeFlatpakref: 'https://raw.githubusercontent.com/endlessm/flatpak-bundler/master/refs/freedesktop-runtime-1.4.flatpakref'
})
console.log('Flatpak built successfully')
} catch (error) {
console.error('Error building flatpak', error)
}
const flatpakBundler = require('@malept/flatpak-bundler')
try {
const finalBuildOptions = await flatpakBundler.bundle({ // Manifest
id: 'org.world.Hello',
base: 'io.atom.electron.BaseApp', // Electron base application
runtime: 'org.freedesktop.Platform', // Use the freedesktop runtime
runtimeVersion: '1.4',
sdk: 'org.freedesktop.Sdk',
finishArgs: [
'--share=ipc', '--socket=x11', // Allow app to show windows with X11
'--socket=pulseaudio', // Allow audio output
'--filesystem=home', // Allow access to users home directory
'--share=network', // Allow network access
'--device=dri' // Allow OpenGL rendering
],
renameDesktopFile: 'hello.desktop', // Rename the desktop file to agree with the app ID so flatpak will export it
renameIcon: 'hello' // Rename the icon to agree with the app ID so flatpak will export it
}, { // Build options
arch: 'x86_64',
baseFlatpakref: 'https://s3-us-west-2.amazonaws.com/electron-flatpak.endlessm.com/electron-base-app-master.flatpakref', // So we can auto install the runtime
bundlePath: 'dist/hello_x86_64.flatpak',
files: [
[ 'static/linux', '/share/' ], // Desktop file and icons
[ packagedFileDir, '/share/bar' ] // Application binaries and assets
],
gpgSign: '1234ABCD', // GPG key to sign with
runtimeFlatpakref: 'https://raw.githubusercontent.com/endlessm/flatpak-bundler/master/refs/freedesktop-runtime-1.4.flatpakref',
symlinks: [
[ '/share/bar/Bar', '/bin/Bar' ] // Create a symlink in /bin to to app executable
]
})
console.log('Flatpak built successfully.')
console.log(`Build dir and repo in ${finalBuildOptions.workingDir}`)
} catch (error) {
console.error('Error building flatpak', error)
}
FAQs
A small utility for packing files in a flatpak.
The npm package @malept/flatpak-bundler receives a total of 0 weekly downloads. As such, @malept/flatpak-bundler popularity was classified as not popular.
We found that @malept/flatpak-bundler demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.