2023-07-04 19:59:00 +03:00
|
|
|
import { fileURLToPath } from 'node:url';
|
|
|
|
import { readdir } from 'node:fs/promises';
|
|
|
|
|
|
|
|
const outputRoot = fileURLToPath(
|
|
|
|
new URL(
|
|
|
|
'../zip-out/AFFiNE-canary.app/Contents/Resources/app',
|
|
|
|
import.meta.url
|
|
|
|
)
|
|
|
|
);
|
|
|
|
const outputList = [
|
|
|
|
[
|
|
|
|
'dist',
|
|
|
|
[
|
|
|
|
'main.js',
|
|
|
|
'helper.js',
|
|
|
|
'preload.js',
|
|
|
|
'affine.darwin-arm64.node',
|
|
|
|
'plugins',
|
|
|
|
],
|
|
|
|
],
|
2023-07-26 00:32:34 +03:00
|
|
|
['dist/plugins', ['bookmark']],
|
2023-07-30 21:10:45 +03:00
|
|
|
['dist/plugins/bookmark', ['index.cjs']],
|
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');
|