245 Commits

Author SHA1 Message Date
Burak Yiğit Kaya
738df577c8 Update: add DNS caching to request manager (#4447)
**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.
2017-09-14 02:59:44 +01:00
Burak Yigit Kaya
5786d3a555 v1.0.2 2017-09-13 17:26:40 +01:00
Maël Nison
5ea8ea7f9c 1.0.1 2017-09-07 14:19:44 +01:00
James Kyle
6c0b94af20 Fix: fixes yarn workspace command (#4080)
**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.
2017-08-24 21:15:55 +01:00
Pierre Neter
6bab5cc40b Update: Add private flag for yarn init command (#4165)
**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
2017-08-24 17:37:02 +01:00
kaylieEB
634c239980 Selective version resolution feature (#4105)
* refactor some test helpers

* first failing tests

* WIP

* Uses "ResolutionMap" instead of the duplicate name "Resolutions"
2017-08-14 18:56:42 +01:00
Will Binns-Smith
f072e965c7 Upgrade: upgrade flow to ^0.52.0 (#4124)
**Summary**

This upgrades flow, both in the flowconfig and in the flow-bin dependency to ^0.52.0

**Test plan**

`yarn lint`
2017-08-09 16:52:53 +01:00
Burak Yiğit Kaya
98af218ede Update: bump version to 1.0.0 for master (#4089) 2017-08-04 11:35:04 +01:00
Burt Harris
df09b7c342 Fix: Make yarn test-only work on Windows again (#4071)
**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.
2017-08-02 13:49:02 +01:00
Burak Yiğit Kaya
c01fbed288 Update: upgrade ESLint to 4.3.0 (#3962)
**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.
2017-07-26 14:55:10 +01:00
Reyad Attiyat
050815d5c2 Fix: Only add auth token when registry url matches pathname url (#3987)
**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.
2017-07-26 11:47:26 +01:00
Maël Nison
71dd1fbe02 Prevent --check-files from crossing symlinks (#3931)
* Prevent --check-files from crossing symlinks

* Update integration.js

* Lints
2017-07-17 14:53:11 +01:00
Simon Vocella
8dab49edd3 Update: remove babel-eslint (#3874) 2017-07-11 16:09:01 +01:00
Burak Yiğit Kaya
2a5428bb8b Fix: fix failing tests on master after release changes (#3899) 2017-07-11 12:05:42 +01:00
Simon Vocella
1e12660c85 upgrade node-emoji to 1.6.1 (#3875) 2017-07-10 09:03:20 +01:00
Simon Vocella
5b4af8ae0c remove babel-jest from package.json (#3873) 2017-07-10 07:52:07 +01:00
Simon Vocella
763d018b9e remove babel-plugin-transform-es2015-typeof-symbol (#3872) 2017-07-10 07:51:29 +01:00
Simon Vocella
c5a758856e upgrade flow (#3876) 2017-07-10 07:48:28 +01:00
Maël Nison
1d37af05ee 0.28.0 2017-07-09 15:29:10 +01:00
Adam Stankiewicz
7de213bd6e Fix allowing to install packages without manifest (#3855) 2017-07-07 10:58:41 -07:00
kaylieEB
337b73f741 Fix: Peer dependencies should only be looked up from top level dependencies (#3803)
* Fix peer dependency to only look from top level dependencies

* lint

* Upgrade/add peer dependencies

* Fix babel-eslint

* variable name fix

* feedback from @byk
2017-07-07 09:39:54 -07:00
Maël Nison
bd99f3c974 Adds back the prettier script (#3839) 2017-07-06 12:39:04 +01:00
Simon Vocella
472a051ec8 Use eslint-plugin-prettier instead of custom scripts for prettier (#3796)
* use eslint-plugin-prettier instead of custom scripts for prettier

* remove prettier script
2017-07-03 14:28:22 -07:00
Simon Vocella
31fec2a3fb upgrade prettier and run it (#3795) 2017-07-03 09:22:37 -07:00
Burak Yiğit Kaya
313b3b90c8 Update: Upgrade Jest to version 20 (#3760)
* 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()`
2017-06-30 12:57:21 +01:00
Burak Yiğit Kaya
08411a05a4 Fix: Make tests great again on Travis CI macOS (#3667)
**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.
2017-06-29 15:34:42 +01:00
Maël Nison
d1dca28ccb 0.27.0 2017-06-23 14:11:24 +01:00
kaylieEB
1e0575c5c6 Add new plugin to .babelrc to transpile Array.prototype.includes (#3705) 2017-06-23 10:15:16 +01:00
Simon Vocella
a3ce7c702f update flow (#3695) 2017-06-22 18:17:45 +01:00
Maël Nison
f94bef3fdf 0.26.0 2017-06-06 14:03:57 +01:00
Kishan Bagaria
9e28a26d25 Replace no-async-without-await plugin with in-built rule (#3480)
* Replace no-async-without-await plugin with in-built rule

* Prettify .eslintrc
2017-05-23 15:00:16 +01:00
Simon Vocella
675a3e6a2b Make package-compatibility and package-fetcher stateless (#3422)
* 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
2017-05-23 12:35:30 +01:00
Simon Vocella
1b21157868 Delete eslint-plugin-prettify and revert back to custom scripts for prettier (#3426)
* delete eslint-plugin-prettify and return back to custom scripts

* formatting eslintrc

* set print-width to 120
2017-05-17 13:07:24 +01:00
Simon Vocella
25890c8cf9 add prettier and prettying everything (#3401)
* 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
2017-05-16 19:12:03 +01:00
Simon Vocella
b501276ab7 update eslint, eslint-config-fb-strict and other dependencies (#3390)
* 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
2017-05-13 22:01:39 +01:00
Konstantin Raev
20f00acc36 0.26.0-0 2017-05-12 19:19:32 +01:00
Konstantin Raev
f6b9659d91 v0.25.0 2017-05-12 19:19:29 +01:00
jrop
d2231165dd Switch to micromatch: fixes yarnpkg/yarn#3336 (#3339)
* Switch to micromatch: fixes yarnpkg/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
2017-05-12 16:29:40 +01:00
Konstantin Raev
20e5779ec3 workspaces: first phase: install node_modules aggregated from all workspaces (#3229)
* 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
2017-05-11 17:53:36 +01:00
Simon Vocella
9931b39b87 use yarn instead of npm everywhere is possible aka Eating your own dog food (#3374) 2017-05-10 19:02:52 +01:00
Simon Vocella
7d9acc66b7 upgrade babel-core (#3366) 2017-05-10 17:22:45 +01:00
Konstantin Raev
569fbb2a9f 0.25.0-0 2017-05-04 13:54:44 +01:00
Konstantin Raev
19122357fb v0.24.0 2017-05-04 13:54:41 +01:00
Matt Traynham
7241de13bb Ref #2165 - file-resolver should invalidate cache with a new hash (#2860)
* 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.
2017-04-24 22:31:45 +01:00
Daniel Lo Nigro
50c5bf0cde Use npm's node-gyp if available, otherwise automatically install node-gyp (#3240)
* Attempt to install node-gyp if it's required but missing

* Try to use node-gyp version from npm

* Trailing commas
2017-04-24 10:44:48 +01:00
Victor Noël
0897457471 Use gunzip-maybe instead of reimplementing (#2971) 2017-04-18 17:05:37 +01:00
Daniel Lo Nigro
e086476e8c Remove Roadrunner (#3079) 2017-04-08 14:55:11 -07:00
Daniel Lo Nigro
3af60cf9c1 Use standalone .js bundle in dist tarball rather than individual JS files (#3030)
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:
![](http://ss.dan.cx/2017/04/Yarn_bundle_dist_metrics_-_Google_Sheets_-_Google__01-13.51.49.png)

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:
![image 3](https://cloud.githubusercontent.com/assets/91933/24582332/483b41f4-16e2-11e7-9509-8024b1e78a39.png)

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.
2017-04-08 14:40:19 -07:00
Maël Nison
508c959080 Remove the dependency on the "rc" module (#3063)
* Removes dependency on the "rc" module

* Removers shebang-loader, not used anymore

* Fixes flow errors

* Fixes tests on Windows
2017-04-07 15:28:55 +01:00
Maël Nison
d4b61a4b80 0.24.0-0 2017-04-06 15:43:38 +01:00