generated from polymech/site-template
mv site | lib config
This commit is contained in:
@@ -8,7 +8,7 @@ import { substitute } from "@polymech/commons/variables";
|
||||
import { appConfigSchema } from "./config.schema.js";
|
||||
import type { AppConfig } from "./config.schema.js";
|
||||
|
||||
import { I18N_SOURCE_LANGUAGE } from "./constants.js"
|
||||
const I18N_SOURCE_LANGUAGE = 'en';
|
||||
|
||||
const LIBRARY_CONFIG_PATH = path.resolve("./app-config.json");
|
||||
const USER_CONFIG_DEFAULT_PATH = path.resolve("./app-config.local.json");
|
||||
@@ -51,8 +51,7 @@ export function loadConfig(
|
||||
}
|
||||
|
||||
const variables = {
|
||||
LANG: locale,
|
||||
...process.env
|
||||
LANG: locale
|
||||
};
|
||||
|
||||
const substitutedLibraryContent = substitute(false, rawLibraryContent, variables);
|
||||
|
||||
+2
-4
@@ -4,10 +4,8 @@ import { resolve, template } from '@polymech/commons'
|
||||
import { sync as read } from '@polymech/fs/read'
|
||||
import { sanitizeUri } from 'micromark-util-sanitize-uri'
|
||||
import { loadConfig } from './config-loader.js'
|
||||
import { I18N_SOURCE_LANGUAGE } from "./constants.js"
|
||||
|
||||
export { I18N_SOURCE_LANGUAGE }
|
||||
|
||||
export const I18N_SOURCE_LANGUAGE = 'en'
|
||||
// Load config
|
||||
const config = loadConfig(I18N_SOURCE_LANGUAGE)
|
||||
|
||||
@@ -30,7 +28,7 @@ export const HOWTO_MIGRATION = () => path.resolve(resolve(config.products.howto_
|
||||
|
||||
// Products
|
||||
export const PRODUCT_ROOT = () => path.resolve(resolve(config.products.root))
|
||||
export const PRODUCT_BRANCHES = read(path.join(PRODUCT_ROOT(), 'config/machines.json'), 'json')
|
||||
export const PRODUCT_BRANCHES = read(path.join('.', 'library.json'), 'json')
|
||||
export const PRODUCT_GLOB = config.products.glob
|
||||
|
||||
// Product compiler
|
||||
|
||||
+1
-1
@@ -25,7 +25,7 @@ const imagesSchema = z.object({
|
||||
type Images = z.infer<typeof imagesSchema>;
|
||||
|
||||
import { loadConfig } from './config-loader.js'
|
||||
import { I18N_SOURCE_LANGUAGE } from "./constants.js"
|
||||
import { I18N_SOURCE_LANGUAGE } from "./config.js"
|
||||
|
||||
// Load config
|
||||
const config = loadConfig(I18N_SOURCE_LANGUAGE)
|
||||
|
||||
@@ -3,11 +3,8 @@ import { defineCollection, z } from "astro:content"
|
||||
import { ComponentConfigSchema } from '@polymech/commons/component'
|
||||
import { loader } from '@polymech/astro-base/model/component.js'
|
||||
import { loader as howtoLoader } from './model/howto/howto.js'
|
||||
import { loader as directorLoader } from './model/directory/item.js'
|
||||
import { LIBARY_BRANCH } from '@/app/config.js'
|
||||
|
||||
|
||||
const store = defineCollection({
|
||||
const library = defineCollection({
|
||||
loader: loader('site-dev') as any,
|
||||
schema: ComponentConfigSchema.passthrough(),
|
||||
})
|
||||
@@ -48,6 +45,7 @@ const directory = defineCollection({
|
||||
}).passthrough()
|
||||
})
|
||||
*/
|
||||
|
||||
const resources = defineCollection({
|
||||
loader: glob({ base: './src/content/resources', pattern: '*.{md,mdx}' }),
|
||||
schema: z.object({
|
||||
@@ -64,7 +62,7 @@ const resources = defineCollection({
|
||||
});
|
||||
|
||||
export const collections = {
|
||||
store,
|
||||
library,
|
||||
resources,
|
||||
//helpcenter,
|
||||
//infopages,
|
||||
|
||||
@@ -5,7 +5,6 @@ import { LANGUAGES_PROD } from "config/config.js"
|
||||
import StoreEntries from "@/components/store/StoreEntries.astro";
|
||||
import BaseLayout from "@/layouts/BaseLayout.astro";
|
||||
import Wrapper from "@polymech/astro-base/components/containers/Wrapper.astro";
|
||||
import Navigation from "@polymech/astro-base/components/global/Navigation.astro";
|
||||
import Translate from "@polymech/astro-base/components/i18n.astro";
|
||||
import { slugify } from "@polymech/astro-base/base/strings.js"
|
||||
|
||||
@@ -13,8 +12,9 @@ const view = 'library'
|
||||
|
||||
export async function getStaticPaths()
|
||||
{
|
||||
|
||||
const view = 'library'
|
||||
const allProducts = await getCollection('store')
|
||||
const allProducts = await getCollection(view)
|
||||
const all: unknown[] = []
|
||||
|
||||
LANGUAGES_PROD.forEach((lang) => {
|
||||
|
||||
Reference in New Issue
Block a user