-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
src: map file symlinks for old node versions #292
Conversation
src/constants/cachedDirectories.json
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're still well under the 10mb limit for a worker but since this file is only going to grow, I think we should continue looking at something like #159
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed :)
// Let's add these to our cached directories. | ||
const fileSymlinks = JSON.parse(await readFile(FILE_SYMLINKS, 'utf8')); | ||
|
||
for (const file of Object.keys(fileSymlinks)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this be cleaned up a bit? Maybe instead if else, we can have different loops just to separate concerns. Performance here should not be a driving factor.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not really sure separating it into two different loops would look much better,
for (const file of Object.keys(fileSymlinks)) {
const directory = `${dirname(file)}/`
if (!(directory in cachedDirectories)) {
continue;
}
const actualFile = await headFile(client, fileSymlinks[file]);
cachedDirectories[directory].files.push({
...actualFile,
name: basename(file)
})
}
for (const file of Object.keys(fileSymlinks)) {
const directory = `${dirname(file)}/`
if (!(directory in cachedDirectories)) {
continue;
}
const actualFile = await headFile(client, fileSymlinks[file]);
const contents = await listDirectory(client, directory);
contents.files.push({
...actualFile,
name: basename(file),
})
cachedDirectories[directory] = contents;
}
Signed-off-by: flakey5 <[email protected]>
6b08c2e
to
71edd3a
Compare
Old Node versions have file symlinks pointing to them, but the worker wasn't handling this (i.e. for https://nodejs.org/dist/v0.1.99/ there should be a
node-v0.1.99.tar.gz
file but there's not).This:
fileSymlinks.json
that holds whatever files need symlinks. The key is the symlink location and the value is the actual location of the filebuild-r2-symlinks.js
script readfileSymlinks.json
and include them in the cached directory listings