mirror of
https://github.com/DRYTRIX/TimeTracker.git
synced 2026-05-20 13:20:38 -05:00
d52266370f
Run desktop packaging workflows on Node 24 and load Vite through an ESM config so macOS, Linux, and Windows builds use a runtime compatible with Vite 7.
43 lines
1.8 KiB
JavaScript
43 lines
1.8 KiB
JavaScript
const assert = require('assert');
|
|
const fs = require('fs');
|
|
const path = require('path');
|
|
const test = require('node:test');
|
|
|
|
const root = path.resolve(__dirname, '..');
|
|
|
|
test('desktop package builds the React renderer with Vite', () => {
|
|
const pkg = JSON.parse(fs.readFileSync(path.join(root, 'package.json'), 'utf8'));
|
|
assert.strictEqual(pkg.scripts['build:renderer'], 'vite build');
|
|
assert.ok(pkg.dependencies.react);
|
|
assert.ok(pkg.dependencies['react-dom']);
|
|
assert.ok(pkg.devDependencies.vite);
|
|
assert.ok(pkg.devDependencies['@vitejs/plugin-react']);
|
|
assert.ok(fs.existsSync(path.join(root, 'vite.config.mjs')));
|
|
assert.ok(!fs.existsSync(path.join(root, 'vite.config.js')));
|
|
assert.ok(pkg.build.files.includes('dist-renderer/**/*'));
|
|
});
|
|
|
|
test('Electron loads the built renderer with legacy fallback', () => {
|
|
const windowSource = fs.readFileSync(path.join(root, 'src/main/window.js'), 'utf8');
|
|
assert.match(windowSource, /dist-renderer\/index\.html/);
|
|
assert.match(windowSource, /legacyIndex/);
|
|
});
|
|
|
|
test('main process store IPC is limited to known desktop settings', () => {
|
|
const mainSource = fs.readFileSync(path.join(root, 'src/main/main.js'), 'utf8');
|
|
assert.match(mainSource, /ALLOWED_STORE_KEYS/);
|
|
assert.match(mainSource, /api_token_server_url/);
|
|
assert.match(mainSource, /theme_mode/);
|
|
assert.match(mainSource, /auto_sync/);
|
|
});
|
|
|
|
test('desktop GitHub workflows use a Vite-compatible Node version', () => {
|
|
const workflowRoot = path.resolve(root, '..', '.github', 'workflows');
|
|
const buildDesktop = fs.readFileSync(path.join(workflowRoot, 'build-desktop.yml'), 'utf8');
|
|
const release = fs.readFileSync(path.join(workflowRoot, 'cd-release.yml'), 'utf8');
|
|
for (const source of [buildDesktop, release]) {
|
|
assert.match(source, /NODE_VERSION:\s+'24'/);
|
|
assert.doesNotMatch(source, /node-version:\s+'18'/);
|
|
}
|
|
});
|