Commit Graph

2044 Commits

Author SHA1 Message Date
Burak Yigit Kaya
b30e2f6d9e Merge branch 'master' into bye-node4 2018-05-23 11:29:10 +01:00
Aram Drevekenin
eee5bee556 fix: Add Node 10 support (#5769)
**Summary**

1. Added node 10 to CircleCI
2. Fixed a test that was using the `net.createServer` method. This was having issues, likely because of this: https://github.com/nodejs/node/issues/20334 - it now uses a "normal" `http` server instead, serving the same purpose.
3. Changed the `readFirstAvailableStream` method in `util/fs.js`. I'm guessing this is related to the same issue as 2, but there have been quite some changes in `10` that might be causing this - so it's just a guess. Since this piece of code could be clearer and more conceise anyway, I opted to just change it. Now instead of relying on the stream `error` event to check if a file exists, it just explicitly checks it before starting the stream.
4. Upgraded `upath` from `1.0.2` to `1.0.5` which supports node 10 (found through its `engines` field when installing).
5. Upgraded Jest
6. Fixed a bug regarding replacing symlinks to non-existent targets on Windows
7. Removed a redundant test
8. Fixed two test cases that were failing frequently on macOS builds

fixes #5761
fixes #5477

**Test plan**

CI should be green (including and especially the new node10 job!)
2018-05-23 11:16:38 +01:00
Jeff Valore
c5067645e9 fix(run): Fix custom shell execution (#5851)
**Summary**

A previous change removed the -c option that was passed to the shell, causing script like "echo foo"
to fail if script-shell was set to bash. This change cleans up the way custom shell is specified,
passing the shell to node's child process spawner instead of trying to make it part of our command
string. Doing it this way seems to account for the previously required -c flag.

fixes #5699 

**Test plan**

No test was added because our tests for the `yarn run` command use a mocked `execute-lifecycle-script`. Plus these tests would get run on windows too, so making a test that specified a config of `script-shell bash` would fail if it was unmocked.

Can be tested manually by creating a `.yarnrc` that contains:

```
script-shell bash
```

and adding a script like:

```
  "scripts": {
    "foo": "echo foo; echo bar; echo $SHELL"
  }
```

which should produce the output

```
$ yarn run foo
yarn run v1.6.0
$ echo foo; echo bar; echo $SHELL
foo
bar
/bin/bash
  Done in 0.15s.
```
2018-05-22 20:35:25 +01:00
Bryan Wain
cde75661fc focused workspaces (#5663) 2018-05-17 10:42:50 -07:00
Aram Drevekenin
661065be5a feat(import): convert package-lock.json to yarn.lock (#5745)
Adds the ability to yarn import using package-lock.json as the dependency-tree state. When one enters the yarn import command, if a package-lock.json file exists, yarn will attempt to import from it. If not, it will import from node_modules normally.
2018-05-17 12:47:55 +02:00
An Thien Tran
d28f8e59ef Fix #5517: Backlashes in output fail for escape sequences in Windows (#5792)
**Summary**
This is the fix for [#5517](https://github.com/yarnpkg/yarn/issues/5517) where backlashes in the output in Windows are broken if the directory path contains "\n". The **stringifyLangArgs** method has been modified so that "\n" will only be replaced by EOL if it is not preceded by a "\\". 

**Test plan**
The test project path is C:\\Users\\An\\Documents\\Projects\\oss\\name\
Before
```
error An unexpected error occurred: "C:\\Users\\An\\Documents\\Projects\\oss\ 
ame\\package.json: Unexpected token U in JSON at position 139". 
```

After 
```
error An unexpected error occurred: "C:\\Users\\An\\Documents\\Projects\\oss\\name\\package.json: Unexpected token U in JSON at position 139". 
```

Also added automated tests.
2018-05-13 18:49:42 +01:00
Konstantin Raev
05080da817 fixes ignored folders in prebuilt packages feature of offline mirror (#5793)
* fixes #5755

* lint and duplication fixes

* fix test
2018-05-08 18:58:23 -07:00
brainfish
08870c8fcd Fix #5776: CLI switch "--scripts-prepend-node-path" doesn't work (#5787) 2018-05-06 12:36:24 +01:00
Anton Alexandrenok
7ab9eda095 Excluded shebang for lockfile package (#5788) 2018-05-06 12:34:07 +01:00
sth
a35a4f97dd Show error message to user when publishing fails (#5771) 2018-05-02 15:03:20 +01:00
renovate[bot]
2c88558aff fix(deps): update dependency fs-extra to v6 (#5767) 2018-05-02 15:02:43 +01:00
Aram Drevekenin
546a1576ed chore(deps): update deprecated deps for node 10 (#5763)
**Summary**
These are a few upgrades of dependencies in order to address issues on node 10 (in relation to: https://github.com/yarnpkg/yarn/issues/5477)

*duplexify* *3.5.0* => *3.5.4* (00d08fa3f2)
*v8-compile-cache* *^1.1.0* => *^2.0.0* (https://github.com/zertosh/v8-compile-cache/pull/7)
*natives* *1.1.0* => *1.1.3* (https://github.com/gulpjs/gulp/issues/2162)

The last did not have to do with `new Buffer` but was something I personally encountered when using `gulp` for building in `node 10`. I don't know how common this is, but the fix is easy and within scope, so decided to include it.


**Test plan**

CI should be green.
2018-04-30 23:16:29 +01:00
Burak Yiğit Kaya
31b6543a9c fix(tar): Upgrade tar-fs and tar-stream to fix warnings on Node 10 (#5752)
**Summary**

Another step towards fixing #5477.

**Test plan**

All existing tests should pass.
2018-04-28 20:50:21 +01:00
peijiesim
63c56c7131 fix(run): yarn run should never prompt when non-interactive (#5694)
**Summary**

This pr fixes a bug ([#5655](https://github.com/yarnpkg/yarn/issues/5655)) in which `yarn run --non-interactive` prints a `Error: No command specified` message and also suppresses the message `question Which command would you like to run?:` when running non-interactively. 

**Test plan**

```
> yarn-local run --non-interactive
yarn run v1.6.0
info Commands available from binary scripts: acorn, atob, babylon, browserslist, commitizen, detect-libc, errno, escodegen, esgenerate, eslint, esparse, esvalidate, flow, git-cz, git-release-notes, gulp, gunzip-maybe, handlebars, import-local-fixture, jest, jest-runtime, js-yaml, jsesc, jsinspect, json5, loose-envify, miller-rabin, mkdirp, node-pre-gyp, nopt, prettier, rc, regjsparser, rimraf, sane, semver, sha.js, shjs, sshpk-conv, sshpk-sign, sshpk-verify, strip-indent, strip-json-comments, uglifyjs, user-home, uuid, watch, webpack, which
info Project commands
   - build
      gulp build
   - build-bundle
      node ./scripts/build-webpack.js
   - build-chocolatey
      powershell ./scripts/build-chocolatey.ps1
   - build-deb
      ./scripts/build-deb.sh
   - build-dist
      bash ./scripts/build-dist.sh
   - build-win-installer
      scripts\build-windows-installer.bat
   - changelog
      git-release-notes $(git describe --tags --abbrev=0 $(git describe --tags --abbrev=0)^)..$(git describe --tags --abbrev=0) scripts/changelog.md
   - commit
      git-cz
   - dupe-check
      yarn jsinspect ./src
   - lint
      eslint . && flow check
   - pkg-tests
      yarn --cwd packages/pkg-tests jest yarn.test.js
   - prettier
      eslint src __tests__ --fix
   - release-branch
      ./scripts/release-branch.sh
   - test
      yarn lint && yarn test-only
   - test-coverage
      node --max_old_space_size=4096 node_modules/jest/bin/jest.js --coverage --verbose
   - test-only
      node --max_old_space_size=4096 node_modules/jest/bin/jest.js --verbose
   - watch
      gulp watch
  Done in 0.28s.
```
2018-04-26 19:11:48 +01:00
Maël Nison
12d8f7fab0 feat(bin): Implement an optional parameter support to yarn bin (#5739)
* feat(bin): Implement an optional parameter support to `yarn bin`

This allows to get the path to a binary without making assumptions regarding the layout of the
`node_modules` folder.

BREAKING CHANGE: n/a

n/a

* Adds `yarn bin` tests

* Update en.js

* Update bin.js

* Update bin.js

* Fixes the tests
2018-04-26 18:45:12 +01:00
Jake Moxey
f1aba796ae Add error when attempting to remove dependency from workspace root and add -W flag (#5737) 2018-04-26 18:39:58 +01:00
Maël Nison
7312d9d066 Adds the directory that contains Node to the PATH (#5743)
* Update execute-lifecycle-script.js

* Adds a test

* Fixes prettier
2018-04-26 18:38:29 +01:00
simevo
fbf5046df6 fix #5729: replace dependency on deepequal with deep-equal (#5742)
* fix #5729: replace dependency on deepequal with deep-equal

* fix bogus lockfile (yarn.lock)

it should only remove deepequal (and its two dependencies
fast-apply and is-args) and add deep-equal

the first lockfile was produced with:
```
rm -f node_modules yarn.lock
yarn
```
this has been produced by restoring the original yarn.lock from
the master branch and:
```
rm -f node_modules
yarn
```
2018-04-26 16:03:53 +01:00
Jeff Valore
99bd44bb43 fix(publish): Run pre and postpack lifecycle scripts on publish (#5712)
**Summary**

npm runs the pre and post pack scripts on publish, but yarn was not. Added these scripts.

fixes #5707

**Test plan**

Added a test that regex's the output to look for scripts being run.
If you look at the test, the regex is kinda weird, but I did it that way to make sure the log statements were in the correct order in the output.
2018-04-26 12:27:17 +01:00
Jake Moxey
8bf8eb0ea8 fix(console-reporter): Fix issue where tree logger was ignoring --silent/-s flag (#5722)
**Summary**

This PR fixes #5721 where `upgrade` was not being silent when the `--silent`/`-s` flags were provided. It still printed the tree.  🖨🌳  

**Test plan**

Added two new test cases.

Manual CLI tests:

Before:
```
> yarn-local upgrade --silent
└─ left-pad@1.3.0
└─ left-pad@1.3.0
```

After:
```
> yarn-local upgrade --silent

```
2018-04-26 12:01:52 +01:00
aduh95
523198451a fix: Remove usage of deprecated Buffer constructor. (#5477) (#5731)
**Summary**

Fixes #5477 and #5704.

Remove usager of deprecated `Buffer`constructor to avoid ugly warnings on Node 10.

**Test plan**

Existing test should pass.
2018-04-26 11:51:36 +01:00
Burak Yigit Kaya
21599a088f Fix glob 2018-04-26 11:39:04 +01:00
Burak Yigit Kaya
3a3bed7520 build(node4): Drop Node 4 builds which has expired
Thanks for all the fish Node 4, you won't be missed.
2018-04-26 10:19:19 +01:00
Jeff Valore
cbc6c8857c fix(publish): Fixes the path parameter when specifying a dir to publish. (#5711)
When specifying a directory as the first parameter to `publish` yarn was ignoring it and just using
`config.cwd`. This fix checks to see if the passed parameter is to a directory and if it is it sets
`config.cwd` to that directory, so that manifest loading and lifecycle script execution occur
correctly in that specified directory.

fixes #5678
2018-04-23 17:12:56 +01:00
Burak Yiğit Kaya
9e97f50aea test(init): Fix flaky init test which used snapshots w/ concurrent (#5700)
**Summary**

Snapshots should not be used with `test.concurrent`. This PR fixes a
flaky test which was doing exactly this.

**Test plan**

CI should pass.
2018-04-19 10:04:58 +01:00
Rebecca Turner
2f0eb8eace fix(build): Stop scripts from trying to read user input during install (#5632)
**Summary**

Fixes #976.

This is a bug fix to the problem where lifecycle scripts that try to go interactive hang yarn installs with no indication as to why.

This sets stdin to /dev/null and, on unix-like systems, detaches the process from the terminal making it unable to read /dev/tty.

Previously with the spinner enabled was impossible to give input to an interactive script on stdin, because a pipe was kept open from the main yarn process to the child process but it was never written to.  Interactive scripts could previously use /dev/tty on unix-likes to bypass this, however the fact that scripts are run in parallel means that if two scripts go interactive in this manner that they'll step on each other.

This does not change the behavior if the spinner is disabled. Also added a simple integration test with a blocking install script that times out without the patch.

**Test plan**

Try running `yarn add semantic-ui`. Hangs without the patch, fails with the patch.
2018-04-18 23:05:10 +01:00
Max Burmagin
f1b63efbc1 adding resolutions should cause lockfile regeneration (#5603)
* adding resolutions should cause lockfile regeneration

* fix test

* fix flow lint error

* codereview fixes
2018-04-18 17:36:19 +01:00
sth
101d48f164 Make secureGitUrl() warn for insecure Urls (#5424)
* Allow insecure URLs with warnings (#4307)

* Added test cases for secureGitUrl()
2018-04-18 17:33:50 +01:00
Jeff Valore
f69ecf1678 fix(resolution): Prevent duplicate patterns in PackageResolver patternsByPackage array (#5681)
* fix(resolution): Prevent duplicate patterns in PackageResolver patternsByPackage array

Previously duplicate patterns would be inserted into this array, causing unneccecary looping and
manifest reading of the same patterns. It also caused a bug when duplicate patterns were marked as
peerDeps (#5676). We now prevent these duplicate entries.

#5676

* fix linting

* refactor Object.assign to expansion
2018-04-18 17:29:44 +01:00
Ian Sutherland
cb81cde932 fix(config): allow binLinks to be set in .yarnrc (#5113)
**Summary**

Fixes #4925. Allow setting `bin-links false` in `.yarnrc`. Currently setting this option doesn't have any effect.

**Test plan**

* Create a package with a `.yarnrc` file containing the line `bin-links false`
* Run `yarn add gulp-cli` (or any package with binaries)
* Verify that no bin links were created in `node_modules/.bin`
2018-04-18 10:00:12 +01:00
Burak Yiğit Kaya
bf05ad36cf test: Fix failing tests on master (#5687)
* test: Fix failing test on master after a release of a new package

**Summary**

We had an integration test relying on a specific version of a package without coding that version
into the test. This PR fixes that and fixes tests failing on master as of now.

**Test plan**

CI should pass.

* Lockdown more package versions

* Don't use test.conccurent with snapshots

* Fix broken snapshots
2018-04-17 17:52:20 +01:00
Maël Nison
2f1ad7f427 chore(release): Add changelog script (#5677)
**Summary**

This diff simply adds a script to easily generate the changelog between the current tag and the previous one.

**Test plan**

Manually ran `yarn changelog`.
2018-04-16 17:04:59 +01:00
Jeff Valore
25742bb522 fix(resolution): Allow github dependency refs of type "#pull/1/head" (#5673)
**Summary**

Fixes #1610. Previously yarn would allow a dependency on a GitHub pull request with "#1/head" where 1 is the PR number. npm allows the format "#pull/1/head" as well. For compatibility, allowing Yarn to fall back to this format.

**Test plan**

Added a test to `git-ref-resolver` to test the case `"pull/10/head"`
2018-04-15 22:02:18 +01:00
Brendan Warkentin
1522cdeee6 feat(version): Added semver versioning flags to version command (#5670)
fixes #5670 

**Summary**

Currently, it's possible (although undocumented) to automatically bump the version by running something like `yarn version --loose-semver --new-version minor`. To me, this seems less convenient and less intuitive than something like `yarn version --minor` (closely comparable to `npm version minor`). I've added the ability to automatically increment the version with one of the flags: `--major`, `--minor`, or `--patch`. This will also satisfy feature request #5367.

**Test plan**

I've included Jest test cases for each of the new versioning flags.
2018-04-15 16:55:28 -04:00
Burak Yiğit Kaya
059ce448e4 chore(request): Add an unfiltered option to getting full responses from npm (#5667)
**Summary**

Follow up to #5593. Looks like we use an npm-specific request header to reduce the bandwidth. That said, for some commands, we need the full responses, which was achieved by setting the `Accept: application/json` header manually. This patch introduces a more descriptive request option, `unfiltered` to standardize this usage.

See https://github.com/npm/npm-registry-client#requests for more info.

**Test plan**

Existing tests should pass.
2018-04-15 21:55:03 +01:00
Rubycut
8a7ee772c1 fix(owner): Fix the currently broken yarn owner command (#5593)
**Summary**

* fixing currently broken owner command
* doesn't ask for npm username and password for list command
* adding basic test #3893 

**Test plan**

Yarn now correctly displays the list of package owners. Also added automated tests.
2018-04-13 17:16:57 +01:00
Burak Yiğit Kaya
a23cc8e535 fix(run): Remove notice and licenseText fields from npm_package_* (#5666)
**Summary**

Fixes #5420. NOTICE and licenseText for packages can be quite long which
can cause E2BIG errors when trying to put it into environment variables
when running scripts. Since these fields are not useful for scripts
anyway, add them to the current blacklist which already has a similar
field in it, `readme`.

**Test plan**

Added an automated test to ensure the env doesn't have these fields but
keeps any other keys.
2018-04-13 16:21:34 +01:00
Dimitar Nestorov
3a04db792a feat(run): Set INIT_CWD in environment (#5656)
**Summary**
`INIT_CWD` environment variable holds the full path you were in when you ran `yarn run`

Motivation: https://twitter.com/housecor/status/983773854530260992

**Test plan**

1. Create a script called `testscript.js`
2. In the file type `console.log(process.env.INIT_CWD);`
3. In `package.json` add a script with a key `testscript` and value `node testscript.js`
4. Build yarn
5. Call `../bin/yarn testscript` from the command line in a subfolder
6. The script should log the folder you're running the script from

Video: https://www.youtube.com/watch?v=XY_w8GVtuCY

**Test plan**

Added a new test.
2018-04-13 11:52:28 +01:00
Brendan Warkentin
75723f2e71 feat(version): Ability to disable commit hooks on versioning (#5640)
**Summary**

Last year I contributed the ability to disable commit hooks when versioning with npm (See [this commit](2dec601c6d (diff-2992be03e25e9f38300b7ce175e4f4e1))). It makes sense to add the same functionality to yarn.

The original motivation for this feature is based on a pre-commit hook that included linting and testing a large code base, taking ~20 seconds to run. When that hook is run on the preceding commits, it's unnecessary and time-taking to do so on versioning. Because of that, it's nice to have the option to disable that git hook.

**Test plan**

Added lower level integration tests.
2018-04-13 09:59:08 +01:00
Phil Quinn
036a246bcb fix(upgrade): Fix for pattern not working with upgrade (#5662)
fixes #5660

**Summary**

Before it needed to have package argument to enter the block to filter the deps. Now it will do it if either a package is given or a --pattern is given.

**Test plan**

Corrected my incorrectly created tests.
Also `is-negative-zero` would not update as there is no new version which would be found in a caret. So changed that to `array-union` which has a version `1.0.2`
2018-04-12 18:17:33 -04:00
renovate[bot]
40d5ae9755 chore(deps): update dependency eslint-plugin-babel to ^5.0.0 (#5647) 2018-04-12 11:17:25 +01:00
Quentin Dreyer
95223b696d chore(deps): update dependency validate-npm-package-license to ^3.0.3 (#5626)
**Summary**

Updating validate-npm-package-license in order to update its dependencies:
- spdx-correct
- spdx-license-ids

This is allowing us to use newer licenses such as EUPL-1.2.

https://github.com/kemitchell/validate-npm-package-license.js/compare/v3.0.1...v3.0.3
https://github.com/jslicense/spdx-correct.js/compare/v1.0.2...v3.0.0
https://github.com/shinnn/spdx-license-ids/compare/v1.2.2...v3.0.0

**Test plan**

N/A
2018-04-12 10:50:21 +01:00
Daniel Lo Nigro
6a4ef66ac5 Remove yarn-e2e from Jenkins (#5651)
These tests are now being ran directly in CircleCI.
2018-04-11 22:06:33 -07:00
Burak Yiğit Kaya
a9e33d86a7 ci(renovate): Disable Renovate Docker support (#5646)
Renovate constantly nags us about pinning Docker image versions which we intentionally don't want to
(see #5622). This PR disables the whole Docker integration since we want our config to stay in this
very specific way for CI.
2018-04-11 07:59:38 -07:00
Maël Nison
4acfe3902a 1.6.0 v1.6.0 2018-04-10 18:12:57 -07:00
Burak Yiğit Kaya
0773134678 test(pkg-tests): Fix duplicate module errors from pkg-tests (#5636)
**Summary**

Adds pkg-tests-fixtures to module ignore path for Jest to avoid duplicate module errors during test
runs.

**Test plan**

Run `yarn test-only --clearCache; yarn test-only` and make sure you
don't see any `duplicate @providesModule` errors from pkg-tests folder.
2018-04-10 17:15:34 +01:00
Burak Yiğit Kaya
ca0316b54e test(resolver): Replace ocaml repo with left-pad for package-resolver (#5638)
**Summary**

Using ocaml repo for package-resolver tests were taking too long and very frequently timing out on
Windows. This patch replaces that with the much smaller left-pad repo.

**Test plan**

AppVeyor tests should not timeout for resolver tests from now on.
2018-04-10 17:14:39 +01:00
Burak Yiğit Kaya
0cb76ff719 test(integration): left-pad released a new version which broke tests (#5635)
**Summary**

Pins the left-pad version used in tests to 1.2.0 to avoid future breakage when a new version is
released.

**Test plan**

Duh :D
2018-04-10 14:59:33 +01:00
sth
ffe9a6427b Fix yarn behaviour when scripts are failing (#5497)
* Add test case to check behaviour for failing scripts

See #5451

* Fixed babel compilation of Error classes for nodejs 4

Added babel-plugin-transform-builtin-extend

* We don't actually need YARN_SILENT here
2018-04-05 10:51:32 +01:00
Jeff Valore
d4299be2e0 fix(linking): Dont integrity check build artifacts (#5470)
* fix(linking): Dont integrity check build artifacts

If an install script modified a file that existed in the package, then yarn would view the file as
stale on every command, mark the package as "fresh", and re-run the install scripts.  With this
change, known build artifacts from the integrity file are checked, and if this package file is a
build atrifact, it's size and timestamp are not checked.

#932

* WIP log message for debugging on CI

* WIP adding logging for debugging CI

* WIP adding logging for debugging CI

* remove debugging console statements.

* fix file timestamps for node 8 copyFile. fixes issue on linux.

* change file mode to what works on windows

* add file timestamp comparison and skip if correction not needed

* fix lint errors

* add error handling to fixTimes for some edge cases

* pass undefined instead of 0 as a file id

* refactor fs code, move OS specific edge cases to fs-normalized.js

* empty commit to rerun CI

* fix logic error when closing file, and fix Flow error
2018-04-05 10:49:00 +01:00