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";
|
2024-05-17 01:21:26 +02:00
|
|
|
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;
|
2023-03-16 22:13:46 +01:00
|
|
|
|
2024-06-09 09:15:16 +02:00
|
|
|
const [themeName, ...themeVariantNames] = buildContext.themeNames;
|
2021-02-21 18:55:06 +01:00
|
|
|
|
2024-05-17 01:21:26 +02: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) {
|
2024-05-17 01:21:26 +02:00
|
|
|
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
|
2023-04-19 05:04:11 +02:00
|
|
|
});
|
2024-02-05 08:52:58 +01:00
|
|
|
}
|
2021-02-21 18:55:06 +01:00
|
|
|
}
|