feat: add auto update support

This commit is contained in:
2026-05-15 01:47:56 -07:00
parent d1ec678d7a
commit 094bcce0dc
101 changed files with 4978 additions and 163 deletions
+33
View File
@@ -70,6 +70,8 @@ function makeArgs(overrides: Partial<CliArgs> = {}): CliArgs {
texthooker: false,
texthookerOpenBrowser: false,
help: false,
update: false,
updateLauncherPath: undefined,
autoStartOverlay: false,
generateConfig: false,
backupOverwrite: false,
@@ -231,6 +233,9 @@ function createDeps(overrides: Partial<CliCommandServiceDeps> = {}) {
runYoutubePlaybackFlow: async (request) => {
calls.push(`runYoutubePlaybackFlow:${request.url}:${request.mode}:${request.source}`);
},
runUpdateCommand: async (args) => {
calls.push(`runUpdateCommand:${args.updateLauncherPath ?? ''}`);
},
printHelp: () => {
calls.push('printHelp');
},
@@ -363,6 +368,34 @@ test('handleCliCommand opens first-run setup window for --setup', () => {
assert.equal(calls.includes('openYomitanSettingsDelayed:1000'), false);
});
test('handleCliCommand runs update command without overlay startup', async () => {
const { deps, calls } = createDeps();
handleCliCommand(
makeArgs({ update: true, updateLauncherPath: '/home/kyle/.local/bin/subminer' }),
'initial',
deps,
);
await new Promise((resolve) => setImmediate(resolve));
assert.deepEqual(calls, ['runUpdateCommand:/home/kyle/.local/bin/subminer']);
});
test('handleCliCommand stops app after headless initial update completes', async () => {
const { deps, calls } = createDeps({
hasMainWindow: () => false,
});
handleCliCommand(
makeArgs({ update: true, updateLauncherPath: '/home/kyle/.local/bin/subminer' }),
'initial',
deps,
);
await new Promise((resolve) => setImmediate(resolve));
assert.deepEqual(calls, ['runUpdateCommand:/home/kyle/.local/bin/subminer', 'stopApp']);
});
test('handleCliCommand dispatches stats command without overlay startup', async () => {
const { deps, calls } = createDeps({
runStatsCommand: async () => {