Security News
PyPI’s New Archival Feature Closes a Major Security Gap
PyPI now allows maintainers to archive projects, improving security and helping users make informed decisions about their dependencies.
flatpak-bundler
Advanced tools
Build flatpaks from nodejs.
Install flatpak-bundler.
$ npm install flatpak-bundler -g
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 programatically from node. It requires 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 you 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 a electron or nw.js app packaging phase.
flatpak-bundler
provides a single method, bundle
, which takes an app
manifest, a build options object, and a completion callback.
Both the manifest and options objects support both camelCase and dash-separated variants of any option.
The callback with be called with callback(error, finalBuildOptions)
arguments.
The finalBuildOptions 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. For complete documentation of the manifest format read the flatpak-builder docs.
/app
contents.flatpak build-finish
. Use this to
add sandbox permissions. See the Electron app example for
some common app permissions.In addition to standard manifest options, the following extra options are supported.
/share/applications/
)flatpak-builder
from.
Defaults to a new tmp directory.${workingDir}/build
${workingDir}/repo
To turn on debugging output set the DEBUG environment variable
DEBUG=flatpak-bundler npm run my-flatpak-command
// Write a hello world script to disk
const fs = require('fs')
fs.writeFileSync('hello',
`#!/bin/bash
echo "Hello, world!"`, { mode: 0o755 })
// Make a flapak with it!
const flatpakBundler = require('flatpak-bundler')
flatpakBundler.bundle({
id: 'org.world.Hello',
runtime: 'org.freedesktop.Platform',
runtimeVersion: '1.4',
runtimeFlatpakref: 'https://raw.githubusercontent.com/endlessm/flatpak-bundler/master/refs/freedesktop-runtime-1.4.flatpakref',
sdk: 'org.freedesktop.Sdk',
files: [
['hello', '/bin/hello']
]
}, {
bundlePath: 'hello.flatpak'
}, function (error) {
if (error) {
console.error('Error building flatpak', error)
return
}
console.log('Flatpak built successfully')
})
const flatpakBundler = require('flatpak-bundler')
flatpakBundler.bundle({ // Manifest
id: 'org.world.Hello',
base: 'io.atom.electron.BaseApp', // Electron base application
baseFlatpakref: FIXME, // So we can auto install the runtime
runtime: 'org.freedesktop.Platform', // Use the freedesktop runtime
runtimeVersion: '1.4',
runtimeFlatpakref: 'https://raw.githubusercontent.com/endlessm/flatpak-bundler/master/refs/freedesktop-runtime-1.4.flatpakref',
sdk: 'org.freedesktop.Sdk',
files: [
[ 'static/linux', '/share/' ], // Desktop file and icons
[ packagedFileDir, '/share/bar' ] // Application binaries and assets
],
symlinks: [
[ '/share/bar/Bar', '/bin/Bar' ] // Create a symlink in /bin to to app executable
],
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',
bundlePath: 'dist/hello_x86_64.flatpak',
gpgSign: '1234ABCD' // Gpg key to sign with
}, function (error, finalAppOptions, finalBuildOptions) { // Callback
if (error) {
console.error('Error building flatpak')
console.error(error)
return
}
console.log('Flatpak built successfully.')
console.log('Build dir and repo in ' + finalBuildOptions.workingDir)
})
FAQs
A small utility for packing files in a flatpak.
The npm package flatpak-bundler receives a total of 536 weekly downloads. As such, flatpak-bundler popularity was classified as not popular.
We found that 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
PyPI now allows maintainers to archive projects, improving security and helping users make informed decisions about their dependencies.
Research
Security News
Malicious npm package postcss-optimizer delivers BeaverTail malware, targeting developer systems; similarities to past campaigns suggest a North Korean connection.
Security News
CISA's KEV data is now on GitHub, offering easier access, API integration, commit history tracking, and automated updates for security teams and researchers.