**Summary**
Fixes#746. Unfortunately, neither Node, nor many systems come with
built-in DNS caching so the many parallel requests that Yarn makes
sometimes overwhelm the DNS servers, and most of the time, for the
very same domain(s). Even worse, we pay the DNS look up cost for
each request, which is quite sad at best. This patch introduces
the `dnscache` module which intercepts all DNS look ups and answers
them from an in-memory cache when possible. This applies to the
built-in `http` and `https` modules, used by `request`.
**Test plan**
Existing tests should pass, and hopefully be faster. Total number of
DNS look ups should decrease dramatically.
**Summary**
Resolves#4021
This fixes the workspace command so that it runs in the correct directory and adds a test to validate it.
Previously the command was also relying on `process.argv` to get the executable path for `node` and `yarn`. However, that ends up being unreliable if yarn was run as part of another process (aka `jest`).
**Test plan**
Added integration tests.
**Summary**
Closes#4113. This PR create the `private` flag for `yarn init` command. Can use both `yes` and `private` flags. Or can use `private` flag alone to set `private` is `true` when run command.
**Test plan**
Have added tests
**Summary**
Fixes#4059. Windows sometimes has both `jest` and `jest.js` files under `node_modules` so this patch changes the `test-only` script to refer to `jest.js` bin file directly.
**Test plan**
Run `yarn test-only` on Windows. It should run and complete without errors.
**Summary**
Upgrade ESLint to version 4. I did this mostly to get [no-process-exit](http://eslint.org/docs/rules/no-process-exit) rule introduced in v4. Refs #3955.
**Test plan**
Lint should pass without errors.
**Summary**
Fixes: #3907.
In yarn version 0.27.4 a patch (5ff69228f6) introduced a change that caused an authorization header to be added to requests that were not being sent to the registry.
This commit brings back some older logic to ensure we only add the authorization header when we are sending requests to the registry.
**Test plan**
Many new unit tests for requests and `isRequestToRegistry`.
To test this change you need a private repository using a repository server such, as Verdaccio configured, to only allow authenticated calls to be made for both download and publish commands. This configuration requires that yarn has the `always-auth` option enabled.
If we install additional packages from GitHub and save them to the `yarn.lock` file it should not send the authorization header for these requests.
* Fix peer dependency to only look from top level dependencies
* lint
* Upgrade/add peer dependencies
* Fix babel-eslint
* variable name fix
* feedback from @byk
* Update: Upgrade Jest to version 20
**Summary**
Fixes#3757. Jest 20 is the latest version with many improvements,
most importantly for us, not automatically polyfilling `Array.includes`.
**Test plan**
CI should pass without issues.
* Fix .includes error
* Kill all `.includes()`
**Summary**
macOS tests on Travis CI keep timing out and they run very slowly. This patch attempts to solve this by doing the following:
- Use ramfs for `__tests__` folder and for `$TMPDIR` for faster file system
- Remove unnecessary `brew update` and `brew install yarn` commands
- Remove unnecessary `--max-workers` argument since all CI VMs have only 2 cores
- Clean up tmp folders per test after they are done
- Fix `link/unlink` test's race condition and previous test case reliance
- Fix `request-manager` timeout tests to be more reliable and finish in under our normal timeout
- Use real timers by default and add necessary `useFakeTimers` calls
- Increase heap size for Linux and OS X to 4 GB since OS X builds were crashing due to limited heap space
- Removes retries from Travis CI
**Test plan**
All tests on all platforms should pass and pass in about 20 minutes max.
* extract resolver from compatibility class
* make package-fetcher stateless and indipendent from package-resolver
* trasform PackageCompability in a function
* renaming check and importing better in install and import command
* renaming fetch and importing better in install and import commands
* remove seedPatterns from package-resolver
* remove newPatterns from package-resolver and add fresh flag in manifest
* run yarn lint-prettier in yarn lint script instead of yarn prettier
* add comment to fresh flag in Manifest
* add pretty files
* remove redunant await from package-fetcher
* remove redunant await and useless async from fetch function
* add prettier and prettying everything
* fix scripts and run yarn prettier
* fix scripts again and run yarn prettier
* use eslint-plugin-prettify instead of custom scripts
* update eslint, babel-eslint, eslint-config-fb-strict
* update lockfile
* downgrade babel-eslint, remove eslint-config-fbjs because the latest is incompatible with the latest of eslint-config-fb-strict, update eslint-plugin-flowtype and eslint-plugin-react
* Switch to micromatch: fixesyarnpkg/yarn#3336
* Trim patterns before generating RegExp
Test suite now passes
* Add test + test fixtures to test micromatch
* Oops. Actually add the fixtures to Git this time
* Update yarn.lock
reverted registry change
* workspaces proof of concept
* added glob support and removed support for recursive workspaces + added tests
* more tests, allow workspaces only on private projects
* conflict in versions will throw errors in first iteration, later we'll do a smart resolution/linking
* file-resolver should invalidate cache with a new hash everytime
* Add/update tests for file protocol cache busting with force flag
* Fixing cache test and adding comment on size of cache directory.
Instead of including all the raw JS files in the dist tarball, just use the single Yarn JS file that's built as part of the build, along with a few other files that are required. This significantly reduces the number of files in the tarball:
```
C:\src\yarn\dist (bundle-as-dist) (yarn@0.23.0-0)
λ find .
.
./bin
./bin/node-gyp-bin
./bin/node-gyp-bin/node-gyp
./bin/node-gyp-bin/node-gyp.cmd
./bin/yarn
./bin/yarn.cmd
./bin/yarn.js
./bin/yarnpkg
./bin/yarnpkg.cmd
./lib
./lib/v8-compile-cache.js
./lib/yarn-cli.js
./LICENSE
./package.json
```
There are three .js files in the archive:
- `lib/v8-compile-cache.js`: Speeds up instantiation time by using the V8 code cache (https://www.npmjs.com/package/v8-compile-cache). This needs to be separate as it has to load **before** the bulk of the application code is loaded, so it can **not** be bundled
- `lib/yarn-cli.js`: Contains all the bundled Yarn code
- `bin/yarn.js`: Entry point to the app, just like today. Loads `v8-compile-cache` then loads `yarn-cli`
This change means that **only** the JavaScript files that are actually used are included, resulting in a nice file size reduction for the installation packages:

Differences are due to differing compression algorithms: Debian packages use xz or LZMA, RedHat uses gzip, Windows installer uses Cabinet
They're also slightly faster to extract:

Testing was performed on my desktop computer (Intel Core i5 6500, Samsung 850 Evo 1TB SSD, Windows 10), with testing for Linux stuff (like installing the Debian package) tested in a Docker container.
Raw data: https://docs.google.com/spreadsheets/d/1d8jdf3DU_GUFdotlPl08PkYa8SkzStK2tgnQ54ivsm0/edit?usp=sharing
Performance is very slightly faster when using `v8-compile-cache` along with the bundled file, but it's not extremely significant (`yarn --version` went from 0.19s to 0.14s on my BuyVM server). The difference might be bigger on servers with slower disks (HDD) or with more overloaded servers.
I also deleted the `build-dist.ps1` file because we _should_ be able to assume that Bash is available on Windows, particularly if Git is installed (as it comes with Git Bash). I need to verify that this works on AppVeyor.