Repository navigation
0.1.0-beta.6
Pre-release
Pre-release
@diamonddigitaldev/electron-kit | Beta Preview (v0.1.0-beta.6)
Important
A beta: the API can still change between 0.x versions. It's published under npm's next tag.
The installer asks before it claims a file type or adds a right-click entry, and asks who it's for. On Linux, an app is in Open With for the files it opens, and the dock knows its window. An app on 0.1.0-beta.5 runs on it without a change, but its build config should move to the kit's config() to get either: see below.
npm install @diamonddigitaldev/electron-kit@nextNew
config(), from@diamonddigitaldev/electron-kit/builder: an app's whole electron-builder config, on the kit's base, from its own options, the files it opens and its right-click entry. It goes inelectron-builder.cjs, besidepackage.json, andpackage.json'sbuildgoes (electron-builder would read it first)..cjs, never.js: on Windows,electron-buildertyped in a folder holdingelectron-builder.jsruns that file with Windows Script Host instead.
const { config } = require("@diamonddigitaldev/electron-kit/builder");
module.exports = config(require("./package.json"), {
build: { appId, productName, publish, win, linux: { icon, category: "AudioVideo" }, nsis, ... },
fileTypes: [{ name: "Audio File", ext: ["mp3", "wav"] }, { name: "Video File", ext: ["mp4"] }],
contextMenu: { label: "Convert with App", folders: true },
});- The asking installer (Windows). It asks who it's for: "Only for me" by default, with no administrator prompt, or everyone. An install for everyone already there is upgraded in place, never joined by a second copy. Then a box for each file type, in the app's groups, all ticked, and one for the right-click entry. A ticked type puts the app in Open With and in Settings > Apps > Default apps, and becomes the default only where no app has been chosen; an unticked one gets nothing. The choices are kept, so an update never adds back what was unticked. Uninstalling takes away everything the installer added. Silently,
/FILETYPES=all,noneor a list, and/NOCONTEXTMENU. - Linux's desktop entry. The
.desktopfile lists the file types' MIME types, so the app is in the file manager's Open With, and gets every selected file. It's named for the app'sappId, which Electron gives the running window, so the dock shows the app's own icon.allFiles: true, for an app that takes any file, puts it in Open With for every file. assertBuildExtendsKit()takes the config itself:assertBuildExtendsKit(require("../electron-builder.cjs")).
Changed
config()never sets electron-builder'sfileAssociations, which claim every type on Windows without asking, and refuses them, with an app's ownnsis.include(itsinstaller.nsh),perMachineandoneClick: the kit's installer asks instead.build.linux.categoryis needed.
Docs
- Building:
config(), the asking installer, the files an app opens on Linux, and the.deband.rpmupdating themselves (after a password prompt). - Getting Started and Testing an App: the
builderexport, and the build config's check.
The docs are in the repository: start at docs/README.md.
Found something wrong? Open an issue.