refactor: use new format for packs

This commit is contained in:
Johannes Loher 2023-06-25 16:04:27 +02:00
parent 4b97bde6d9
commit 032b006dd5
No known key found for this signature in database
GPG key ID: 7CB0A9FB553DA045
1546 changed files with 70353 additions and 79060 deletions

View file

@ -2,14 +2,12 @@
//
// SPDX-License-Identifier: MIT
import livereload from "rollup-plugin-livereload";
import styles from "@ironkinoko/rollup-plugin-styles";
import { swc } from "rollup-plugin-swc3";
import { copy } from "@guanghechen/rollup-plugin-copy";
import { distDirectory, name, sourceDirectory } from "./tools/const.js";
import { convertJSONToPack } from "./tools/json-pack-tools.js";
const staticFiles = [
".reuse",
@ -27,7 +25,6 @@ const staticFiles = [
"templates",
];
const isProduction = process.env.NODE_ENV === "production";
const isWatch = process.env.ROLLUP_WATCH === "true";
/**
* @type {import('rollup').RollupOptions}
@ -59,23 +56,7 @@ const config = {
sourceMap: true,
minimize: isProduction,
}),
copy({
targets: [
{ src: staticFiles, dest: distDirectory },
{
src: [`packs/*.json`],
dest: `${distDirectory}/packs`,
rename: (name) => `${name}.db`,
transform: convertJSONToPack,
},
{
src: [`packs/*.json.license`],
dest: `${distDirectory}/packs`,
rename: (name, extension) => `${name.replace(".json", ".db")}.${extension}`,
},
],
}),
isWatch && livereload(distDirectory),
copy({ targets: [{ src: staticFiles, dest: distDirectory }] }),
],
};