mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-07-27 16:49:51 -07:00
feat(sync-ui): sync window renderer, snapshots in /tmp/subminer-db-snapshots, docs + changelog
This commit is contained in:
@@ -293,12 +293,8 @@ test('runSyncCommand --json emits NDJSON progress events for a two-way host sync
|
||||
const events = lines.map((line) => JSON.parse(line));
|
||||
const types = events.map((event) => event.type);
|
||||
assert.ok(types.includes('stage'));
|
||||
assert.ok(
|
||||
events.some((event) => event.type === 'stage' && event.stage === 'snapshot-local'),
|
||||
);
|
||||
assert.ok(
|
||||
events.some((event) => event.type === 'merge-summary' && event.target === 'local'),
|
||||
);
|
||||
assert.ok(events.some((event) => event.type === 'stage' && event.stage === 'snapshot-local'));
|
||||
assert.ok(events.some((event) => event.type === 'merge-summary' && event.target === 'local'));
|
||||
assert.ok(
|
||||
events.some(
|
||||
(event) => event.type === 'remote-output' && event.text.includes('remote summary text'),
|
||||
|
||||
@@ -74,10 +74,7 @@ test('parseCliPrograms captures sync --json and --check flags', () => {
|
||||
});
|
||||
|
||||
test('parseCliPrograms rejects invalid sync --check combinations', () => {
|
||||
assert.throws(
|
||||
() => parseCliPrograms(['sync', '--check'], 'subminer'),
|
||||
/--check requires a host/,
|
||||
);
|
||||
assert.throws(() => parseCliPrograms(['sync', '--check'], 'subminer'), /--check requires a host/);
|
||||
assert.throws(
|
||||
() => parseCliPrograms(['sync', 'media-box', '--check', '--push'], 'subminer'),
|
||||
/--check cannot be combined/,
|
||||
|
||||
@@ -356,7 +356,9 @@ export function parseCliPrograms(
|
||||
throw new Error('Sync --check requires a host.');
|
||||
}
|
||||
if (check && (push || pull || snapshot || merge)) {
|
||||
throw new Error('Sync --check cannot be combined with --push, --pull, --snapshot, or --merge.');
|
||||
throw new Error(
|
||||
'Sync --check cannot be combined with --push, --pull, --snapshot, or --merge.',
|
||||
);
|
||||
}
|
||||
const modes = [Boolean(host), Boolean(snapshot), Boolean(merge)].filter(Boolean).length;
|
||||
if (modes === 0) {
|
||||
|
||||
@@ -43,9 +43,9 @@ export function tableExists(db: Database, tableName: string): boolean {
|
||||
export function readSchemaVersion(db: Database): number | null {
|
||||
if (!tableExists(db, 'imm_schema_version')) return null;
|
||||
const row = db
|
||||
.query<{ schema_version: number }>(
|
||||
'SELECT MAX(schema_version) AS schema_version FROM imm_schema_version',
|
||||
)
|
||||
.query<{
|
||||
schema_version: number;
|
||||
}>('SELECT MAX(schema_version) AS schema_version FROM imm_schema_version')
|
||||
.get();
|
||||
return typeof row?.schema_version === 'number' ? row.schema_version : null;
|
||||
}
|
||||
@@ -126,7 +126,9 @@ function statsDaemonStateCandidates(dbPath: string): string[] {
|
||||
});
|
||||
candidates.add(path.join(configDir, 'stats-daemon.json'));
|
||||
if (process.platform === 'darwin') {
|
||||
candidates.add(path.join(homeDir, 'Library', 'Application Support', 'SubMiner', 'stats-daemon.json'));
|
||||
candidates.add(
|
||||
path.join(homeDir, 'Library', 'Application Support', 'SubMiner', 'stats-daemon.json'),
|
||||
);
|
||||
}
|
||||
return [...candidates];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user