mirror of
https://github.com/amitwh/markdown-converter.git
synced 2026-10-01 17:29:29 +05:30
electron-builder 26.x rejected the build with
'configuration.snap should be one of these: null' because
'channels' isn't part of the SnapOptions schema in this
version (it's a snapcraft.yaml / Snap Store publish-side
concept, not a build-time key).
Also relocated 'desktopName' out of linux.* — the warning
says to set it in package.json (done in the prior commit)
and let electron-builder merge it; setting it inline
under linux.* is rejected by the schema too.
What actually silences the warning now:
- package.json: 'desktopName': 'MarkdownConverter' so
Electron sets the same WM_CLASS on the X11/Wayland
window.
- electron-builder.config.js: 'syncDesktopName: true'
inside linux.* so the generated .desktop file's
StartupWMClass matches.
- electron-builder.config.js: 'snap: { confinement,
grade }' at the top level using the valid keys only.
Verified by a fresh linux build producing all three
artifacts (deb, AppImage, snap) without warnings or
schema errors.
Amit Haridas
150 lines
4.9 KiB
JavaScript
150 lines
4.9 KiB
JavaScript
/**
|
|
* electron-builder configuration (replaces the static package.json "build"
|
|
* section so it can be computed dynamically).
|
|
*
|
|
* Why a JS config: the bundled markitdown binary is OPTIONAL at build time —
|
|
* PyInstaller can only build for the host OS, so e.g. a Windows package
|
|
* built on a machine without bin/win32/markitdown.exe must simply omit it
|
|
* (the app falls back to system-installed markitdown at runtime) instead of
|
|
* failing on a missing extraFiles source.
|
|
*
|
|
* Everything else mirrors the previous static config verbatim.
|
|
*/
|
|
const fs = require('fs');
|
|
const path = require('path');
|
|
|
|
/** Common extraFiles for a platform: pandoc always, markitdown when built. */
|
|
function toolExtraFiles(platform) {
|
|
const exe = platform === 'win32' ? '.exe' : '';
|
|
const files = [{ from: `bin/${platform}/pandoc${exe}`, to: `bin/pandoc${exe}` }];
|
|
const markitdown = `bin/${platform}/markitdown${exe}`;
|
|
if (fs.existsSync(path.join(__dirname, markitdown))) {
|
|
files.push({ from: markitdown, to: `bin/markitdown${exe}` });
|
|
} else {
|
|
console.warn(
|
|
`[electron-builder.config] ${markitdown} not found — building WITHOUT the ` +
|
|
'bundled markitdown (the app will use a system install if present). ' +
|
|
'Run "npm run bundle:markitdown" on this platform to bundle it.'
|
|
);
|
|
}
|
|
return files;
|
|
}
|
|
|
|
module.exports = {
|
|
appId: 'com.concreteinfo.markdownconverter',
|
|
productName: 'MarkdownConverter',
|
|
copyright: 'Copyright (C) 2024-2025 ConcreteInfo',
|
|
directories: { output: 'dist' },
|
|
icon: 'assets/icon',
|
|
// v4.13.0 — auto-update wiring via electron-updater. `provider: 'github'`
|
|
// is the no-config option: it reads releases from this repo's Releases
|
|
// page and matches by the tag's semver against package.json. Replace
|
|
// with `generic` + `url:` if you ever move off GitHub releases.
|
|
publish: {
|
|
provider: 'github',
|
|
owner: 'concreteinfo',
|
|
repo: 'markdownconverter',
|
|
releaseType: 'release',
|
|
},
|
|
files: [
|
|
'src/**/*',
|
|
'assets/**/*',
|
|
'scripts/**/*',
|
|
'node_modules/**/*',
|
|
'package.json',
|
|
'THIRD-PARTY-NOTICES.md',
|
|
'SOURCES.md',
|
|
'third-party-licenses/**/*',
|
|
],
|
|
asarUnpack: [
|
|
'node_modules/ffmpeg-static/**',
|
|
'node_modules/sharp/**',
|
|
'node_modules/@img/**',
|
|
'node_modules/@napi-rs/**',
|
|
'assets/fonts/**',
|
|
],
|
|
fileAssociations: [
|
|
{
|
|
ext: 'md',
|
|
name: 'Markdown Document',
|
|
description: 'Markdown Document',
|
|
mimeType: 'text/markdown',
|
|
role: 'Editor',
|
|
},
|
|
{
|
|
ext: 'markdown',
|
|
name: 'Markdown Document',
|
|
description: 'Markdown Document',
|
|
mimeType: 'text/markdown',
|
|
role: 'Editor',
|
|
},
|
|
{
|
|
ext: 'pdf',
|
|
name: 'PDF Document',
|
|
description: 'PDF Document',
|
|
mimeType: 'application/pdf',
|
|
role: 'Editor',
|
|
},
|
|
],
|
|
mac: {
|
|
category: 'public.app-category.productivity',
|
|
identity: null,
|
|
extraFiles: toolExtraFiles('darwin'),
|
|
},
|
|
win: {
|
|
target: [
|
|
{ target: 'nsis', arch: ['x64'] },
|
|
{ target: 'portable', arch: ['x64'] },
|
|
{ target: 'zip', arch: ['x64'] },
|
|
],
|
|
artifactName: '${productName}-${version}-${arch}.${ext}',
|
|
requestedExecutionLevel: 'asInvoker',
|
|
legalTrademarks: 'Copyright (C) 2024-2025 ConcreteInfo',
|
|
verifyUpdateCodeSignature: false,
|
|
signAndEditExecutable: false,
|
|
extraFiles: toolExtraFiles('win32'),
|
|
},
|
|
nsis: {
|
|
oneClick: false,
|
|
perMachine: false,
|
|
allowToChangeInstallationDirectory: true,
|
|
displayLanguageSelector: true,
|
|
createDesktopShortcut: true,
|
|
createStartMenuShortcut: true,
|
|
shortcutName: 'MarkdownConverter',
|
|
runAfterFinish: true,
|
|
menuCategory: 'Productivity',
|
|
license: 'LICENSE',
|
|
warningsAsErrors: false,
|
|
artifactName: '${productName}-Setup-${version}.${ext}',
|
|
deleteAppDataOnUninstall: false,
|
|
differentialPackage: true,
|
|
},
|
|
linux: {
|
|
target: ['deb', 'AppImage', 'snap'],
|
|
category: 'Utility',
|
|
maintainer: 'ConcreteInfo <amit.wh@gmail.com>',
|
|
extraFiles: toolExtraFiles('linux'),
|
|
// v4.13.0 — keep the generated .desktop file's StartupWMClass in sync
|
|
// with the top-level desktopName in package.json so DEs can link the
|
|
// running window to the launcher icon. desktopName itself is read
|
|
// from package.json (electron-builder merges package.json fields into
|
|
// the linux config automatically).
|
|
syncDesktopName: true,
|
|
},
|
|
// v4.13.0 — Snap packaging defaults. `grade: stable` is required for
|
|
// the auto-updater to push updates to the stable track from GitHub
|
|
// releases (electron-updater expects stable-grade snaps). We let
|
|
// snapcraft pick its default channel set — the publish-side channels
|
|
// live in `snapcraft.yaml` / the Snap Store, not in this config.
|
|
snap: {
|
|
confinement: 'strict',
|
|
grade: 'stable',
|
|
},
|
|
deb: {
|
|
depends: ['imagemagick', 'libreoffice-common'],
|
|
description: 'Professional Markdown editor and universal file converter',
|
|
maintainer: 'ConcreteInfo <amit.wh@gmail.com>',
|
|
},
|
|
};
|