keywind/scripts/build.ts
2023-03-11 00:00:00 +04:00

25 lines
527 B
TypeScript

import archiver from 'archiver';
import { createWriteStream, existsSync, mkdirSync } from 'fs';
import { name } from '../package.json';
const dir = 'out';
const file = `${name}.jar`;
const path = `${dir}/${file}`;
!existsSync(dir) && mkdirSync(dir);
const output = createWriteStream(`${__dirname}/../${path}`);
const archive = archiver('zip');
archive.on('error', (error) => {
throw error;
});
archive.pipe(output);
archive.directory('META-INF', 'META-INF');
archive.directory('theme', 'theme');
archive.finalize();