(cmds, pkg, spinner)
| 102785 | } |
| 102786 | |
| 102787 | install(cmds, pkg, spinner) { |
| 102788 | var _this3 = this; |
| 102789 | |
| 102790 | return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { |
| 102791 | const ref = pkg._reference; |
| 102792 | invariant(ref, 'expected reference'); |
| 102793 | const locs = ref.locations; |
| 102794 | |
| 102795 | let updateProgress; |
| 102796 | |
| 102797 | if (cmds.length > 0) { |
| 102798 | updateProgress = function updateProgress(data) { |
| 102799 | const dataStr = data.toString() // turn buffer into string |
| 102800 | .trim(); // trim whitespace |
| 102801 | |
| 102802 | invariant(spinner && spinner.tick, 'We should have spinner and its ticker here'); |
| 102803 | if (dataStr) { |
| 102804 | spinner.tick(dataStr |
| 102805 | // Only get the last line |
| 102806 | .substr(dataStr.lastIndexOf('\n') + 1) |
| 102807 | // change tabs to spaces as they can interfere with the console |
| 102808 | .replace(/\t/g, ' ')); |
| 102809 | } |
| 102810 | }; |
| 102811 | } |
| 102812 | |
| 102813 | try { |
| 102814 | for (var _iterator4 = cmds, _isArray4 = Array.isArray(_iterator4), _i4 = 0, _iterator4 = _isArray4 ? _iterator4 : _iterator4[Symbol.iterator]();;) { |
| 102815 | var _ref6; |
| 102816 | |
| 102817 | if (_isArray4) { |
| 102818 | if (_i4 >= _iterator4.length) break; |
| 102819 | _ref6 = _iterator4[_i4++]; |
| 102820 | } else { |
| 102821 | _i4 = _iterator4.next(); |
| 102822 | if (_i4.done) break; |
| 102823 | _ref6 = _i4.value; |
| 102824 | } |
| 102825 | |
| 102826 | const _ref5 = _ref6; |
| 102827 | const stage = _ref5[0]; |
| 102828 | const cmd = _ref5[1]; |
| 102829 | |
| 102830 | yield Promise.all(locs.map((() => { |
| 102831 | var _ref7 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (loc) { |
| 102832 | var _ref8 = yield (0, (_executeLifecycleScript || _load_executeLifecycleScript()).default)({ |
| 102833 | stage, |
| 102834 | config: _this3.config, |
| 102835 | cwd: loc, |
| 102836 | cmd, |
| 102837 | isInteractive: false, |
| 102838 | updateProgress |
| 102839 | }); |
| 102840 | |
| 102841 | const stdout = _ref8.stdout; |
| 102842 | |
| 102843 | _this3.reporter.verbose(stdout); |
| 102844 | }); |
no test coverage detected