Skip to content

Fix two minor Rush issues - #571

Merged
Pete Gonzalez (octogonz) merged 5 commits into
masterfrom
pgonzal/rush-fixes
Mar 20, 2018
Merged

Pete Gonzalez (octogonz) merged 5 commits into
masterfrom
pgonzal/rush-fixes

Conversation

@octogonz

@octogonz Pete Gonzalez (octogonz) commented Mar 20, 2018 •

Copy link
Copy Markdown
Collaborator
  1. The common/temp/shrinkwrap.yaml was folding duplicates, which made diffs less readable
  2. The environment version check needs to happen during startup of rush, not in the entry point for rush-lib (Regression from Rush should warn about unsupported versions of the NodeJS runtime #539)

noCompatMode: true,
noRefs: true,
sortKeys: true
};

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Zoltan Kochan (@zkochan) do you think this configuration should be exported by the pnpm-shrinkwrap library? Could that library help with the operations in this file?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can't you just use one of the write functions from pnpm-shrinkwrap?

@octogonz Pete Gonzalez (octogonz) Mar 20, 2018 •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nickpape-msft said that he looked at this library, but the API was unclear. For example, you have:

write(pkgPath, wantedShrinkwrap, currentShrinkwrap) => Promise
Writes the wanted/current shrinkwrap files. When they are empty, removes them.

What are the "wanted" and "current" files? The data type for wantedShrinkwrap is a Shrinkwrap interface, which seems useful, but it appears to be a forgotten export for this API.

This one looks useful:

writeCurrentOnly(pkgPath, currentShrinkwrap) => Promise
Writes the current shrinkwrap file only. Fails if there is no node_modules directory in the pkgPath

...but it says that it expects a node_modules folder for some reason. Why? Seems like an arbitrary requirement.

Lastly, it might be nice to have non-async versions of these functions. We often avoid async in our tools because it makes the control follow more difficult to follow and debug. And the single-threaded parallelism tends not to provide much speed improvement, because (1) NodeJS makes it difficult to bound the parallelism, and too many async operations can actually slow things down by causing too much context switching or disk thrashing, and (2) Rush already launches a separate node.exe process for each CPU core, which is perhaps a better behaved form of parallelism.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The wanted shrinkwrap is in the root of your project. In the same directory where the package.json is. The current shrinkwrap.yaml is the one in node_modules/.shrinkwrap.yaml. I don't know which one you need but pnpm writes both.

I don't have objections having sync versions or exporting the configs passed to YAML

@octogonz
Pete Gonzalez (octogonz) merged commit 58f9134 into master Mar 20, 2018
@octogonz
Pete Gonzalez (octogonz) deleted the pgonzal/rush-fixes branch May 2, 2018 04:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants