1 | 'use strict';
|
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 resetGit = function () {
|
16 | var _ref = (0, _asyncToGenerator3.default)( _regenerator2.default.mark(function _callee() {
|
17 | return _regenerator2.default.wrap(function _callee$(_context) {
|
18 | while (1) {
|
19 | switch (_context.prev = _context.next) {
|
20 | case 0:
|
21 | _context.next = 2;
|
22 | return (0, _fsExtra.pathExists)('.git');
|
23 |
|
24 | case 2:
|
25 | if (_context.sent) {
|
26 | _context.next = 4;
|
27 | break;
|
28 | }
|
29 |
|
30 | return _context.abrupt('return', console.log('No .git directory found'));
|
31 |
|
32 | case 4:
|
33 | console.log('Resetting git...');
|
34 | _context.next = 7;
|
35 | return (0, _fsExtra.remove)('.git');
|
36 |
|
37 | case 7:
|
38 | _context.next = 9;
|
39 | return (0, _childProcessPromise.spawn)(['git init', 'git add .', 'git commit -m "Initial commit"'].join(' && '), [], {
|
40 | shell: true,
|
41 | stdio: 'inherit'
|
42 | });
|
43 |
|
44 | case 9:
|
45 | case 'end':
|
46 | return _context.stop();
|
47 | }
|
48 | }
|
49 | }, _callee, this);
|
50 | }));
|
51 |
|
52 | return function resetGit() {
|
53 | return _ref.apply(this, arguments);
|
54 | };
|
55 | }();
|
56 |
|
57 | var reset = function () {
|
58 | var _ref2 = (0, _asyncToGenerator3.default)( _regenerator2.default.mark(function _callee2(options) {
|
59 | return _regenerator2.default.wrap(function _callee2$(_context2) {
|
60 | while (1) {
|
61 | switch (_context2.prev = _context2.next) {
|
62 | case 0:
|
63 | _context2.next = 2;
|
64 | return (0, _rename2.default)(options);
|
65 |
|
66 | case 2:
|
67 | _context2.next = 4;
|
68 | return resetGit();
|
69 |
|
70 | case 4:
|
71 | case 'end':
|
72 | return _context2.stop();
|
73 | }
|
74 | }
|
75 | }, _callee2, this);
|
76 | }));
|
77 |
|
78 | return function reset(_x) {
|
79 | return _ref2.apply(this, arguments);
|
80 | };
|
81 | }();
|
82 |
|
83 | var _childProcessPromise = require('child-process-promise');
|
84 |
|
85 | var _fsExtra = require('fs-extra');
|
86 |
|
87 | var _rename = require('./rename');
|
88 |
|
89 | var _rename2 = _interopRequireDefault(_rename);
|
90 |
|
91 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
92 |
|
93 | exports.default = reset;
|
94 |
|
\ | No newline at end of file |