Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
160 commits
Select commit Hold shift + click to select a range
2f15c38
Start the dev shell with electron-vite.
jtklein-agents Nov 10, 2026
f3c9f64
Load the built page from the renderer output.
jtklein-agents Nov 10, 2026
0be4b22
Record the dev-shell gotchas and check the lockfile still compiles.
jtklein-agents Nov 10, 2026
708b3f8
Compile the shell with electron-vite and stop before packing.
jtklein-agents Nov 10, 2026
2faf190
Create shell-build.yaml
jtklein-agents Nov 10, 2026
fa17f78
Run the end-to-end analyses against the built shell instead of the de…
jtklein-agents Nov 10, 2026
b66dba3
Update .eslintrc.cjs
jtklein-agents Nov 10, 2026
df19756
Update README.md
jtklein-agents Nov 10, 2026
3892315
Update electron-vite-packaging.md
jtklein-agents Nov 10, 2026
3f1d07f
Run the page render test on Jest with the page's decorator transform.
jtklein-agents Nov 10, 2026
08c5161
Retro findings
jtklein-agents Nov 10, 2026
a557abe
Pack the built shell instead of the main-process source.
jtklein-agents Nov 11, 2026
c2f1eee
Update electron-vite-packaging.md
jtklein-agents Nov 11, 2026
e9aa6ac
Point the build docs at the shell pack instead of the React package s…
jtklein-agents Nov 11, 2026
c4d88ac
Upload main and page source maps on a production build when the Sentr…
jtklein-agents Nov 11, 2026
2bc9961
Update electron-vite-packaging.md
jtklein-agents Nov 11, 2026
09bce09
Update electron.vite.config.js
jtklein-agents Nov 11, 2026
d97091d
Update pre-commit
jtklein-agents Nov 11, 2026
e3d6f67
Remove the Create React App and electron-webpack toolchain now that e…
jtklein-agents Nov 11, 2026
ce2b6bb
Update electron-vite-packaging.md
jtklein-agents Nov 11, 2026
308d756
Update BUILD.md
jtklein-agents Nov 11, 2026
84e390b
Drop unused packages
jtklein-agents Nov 11, 2026
e9b6710
Update docs
jtklein-agents Nov 11, 2026
88009c6
Copy text through the renderer bridge.
jtklein-agents Nov 11, 2026
58039fc
Update playwright.config.js
jtklein-agents Nov 11, 2026
b8aa072
Update preload.test.js
jtklein-agents Nov 11, 2026
0a94e1e
Update electron-vite-packaging.md
jtklein-agents Nov 11, 2026
88475a7
Update docs
jtklein-agents Nov 11, 2026
bd556fb
Choose an alignment through the renderer bridge.
jtklein-agents Nov 11, 2026
36194d1
A baseline for existing type errors
jtklein-agents Nov 11, 2026
83a640a
Update docs
jtklein-agents Nov 11, 2026
6904543
Read and write text through the renderer bridge.
jtklein-agents Nov 12, 2026
7c8e2e2
Check an output name through the renderer bridge.
jtklein-agents Nov 12, 2026
8f1aa3a
Choose an output directory through the renderer bridge.
jtklein-agents Nov 12, 2026
e8c6b4b
Parse an alignment through the renderer bridge.
jtklein-agents Nov 12, 2026
70bde9a
Restore the text bridge beside the output-directory picker.
jtklein-agents Nov 12, 2026
aa55cbf
Choose an ASTRAL file through the renderer bridge.
jtklein-agents Nov 12, 2026
98a5513
Choose a partition file through the renderer bridge.
jtklein-agents Nov 12, 2026
2b2cfe7
Choose a tree or a constraint through the renderer bridge.
jtklein-agents Nov 12, 2026
455aa21
Choose a tree or a constraint through the renderer bridge.
jtklein-agents Nov 12, 2026
5483332
Expose alignment parsing on the renderer bridge.
jtklein-agents Nov 12, 2026
470bb90
Keep the tree preload proof to one assertion.
jtklein-agents Nov 12, 2026
0f91878
Update baseline test
jtklein-agents Nov 12, 2026
8fc0565
Update docs
jtklein-agents Nov 12, 2026
f5af650
Update baseline test
jtklein-agents Nov 12, 2026
eacf37b
Update package.json
jtklein-agents Nov 12, 2026
7772d26
Update pre-load test
jtklein-agents Nov 12, 2026
34a76e7
Update docs
jtklein-agents Nov 12, 2026
f7ec9a4
Update docs
jtklein-agents Nov 12, 2026
01933d3
Update docs
jtklein-agents Nov 12, 2026
df2b737
Update docs
jtklein-agents Nov 12, 2026
d0b3a39
Update docs
jtklein-agents Nov 12, 2026
be5aa41
Update docs
jtklein-agents Nov 12, 2026
e5523ee
Keep a dropped file's path on the page.
jtklein-agents Nov 12, 2026
ec77f20
Read the host once on the renderer bridge.
jtklein-agents Nov 12, 2026
1b0260e
Join and quote page paths without Node's path module.
jtklein-agents Nov 12, 2026
69fe8e2
Update preload.test.js
jtklein-agents Nov 12, 2026
89dcc72
Merge remote-tracking branch 'origin/electron-vite' into 24-dropped-f…
jtklein-agents Nov 12, 2026
e14125c
Update docs
jtklein-agents Nov 12, 2026
dbd53d4
Update docs
jtklein-agents Nov 12, 2026
3edfe9a
Point the disk image icon at the tracked file.
jtklein-agents Nov 12, 2026
bc79fe4
Merge pull request #45 from jtklein-agents/24-dropped-file-path
jtklein-agents Nov 12, 2026
4d886c9
Merge pull request #47 from jtklein-agents/26-plain-path-helper
jtklein-agents Nov 12, 2026
a1fa972
Merge electron-vite into the host branch.
jtklein-agents Nov 12, 2026
5a349a5
Merge electron-vite into the host branch.
jtklein-agents Nov 12, 2026
8e2e7ce
Stream a RAxML run through the renderer bridge.
jtklein-agents Nov 12, 2026
c3917b4
Merge pull request #46 from jtklein-agents/25-page-knows-the-host
jtklein-agents Nov 12, 2026
dd903ff
Open a result path through the renderer bridge.
jtklein-agents Nov 12, 2026
c025a48
Reveal a file in its folder through the renderer bridge.
jtklein-agents Nov 12, 2026
4c984af
Model selection returns a model or a failure.
jtklein-agents Nov 12, 2026
985ca01
Merge branch 'electron-vite' of https://github.com/jtklein-agents/rax…
jtklein-agents Nov 12, 2026
5d51275
Update docs
jtklein-agents Nov 12, 2026
45e65dc
Merge electron-vite into the show-in-folder branch.
jtklein-agents Nov 12, 2026
819886a
Update docs
jtklein-agents Nov 12, 2026
d28eb19
Share the run-event names in one definition.
jtklein-agents Nov 12, 2026
8f061f2
Update docs
jtklein-agents Nov 12, 2026
3a8df42
Merge electron-vite into the run-stream branch.
jtklein-agents Nov 12, 2026
d85a9d8
Merge pull request #49 from jtklein-agents/29-model-selection
jtklein-agents Nov 12, 2026
5a43259
Merge origin/electron-vite into the result-path branch.
jtklein-agents Nov 12, 2026
c3efa6a
Merge electron-vite into the show-in-folder branch.
jtklein-agents Nov 12, 2026
54a6f3e
Merge pull request #48 from jtklein-agents/32-open-result-path
jtklein-agents Nov 12, 2026
47a868a
Merge electron-vite into the run-stream branch.
jtklein-agents Nov 12, 2026
5e14ef4
Merge electron-vite into the run-stream branch.
jtklein-agents Nov 12, 2026
07a123d
Merge pull request #51 from jtklein-agents/27-run-streams
jtklein-agents Nov 12, 2026
f02e1a8
Merge electron-vite into the show-in-folder branch.
jtklein-agents Nov 12, 2026
ad49c4e
Merge electron-vite into the show-in-folder branch.
jtklein-agents Nov 12, 2026
637da3d
Merge pull request #50 from jtklein-agents/33-reveal-file-in-folder
jtklein-agents Nov 12, 2026
2042c11
Report an ASTRAL exit code through the renderer bridge.
jtklein-agents Nov 12, 2026
0ca012f
Reload the window that asked, through the renderer bridge.
jtklein-agents Nov 12, 2026
58541f9
Let the menu update runs, theme, and constraints through the renderer…
jtklein-agents Nov 12, 2026
3e2e7e4
Stop a cancelled run without a finished event.
jtklein-agents Nov 12, 2026
1d9ca8f
Keep the reload handler inline.
jtklein-agents Nov 12, 2026
c5c6903
Update docs
jtklein-agents Nov 12, 2026
30a0e07
Share the ASTRAL subscription name.
jtklein-agents Nov 12, 2026
26723b4
Update docs
jtklein-agents Nov 12, 2026
7de5e7f
Register menu subscriptions on the run-event map.
jtklein-agents Nov 12, 2026
65f0dd3
Fail lint when a single-line import runs past 100 characters.
jtklein-agents Nov 12, 2026
6fef424
Update docs
jtklein-agents Nov 12, 2026
376da71
A cancel before the child starts stays quiet, and its exit does not d…
jtklein-agents Nov 12, 2026
05b771a
Merge pull request #53 from jtklein-agents/31-astral-exit-code
jtklein-agents Nov 12, 2026
e86b7c4
Merge electron-vite into the menu branch.
jtklein-agents Nov 12, 2026
7e5867f
Merge electron-vite into the reload branch.
jtklein-agents Nov 12, 2026
92136bd
Record the quiet cancel and fail if the handler still sends a termina…
jtklein-agents Nov 12, 2026
adf3324
Merge pull request #52 from jtklein-agents/35-reload-the-window
jtklein-agents Nov 12, 2026
7aea725
Merge electron-vite into the menu branch.
jtklein-agents Nov 12, 2026
516a6e4
Merge pull request #54 from jtklein-agents/34-menu-updates-the-page
jtklein-agents Nov 12, 2026
33b81cc
Merge electron-vite into the cancel branch.
jtklein-agents Nov 12, 2026
bb6cc3b
Give page tests the cancel method dispose already calls.
jtklein-agents Nov 12, 2026
e181127
Merge pull request #55 from jtklein-agents/28-cancel-run
jtklein-agents Nov 12, 2026
b362766
Load the example files in development through the renderer bridge.
jtklein-agents Nov 12, 2026
08453ae
Cancel model selection through the bridge so the page gets no result.
jtklein-agents Nov 12, 2026
029399a
Fail a quiet-cancel scan unless the return sits on the path to the send.
jtklein-agents Nov 12, 2026
b8067f9
Record the dev bootstrap's example-file call, one sentence per line.
jtklein-agents Nov 12, 2026
1e8fa6c
Merge pull request #56 from jtklein-agents/30-cancel-model-selection
jtklein-agents Nov 12, 2026
b225ade
Merge origin/electron-vite into the example-files branch.
jtklein-agents Nov 12, 2026
0e444a2
Merge pull request #57 from jtklein-agents/40-dev-bootstrap-example-f…
jtklein-agents Nov 12, 2026
c35a595
Learn the app version from the renderer bridge instead of the startup…
jtklein-agents Nov 12, 2026
dbb5afc
An unhandled error is shown
jtklein-agents Nov 13, 2026
0f386e6
A GitHub report includes debug info
jtklein-agents Nov 13, 2026
e0e848e
Record the getVersion call site and ban negated length comparisons.
jtklein-agents Nov 13, 2026
cbaae87
An update downloads with no progress window
jtklein-agents Nov 13, 2026
43ebbbb
Update docs
jtklein-agents Nov 13, 2026
3f8f092
Record bridge packaging coverage for the GitHub report.
jtklein-agents Nov 13, 2026
cec5c24
Send the store state report through the renderer bridge when the shel…
jtklein-agents Nov 13, 2026
b12498f
Record no-progress update downloads and the jsdom setImmediate rule.
jtklein-agents Nov 13, 2026
c0d0bb7
Merge pull request #58 from jtklein-agents/37-page-learns-the-app-ver…
jtklein-agents Nov 13, 2026
1f30603
Merge origin/electron-vite into 36-unhandled-error
jtklein-agents Nov 13, 2026
08b18ec
Merge pull request #61 from jtklein-agents/41-update-no-progress-window
jtklein-agents Nov 13, 2026
b8908bb
Merge origin/electron-vite into 36-unhandled-error
jtklein-agents Nov 13, 2026
9c0fd8b
Merge pull request #59 from jtklein-agents/36-unhandled-error
jtklein-agents Nov 13, 2026
8628ffe
Merge origin/electron-vite into the state-report branch.
jtklein-agents Nov 13, 2026
8d56b49
Merge pull request #62 from jtklein-agents/38-state-report
jtklein-agents Nov 13, 2026
75dfdb7
Merge origin/electron-vite into the GitHub report branch.
jtklein-agents Nov 13, 2026
290b633
Merge pull request #60 from jtklein-agents/39-github-report-debug-info
jtklein-agents Nov 13, 2026
bd90040
Merge branch 'master' of https://github.com/jtklein-agents/raxmlGUI
jtklein-agents Nov 13, 2026
9925292
Restore console logs the shell extraction dropped.
jtklein-agents Nov 13, 2026
cc1ac28
Log ALIGNMENT_SELECTED as a string, not an ipc constant.
jtklein-agents Nov 13, 2026
b45b31e
Log ASTRAL_FILE_SELECTED as a string, not an ipc constant.
jtklein-agents Nov 13, 2026
1ef1c97
Remove the log-baseline lint check.
jtklein-agents Nov 13, 2026
bbbebf7
Record #44 log-restore rules and drop ipc-only log labels.
jtklein-agents Nov 13, 2026
df2306d
Shut Node out of every shell window.
jtklein-agents Nov 13, 2026
2f7570a
Merge pull request #63 from jtklein-agents/issue-44-dropped-logs
jtklein-agents Nov 13, 2026
6516847
Fail e2e fast when the worktree lacks binaries.
jtklein-agents Nov 13, 2026
9d936c3
Merge origin/electron-vite into issue-42-node-shut-out.
jtklein-agents Nov 13, 2026
09b3ace
Keep dark mode in main electron-store via the bridge.
jtklein-agents Nov 13, 2026
0931a85
Drop cpus and electron-better-ipc.
jtklein-agents Nov 13, 2026
cd98530
Merge pull request #64 from jtklein-agents/issue-42-node-shut-out
jtklein-agents Nov 13, 2026
d7e26c4
Fix code-review findings on the electron-vite shell.
jtklein-agents Nov 13, 2026
43251e2
Merge pull request #65 from jtklein-agents/review-fixes
jtklein-agents Nov 13, 2026
29a07ec
Lock shell review findings into lint and tests.
jtklein-agents Nov 13, 2026
19db221
Merge pull request #66 from jtklein-agents/retro-env-1-7
jtklein-agents Nov 13, 2026
413c39e
Remove the shell-build CI workflow.
jtklein-agents Nov 13, 2026
4c9c30a
Merge pull request #68 from jtklein-agents/remove-shell-build-ci
jtklein-agents Nov 13, 2026
ece8392
Delete electron-vite-packaging.md
jtklein-agents Nov 13, 2026
0f0709a
Remove the import-lines lint check.
jtklein-agents Nov 13, 2026
c26773a
Update packagingBridge.test.js
jtklein-agents Nov 13, 2026
7d2e449
Merge pull request #69 from jtklein-agents/remove-import-lines
jtklein-agents Nov 13, 2026
92d6497
Drop ipcLive and toolchain guards and no-restricted-syntax.
jtklein-agents Nov 13, 2026
8ff0b54
Delete packagingBridge.test.js
jtklein-agents Nov 13, 2026
8baefcf
Merge pull request #70 from jtklein-agents/remove-ipc-live-test
jtklein-agents Nov 13, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .cursorignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/out
14 changes: 14 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,22 @@ module.exports = {
indent: ['error', 2, { SwitchCase: 1 }],
'multiline-ternary': ['error', 'always'],
'space-in-parens': ['error', 'always'],
'no-warning-comments': [
'error',
{
terms: [ 'shortcut:' ],
location: 'anywhere',
},
],
},
overrides: [
{
// `yarn lint` does not include e2e, and that tree does not use the src parenthesis style.
files: ['e2e/**/*.js'],
rules: {
'space-in-parens': 'off',
},
},
{
files: ['**/*.{ts,tsx}'],
rules: {
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,9 @@ jobs:

- name: ESLint
run: yarn lint

- name: Typecheck baseline
run: yarn typecheck:baseline

- name: Page render test
run: yarn react-test
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
# production
/build
/dist
/out
/release

# misc
Expand Down
5 changes: 4 additions & 1 deletion BUILD.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ The benefit of this workflow is that it allows you to always have the latest art
5. Update CHANGELOG and the download links in `docs/_layouts/default.html` to the new version.
5. Bump the version in package.json to use for the next draft and push to update the download links on the github page.
6. Uploading Debug Information
To get symbolicated stack traces for native crashes, you have to upload debug symbols to Sentry. Sentry Wizard creates a convenient sentry-symbols.js script that will upload the Electron symbols for you. After installing the SDK and every time you upgrade the Electron version, run this script:

A production build uploads JavaScript source maps for the main process and the page when `SENTRY_ORG` and `SENTRY_AUTH_TOKEN` are set. The release name is `raxmlGUI@version`. The preload is not included, and a dev start does not upload.

Native crash symbols stay a manual upload. `sentry-symbols.js` downloads the Electron symbols and uploads them with `sentry-cli upload-dif`. After installing the SDK, and again after every Electron upgrade, run `node sentry-symbols.js`.

## Homepage

Expand Down
13 changes: 7 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,18 @@ A desktop GUI for RAxML.

## Development

This is a an [Electron](https://electronjs.org/) App that was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
This is an [Electron](https://electronjs.org/) app. The shell is built with electron-vite.

```yarn start``` will start the Electron app and the React app at the same time.
```yarn build``` will build the React app and package it along the Electron app.
```yarn start``` starts the shell.
```yarn build``` compiles the shell into `out/`.
```yarn build-mac```, ```yarn build-win```, and ```yarn build-linux``` compile the shell, then pack it with electron-builder.

### End-to-end tests

E2e tests use [Playwright](https://playwright.dev/) to drive the real Electron app against the CRA dev server and the bundled RAxML binaries. Specs in `e2e/` load the dev prefilled nucleotide alignment and check the UI and output files:
`yarn test:e2e` builds the shell, then [Playwright](https://playwright.dev/) launches `out/main/index.js`. There is no dev server. Specs in `e2e/` check the UI and output files:

- `modeltest-then-raxml-ng.spec.js` — ModelTest, then a full raxml-ng analysis
- `raxmlHPC.spec.js` — classic raxmlHPC (ML search)
- `raxmlHPC.spec.js` — classic raxmlHPC (ML search), including copying the command and the citation

Download binaries once, then run:

Expand All @@ -23,7 +24,7 @@ yarn download-binaries
yarn test:e2e
```

The test harness sets `RAXMLGUI_E2E=1` when launching Electron. That disables DevTools and auto-update checks, and points the main process at the repo `static/` directory (example files, binaries, and test output) instead of the packaged app resources path.
The launch sets `RAXMLGUI_E2E=1`. That skips auto-update checks and points the main process at the repo `static/` directory (example files, binaries, and test output). The built page loads that example alignment from the same flag.


## Input formats
Expand Down
23 changes: 1 addition & 22 deletions TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,4 @@ Todo:

## TypeScript in the Electron main process

Main, shared modules used by main, `src/constants/ipc`, and `src/settings/*` are **`.js` today** so `electron-webpack` can resolve extensionless imports (`./api`, `../common/utils`, etc.). The renderer may still use `.ts`/`.tsx`; CRA handles that separately.

**Why:** [`electron-webpack`](package.json) bundles main with Babel and default webpack `resolve.extensions` (no `.ts`). Without config, `yarn compile` fails with “Can't resolve …” even when sources are `.ts`.

**When re-migrating, wire bundling first, then rename (`git mv`).**

1. **Pick one approach**
- [`@electron-webpack/typescript`](https://webpack.electron.build/add-ons/typescript) add-on (documented for this stack), or
- Extend [`webpack.config.js`](webpack.config.js): `resolve.extensions` include `.ts` (and `.tsx` if needed); `babel-loader` on `*.ts` with `@babel/preset-typescript` (strip types only, same pattern as renderer).

2. **Scope of the main bundle** (must all compile or stay `.js`):
- `src/main/**`
- `src/common/**` imported from main (e.g. `utils`, `io`, `errors`, parsers, `typecheckAlignment`)
- `src/constants/ipc`
- `src/settings/raxml`, `src/settings/raxmlng` (pulled in via menu → `app/store`)

3. **Verify on a clean tree** (matches CI `compile` step):
- `yarn compile` / `yarn build`
- `yarn lint` (main is `.js` today; TS-only ESLint override applies once files are `.ts` again)
- `npx tsc --noEmit` if types are restored (optional `electron-webpack-globals.d.ts` for `__static`)

4. **Optional:** broaden `electron-builder` `build.files` if packaging needs nested `src/main/**` beyond the top-level glob.
Main, shared modules used by main, `src/constants/ipc`, and `src/settings/*` are `.js`. The shell build is `yarn build` (`electron-vite build`). The page build compiles JSX in `.js` files. A move of those main sources to `.ts` starts from that build.
13 changes: 0 additions & 13 deletions craco.config.js

This file was deleted.

36 changes: 26 additions & 10 deletions e2e/helpers/launchApp.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,38 @@
const fs = require('fs');
const path = require('path');
const { _electron: electron } = require('playwright/test');

const repoRoot = path.join(__dirname, '..', '..');
const mainEntry = path.join(repoRoot, 'dist', 'main', 'main.js');
const mainEntry = path.join(repoRoot, 'out', 'main', 'index.js');
const binParent =
process.platform === 'darwin'
? 'Mac'
: process.platform === 'win32'
? 'Windows'
: 'Linux';
const binDir = path.join(repoRoot, 'static', 'bin', binParent);

/**
* Launch the raxmlGUI Electron app against the CRA dev server.
* Launch the built shell. No dev server and no page URL override.
* @returns {Promise<import('playwright/test').ElectronApplication>}
*/
async function launchApp() {
if (!fs.existsSync(binDir)) {
throw new Error(
`Missing ${binDir}. From the main checkout, link static/bin into this worktree (see AGENTS.md Worktree).`,
);
}
const env = {
...process.env,
NODE_ENV: 'production',
RAXMLGUI_E2E: '1',
};
delete env.ELECTRON_START_URL;
delete env.ELECTRON_RENDERER_URL;

return electron.launch({
args: [mainEntry],
env: {
...process.env,
NODE_ENV: 'development',
ELECTRON_START_URL: 'http://localhost:3000/',
RAXMLGUI_E2E: '1',
},
env,
cwd: repoRoot,
});
}
Expand All @@ -31,14 +47,14 @@ async function getAppWindow(electronApp) {
while (Date.now() < deadline) {
for (const window of electronApp.windows()) {
const url = window.url();
if (url.includes('localhost:3000')) {
if (url.includes('out/renderer/index.html')) {
return window;
}
}
await new Promise((resolve) => setTimeout(resolve, 250));
}

throw new Error('Could not find raxmlGUI renderer window on localhost:3000');
throw new Error('Could not find the built raxmlGUI page');
}

module.exports = {
Expand Down
39 changes: 39 additions & 0 deletions e2e/no-node.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
// @ts-check
const { test, expect } = require('playwright/test');
const { launchApp, getAppWindow } = require('./helpers/launchApp');

test.describe('Node shut out', () => {
/** @type {import('playwright/test').ElectronApplication | undefined} */
let electronApp;

test.afterEach(async () => {
if (electronApp) {
await electronApp.close();
electronApp = undefined;
}
});

test('the built page has no Node', async () => {
electronApp = await launchApp();
const page = await getAppWindow(electronApp);

await expect(page.getByText('nucleotide', { exact: true })).toBeVisible({
timeout: 60_000,
});

const probe = await page.evaluate(() => ({
require: typeof require,
processVersions:
typeof process !== 'undefined' && process && process.versions
? process.versions
: null,
bridgeRequire: typeof window.require,
bridgeProcess: typeof window.process,
}));

expect(probe.require).toBe('undefined');
expect(probe.bridgeRequire).toBe('undefined');
expect(probe.bridgeProcess).toBe('undefined');
expect(probe.processVersions && probe.processVersions.node).toBeFalsy();
});
});
11 changes: 1 addition & 10 deletions e2e/playwright.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,12 @@ const path = require('path');
const config = {
testDir: path.join(__dirname),
testIgnore: ['docs/**'],
// Locator checks use Playwright's 5s expect timeout. A long wait passes its own timeout.
timeout: 15 * 60 * 1000,
expect: {
timeout: 10 * 60 * 1000,
},
fullyParallel: false,
workers: 1,
retries: process.env.CI ? 1 : 0,
reporter: [['list'], ['html', { open: 'never' }]],
webServer: {
command: 'yarn react-start',
url: 'http://localhost:3000',
reuseExistingServer: !process.env.CI,
timeout: 120 * 1000,
cwd: path.join(__dirname, '..'),
},
};

module.exports = config;
8 changes: 8 additions & 0 deletions e2e/raxmlHPC.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,14 @@ test.describe('raxmlHPC', () => {
expect(commandText).toMatch(/-f d/);
expect(commandText).toMatch(/-m \S+/);

await page.getByLabel('copy-command').click();
await expect.poll(async () => electronApp.evaluate(async ({ clipboard }) => clipboard.readText())).toBe(commandText);

await page.getByText('How to cite?').click();
await page.getByRole('button', { name: 'Copy to clipboard' }).click();
await expect.poll(async () => electronApp.evaluate(async ({ clipboard }) => clipboard.readText())).toContain('10.1111/2041-210X.13512');
await page.locator('#show-citation').getByRole('button', { name: 'Close' }).click();

const outputFilename = `${outputId}.tre`;
const bestTreePath = path.join(
outputDir,
Expand Down
71 changes: 71 additions & 0 deletions electron.vite.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
import { resolve } from 'node:path';
import { sentryVitePlugin } from '@sentry/bundler-plugins/vite';
import { defineConfig } from 'electron-vite';
import react from '@vitejs/plugin-react';
import { version } from './package.json';

// Dev still builds main, so this gates on electron-vite's command. Leave build.sourcemap unset: this plugin turns hidden maps on and deletes them. An explicit true or "hidden" leaves .map files in out/, which the pack includes. The upload also needs SENTRY_PROJECT in the environment.
function sourceMapUpload( command ) {
if ( command !== 'build' || !process.env.SENTRY_ORG || !process.env.SENTRY_AUTH_TOKEN ) {
return [];
}
return sentryVitePlugin( {
release: {
name: `raxmlGUI@${version}`,
},
} );
}

export default defineConfig( ( { command } ) => ( {
main: {
// electron-webpack injected this path. The main process still reads the repo's static files through it.
define: {
__static: JSON.stringify( resolve( __dirname, 'static' ) ),
},
plugins: sourceMapUpload( command ),
},
preload: {
build: {
externalizeDeps: false,
},
},
renderer: {
root: '.',
publicDir: false,
resolve: {
// Default entry also loads filenamify-path, which needs Node's path.
alias: {
filenamify: resolve( __dirname, 'node_modules/filenamify/filenamify.js' ),
},
},
optimizeDeps: {
// The page keeps JSX in .js files. The dep scanner parses those only when .js is jsx.
rolldownOptions: {
moduleTypes: {
'.js': 'jsx',
},
},
},
plugins: [
// plugin-react 5: its babel option compiles legacy MobX decorators. 6 dropped babel.
// JSX in .js is compiled here too: Vite's oxc parser does not treat .js as JSX.
react( {
babel: {
plugins: [
['@babel/plugin-proposal-decorators', { legacy: true }],
['@babel/plugin-proposal-class-properties', { loose: true }],
['@babel/plugin-transform-react-jsx', { runtime: 'automatic' }],
],
},
} ),
...sourceMapUpload( command ),
],
build: {
rollupOptions: {
input: {
index: resolve( __dirname, 'index.html' ),
},
},
},
},
} ) );
13 changes: 13 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>raxmlGUI 2.0</title>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500" />
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/index.tsx"></script>
</body>
</html>
15 changes: 15 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
module.exports = {
testEnvironment: 'jsdom',
setupFiles: [ '<rootDir>/jest/setup.js' ],
roots: [ '<rootDir>/src' ],
transform: {
'^.+\\.(js|jsx|mjs|ts|tsx)$': '<rootDir>/jest/babelTransform.js',
},
transformIgnorePatterns: [ '/node_modules/(?!d3-array/)' ],
moduleFileExtensions: [ 'js', 'jsx', 'mjs', 'ts', 'tsx', 'json', 'node' ],
moduleNameMapper: {
'\\.css$': '<rootDir>/jest/fileMock.js',
'^electron$': '<rootDir>/jest/electron.js',
'^@sentry/electron/renderer$': '<rootDir>/jest/sentry.js',
},
};
17 changes: 17 additions & 0 deletions jest/babelTransform.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
const babelJest = require( 'babel-jest' );

// Decorator plugins match the page build. preset-env and preset-typescript
// are what Jest needs to load the page's ESM and .tsx imports.
module.exports = babelJest.default.createTransformer( {
babelrc: false,
configFile: false,
presets: [
[ '@babel/preset-env', { targets: { node: 'current' } } ],
'@babel/preset-typescript',
],
plugins: [
[ '@babel/plugin-proposal-decorators', { legacy: true } ],
[ '@babel/plugin-proposal-class-properties', { loose: true } ],
[ '@babel/plugin-transform-react-jsx', { runtime: 'automatic' } ],
],
} );
Loading
Loading