Files
wehub-resource-sync dde272c4b8
i18n - Build Validation / Validate i18n Builds (24) (push) Has been cancelled
CI - Node.js / Lint (24) (push) Has been cancelled
CI - Node.js / Build (24) (push) Has been cancelled
CI - Node.js / Test (24) (push) Has been cancelled
CI - Node.js / Test - Upcoming Changes (24) (push) Has been cancelled
CI - Node.js / Test - i18n (italian, 24) (push) Has been cancelled
CI - Node.js / Test - i18n (portuguese, 24) (push) Has been cancelled
CD - Docker - GHCR Images / Build and Push Images (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 11:55:53 +08:00

36 lines
917 B
TypeScript

import path from 'path';
import {
getBlockStructure,
writeBlockStructure
} from '@freecodecamp/curriculum/file-handler';
import type { BlockLabel } from '@freecodecamp/shared/config/blocks';
import { getProjectPath } from './get-project-info.js';
export type Meta = {
blockLayout: string;
blockLabel?: BlockLabel;
isUpcomingChange: boolean;
dashedName: string;
helpCategory: string;
time: string;
template: string;
required: string[];
challengeOrder: { id: string; title: string }[];
};
function getMetaData() {
const block = getBlock(getProjectPath());
return getBlockStructure(block) as Meta;
}
function getBlock(filePath: string) {
return path.basename(filePath);
}
async function updateMetaData(newMetaData: Record<string, unknown>) {
const block = getBlock(getProjectPath());
await writeBlockStructure(block, newMetaData);
}
export { getMetaData, updateMetaData, getBlock };