35 lines
1.1 KiB
TypeScript
Raw Normal View History

2024-06-09 09:15:16 +02:00
import type { BuildContext } from "../../shared/buildContext";
2024-05-12 20:47:03 +02:00
import { assert } from "tsafe/assert";
2024-05-17 05:13:41 +02:00
import {
generateSrcMainResourcesForMainTheme,
2024-06-09 09:15:16 +02:00
type BuildContextLike as BuildContextLike_generateSrcMainResourcesForMainTheme
2024-05-17 05:13:41 +02:00
} from "./generateSrcMainResourcesForMainTheme";
import { generateSrcMainResourcesForThemeVariant } from "./generateSrcMainResourcesForThemeVariant";
2022-08-16 14:41:06 +07:00
2024-06-09 09:15:16 +02:00
export type BuildContextLike = BuildContextLike_generateSrcMainResourcesForMainTheme & {
2024-05-12 21:23:20 +02:00
themeNames: string[];
2023-08-21 05:54:17 +02:00
};
2022-08-16 14:41:06 +07:00
2024-06-09 09:15:16 +02:00
assert<BuildContext extends BuildContextLike ? true : false>();
2021-03-22 20:54:28 +01:00
2024-05-20 15:48:51 +02:00
export async function generateSrcMainResources(params: {
2024-06-09 09:15:16 +02:00
buildContext: BuildContextLike;
2024-05-20 15:48:51 +02:00
}): Promise<void> {
2024-06-09 09:15:16 +02:00
const { buildContext } = params;
2024-06-09 09:15:16 +02:00
const [themeName, ...themeVariantNames] = buildContext.themeNames;
2021-02-21 18:55:06 +01:00
await generateSrcMainResourcesForMainTheme({
2024-05-12 20:47:03 +02:00
themeName,
2024-06-09 09:15:16 +02:00
buildContext
2024-05-12 20:47:03 +02:00
});
2022-08-16 14:41:06 +07:00
2024-05-12 20:47:03 +02:00
for (const themeVariantName of themeVariantNames) {
generateSrcMainResourcesForThemeVariant({
2024-01-31 21:56:46 +01:00
themeName,
2024-05-12 20:47:03 +02:00
themeVariantName,
2024-06-09 09:15:16 +02:00
buildContext
});
2024-02-05 08:52:58 +01:00
}
2021-02-21 18:55:06 +01:00
}