mirror of
https://github.com/tabler/tabler.git
synced 2025-12-21 17:34:25 +04:00
fix: update appData function to use dynamic path resolution for core files
This commit is contained in:
@@ -1,10 +1,16 @@
|
|||||||
import { readFileSync } from "fs";
|
import { readFileSync } from "fs";
|
||||||
import { join } from "path";
|
import { join, dirname } from "path";
|
||||||
|
|
||||||
|
import { fileURLToPath } from "url";
|
||||||
|
|
||||||
export function appData(eleventyConfig) {
|
export function appData(eleventyConfig) {
|
||||||
eleventyConfig.addGlobalData("package", JSON.parse(readFileSync(join("..", "core", "package.json"), "utf-8")));
|
const currentDir = dirname(fileURLToPath(import.meta.url));
|
||||||
eleventyConfig.addGlobalData("changelog", readFileSync(join("..", "core", "CHANGELOG.md"), "utf-8"));
|
|
||||||
eleventyConfig.addGlobalData("libs", JSON.parse(readFileSync(join("..", "core", "libs.json"), "utf-8")));
|
console.log('currentDir', currentDir);
|
||||||
|
|
||||||
|
eleventyConfig.addGlobalData("package", JSON.parse(readFileSync(join(currentDir, "..", "..", "core", "package.json"), "utf-8"))) ;
|
||||||
|
eleventyConfig.addGlobalData("changelog", readFileSync(join(currentDir, "..", "..", "core", "CHANGELOG.md"), "utf-8"));
|
||||||
|
eleventyConfig.addGlobalData("libs", JSON.parse(readFileSync(join(currentDir, "..", "..", "core", "libs.json"), "utf-8")));
|
||||||
|
|
||||||
// Analytics Environment Variables
|
// Analytics Environment Variables
|
||||||
eleventyConfig.addGlobalData("posthogApiKey", process.env.NEXT_PUBLIC_POSTHOG_KEY);
|
eleventyConfig.addGlobalData("posthogApiKey", process.env.NEXT_PUBLIC_POSTHOG_KEY);
|
||||||
|
|||||||
Reference in New Issue
Block a user