Source identity
| Field | Recorded value |
|---|---|
| Source type | GitHub source |
| Original record | Janady13/llms-txt-hub / packages/utils/content-paths.ts |
| Date | Not specified in source |
| Repository | Janady13/llms-txt-hub |
| Revision | e0f4bf978d4df168369c7601d9c5f5ea89e84377 |
| Branch | main |
| Path or archive member | packages/utils/content-paths.ts |
| Original SHA-256 | f8fb68cb3735638047ec1416f0863181ecc4768d3e947dfe5b19b48fe57316a9 |
| Git blob SHA | a25241b30873ad1bdf0678623aeecadfd604c8cd |
| Reading-copy SHA-256 | f8fb68cb3735638047ec1416f0863181ecc4768d3e947dfe5b19b48fe57316a9 |
Recovered source transcript
Download complete source text ↓29 lines · 0.8 KB
import path from 'node:path'
import { fileURLToPath } from 'node:url'
// Get the monorepo root path
function getMonorepoRoot(): string {
// Start from the current file's directory
let currentDir = path.dirname(fileURLToPath(import.meta.url))
// Go up until we find the monorepo root (where package.json exists)
while (!path.basename(currentDir).includes('llms-txt-hub')) {
currentDir = path.dirname(currentDir)
}
return currentDir
}
const MONOREPO_ROOT = getMonorepoRoot()
export function getContentPath(contentType: 'resources' | 'websites'): string {
return path.join(MONOREPO_ROOT, 'content', contentType)
}
export function getContentFilePath(
contentType: 'resources' | 'websites',
fileName: string
): string {
return path.join(getContentPath(contentType), fileName)
}