2023-07-04 19:59:00 +03:00
|
|
|
import { readdir } from 'node:fs/promises';
|
2023-08-22 18:16:26 +03:00
|
|
|
import { fileURLToPath } from 'node:url';
|
2023-07-04 19:59:00 +03:00
|
|
|
|
|
|
|
const outputRoot = fileURLToPath(
|
|
|
|
new URL(
|
2023-08-02 18:56:00 +03:00
|
|
|
'../out/canary/AFFiNE-canary-darwin-arm64/AFFiNE-canary.app/Contents/Resources/app',
|
2023-07-04 19:59:00 +03:00
|
|
|
import.meta.url
|
|
|
|
)
|
|
|
|
);
|
2023-08-02 18:56:00 +03:00
|
|
|
|
2023-07-04 19:59:00 +03:00
|
|
|
const outputList = [
|
2023-09-30 10:02:17 +03:00
|
|
|
['dist', ['main.js', 'helper.js', 'preload.js', 'affine.darwin-arm64.node']],
|
2023-07-04 19:59:00 +03:00
|
|
|
] as [entry: string, expected: string[]][];
|
|
|
|
|
|
|
|
await Promise.all(
|
|
|
|
outputList.map(async ([entry, output]) => {
|
|
|
|
const files = await readdir(`${outputRoot}/${entry}`);
|
|
|
|
output.forEach(file => {
|
|
|
|
if (!files.includes(file)) {
|
|
|
|
throw new Error(`File ${entry}/${file} not found`);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
})
|
|
|
|
);
|
|
|
|
|
|
|
|
console.log('Output check passed');
|