1 | ;
|
2 |
|
3 | Object.defineProperty(exports, "__esModule", {
|
4 | value: true
|
5 | });
|
6 |
|
7 | var _regenerator = require('babel-runtime/regenerator');
|
8 |
|
9 | var _regenerator2 = _interopRequireDefault(_regenerator);
|
10 |
|
11 | var _asyncToGenerator2 = require('babel-runtime/helpers/asyncToGenerator');
|
12 |
|
13 | var _asyncToGenerator3 = _interopRequireDefault(_asyncToGenerator2);
|
14 |
|
15 | var _getPrototypeOf = require('babel-runtime/core-js/object/get-prototype-of');
|
16 |
|
17 | var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf);
|
18 |
|
19 | var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');
|
20 |
|
21 | var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
|
22 |
|
23 | var _createClass2 = require('babel-runtime/helpers/createClass');
|
24 |
|
25 | var _createClass3 = _interopRequireDefault(_createClass2);
|
26 |
|
27 | var _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn');
|
28 |
|
29 | var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
|
30 |
|
31 | var _inherits2 = require('babel-runtime/helpers/inherits');
|
32 |
|
33 | var _inherits3 = _interopRequireDefault(_inherits2);
|
34 |
|
35 | var _path = require('path');
|
36 |
|
37 | var _path2 = _interopRequireDefault(_path);
|
38 |
|
39 | var _cliEngineCommand = require('cli-engine-command');
|
40 |
|
41 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
42 |
|
43 | var Yarn = function (_Base) {
|
44 | (0, _inherits3.default)(Yarn, _Base);
|
45 |
|
46 | function Yarn() {
|
47 | (0, _classCallCheck3.default)(this, Yarn);
|
48 | return (0, _possibleConstructorReturn3.default)(this, (Yarn.__proto__ || (0, _getPrototypeOf2.default)(Yarn)).apply(this, arguments));
|
49 | }
|
50 |
|
51 | (0, _createClass3.default)(Yarn, [{
|
52 | key: 'exec',
|
53 | value: function () {
|
54 | var _ref = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee() {
|
55 | var _this2 = this;
|
56 |
|
57 | for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
|
58 | args[_key] = arguments[_key];
|
59 | }
|
60 |
|
61 | var deleteYarnRoadrunnerCache, execa, cwd, stdio;
|
62 | return _regenerator2.default.wrap(function _callee$(_context) {
|
63 | while (1) {
|
64 | switch (_context.prev = _context.next) {
|
65 | case 0:
|
66 | deleteYarnRoadrunnerCache = function deleteYarnRoadrunnerCache() {
|
67 | var getDirectory = function getDirectory(category) {
|
68 | // use %LOCALAPPDATA%/Yarn on Windows
|
69 | if (process.platform === 'win32' && process.env.LOCALAPPDATA) {
|
70 | return _path2.default.join(process.env.LOCALAPPDATA, 'Yarn', category);
|
71 | }
|
72 |
|
73 | // otherwise use ~/.{category}/yarn
|
74 | return _path2.default.join(_this2.config.dirs.home, '.' + category, 'yarn');
|
75 | };
|
76 |
|
77 | var getCacheDirectory = function getCacheDirectory() {
|
78 | if (process.platform === 'darwin') {
|
79 | return _path2.default.join(_this2.config.dirs.home, 'Library', 'Caches', 'Yarn');
|
80 | }
|
81 |
|
82 | return getDirectory('cache');
|
83 | };
|
84 |
|
85 | try {
|
86 | _this2.fs.unlinkSync(_path2.default.join(getCacheDirectory(), '.roadrunner.json'));
|
87 | } catch (err) {}
|
88 | };
|
89 |
|
90 | execa = require('execa');
|
91 | cwd = _path2.default.join(this.config.dirs.data, 'plugins');
|
92 | stdio = this.config.debug ? 'inherit' : null;
|
93 |
|
94 | this.debug(cwd + ': ' + this.bin + ' ' + args.join(' '));
|
95 | deleteYarnRoadrunnerCache();
|
96 | _context.next = 8;
|
97 | return execa(this.bin, args, { cwd: cwd, stdio: stdio });
|
98 |
|
99 | case 8:
|
100 | case 'end':
|
101 | return _context.stop();
|
102 | }
|
103 | }
|
104 | }, _callee, this);
|
105 | }));
|
106 |
|
107 | function exec() {
|
108 | return _ref.apply(this, arguments);
|
109 | }
|
110 |
|
111 | return exec;
|
112 | }()
|
113 | }, {
|
114 | key: 'bin',
|
115 | get: function get() {
|
116 | return _path2.default.join(__dirname, '..', 'node_modules', '.bin', 'yarn');
|
117 | }
|
118 | }]);
|
119 | return Yarn;
|
120 | }(_cliEngineCommand.Base);
|
121 |
|
122 | exports.default = Yarn;
|
123 | //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy95YXJuLmpzIl0sIm5hbWVzIjpbIllhcm4iLCJhcmdzIiwiZGVsZXRlWWFyblJvYWRydW5uZXJDYWNoZSIsImdldERpcmVjdG9yeSIsImNhdGVnb3J5IiwicHJvY2VzcyIsInBsYXRmb3JtIiwiZW52IiwiTE9DQUxBUFBEQVRBIiwiam9pbiIsImNvbmZpZyIsImRpcnMiLCJob21lIiwiZ2V0Q2FjaGVEaXJlY3RvcnkiLCJmcyIsInVubGlua1N5bmMiLCJlcnIiLCJleGVjYSIsInJlcXVpcmUiLCJjd2QiLCJkYXRhIiwic3RkaW8iLCJkZWJ1ZyIsImJpbiIsIl9fZGlybmFtZSJdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7OztBQUVBOzs7O0FBQ0E7Ozs7SUFFcUJBLEk7Ozs7Ozs7Ozs7Ozs7OzBDQUdKQyxJO0FBQUFBLGM7Ozs7Ozs7O0FBQ1RDLHlDLEdBQTRCLFNBQTVCQSx5QkFBNEIsR0FBTTtBQUNwQyxzQkFBSUMsZUFBZSxTQUFmQSxZQUFlLENBQUNDLFFBQUQsRUFBYztBQUMvQjtBQUNBLHdCQUFJQyxRQUFRQyxRQUFSLEtBQXFCLE9BQXJCLElBQWdDRCxRQUFRRSxHQUFSLENBQVlDLFlBQWhELEVBQThEO0FBQzVELDZCQUFPLGVBQUtDLElBQUwsQ0FBVUosUUFBUUUsR0FBUixDQUFZQyxZQUF0QixFQUFvQyxNQUFwQyxFQUE0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aW4odGhpcy5jb25maWcuZGlycy5ob21lLCBgLiR7Y2F0ZWdvcnl9YCwgJ3lhcm4nKVxuICAgICAgfVxuXG4gICAgICBsZXQgZ2V0Q2FjaGVEaXJlY3RvcnkgPSAoKSA9PiB7XG4gICAgICAgIGlmIChwcm9jZXNzLnBsYXRmb3JtID09PSAnZGFyd2luJykge1xuICAgICAgICAgIHJldHVybiBwYXRoLmpvaW4odGhpcy5jb25maWcuZGlycy5ob21lLCAnTGlicmFyeScsICdDYWNoZXMnLCAnWWFybicpXG4gICAgICAgIH1cblxuICAgICAgICByZXR1cm4gZ2V0RGlyZWN0b3J5KCdjYWNoZScpXG4gICAgICB9XG5cbiAgICAgIHRyeSB7XG4gICAgICAgIHRoaXMuZnMudW5saW5rU3luYyhwYXRoLmpvaW4oZ2V0Q2FjaGVEaXJlY3RvcnkoKSwgJy5yb2FkcnVubmVyLmpzb24nKSlcbiAgICAgIH0gY2F0Y2ggKGVycikge31cbiAgICB9XG5cbiAgICBjb25zdCBleGVjYSA9IHJlcXVpcmUoJ2V4ZWNhJylcbiAgICBjb25zdCBjd2QgPSBwYXRoLmpvaW4odGhpcy5jb25maWcuZGlycy5kYXRhLCAncGx1Z2lucycpXG4gICAgY29uc3Qgc3RkaW8gPSB0aGlzLmNvbmZpZy5kZWJ1ZyA/ICdpbmhlcml0JyA6IG51bGxcbiAgICB0aGlzLmRlYnVnKGAke2N3ZH06ICR7dGhpcy5iaW59ICR7YXJncy5qb2luKCcgJyl9YClcbiAgICBkZWxldGVZYXJuUm9hZHJ1bm5lckNhY2hlKClcbiAgICBhd2FpdCBleGVjYSh0aGlzLmJpbiwgYXJncywge2N3ZCwgc3RkaW99KVxuICB9XG59XG4iXX0= |
\ | No newline at end of file |