2024-01-07 20:07:45 -06:00
|
|
|
import { readdir } from 'fs/promises';
|
|
|
|
|
import { readBase64DVPL } from '../../src/core/blitz/readBase64DVPL';
|
2024-01-20 21:35:36 -06:00
|
|
|
import { commitAssets } from '../../src/core/blitzkrieg/commitAssets';
|
|
|
|
|
import { FileChange } from '../../src/core/blitzkrieg/commitMultipleFiles';
|
2024-02-20 11:21:01 -06:00
|
|
|
import { DATA, POI } from './constants';
|
2024-01-07 20:07:45 -06:00
|
|
|
|
2024-01-29 17:14:51 -06:00
|
|
|
export async function scratchedFlags(production: boolean) {
|
2024-01-07 20:07:45 -06:00
|
|
|
console.log('Building scratched flags...');
|
|
|
|
|
|
2024-01-16 16:58:00 -06:00
|
|
|
const flags = await readdir(`${DATA}/${POI.flags}`);
|
2024-01-20 21:35:36 -06:00
|
|
|
const changes = await Promise.all(
|
|
|
|
|
flags
|
|
|
|
|
.filter(
|
|
|
|
|
(flag) =>
|
|
|
|
|
flag.startsWith('flag_tutor-tank_') &&
|
|
|
|
|
!flag.endsWith('@2x.packed.webp.dvpl'),
|
|
|
|
|
)
|
|
|
|
|
.map(async (flag) => {
|
|
|
|
|
const content = await readBase64DVPL(`${DATA}/${POI.flags}/${flag}`);
|
|
|
|
|
const name = flag.match(/flag_tutor-tank_(.+)\.packed\.webp/)![1];
|
2024-01-07 20:07:45 -06:00
|
|
|
|
2024-01-20 21:35:36 -06:00
|
|
|
return {
|
|
|
|
|
content,
|
|
|
|
|
encoding: 'base64',
|
|
|
|
|
path: `flags/scratched/${name}.webp`,
|
|
|
|
|
} satisfies FileChange;
|
|
|
|
|
}),
|
2024-01-07 20:07:45 -06:00
|
|
|
);
|
2024-01-20 21:35:36 -06:00
|
|
|
|
2024-01-21 00:01:32 -06:00
|
|
|
await commitAssets('scratched flags', changes, production);
|
2024-01-07 20:07:45 -06:00
|
|
|
}
|