Commit Graph

12 Commits

Author SHA1 Message Date
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
William Hilton
2b09caff06 Update: Separate lockfile into its own npm package (#4114)
**Summary**

Fixes #3879. Separates the lockfile parser as a separate npm package.

**Test plan**

Existing unit tests.
2017-08-20 00:53:54 +01:00
Burak Yiğit Kaya
2c54c02453 Fix: Fix single-file builds and simplify bundles (#4063)
**Summary**

Fixes #4057.

**Test plan**

CI should pass, especially with `build-dist` job.

Manual:

 - Run `yarn build-dist`
 - Run `node artifacts/yarn-0.28.0.js --version`
 - Run `./dist/bin/yarn --version`

Make sure all above commands work without errors.
2017-08-02 12:54:40 +01:00
Burak Yiğit Kaya
61e402b1f7 Fix: avoid using process.exit() when possible (#3955)
**Summary**

Refs #3524. We are using `process.exit()` pretty liberally although it is [strongly advised not to use it](https://nodejs.org/api/process.html#process_process_exit_code) since it may cause the `stdout` to get corrupted/terminated before a full flush. This patch changes all possible `process.exit(code)` calls with `process.exitCode = code` statements.

We'd also ideally enable [no-process-exit](http://eslint.org/docs/rules/no-process-exit) rule in ESLint but it requires an upgrade to ESLint v4 which should be handled separately.

**Test plan**

Expect tests to pass and actually finish (not run indefinitely due to `yarn` not exiting at all). Also, the script referenced in #3524 to output something like the following:
```
DATA 18
DATA 8192
DATA 8192
DATA 5392
DATA 15
EXIT 0
```
2017-07-20 17:23:28 +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
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
wtgtybhertgeghgtwtg
88f558c057 Remove json-loader. (#2605) 2017-02-14 09:49:19 -08:00
QWp6t
500bd03a02 Add -loader suffix in webpack, closes #2410 (#2447)
Previously, packages named with `-loader` suffix could be specified as loaders within Webpack without requiring the suffix to be named explicitly. Webpack 2.1.0-beta.26 no longer looks for `-loader` suffix automatically, and packages have to therefore be named explicitly or `-loader` can be added to `resolveLoader.moduleExtensions`.
See: https://github.com/webpack/webpack/releases/tag/v2.1.0-beta.26
2017-01-14 19:03:47 +00:00
Daniel Lo Nigro
b17082da07 Build tarball and standalone JS files into artifacts directory (#1231) 2016-10-19 22:19:37 -07:00
Ekin Koc
ecbceeb9ca Add node shebang to single JS builds (#915) 2016-10-13 11:33:20 +01:00
Andres Suarez
72dc2ab09b Bundle & distribute yarn as one js file (#413) 2016-10-04 14:45:52 +01:00