MCPcopy Create free account
hub / github.com/Openpanel-dev/openpanel / getFeatureData

Function getFeatureData

apps/public/src/lib/features.ts:105–120  ·  view source on GitHub ↗
(
  slug: string,
)

Source from the content-addressed store, hash-verified

103const contentDir = join(process.cwd(), 'content', 'features');
104
105export async function getFeatureData(
106 slug: string,
107): Promise<FeatureData | null> {
108 try {
109 const filePath = join(contentDir, `${slug}.json`);
110 const fileContents = readFileSync(filePath, 'utf8');
111 const data = JSON.parse(fileContents) as Omit<FeatureData, 'url'>;
112 return {
113 ...data,
114 url: `/features/${slug}`,
115 };
116 } catch (error) {
117 console.error(`Error loading feature data for ${slug}:`, error);
118 return null;
119 }
120}
121
122export async function getAllFeatureSlugs(): Promise<string[]> {
123 try {

Callers 4

generateMetadataFunction · 0.90
FeaturePageFunction · 0.90
getOgDataFunction · 0.90
loadFeatureSourceFunction · 0.85

Calls 3

joinFunction · 0.85
parseMethod · 0.80
errorMethod · 0.45

Tested by

no test coverage detected