osrl - profile | config | clear

This commit is contained in:
babayaga 2025-12-29 09:42:56 +01:00
parent bdf641baab
commit 54aef5ec39
6 changed files with 15 additions and 19 deletions

View File

@ -1,12 +1,12 @@
export default {
"environment": "build",
"environment": "dev",
"isSsrBuild": false,
"projectBase": "",
"publicDir": "C:\\Users\\zx\\Desktop\\polymech\\site2\\public\\",
"rootDir": "C:\\Users\\zx\\Desktop\\polymech\\site2\\",
"mode": "production",
"outDir": "C:\\Users\\zx\\Desktop\\polymech\\site2\\dist\\",
"assetsDir": "_astro",
"publicDir": "C:\\Users\\zx\\Desktop\\polymech\\library.polymech\\public\\",
"rootDir": "C:\\Users\\zx\\Desktop\\polymech\\library.polymech\\",
"mode": "dev",
"outDir": "dist",
"assetsDir": "/_astro",
"sourcemap": false,
"assetFileNames": "/_astro/[name]@[width].[hash][extname]"
}

View File

@ -103,7 +103,7 @@ export default {
}
},
// higher concurrency causes sharp/vips errors as well
{ concurrency: 10 }
{ concurrency: 1 }
);
// 6. Write the updated asset list back to the manifest for the next build.

View File

@ -48,7 +48,9 @@ export function loadConfig(
config: string = LIBRARY_CONFIG_PATH,
schema: z.ZodType<any> = appConfigSchema,
): AppConfig {
const cacheKey = `${locale}:${config}`;
if (configCache.has(cacheKey)) {
return configCache.get(cacheKey)!;
}
@ -56,7 +58,7 @@ export function loadConfig(
// 1. Load Library Config (Defaults)
let rawLibraryContent: string;
try {
logger.info(`Loading library config from ${config}`);
logger.info(`Loading library config from ${config} for locale ${locale}`);
rawLibraryContent = fs.readFileSync(config, 'utf-8');
} catch (error) {
logger.error(`Failed to read library config file at ${config}: ${error}`, error);

View File

@ -17,13 +17,8 @@ import TabContent from "../components/tab-content.astro";
import {
I18N_SOURCE_LANGUAGE,
SHOW_3D_PREVIEW,
SHOW_FILES,
SHOW_GALLERY,
SHOW_RENDERINGS,
SHOW_LICENSE,
SHOW_DESCRIPTION,
SHOW_TABS,
SHOW_SPECS,
SHOW_DEBUG,
SHOW_SAMPLES,
SHOW_RESOURCES,

View File

@ -27,6 +27,8 @@ import type { Loader, LoaderContext } from 'astro/loaders'
import { PolymechInstance } from '../registry.js';
import { AppConfig } from "../app/config.schema.js"
import { logger } from '../app/logger.js'
const config = (): AppConfig => PolymechInstance.getConfig();
// Config Accessors
@ -137,12 +139,10 @@ const onItem = async (item: IStoreItem, ctx: ILoaderContextEx) => {
}
const { logger } = ctx
let data: IComponentConfigEx = item.data
const itemRel = data.rel
const itemRelMin = data.rel.replace('products/', '')
const itemDir = PRODUCT_DIR(itemRel)
const default_profile = env(itemRel)
data.product_rel = itemRelMin
data.assets = {
renderings: [],
@ -177,10 +177,9 @@ const onItem = async (item: IStoreItem, ctx: ILoaderContextEx) => {
} catch (error) {
logger.error(`Error reading defaults.json: ${error.message}`);
}
data = {
...data,
...default_profile.variables,
...(default_profile?.variables || {}),
product_rel_min: itemRelMin.replace('products/', ''),
}
data = resolveConfig(data as Record<string, string>) as IComponentConfigEx
@ -216,7 +215,6 @@ export function loader(branch: string): Loader {
store,
generateDigest
}: ILoaderContextEx) => {
store.clear();
let products = items(branch)
for (const item of products) {
@ -239,7 +237,6 @@ export function loader(branch: string): Loader {
id: `${item.rel}`,
data: data
}
await onItem(storeItem, {
logger,
watcher,

View File

@ -16,6 +16,8 @@
"esModuleInterop": true,
"skipLibCheck": true,
"baseUrl": ".",
"sourceMap": true,
"inlineSources": true,
"lib": [
"DOM",
"ES2015"