-
Notifications
You must be signed in to change notification settings - Fork 28
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
Set the required configuration for processing a Yarn request #360
Set the required configuration for processing a Yarn request #360
Conversation
I focused on the yarnrc attributes we are sure we need to change based on the design doc, I still need to investigate the ones under "maybe" and do more real-world testing. |
d93088d
to
ccd7cc9
Compare
New changes: Split the first commit in two, removed the WIP status from the first three commits, added a new WIP commit to investigate additional yarnrc configuration options. |
ccd7cc9
to
3ef9908
Compare
3ef9908
to
ca40b15
Compare
Sadly, I think we're going to need |
@@ -22,6 +22,15 @@ | |||
DEFAULT_CACHE_FOLDER = "./.yarn/cache" | |||
DEFAULT_REGISTRY = "https://registry.yarnpkg.com" | |||
|
|||
ChecksumBehavior = Literal["throw", "update", "ignore"] |
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.
Isn't "reset" also a possible value here?
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 think that is valid for v4 only 🤔
v3: https://v3.yarnpkg.com/configuration/yarnrc
v4: https://yarnpkg.com/configuration/yarnrc#checksumBehavior
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.
Should we make a note to yarn v4 story/epic that reset
should be added there?
You're absolutely right. We want to ignore the commited yarn executable if it exists, and that requires the ignorePath option set. |
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.
Looks amazing Bruno. I left here a few nitpicks, feel free to ignore them. :) I assume those TBD commits will be resolved in upcoming PRs. 👍
ca40b15
to
b4d6e90
Compare
e23c6b4
to
60c7226
Compare
Since we will always write some configuration options into the .yarnrc.yml when processing a Yarn request, we can safely instantiate an empty YarnRc object whenever a Project is loaded. Signed-off-by: Bruno Pimentel <[email protected]>
This will be needed later on so that the configuration in the .yarnrc.yaml file can be changed for the prefetch. Signed-off-by: Bruno Pimentel <[email protected]>
The name was changed from 'write_to_file' to simply 'write', making it consistent to a similar method present in the YarnRc class. Signed-off-by: Bruno Pimentel <[email protected]>
STONEBLD-1777 Set the following options in the .yarnrc.yml file: - checksumBehavior: set to 'throw', so an exception is raised in case of checksum mismatches. - enableImmutableInstalls: makes 'yarn install' fail in case a change to the lockfile is necessary. - plugins: set to an empty array, so that no plugins will be used in the prefetch/cache checking. This avoids arbitrary code execution. - pnpMode: set to 'strict', to disallow modules to require packages they don't explicitly list in their own dependencies. For zero-installs: - enableImmutableCache: makes 'yarn install' fail if any modification in the cache folder would be made. For regular workflow: - enableMirror: set to true to ensure the globalFolder will be used. - globalFolder: set to the request's output folder. The prefetched packages will be placed in it. More details at: https://v3.yarnpkg.com/configuration/yarnrc Signed-off-by: Bruno Pimentel <[email protected]>
Sets the "enableStrictSsl" to true and "unsafeHttpWhitelist" to an empty list in .yarnrc.yml. See https://v3.yarnpkg.com/configuration/yarnrc for more info. Signed-off-by: Bruno Pimentel <[email protected]>
Set the .yarnrc.yml option "enableTelemetry" to false to prevent the yarn commands from making unnecessary requests. See https://v3.yarnpkg.com/configuration/yarnrc for more info. Signed-off-by: Bruno Pimentel <[email protected]>
Set the ignorePath option to true, which makes yarn ignore the executable defined yarnPath and fallback to the global one. This makes Corepack fetch a new yarn executable, which will then be used. We don't want to rely on the executable that is commited to the repository, since there's no way to know if it has been tampered. Signed-off-by: Bruno Pimentel <[email protected]>
Set the "enableScripts" .yarnrc.yml option to false, which avoids the unplugging of dependencies that have postinstall scripts. The unplugged content is necessary for the Yarn project to run, but since a "yarn install" is expected to happen during the build phase for a regular workflow project, this content will still be generated as expected. For more info, see: - https://v3.yarnpkg.com/cli/install (--mode=skip-build section) Signed-off-by: Bruno Pimentel <[email protected]>
60c7226
to
258e04e
Compare
c849c6d
to
258e04e
Compare
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.
LGTM 🚀
The following .yarnrc.yml options are strictly necessary in order to process a yarn request:
checksum mismatches
the lockfile is necessary
prefetch/cache checking. This avoids arbitrary code execution.
For zero-installs:
the cache folder would be made.
For regular workflow:
packages will be placed in it.
We're also setting these "nice to have" options:
Maintainers will complete the following section