Commit Graph

1800 Commits

Author SHA1 Message Date
Burak Yigit Kaya
471a574816 fix(config): Don't override registry with undefined by default
**Summary**

Follow up to #4238. We were always passing the `registry` key in
registry overrides but its value was `undefined` when an override
was not in place. `Object.assign` doesn't care about that though
so we were overriding the registry all the time, mostly with
`undefined`.

**Test plan**

Added new test case.
2017-10-05 17:11:47 +01:00
Nikhil Motiani
633b28168d fix(resolver): parentNames is missing in package warning breadcrumbs (#4484)
**Summary**

Bugfix for #4480. Change suggested by @BYK 

**Test plan**
Running yarn on local.

_**Before Changes**_
```bash
warning node-uuid@1.4.8: Use uuid module instead
```

_**After Changes**_
```bash
warning raven > node-uuid@1.4.8: Use uuid module instead
```
2017-10-05 16:46:09 +01:00
Valerii Iatsko
972166c166 chore(tests): Make integration tests passing on Node 7 (#4606)
**Summary**

The change introduced in 96c215c1ce caused tests to fail on node 7 as react-scripts is not compatible with it. This patch adds `--ignore-engines` flag to suppress the warning.

**Test plan**

Tests should pass on Node 7.
2017-10-05 16:41:31 +01:00
Burak Yiğit Kaya
5a9b2d0ab6 chore(tests): Don't output coverage on regular test runs (#4629)
* chore(tests): Don't output coverage on regular test runs

**Summary**

We output a long coverage summary in both CI and local tests which
just adds noise to the output, especially when tests are failing
and one is trying to figure out what is wrong. Since this
information is not used by any automatic tooling, it is better to
disable it for now. This PR keeps the option with `test-coverage`
script for people who still want it.

**Test plan**

When running `yarn test` you should not see a long coverage table
at the end after the patch.

* some fixes

* Revert "some fixes"

This reverts commit 75ca538995.
2017-10-05 16:00:34 +01:00
Maël Nison
e28603481f Improves the workspaces (#4630) 2017-10-05 15:58:44 +01:00
Valerii Iatsko
3178e076d4 chore(utils): replace last expandPath with resolveWithHome (#4605)
**Summary**

Looking at two solutions introduced in #3393 and #3756, the first one doesn't support win32, while the second does, sticking with the second one more beneficial and supports a wider range of OS.

Removed the stuff introduced in #3393 keeping only #3756.

#3756 also introduced config file normalization, so probably second argument to getOption is obsolete, will discover that and submit another PR if that's the case.

**Test plan**

Modified tests appropriately.
2017-10-04 20:51:27 +01:00
Phil Quinn
4a0898e683 Add ability to upgrade based on pattern (#4610) 2017-10-04 12:27:33 +01:00
Phil Quinn
03f1ecc6ee Add ability to filter yarn list with pattern (#4609) 2017-10-04 12:26:33 +01:00
Burak Yiğit Kaya
0115ece56b fix(request-manager): Flaky network messsage should be info, not warning (#4621)
**Summary**

Sometimes Yarn saturates the network and sometimes the network itself
has issues, especially on CI and Yarn reports this as a warning. This
should be a simple info message unless it actually completely fails.

This also fixes a flaky integration test with react-scripts.

**Test plan**

`react-scripts` integration test should not be flaky anymore.
2017-10-04 11:30:44 +01:00
Jeff Valore
9e9d6aeb5d fix(network): Allow https-proxy false to not use a proxy for HTTPS (#4614)
**Summary**

Fixes #4546. Previous behavior was that if `.npmrc` or `.yarnrc` contained and `http-proxy` but not an `https-proxy`, HTTPS requests would "fall back" to the `http-proxy`.

This is not always the desired behavior; See #4546 sometimes one protocol needs a proxy and the other does not.

This PR adds the ability to set the `https-proxy` to `false` which will cause Yarn to not use an HTTPS proxy (and not fall-back to the HTTP proxy). This allows the code to treat `undefined` as the setting not being specified (which will fall back to http-proxy) and `false` as the setting being specified, but set to false (which will not use a proxy).

**Test plan**

Tested manually on Windows with Fiddler.

I have no idea how to test this since requests go through the mock http requester when running tests. Suggestions welcome!
2017-10-04 11:23:15 +01:00
Ryan Hendrickson
38790e81de fix(run): improve escaping for script arguments (#4135)
**Summary**

Extra command-line arguments to scripts were not being escaped correctly. This patch adds robust shell quoting logic for both Windows and Linux/macOS.

**Test plan**

On *nix, create a `package.json` containing `"scripts":{"echo":"echo"}`. Run `yarn run -s echo -- '$X \"blah\"'`. Expect to observe ` \blah\` prior to this patch, and `$X \"blah\"` after it.

Testing on Windows should be similar, but may require fancier escaping to get the arguments into yarn in the first place. (I don't have access to a Windows box to verify the exact procedure to follow, sorry—but I did confirm that my automated tests succeed in AppVeyor.)
2017-10-03 17:56:45 +01:00
Liran Tal
6b5756374f feat(configuration): add custom registry cli flag (#4238)
**Summary**
implements #792 - addresses a command line flag --registry to specify a registry that overides yarn/npm configuration for installing dependencies.

**Test plan**

Added new tests.
2017-10-03 17:16:59 +01:00
Burak Yiğit Kaya
e3a1fe3c54 fix(resolver): Only optimize patterns in flat mode (#4613)
**Summary**

Fixes #4550. The optimization introduced in #4488 should only
apply to flat installations since even if a single pattern can
satisfy all resolved versions, it is not guaranteed that it is
strict enough for resolving correctly for all patterns under all
circumstances.

**Test plan**

Manual verification.
2017-10-03 13:51:19 +01:00
Cameron Hunter
e3004ab371 chore(tests): Add failing test-case for issue #2636 (#4598)
**Summary**
This is a failing test-case for issue #2636. It tests that bundled dependencies are not correctly being included in the archive created by `yarn pack`.

**Test plan**
Changing the behavior of `pack` to include the bundled dependencies should make this failing test-case pass.
2017-10-03 13:42:43 +01:00
Valerii Iatsko
d43340c05d Updated node to 8.x in Dockerfile.dev (#4607) 2017-10-03 21:20:34 +11:00
Phil Quinn
4638161a7f Fix: allow package without manifest to be removed (fixes #4310) (#4599) 2017-10-03 11:16:32 +01:00
Phil Quinn
1276e3ff44 Feature: Add ability to filter yarn cache (fixes #3200) (#4571) 2017-10-03 11:05:16 +01:00
Veniamin Krol
4fa9f71bab fix(install): Fix performance issue with multiple lifecycle package scripts (#4588)
**Summary**

Fixes #4551.

See https://github.com/yarnpkg/yarn/issues/4551#issuecomment-332510392

**Test plan**

* Existing tests pass
* Manually tested
2017-10-02 17:10:05 +01:00
Nicolas Barray
a3af4774f3 fix(autoclean): remove *.gz from the default .yarnclean file (#4601)
**Summary**

I removed the *.gz from the default .yarnclean generated by the `yarn autoclean --init` command. 

**Test plan**

I tested by hand and launch `yarn test` and didn't find a test case for the autoclean --init option. If needed I could write a test case to check the default .yarnclean file content against the constant DEFAULT_FILTER.

I hope it resolve half the issue #4450 :)
2017-10-02 17:08:19 +01:00
Brian K. Christensen
75bc4505df fix(windows): Detect when winpty is present and if the current terminal is a TTY (#4577)
**Summary**

This addresses some of the windows issues regarding running yarn in gitbash and friends envrionment.
with this fix I keep the behavior introduced 5 months ago in yarnpkg/yarn#3245, but try to do a better job detecting when to use winpty out of the box, in order make `piping` of output work with yarn.

Before this fix:
```shell
$ yarn --version
1.1.0
$ yarn --version | cat
1.1.0
$ yarn init
yarn init v1.1.0
error An unexpected error occurred: "Can't answer a question unless a user TTY".
info If you think this is a bug, please open a bug report with the information provided in "D:\\workspace\\yarn\\yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/init for documentation about this command.
```

Piping works for simple commands, but interactive commands only work with an environment set to something. This prohibits scripts/tools around yarn that uses pipe, which is quite common to do in an unix like environment, but theses tools cannot work in windows' unix like environment.

WinPTY seems to be the savior here, but we need to only run yarn through winpty when a tty actually needs to be allocated. 

Previous attempts to solve this problem like: 
- yarnpkg/yarn#2230
- yarnpkg/yarn#2243

Did not address the use cases of piping, so they essentially broke that behavior.
Then yarnpkg/yarn#3245 fixed that, but now you have to use `YARN_FORCE_WINPTY=1` environment variable in order for `yarn init` and `yarn upgrade-interactive` to work and that's alright, but if you export that variable then piping is broken yet again because the variable will also be set in the piped command, and we haven't solved any problem.

I suggest we keep the environment variable behavior but open up for better detection when to use winpty out of the box.

This fix detects if the winpty binary is in path, and only use it if stdin is in fact a TTY: `test -t 1`. 

**Test plan**

The output of running:
- `yarn init`
- `yarn upgrade-interactive`
- `yarn --version | cat`

Without having the `YARN_FORCE_WINPTY=1` environment variable set.

```shell
$ ./bin/yarn init
yarn init v1.1.0
question name (yarn):

$ ./bin/yarn upgrade-interactive
yarn upgrade-interactive v1.1.0
info Color legend :
 "<red>"    : Major Update backward-incompatible updates
 "<yellow>" : Minor Update backward-compatible features
 "<green>"  : Patch Update backward-compatible bug fixes
? Choose which packages to update. (Press <space> to select, <a> to toggle all, <i> to inverse selection)
 devDependencies
   name                         range                      from               to             url
>( ) babel-core                   ^6.24.1                    6.24.1          ❯  6.26.0         https://babeljs.io/
 ( ) babylon                      ^6.5.0                     6.17.1          ❯  6.18.0         https://babeljs.io/
 ( ) eslint                       ^4.3.0                     4.3.0           ❯  4.7.2          http://eslint.org
 ( ) eslint-config-fb-strict      ^20.1.0-delta.3            20.1.0-delta.3  ❯  20.1.0-echo.1  https://github.com/facebook/jest#readme
 ( ) eslint-plugin-babel          ^4.0.0                     4.1.1           ❯  4.1.2          https://github.com/babel/eslint-plugin-babel#readme
 ( ) eslint-plugin-flowtype       ^2.35.0                    2.35.0          ❯  2.36.0         https://github.com/gajus/eslint-plugin-flowtype#readme
 ( ) eslint-plugin-jasmine        ^2.6.2                     2.6.2           ❯  2.8.4          https://github.com/tlvince/eslint-plugin-jasmine
 ( ) eslint-plugin-prettier       ^2.1.2                     2.1.2           ❯  2.3.1          https://github.com/prettier/eslint-plugin-prettier#readme
 ( ) eslint-plugin-react          ^7.1.0                     7.1.0           ❯  7.4.0          https://github.com/yannickcr/eslint-plugin-react
 ( ) eslint-plugin-yarn-internal  file:scripts/eslint-rules  0.0.0           ❯  exotic         file:scripts/eslint-rules
 ( ) gulp-sourcemaps              ^2.2.0                     2.6.0           ❯  2.6.1          http://github.com/gulp-sourcemaps/gulp-sourcemaps
 ( ) prettier                     ^1.5.2                     1.5.2           ❯  1.7.2          https://prettier.io
 ( ) webpack                      ^2.1.0-beta.25             2.6.0           ❯  2.7.0          https://github.com/webpack/webpack

 dependencies
   name                         range                      from               to             url
 ( ) babel-runtime                ^6.0.0                     6.23.0          ❯  6.26.0         https://github.com/babel/babel/tree/master/packages/babel-runtime
 ( ) commander                    ^2.9.0                     2.9.0           ❯  2.11.0         https://github.com/tj/commander.js#readme
 ( ) debug                        ^2.2.0                     2.6.8           ❯  2.6.9          https://github.com/visionmedia/debug#readme
 ( ) gunzip-maybe                 ^1.4.0                     1.4.0           ❯  1.4.1          https://github.com/mafintosh/gunzip-maybe
 ( ) inquirer                     ^3.0.1                     3.0.6           ❯  3.3.0          https://github.com/SBoudrias/Inquirer.js#readme
 ( ) node-emoji                   ^1.6.1                     1.6.1           ❯  1.8.1          https://github.com/omnidan/node-emoji#readme
 ( ) request                      ^2.81.0                    2.81.0          ❯  2.83.0         https://github.com/request/request#readme
 ( ) rimraf                       ^2.5.0                     2.6.1           ❯  2.6.2          https://github.com/isaacs/rimraf#readme
 ( ) semver                       ^5.1.0                     5.3.0           ❯  5.4.1          https://github.com/npm/node-semver#readme
 ( ) tar-fs                       ^1.15.1                    1.15.2          ❯  1.15.3         https://github.com/mafintosh/tar-fs
 ( ) uuid                         ^3.0.1                     3.0.1           ❯  3.1.0          https://github.com/kelektiv/node-uuid#readme

$ ./bin/yarn --version | cat
1.1.0
$
```

And importantly when running the interactive commands through a pipe, it will correctly fail by saying you not are running the interactive commands in a TTY:

```shell
 $ ./bin/yarn init | cat
yarn init v1.1.0
error An unexpected error occurred: "Can't answer a question unless a user TTY".
info If you think this is a bug, please open a bug report with the information provided in "D:\\workspace\\yarn\\yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/init for documentation about this command.

 $ ./bin/yarn upgrade-interactive | cat
yarn upgrade-interactive v1.1.0
info Color legend :
 "<red>"    : Major Update backward-incompatible updates
 "<yellow>" : Minor Update backward-compatible features
 "<green>"  : Patch Update backward-compatible bug fixes
Done in 1.43s.
Error: Can't answer a question unless a user TTY
    at D:\workspace\yarn\lib\reporters\console\console-reporter.js:487:31
    at Generator.next (<anonymous>)
    at step (D:\workspace\yarn\node_modules\babel-runtime\helpers\asyncToGenerator.js:17:30)
    at D:\workspace\yarn\node_modules\babel-runtime\helpers\asyncToGenerator.js:35:14
    at Promise (<anonymous>)
    at F (D:\workspace\yarn\node_modules\core-js\library\modules\_export.js:35:28)
    at D:\workspace\yarn\node_modules\babel-runtime\helpers\asyncToGenerator.js:14:12
    at ConsoleReporter.prompt (D:\workspace\yarn\lib\reporters\console\console-reporter.js:518:7)
    at Object.<anonymous> (D:\workspace\yarn\lib\cli\commands\upgrade-interactive.js:116:38)
    at Generator.next (<anonymous>)
```
2017-09-29 14:50:03 +01:00
Burak Yiğit Kaya
8580a5831e Fix: always prefer CLI options over env for --prod (#4572)
**Summary**

Fixes #4557. Also adds `yarn config current` that lists the current
configuration as JSON for testing purposes.

**Test plan**

Added integration tests.
2017-09-28 20:16:58 +01:00
Burak Yiğit Kaya
3b0bcc0e4f Fix: bring back the aggressive concurrency protection (#4573)
**Summary**

Follow up to #4486 which reverted the while loop that waits on
potential multiple copies of the same file. This seems to have
some random breakages and needs more investigation for optimizing.

**Test plan**

N/A
2017-09-28 16:55:00 +01:00
Matt Mulder
391eadeed3 Fix: respect patterns with "||" in the range during optimizeResolutions (#4562)
**Summary**

Fixes #4547 by testing each version against all ranges individually, rather than munging the patterns together to get a single range.

**Test plan**

Existing tests, plus a regression test to repro #4547: "manifest optimization respects versions with alternation"
2017-09-28 00:13:13 +01:00
John Ferlito
8cf5f5d501 Ensure publish hooks are run at the same time. (#4553)
Move publish, prepublish and prepare hooks to run before tar ball is
created.

Also switch the order of prepare to be consistent with
https://docs.npmjs.com/misc/scripts
2017-09-27 14:28:35 +01:00
Clint Modien
0415b07b32 Fix: Suppress "revealed multiple traversal of the same folder" warnings (#4549)
**Summary**

Refs #3751. Changes `reporter.warn` to `reporter.verbose` for the message "The case-insensitive file ${dest} shouldn't be copied twice in one bulk copy".

**Test plan**

Manual verification.
2017-09-26 13:53:53 +01:00
Burak Yigit Kaya
19b09975e9 Chore: fix tests after the new release 2017-09-25 11:13:18 +01:00
Burak Yigit Kaya
ee5d4a153a Chore: use npm@4 for publishing tarballs
**Summary**

Yarn 1.1.0 release failed due to a bug in npm@5:
https://github.com/npm/npm/issues/16723. This patch uses `npx` to
force using `np@4` when publishing in `update-npm.sh`.

**Test plan**

CircleCI
v1.1.0
2017-09-24 19:03:41 +01:00
Burak Yigit Kaya
332b0dd7f6 v1.1.0 2017-09-22 20:08:03 +01:00
Burak Yiğit Kaya
49041f22d7 Update: add yarn global dir command (#4522)
**Summary**

Fixes #2652. Adds a `yarn global dir` command that prints the output
of the global installation folder that houses the global `node_modules`.

**Test plan**

Manual verification.
2017-09-22 20:06:33 +01:00
Matt Mulder
4020ccd0a3 Fix: unbound transitive dependencies should not conflict with top level dependency (#4488)
**Summary**

Fixes #3780, and makes the failing test from #3779 passing.

As a final step of package resolution, for each dependency we check whether any version satisfies all resolved version ranges. 

**Test plan**

Fixes an existing (failing) test: "unbound transitive dependencies should not conflict with top level dependency"
2017-09-22 14:12:42 +01:00
Daniel Tschinder
107ebf11f7 Fix: Make stripColor to be available again on reporter.format (#4518)
**Summary**
This is a bugfix for the following error which happens on master

```
❯ yarn outdated
yarn outdated v1.0.2
error An unexpected error occurred: "this.format.stripColor is not a function".
info If you think this is a bug, please open a bug report with the information provided in "/Users/danieltschinder/Documents/ResearchGate/PHP/community/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/outdated for documentation about this command.
```


chalk 2.0 removed stripColor see https://github.com/chalk/chalk/releases/tag/v2.0.0 and this wasn't respected in #4482

**Test plan**

Manual verification.
2017-09-22 13:12:26 +01:00
Burak Yiğit Kaya
2c2b23eb54 Update: warn when used with not supported Node versions (#4502)
**Summary**

Fixes #4501, refs #4490, refs #4284. Yarn now warns when it
detects it is running in a Node version that is not fully
supported and warns the user about this. This is different than
the hard Node 4+ check in the entry file since in that case,
Yarn wouldn't run at all due to syntax incompatibilities. This
warning is to signal that users may encounter unexpected errors
but are allowed to use Yarn if they wish. It also adds a new
flag to suppress this warning: `--no-node-version-check`.

**Test plan**

Since we cannot add unsupported Node versions to our CI and
spoof the Node version internally, this has to be tested
manually, which I did.
2017-09-22 12:58:12 +01:00
Burak Yiğit Kaya
9f5160bf9f Fix: don't suggest npm upgrade since it is broken (#4511)
**Summary**

Fixes #3042.

**Test plan**

Manual verification.
2017-09-22 12:57:49 +01:00
Burak Yigit Kaya
dcbbc1cdcc Chore: update comment about sudo in .travis.yml 2017-09-21 12:43:13 +01:00
Kay.L
085064d662 Fix: Upgrade Chalk to take advantage of the latest (colour) fixes (#4482)
**Summary*

Fixes #4424. The latest Chalk has fixes to Windows 10 / MacOS and more would improve the color detection in different env.

https://github.com/chalk/supports-color/blob/master/index.js#L48
https://github.com/chalk/supports-color/blob/master/index.js#L78

**Test plan**

Existing and updated tests. Also manual verification.
2017-09-21 12:39:16 +01:00
Burak Yiğit Kaya
002d39c9b1 Fix: fix argument parsing and .yarrc argument passing (#4498)
**Summary**
Fixes #4457, partially handles #4470. `.yarnrc` argument passing logic was not aligned with
how `commander` works. Even more, `commander`'s boolean logic was
also not used correctly. This patch fixes both, allowing use of
boolean type CLI options both ways (enable/disable) both from the
command line and `.yarnrc` file.

**Test plan**

Added new integration test for getting args from `.yarnrc`.
2017-09-20 01:51:12 +01:00
Burak Yiğit Kaya
e52e8b18c9 Fix: make lockfile parser tolerant to CRLF (#4495)
**Summary**

Lockfile parser fails when the lockfile had Windows-style line
endings with an "Invalid token" error. This is default on Windows
and, say when editing the file using vim, it is not obvious or
trivial that the file endings are in Windows-style. This patch
makes the parser tolareate potential "\r" chars before "\n" while
keeping the existing parsing logic the same.

**Test plan**

Added three new unit tests.
2017-09-19 10:18:29 +01:00
Burak Yiğit Kaya
01dceb3a5b Fix: always use origin/master instead of master for homebrew (#4444)
* Fix: always use origin/master instead of master for homebrew

**Summary**

Fixes #3415. The old homebrew update script updated the repo
from remote but did not update the local `master` branch, thus
had the potential for conflicts and mismatches. This patch
forces it to use `origin/master` instead and uses the latest
up-to-date version from the source.

**Test plan**

N/A

* Stay on master
2017-09-19 10:40:06 +10:00
Burak Yiğit Kaya
d64512c632 Fix: Better npm_config_argv emulation (#4479)
**Summary**

Fixes #2226. Better emulates `npm_config_argv` by passing
`process.argv.slice(2)` as the `original` portion and both the
command name and the script name in `cooked` portion.

**Test case**

Added integration tests.
2017-09-18 22:07:28 +01:00
Aleksei Gusev
3124c91c99 Chore: Free tests from FORCE_COLOR environment variable dependency (#4381)
**Summary**

FORCE_COLOR environment variable allows to force yarn to use
colors. This makes some of tests fail because of comparing
colorized output with plain strings.

For example, if you run a test in environment where
FORCE_COLOR is set you get this failure:

```
 FAIL  __tests__\index.js
  ● should add package
    expect(received).toEqual(expected)
    Expected value to equal:
      "success Saved lockfile."
    Received:
success Saved lockfile."
```

**Test plan**

Run tests in an environment where `FORCE_COLOR` is enabled. They should pass.
2017-09-18 16:55:27 +01:00
Burak Yiğit Kaya
0ee1c55fd5 Update: use fs.copyFile when available (#4486)
**Summary**

Fixes #4331. Supersedes #3290. Uses the newly added `fs.copyFile` 
on Node 8.5 hen available and falls back to the old buffer based 
method otherwise. This patch also refactors the file copy code a 
bit making it more efficient. Here are the durations on my computer 
with [this package.json](c0ded8b82b/perf/project/alottafiles/package.json):

| master | w/o copyFile | w/ copyFile |
| - | - | - |
| ~23s | ~19s | ~14s |

This is with `yarn.lock` in place and w/o `node_modules`.

**Test plan**

CI should pass.
2017-09-18 13:47:31 +01:00
Ahmed El Gabri
0e16ee9a3e Feature: Support save-exact true (#4471)
**Summary**

Fixes #4343. Currently there is no way to remove the package prefix inside `.yarnrc` file, this PR add support for `save-exact` in `.yarnrc` as discussed in #4343. Full credit goes to @jambonrose

```
save-exact true
```

One small thing, should `yarn` be backwards compatible with the old behavior which is `save-prefix ''`? We can just add an extra check here for do this. What do you think @BYK?


```js
} else if (exact || Boolean(this.config.getOption('save-exact')) || Boolean(this.config.getOption('save-prefix'))) {

```

**Test plan**

New unit test.
2017-09-17 01:47:27 +01:00
Burak Yiğit Kaya
96c215c1ce Fix: Resolve peerDependencies from all higher levels, not just root (#4478)
**Summary**

Fixes #4446, fixes #4433, fixes #2688, fixes #2387. Follow up to #3803. The fix in #3893 was
too aggressive, allowing only top-level dependencies to be used in
peer dependency resolution which was incorrect. This patch allows
resolving peer dependencies from the same or higher levels in the
dependency tree.

**Test plan**

Additional unit and integration tests.
2017-09-16 11:16:17 +01:00
Burak Yiğit Kaya
b22ac9b0c9 Chore: use a Set for look ups in PATH_KEYS (#4472) 2017-09-15 18:43:15 +01:00
Burak Yiğit Kaya
8b665e32a3 Chore: ignore flow warnings from graphql (#4473) 2017-09-15 14:17:29 +01:00
Burak Yiğit Kaya
6fdbb39a43 Fix: Handle null versions in package.json (#4461)
**Summary**

Fixes #4429. Apparently there's an advice on the internet to use
`null` as the package version to install the latest version and
even worse, some people are using this. This patch makes sure
the version is at least a string (albeit an empty one) when
fixing the manifest.

**Test plan**

Added new integration test.
2017-09-14 14:45:09 -07:00
Adam Stankiewicz
b346f2c435 Chore: Add test to ensure manifest-less local packages are installable (#4456)
**Summary**

Refs #4257. Adds the missing regression test.

**Test plan**

The new test should pass.
2017-09-14 20:58:55 +01:00
Burak Yiğit Kaya
ef8185b015 Fix: incorrect optional ignore in nested dependencies (#4448)
**Summary**

Fixes #4445. The bug was introduced in
https://github.com/yarnpkg/yarn/pull/3976/files#diff-7066979f95168f7bb59e4f9cfb3ba8fcR211
with an incomplete package optional check. This caused many transient
dependencies to be ignored at linking stage when `--ignore-optional`
flag is passed. This patch fixes the check to combine the flag with
the package's actual optional mark.

**Test plan**

Manually verified #4445 is resolved. Also added a unit test.
2017-09-14 17:30:18 +01:00
Chaitanya Kumar Kamatham
cf3a5f2146 Fix: inaccurate message when using -g with add (#4449)
**Summary**
Fixed incorrect documentation for global add deprecated message

**Test plan**

Run `yarn add -g left-pad` and follow the suggested command on the console. It should work.
2017-09-14 15:13:10 +01:00
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