mirror of
https://github.com/amitwh/markdown-converter.git
synced 2026-10-01 09:19:34 +05:30
- electron-builder config moves to electron-builder.config.js so markitdown bundling is conditional per platform (PyInstaller only builds for the host OS; a missing binary now logs a warning and ships without it instead of failing the build); package.json static build section removed, all npm scripts pointed at the config; third-party-licenses/ added to packaged files - FIX (pre-existing): packaged apps looked for bundled pandoc in resources/bin, but extraFiles land next to the executable (Contents/ on macOS) — packaged builds silently fell back to system pandoc since 4.5. New bundledToolDir() resolves the real location for pandoc + markitdown - download-tools.js pins the win32 pandoc.exe SHA-256 (fetched + verified) - sharp packaging test accepts sharp 0.35's versioned binding filename - release.yml: bundle-markitdown step (best-effort) on every OS and a new macOS job; release aggregates linux+windows+macos artifacts Local release artifacts built and verified (dist/): - MarkdownConverter-4.7.0.AppImage (363MB, pandoc+markitdown bundled, packaged app boots clean, tools resolve at the fixed path) - markdown-converter_4.7.0_amd64.deb (293MB) - MarkdownConverter-Setup-4.7.0.exe (223MB), portable exe (223MB), zip (305MB) — pandoc bundled; markitdown omitted (cannot cross-build), legal docs verified inside app.asar 637/637 tests green; lint clean.
125 lines
3.8 KiB
JavaScript
125 lines
3.8 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',
|
|
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'),
|
|
},
|
|
deb: {
|
|
depends: ['imagemagick', 'libreoffice-common'],
|
|
description: 'Professional Markdown editor and universal file converter',
|
|
maintainer: 'ConcreteInfo <amit.wh@gmail.com>',
|
|
},
|
|
};
|