- Switch from deprecated Vue CLI plugin to `electron-vite` (see nklayman/vue-cli-plugin-electron-builder#1982) - Update main/preload scripts to use `index.cjs` filenames to support `"type": "module"`, resolving crash issue (#233). This crash was related to Electron not supporting ESM (see electron/asar#249, electron/electron#21457). - This commit completes migration to Vite from Vue CLI (#230). Structure changes: - Introduce separate folders for Electron's main and preload processes. - Move TypeHelpers to `src/` to mark tit as accessible by the rest of the code. Config changes: - Make `vite.config.ts` reusable by Electron configuration. - On electron-builder, use `--publish` flag instead of `-p` for clarity. Tests: - Add log for preload script loading verification. - Implement runtime environment sanity checks. - Enhance logging in `check-desktop-runtime-errors`.
41 lines
1.5 KiB
TypeScript
41 lines
1.5 KiB
TypeScript
import { IProjectInformation } from '@/domain/IProjectInformation';
|
|
import { ProjectInformation } from '@/domain/ProjectInformation';
|
|
import { ICategoryCollection } from '@/domain/ICategoryCollection';
|
|
import { getEnumValues } from '@/application/Common/Enum';
|
|
import type { CollectionData } from '@/application/collections/';
|
|
import { CategoryCollectionParserType } from '@/application/Parser/ApplicationParser';
|
|
import { OperatingSystem } from '@/domain/OperatingSystem';
|
|
import { CategoryCollectionStub } from './CategoryCollectionStub';
|
|
|
|
export class CategoryCollectionParserStub {
|
|
public readonly arguments = new Array<{
|
|
data: CollectionData,
|
|
info: ProjectInformation,
|
|
}>();
|
|
|
|
private readonly returnValues = new Map<CollectionData, ICategoryCollection>();
|
|
|
|
public withReturnValue(
|
|
data: CollectionData,
|
|
collection: ICategoryCollection,
|
|
): this {
|
|
this.returnValues.set(data, collection);
|
|
return this;
|
|
}
|
|
|
|
public getStub(): CategoryCollectionParserType {
|
|
return (data: CollectionData, info: IProjectInformation) => {
|
|
this.arguments.push({ data, info });
|
|
if (this.returnValues.has(data)) {
|
|
return this.returnValues.get(data);
|
|
}
|
|
// Get next OS with a unique OS so mock does not result in an invalid app due to duplicated OS
|
|
// collections.
|
|
const currentRun = this.arguments.length - 1;
|
|
const nextOs = getEnumValues(OperatingSystem)[currentRun];
|
|
return new CategoryCollectionStub()
|
|
.withOs(nextOs);
|
|
};
|
|
}
|
|
}
|