Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions scripts/utils/addSymlinksToDirectoryCache.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,10 @@ export async function addStaticFileSymlinksToCache(
// 2. It's handled specially and is technically in the root directory,
// which we should never be listing thus don't need to add it to the
// directory cache.
// So, let's remove it then add it back once we're done handling the rest of
// the static file symlinks.
// So, let's remove them then add them back once we're done handling the rest
// of the static file symlinks.
Comment thread
avivkeller marked this conversation as resolved.
fileSymlinks['node-config-schema.json'] = undefined;
fileSymlinks['llms.txt'] = undefined;
Comment thread
avivkeller marked this conversation as resolved.

// Add the symlinks to the directory cache
for (const symlink of Object.keys(fileSymlinks)) {
Expand Down Expand Up @@ -171,10 +172,11 @@ export async function addStaticFileSymlinksToCache(
});
}

// Update the node-config-schema.json file symlink to point to the latest
// version
// Update the node-config-schema.json and llms.txt file symlinks to point to
// the latest version
fileSymlinks['node-config-schema.json'] =
`${RELEASE_DIR}${latestVersion}/docs/node-config-schema.json`;
fileSymlinks['llms.txt'] = `${RELEASE_DIR}${latestVersion}/docs/llms.txt`;

// Update file so it can be used in the worker
await writeFile(
Expand All @@ -201,10 +203,11 @@ export async function addStaticFileSymlinksToCache(
*
* We use symlinks to point to both files and directories.
*
* The file symlinks are more or less static. There are only two that are
* The file symlinks are more or less static. There are only a few that are
* constantly updated with each release:
* - `nodejs/release/node-latest.tar.gz`
* - `node-config-schema.json`
* - `llms.txt`
*
* The directory symlinks are dynamic with a few exceptions for a select number
* of directories in `nodejs/docs/`
Expand Down
3 changes: 2 additions & 1 deletion src/constants/fileSymlinks.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,5 +68,6 @@
"nodejs/release/v0.1.15/node-v0.1.15.tar.gz": "nodejs/release/node-v0.1.15.tar.gz",
"nodejs/release/v0.4.12/node-v0.4.12.tar.gz": "nodejs/release/node-v0.4.12.tar.gz",
"nodejs/release/v0.1.32/node-v0.1.32.tar.gz": "nodejs/release/node-v0.1.32.tar.gz",
"node-config-schema.json": "nodejs/release/v26.3.1/docs/node-config-schema.json"
"node-config-schema.json": "nodejs/release/v26.3.1/docs/node-config-schema.json",
"llms.txt": "nodejs/release/v26.3.1/docs/llms.txt"
}
3 changes: 2 additions & 1 deletion src/middleware/r2Middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,8 @@ function getR2Path({
}
} else if (
pathname.startsWith('/metrics') ||
pathname === '/node-config-schema.json'
pathname === '/node-config-schema.json' ||
pathname === '/llms.txt'
) {
// Substring to cut off the leading /
return pathname.substring(1);
Expand Down
3 changes: 3 additions & 0 deletions src/routes/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ export function registerRoutes(router: Router): void {
router.head('/node-config-schema.json', r2Middleware);
router.get('/node-config-schema.json', r2Middleware);

router.head('/llms.txt', r2Middleware);
router.get('/llms.txt', r2Middleware);
Comment thread
avivkeller marked this conversation as resolved.
Comment thread
avivkeller marked this conversation as resolved.

router.head('/dist/?:filePath+', r2Middleware, originMiddleware);
router.get('/dist/?:filePath+', cachedR2Middleware, originMiddleware);

Expand Down