Bladeren bron

Release packaging: AppImage via electron-builder

- electron-builder config in apps/electron (AppImage, product metadata)
- electron-launcher.js sets THEIA_PLUGINS to bundled resources/plugins
- sync-plugins stages modula2-language with production node_modules
- plugins ship as extraResources (outside asar); README documents
  the yarn package flow and host prerequisites (gm2, gdb, readelf)
Eric Streit 1 week geleden
bovenliggende
commit
5426b2038d
5 gewijzigde bestanden met toevoegingen van 598 en 27 verwijderingen
  1. 1 0
      .gitignore
  2. 22 0
      README.md
  3. 19 0
      apps/electron/electron-launcher.js
  4. 27 3
      apps/electron/package.json
  5. 529 24
      yarn.lock

+ 1 - 0
.gitignore

@@ -3,6 +3,7 @@ lib/
 out/
 src-gen/
 plugins/
+dist/
 .browser_modules/
 *.log
 .DS_Store

+ 22 - 0
README.md

@@ -50,6 +50,28 @@ yarn start:electron
 
 The language extension is intentionally a VS Code-compatible extension because Theia recommends VS Code extensions for language support. Native Theia extensions are used for product-specific workbench features.
 
+## Release packaging (AppImage)
+
+The Electron app packages to a self-contained AppImage with everything
+except the compiler toolchain (see host prerequisites below):
+
+```bash
+cd apps/electron
+yarn package   # production bundle + plugin staging + AppImage in dist/
+```
+
+This runs `bundle:prod` (native rebuild + production esbuild), stages the
+`modula2-language` plugin with its runtime dependencies into
+`apps/electron/plugins/`, and builds
+`dist/Modula-2 IDE-<version>.AppImage` via electron-builder. The packaged
+launcher (`electron-launcher.js`) points the backend at the bundled
+`resources/plugins` through the `THEIA_PLUGINS` environment variable, so no
+`--plugins` flag is needed.
+
+Host prerequisites (not bundled): GNU Modula-2 (`gm2`), `gdb` and `readelf`
+for build/run/debug. On Debian/Ubuntu the IDE itself needs only FUSE (or
+`APPIMAGE_EXTRACT_AND_RUN=1`) to launch the AppImage.
+
 ## Roadmap
 
 1. Stabilize the GNU Modula-2/Coco/R grammar against `gm2` (see `GNU-grammar`).

+ 19 - 0
apps/electron/electron-launcher.js

@@ -0,0 +1,19 @@
+// Packaged-app launcher: point the backend at the bundled VS Code plugins,
+// then boot the real Electron main. In dev (`yarn start`) this file is not
+// used: resourcesPath has no `plugins` sibling and the start script already
+// passes `--plugins` explicitly, so behaviour there is unchanged.
+const path = require('path');
+
+if (!process.env.THEIA_PLUGINS) {
+  try {
+    const fs = require('fs');
+    const dir = path.join(process.resourcesPath, 'plugins');
+    if (fs.existsSync(dir)) {
+      process.env.THEIA_PLUGINS = `local-dir:${dir}`;
+    }
+  } catch {
+    // Unexpected layout: fall through to default plugin discovery.
+  }
+}
+
+module.exports = require('./lib/backend/electron-main.js');

+ 27 - 3
apps/electron/package.json

@@ -1,8 +1,10 @@
 {
   "private": true,
   "name": "modula2-ide-electron",
-  "version": "0.1.0",
-  "main": "lib/backend/electron-main.js",
+  "version": "0.12.0",
+  "description": "GNU Modula-2 IDE built on Eclipse Theia",
+  "author": "Eric Streit <eric@yojik.eu>",
+  "main": "electron-launcher.js",
   "dependencies": {
     "@theia/core": "1.75.0",
     "@theia/debug": "1.75.0",
@@ -31,14 +33,36 @@
     "@types/react": "^19.0.0",
     "@types/react-dom": "^19.0.0",
     "electron": "42.8.1",
+    "electron-builder": "^26.15.3",
     "rimraf": "^6.0.1"
   },
   "scripts": {
     "clean": "rimraf src-gen",
     "rebuild": "theia rebuild:electron --cacheRoot ../..",
     "bundle": "yarn rebuild && theia build --mode development",
+    "bundle:prod": "yarn rebuild && theia build --mode production",
+    "sync-plugins": "rm -rf plugins && mkdir -p plugins && cp -a ../../plugins/modula2-language plugins/modula2-language && rm -rf plugins/modula2-language/src && npm install --omit=dev --no-audit --no-fund --ignore-scripts --prefix plugins/modula2-language",
     "start": "theia start --plugins=local-dir:../../plugins",
-    "watch": "yarn rebuild && theia build --watch --mode development"
+    "watch": "yarn rebuild && theia build --watch --mode development",
+    "package": "yarn bundle:prod && yarn sync-plugins && electron-builder --linux AppImage --publish never"
+  },
+  "build": {
+    "appId": "eu.yojik.modula2-ide",
+    "productName": "Modula-2 IDE",
+    "files": [
+      "electron-launcher.js",
+      "lib/**",
+      "src-gen/frontend/**",
+      "package.json"
+    ],
+    "extraResources": [
+      "plugins"
+    ],
+    "linux": {
+      "target": ["AppImage"],
+      "category": "Development"
+    },
+    "publish": null
   },
   "theia": {
     "target": "electron"

File diff suppressed because it is too large
+ 529 - 24
yarn.lock


Some files were not shown because too many files changed in this diff