fix desktop release packaging rebuild

This commit is contained in:
cita-777
2026-04-06 15:37:22 +08:00
parent 566501be1f
commit f18aa98888
2 changed files with 28 additions and 2 deletions
+26
View File
@@ -0,0 +1,26 @@
import { readFileSync } from 'node:fs';
import { resolve } from 'node:path';
import { describe, expect, it } from 'vitest';
describe('desktop package scripts', () => {
it('rebuilds the app before package:desktop targets invoke electron-builder', () => {
const packageJson = JSON.parse(
readFileSync(resolve(process.cwd(), 'package.json'), 'utf8'),
) as { scripts?: Record<string, string> };
const scripts = packageJson.scripts || {};
const packageDesktop = scripts['package:desktop'] || '';
const packageDesktopIntel = scripts['package:desktop:mac:intel'] || '';
const distDesktop = scripts['dist:desktop'] || '';
const distDesktopIntel = scripts['dist:desktop:mac:intel'] || '';
expect(
packageDesktop === 'npm run dist:desktop' || packageDesktop.includes('npm run build'),
).toBe(true);
expect(
packageDesktopIntel === 'npm run dist:desktop:mac:intel' || packageDesktopIntel.includes('npm run build'),
).toBe(true);
expect(distDesktop).toContain('npm run build');
expect(distDesktopIntel).toContain('npm run build');
});
});