Files
yarn/bin/yarn.js
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

30 lines
873 B
JavaScript
Executable File

#!/usr/bin/env node
/* eslint-disable no-var */
/* eslint-disable flowtype/require-valid-file-annotation */
'use strict';
var ver = process.versions.node;
var majorVer = parseInt(ver.split('.')[0], 10);
if (majorVer < 4) {
console.error('Node version ' + ver + ' is not supported, please use Node.js 4.0 or higher.');
process.exitCode = 1;
} else {
var dirPath = '../lib/';
var v8CompileCachePath = dirPath + 'v8-compile-cache';
var fs = require('fs');
// We don't have/need this on legacy builds and dev builds
if (fs.existsSync(v8CompileCachePath)) {
require(v8CompileCachePath);
}
// Just requiring this package will trigger a yarn run since the
// `require.main === module` check inside `cli/index.js` will always
// be truthy when built with webpack :(
var cli = require(dirPath + 'cli');
if (!cli.autoRun) {
cli.default();
}
}