30 Commits

Author SHA1 Message Date
Maël Nison
e905f7479e Yarn Plug'n'Play: Implementation (#6382)
* Initial pnp implementation

* Adds the pnp-env directory for quick checks

* Improves the "yarn node" command so that it works with pnp

Branch: yarn-node-pnp

* Adds the pnp tests to the pkg-tests testsuite

Branch: pkg-tests

* Fixes various issues with the pnp map generation

Branch: pnp-map-improvements

* Remove the scriptsPrependNodePath option

Branch: lifecycle-wrappers-remove-option

* Adds tests to ensure that the lifecycle scripts are called with the right binaries

Branch: lifecycle-wrappers-tests

* Fixes linting

Branch: lifecycle-wrappers-flowlint

* Improve the error message when an optional required dependency hasn't been installed

Branch: lifecycle-wrappers-improve-pnp-error

* Implements lifecycle wrappers

Branch: lifecycle-wrappers-main

* Adds .pnp.js files to the gitignore

* Fallbacks to the toplevel dependencies when a transitive dependency cannot be resolved

* Fixes an issue inside the pkg-tests helper

Branch: pkg-tests-helper-definition

* Improves the fixtures so that they also return info about their dev and peer dependencies

Branch: dev-peer-fixtures

* Finishes to hide plugnplay behind a yarnrc option (`plugnplay-experimental`)

Branch: option-plugnplay-experimental

* Adds failing tests for pnp peer dependencies

Branch: pnp-peer-dependencies-failing

* Prettifies the generated pnp files

* Adds the plugnplay flag to the integrity check

* Removes the pnp file at link-time if installing with pnp disabled

* Improves pnp maps compatibility

* Prevents "yarn check" from checking the node_modules existence when under pnp

* Adds a missing package to the request cache

* Fixes tests

Branch: pnp-fix-tests

* Reimplements the resolution to correctly account for peer dependencies

Branch: better-faster-stronger

* Externalizes the creation of proxy scripts

Branch: portable-proxy-scripts

* Implements support for `yarn run` within pnp-enabled installations

Branch: pnp-yarn-run

* Makes it possible for dependency binaries to require their own dependencies

Branch: pnp-yarn-run-dependencies

* Moves the pnp embed api into its own file

* Adds the test folder to Jest error messages

Branch: jest-better-message

* Improves peer dependency tests

Branch: peer-deps-tests

* Adds tests for require.resolve

Branch: require-resolve-tests

* Refactors the pnp file

Branch: pnp-file-refactoring

* Updates the build-webpack script to include a custom resolver

Branch: webpack-resolver

* Fixes tests

Branch: fix-tests

* Generates virtual when using peer dependencies

Branch: virtual-packages

* Refactors the generated pnp files to use the newly generated maps

Branch: pnp-refactor-find

* Implements Module._findPath

Branch: module-findpath

* Adds tests for workspaces

Branch: workspace-tests

* Fixes top level detection

Branch: fix-top-level-detection

* Implements workspaces support in pnp

Branch: pnp-workspaces

* Automatically adds workspaces as dependencies of the top-level

Branch: auto-workspace-dependencies

* Updates the cache path to include the 'node_modules' string

Branch: node-modules-cache

* Prevents pnp from bootstrapping when running non-pnp-installed scripts

Branch: fix-npm-run

* Installs peer dependencies symlinks inside a project folder

Branch: per-project-virtual-deps

* Adds a sample application that showcases webpack, babel, react, jest

Branch: sample-app

* Ignores the .pnp directory

Branch: ignore-pnp

* Implements a blacklist that throws nicer errors when a package is required through a realpath'd path.

Branch: location-blacklist

* Changes the order the locations are matched to package locators

Branch: location-to-locator-match-order

* Automatically adds packages as dependencies of themselves if possible

Branch: implicit-self

* Updates the node resolution

Branch: node-resolution-improvements

* Ensures that binaries are set as executable in the cache

Branch: chmod-bins

* Disables integrity checks when running under pnp

Branch: pnp-no-integrity

* Makes the .pnp.js file an actual executable that can be used as a resolution server

Branch: pnp-executable

* Removes pnp-env

* Fixes a few tests

* Fixes snapshots

* Fixes the lockfile not being written when using pnp

Branch: fix-lockfile

* Fixes the `yarn node` command being incorrectly forwarded arguments

Branch: fix-yarn-node

* Uses symlinks instead of a script for bin indirection to allow calling them directly through Node

Branch: bin-symlinks

* Adds a `yarn bin <name>` command that returns the path of the specified bin on the disk

Branch: yarn-bin-name

* Implements an --into option to yarn node/yarn run

Branch: opt-into

* Implements the `--pnp` option

Branch: pnp-option

* Adds new tests for checking that packages are correctly locked

Branch: lock-tests

* Bugfixes

This diff ships with two fixes:

- Fixes calling a pnp script from a non-pnp scripts
- Fixes relative requires from binaries

It also adds tests for all those cases

Branch: bugfixes

* Fixes workspace registration

Branch: workspace-registration-fix

* Uses --enable-pnp (alias --pnp) and --disable-pnp

Branch: instalconfig-pnp

* Adds the issuer into the error messages when requesting a package one shouldn't have access to.

Branch: via-issuer

* Implements extendedQualifiedPathResolution

Branch: extended-qualified-path-resolution

* Changes the return of the pnp daemon to return json data

* Implements custom shebangs for the pnp file

* Changes the return of the pnp-exposed functions to return null with builtins

* Various fixes & improvements

* Adds a test, prettier, fixes a test

* Don't iterate on the registries

* Renames YARN_PLUGNPLAY_EXPERIMENTAL into YARN_PLUGNPLAY_OVERRIDE

* Avoids touching the .pnp.js file when it doesn't need to change

* Reworks the cache path to contain the "node_modules/<pkg-name>" string

* Shims resolve#isCore

* Improves error messages

* Fixes the environment cast to allow passing false/0

* Implements a pnp blacklist settings

* Fixes the fallback resolution to use _resolveFilename instead of _finePath

* Fixes fallback relative path resolution

* Implements require.cache

* Prevents pnp from being enabled on Windows

* Removes absolute paths from the pnp files

* Implements a super basic offline cache integration

* feat(pnp): eject package command (#92)

* test(pnp): support ejecting packages

* feat(pnp): eject package command

* test(pnp): use fs.readdir instead of fs.readdirSync

* test(pnp): do not expect specific error message

* refactor(pnp): move eject logic to package linker

* fix(pnp): change ejected folder to .pnp/ejected/pkgName-pkgVersion/node_modules/pkgName

* fix(pnp): do not re-eject package

* test(pnp): do not rely on installConfig

* Fixes yarn bin

* Preserves the node_modules components in zip paths

* Fixes the offline cache

* Adds a VERSIONS field into the generated resolver

* Exposes the "extensions" option to "resolveRequest"

* Renames yarn eject into yarn unplug

* Tweaks yarn unplug

* Removes packageMainEntry from the package information

* Makes "unplug" print the list of unplugged packages

* Unplugs postinstall packages automatically

* Renames things

* Adds a warning on Windows to notify that PnP settings are ignored at the moment

* Fixes the default shebang

* Exports pnpapi

* Reworks the resolve shim to only affect liftoff

* Guards the pnp file against fs extensions

* Fixes the resolve shim

* Fixes a broken test

* Re-enables the focus tests

* Stops relying on bash for test scripts

* Fixes nohoist

* Revert "Fixes a broken test"

This reverts commit 84358aa507.

* Ensures that the getPackageInformation function returns an absolute path
2018-09-24 18:25:29 +01:00
ConnectDotz
1f18a3d3d8 remove .vscode settings from repository (#5608)
looks like accidently checked in a few days ago, we should not keep this file in the repo since every vscode dev will most likely have their custom settings for their own dev env.
2018-04-03 17:19:13 +01:00
Daniel Lo Nigro
dff32cb62c Tweaks to lockfile package (#4215) 2017-08-21 20:13:22 -07:00
Maël Nison
98095116f5 Implements the enable-meta-folder (#3367)
* Implements the enable-meta-folder

* Adds enable-meta-folder support to yarn-error.log
2017-05-10 19:01:08 +01:00
Alec Merdler
ab97b0f816 Hide Activity/Progress Output in JSONReporter with --no-progress Flag (#3158)
* remove activity output when --json and --no-progress flags used

* added more tests

* cleaning up tests

* fixed CI snapshot tests
2017-04-20 10:59:39 +01:00
Konstantin Raev
fecbc0abb0 [CI fix] track missing request caches (#3117) 2017-04-13 15:36:41 +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
Thomas Grainger
e8242cd098 Remove .DS_store this should also be in a global .gitignore (#2506) 2017-01-20 11:56:49 +00:00
Andrew
301f802f97 Remove all IDE-specific ignores (#2325) 2017-01-02 00:50:49 +00:00
Neil Kistner
8f9fc6b647 Consolidate outdated logic and check for wanted > current (#1865) 2016-11-16 18:37:49 +00:00
Chris Northwood
cdc0c0ca98 Enable using TLS client certificates for communicating with private repositories (#1588)
* Add a failing unit test for #1165

* Add support for TLS client certificates when making requests (fixes #1165)
2016-11-01 11:57:33 +00:00
Or Kazaz
3fde2589e7 Created an .eslintrc file for the eslint configurations instead of having it in the package.json file (#823) 2016-10-12 08:28:44 +01:00
Daniel Lo Nigro
1e268f52ca Add RPM packaging (#556) 2016-10-10 10:53:45 +01:00
Sebastian McKenzie
86c98a62a7 Add missing commands (#439)
* add init command - closes #360

* list available commands and examples in cli help - fixes #345

* add outdated command - fixes #379

* rename uninstall command to remove

* add global command - fixes #227

* remove command aliases

* fix licenses not being shown due to integrity check shortcircuiting - fixes #424

* turn aliases back into js

* clean up single instance arguments - fixes #308

* ignore arguments that are included after -- - fixes #251

* add unlink command

* add lint rule against non-language keys

* clean up Config initialisation

* add link command - closes #336

* support array of string engines - fixes #447

* add missing request cache fixtures

* polish link command

* remove gulp file output

* add config command - fixes #378

* add yarn.lock and fix constants

* update aliases

* add missing i18n for CLI

* make `upgrade` command work how you'd expect

* update test metamethod

* require arguments for add command

* move dependency objects into constnats

* add init command - closes #360

* list available commands and examples in cli help - fixes #345

* add outdated command - fixes #379

* rename uninstall command to remove

* add global command - fixes #227

* remove command aliases

* fix licenses not being shown due to integrity check shortcircuiting - fixes #424

* turn aliases back into js

* clean up single instance arguments - fixes #308

* ignore arguments that are included after -- - fixes #251

* add unlink command

* add lint rule against non-language keys

* clean up Config initialisation

* add link command - closes #336

* support array of string engines - fixes #447

* polish link command

* remove gulp file output

* add config command - fixes #378

* add yarn.lock and fix constants

* fix lint, copy test fixtures to temp directory rather than mutating cwd

* fix lint

* add handler for extractor errors

* remove unused jest snapshot

* fix check-lockfile script

* fix lint

* fix check-lockfile

* try and fix test

* properly copy over lockfile scripts folder, ignore ds_store files in test directories

* remove problematic fixtures

* add back problematic fixtures

* disable test
2016-10-05 12:50:44 +01:00
Daniel Lo Nigro
b63a1d1510 Debian package build (#414)
* Script to build Debian package

* Adjustments for Debian scripts:
 - Add copyright file
 - Add full description to control file
 - Ignore some lintian rules
 - Delete clowny files that aren't needed and break lintian rules
 - Update shebang in yarn.js from "node" to "nodejs" as per Debian package of Node

* Add basic Debian instructions

* Revert readme change and explicitly require Node.js 4 or above
2016-10-04 11:46:40 -07:00
Daniel Lo Nigro
f2b93ffc00 Add Windows Chocolatey package (#442)
* Add Chocolatey package

* Update to final URL
2016-10-04 10:15:16 -07:00
Daniel Lo Nigro
66e4395765 Add Windows installer 2016-10-04 11:40:53 +01:00
Sebastian McKenzie
e45eecbeb6 use roadrunner for caching node module resolution (#446) 2016-09-26 18:48:52 +09:00
Andres Suarez
ccce36c0e4 Fix test dirs in gitignore (#410) 2016-09-22 09:58:08 +01:00
Konstantin Raev
d643e4850f Feature: self updating command that downloads kpm releases from github 2016-08-26 12:18:58 +01:00
Sebastian McKenzie
862d20b9b3 fix support for node 4 - fixes #63 2016-06-21 23:56:09 +01:00
Sebastian McKenzie
ce25a9631a clean up 2016-04-04 20:04:56 +01:00
Sebastian McKenzie
2fbaa3ab54 hopefully fix tests for good 2016-03-10 09:29:20 +00:00
Sebastian McKenzie
236ff41e64 remove node 0.8 testing, let -> var in gulpfile, fix references to kreporters in tests 2016-03-10 08:06:30 +00:00
Sebastian McKenzie
ce508e6327 more tests 2016-02-17 06:59:47 +00:00
Sebastian McKenzie
b33328b143 fix tests 2016-02-01 11:59:00 +00:00
Sebastian McKenzie
176c9f4c3f add test coverage, remove a bunch of flow suppressions 2016-01-26 15:29:58 +00:00
Sebastian McKenzie
1e6ef9f182 add legacy pre node 5 support! 2016-01-24 01:22:53 +00:00
Sebastian McKenzie
086c2ecceb first commit 2016-01-23 10:06:17 +00:00