fscr 6.2.3 → 6.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +2 -1
- package/dist/lib/git/pub.js +0 -14
- package/dist/lib/release/bump.js +9 -6
- package/dist/lib/taskList.js +69 -61
- package/dist/lib/test-files/consoleSample.js +13 -0
- package/dist/lib/test-files/inputSample.js +17 -0
- package/dist/lib/test-files/testConsole.js +1 -0
- package/dist/lib/test-files/testInput.js +2 -0
- package/package.json +12 -6
- package/dist/lib/codemod/arrow.js +0 -13
- package/dist/lib/codemod/arrow2.js +0 -67
- package/dist/lib/codemod/funcs.js +0 -25
- package/dist/lib/codemod/removeConsole.js +0 -12
- package/dist/lib/codemod/test.js +0 -8
- package/dist/lib/components/App.js +0 -64
- package/dist/lib/components/Selector.js +0 -133
- package/dist/lib/components/TabChanger.js +0 -113
- package/dist/lib/components/Table.js +0 -177
- package/dist/lib/components/Tabs.js +0 -221
- package/dist/lib/generateFScripts.js +0 -25
- package/dist/lib/generateToc.js +0 -30
- package/dist/lib/helpers.js +0 -191
- package/dist/lib/parseScriptsMd.js +0 -85
- package/dist/lib/parseScriptsPackage.js +0 -9
- package/dist/lib/release/index.js +0 -4
- package/dist/lib/run/lib.js +0 -454
- package/dist/lib/run/main-p.js +0 -59
- package/dist/lib/run/main-s.js +0 -56
- package/dist/lib/run/parse-cli-args.js +0 -222
- package/dist/lib/run/run-p.js +0 -30
- package/dist/lib/run/run-s.js +0 -57
- package/dist/lib/runCLICommand.js +0 -30
- package/dist/lib/runParallel.js +0 -20
- package/dist/lib/runSequence.js +0 -38
- package/dist/lib/taskListAutoComplete.js +0 -15
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
-
import React, { PureComponent, Component } from "react";
|
|
3
|
-
import { Color, Box, StdinContext } from "ink";
|
|
4
|
-
import BBox from "ink-box";
|
|
5
|
-
const ARROW_UP = "\u001B[A";
|
|
6
|
-
const ARROW_DOWN = "\u001B[B";
|
|
7
|
-
const ARROW_LEFT = "\u001B[D";
|
|
8
|
-
const ARROW_RIGHT = "\u001B[C";
|
|
9
|
-
const TAB_KEY = "\u0009";
|
|
10
|
-
const ENTER = "\r";
|
|
11
|
-
// const ENTER = "\u000d\n";
|
|
12
|
-
class TabsHandler extends Component {
|
|
13
|
-
constructor() {
|
|
14
|
-
super();
|
|
15
|
-
console.clear();
|
|
16
|
-
this.state = {
|
|
17
|
-
i: 0,
|
|
18
|
-
active: [0, 0]
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
onKeyChange = data => {
|
|
22
|
-
const s = String(data);
|
|
23
|
-
const {
|
|
24
|
-
children,
|
|
25
|
-
onChange,
|
|
26
|
-
activeTab
|
|
27
|
-
} = this.props;
|
|
28
|
-
const tabList = children.map((child, key) => child.props.name);
|
|
29
|
-
let curInd = tabList.indexOf(activeTab);
|
|
30
|
-
if (s === ARROW_LEFT) {
|
|
31
|
-
if (curInd > 0) {
|
|
32
|
-
curInd--;
|
|
33
|
-
} else {
|
|
34
|
-
curInd = tabList.length - 1;
|
|
35
|
-
}
|
|
36
|
-
onChange(tabList[curInd]);
|
|
37
|
-
}
|
|
38
|
-
if (s === ARROW_RIGHT || s === TAB_KEY) {
|
|
39
|
-
if (curInd < tabList.length - 1) {
|
|
40
|
-
curInd++;
|
|
41
|
-
} else {
|
|
42
|
-
curInd = 0;
|
|
43
|
-
}
|
|
44
|
-
onChange(tabList[curInd]);
|
|
45
|
-
}
|
|
46
|
-
if (s === ENTER) {
|
|
47
|
-
console.info("ENTER)");
|
|
48
|
-
}
|
|
49
|
-
};
|
|
50
|
-
handleSelect = item => {
|
|
51
|
-
console.log(item);
|
|
52
|
-
};
|
|
53
|
-
componentDidMount() {
|
|
54
|
-
const {
|
|
55
|
-
stdin,
|
|
56
|
-
setRawMode
|
|
57
|
-
} = this.props;
|
|
58
|
-
setRawMode(true);
|
|
59
|
-
stdin.on("data", this.onKeyChange);
|
|
60
|
-
}
|
|
61
|
-
render() {
|
|
62
|
-
const {
|
|
63
|
-
children,
|
|
64
|
-
activeTab
|
|
65
|
-
} = this.props;
|
|
66
|
-
const tabObj = {};
|
|
67
|
-
children.forEach((child, key) => {
|
|
68
|
-
tabObj[child.props.name] = child;
|
|
69
|
-
});
|
|
70
|
-
let lengthOfChars = Object.keys(tabObj).join(" ").length;
|
|
71
|
-
return /*#__PURE__*/React.createElement(Box, {
|
|
72
|
-
flexDirection: "column"
|
|
73
|
-
}, /*#__PURE__*/React.createElement(Box, {
|
|
74
|
-
flexDirection: "row"
|
|
75
|
-
}, children.map((child, key) => {
|
|
76
|
-
const {
|
|
77
|
-
name,
|
|
78
|
-
renderName
|
|
79
|
-
} = child.props;
|
|
80
|
-
return /*#__PURE__*/React.createElement(Box, {
|
|
81
|
-
key: name,
|
|
82
|
-
flexDirection: "row"
|
|
83
|
-
}, /*#__PURE__*/React.createElement(Box, {
|
|
84
|
-
padding: 0.5
|
|
85
|
-
}, /*#__PURE__*/React.createElement(Color, {
|
|
86
|
-
bgGreen: activeTab === name,
|
|
87
|
-
black: activeTab === name
|
|
88
|
-
}, renderName ? renderName() : name[0].toUpperCase() + name.slice(1))));
|
|
89
|
-
})), /*#__PURE__*/React.createElement(Box, null, Array.from({
|
|
90
|
-
length: lengthOfChars + children.length
|
|
91
|
-
}).map(e => "").join("─")), /*#__PURE__*/React.createElement(Box, {
|
|
92
|
-
paddingLeft: 0.5
|
|
93
|
-
}, tabObj[activeTab].props.children));
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
export class Tab extends PureComponent {
|
|
97
|
-
render() {
|
|
98
|
-
return /*#__PURE__*/React.createElement(Box, null, "TEST");
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
export class Tabs extends PureComponent {
|
|
102
|
-
render() {
|
|
103
|
-
return /*#__PURE__*/React.createElement(StdinContext.Consumer, null, ({
|
|
104
|
-
stdin,
|
|
105
|
-
setRawMode
|
|
106
|
-
}) => /*#__PURE__*/React.createElement(TabsHandler, _extends({}, this.props, {
|
|
107
|
-
stdin: stdin,
|
|
108
|
-
setRawMode: setRawMode
|
|
109
|
-
})));
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
// render(<Keyselect />);
|
|
@@ -1,177 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { Box, Color } from "ink";
|
|
3
|
-
import PropTypes from "prop-types";
|
|
4
|
-
|
|
5
|
-
// Components ----------------------------------------------------------------
|
|
6
|
-
|
|
7
|
-
const Header = ({
|
|
8
|
-
children
|
|
9
|
-
}) => /*#__PURE__*/React.createElement(Color, {
|
|
10
|
-
blue: true,
|
|
11
|
-
bold: true
|
|
12
|
-
}, children);
|
|
13
|
-
Header.propTypes = {
|
|
14
|
-
children: PropTypes.any.isRequired
|
|
15
|
-
};
|
|
16
|
-
const Cell = ({
|
|
17
|
-
children
|
|
18
|
-
}) => /*#__PURE__*/React.createElement(Color, null, children);
|
|
19
|
-
Cell.propTypes = {
|
|
20
|
-
children: PropTypes.any.isRequired,
|
|
21
|
-
focused: PropTypes.bool
|
|
22
|
-
};
|
|
23
|
-
Cell.defaultProps = {
|
|
24
|
-
focused: false
|
|
25
|
-
};
|
|
26
|
-
const Skeleton = ({
|
|
27
|
-
children
|
|
28
|
-
}) => /*#__PURE__*/React.createElement(Color, {
|
|
29
|
-
white: true,
|
|
30
|
-
bold: true
|
|
31
|
-
}, children);
|
|
32
|
-
Skeleton.propTypes = {
|
|
33
|
-
children: PropTypes.any.isRequired
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
// Helpers -------------------------------------------------------------------
|
|
37
|
-
|
|
38
|
-
const get = key => obj => obj[key];
|
|
39
|
-
const length = el => el.length;
|
|
40
|
-
const isUndefined = v => v === undefined;
|
|
41
|
-
const not = func => (...args) => !func(...args);
|
|
42
|
-
const toString = val => (val || String()).toString();
|
|
43
|
-
const isEmpty = el => el.length === 0;
|
|
44
|
-
const intersperse = val => vals => vals.reduce((s, c, i) => isEmpty(s) ? [c] : [...s, val(i), c], []);
|
|
45
|
-
const fillWith = el => length => str => `${str}${el.repeat(length - str.length)}`;
|
|
46
|
-
const getCells = columns => data => columns.map(({
|
|
47
|
-
width,
|
|
48
|
-
key
|
|
49
|
-
}) => ({
|
|
50
|
-
width,
|
|
51
|
-
key,
|
|
52
|
-
value: get(key)(data)
|
|
53
|
-
}));
|
|
54
|
-
const union = (...arrs) => [...new Set([].concat(...arrs))];
|
|
55
|
-
const generateColumn = padding => data => key => {
|
|
56
|
-
const allColumns = data.map(get(key));
|
|
57
|
-
const columnsWithValues = allColumns.filter(not(isUndefined));
|
|
58
|
-
const vals = columnsWithValues.map(toString);
|
|
59
|
-
const lengths = vals.map(length);
|
|
60
|
-
const width = Math.max(...lengths, key.length) + padding * 2;
|
|
61
|
-
return {
|
|
62
|
-
width,
|
|
63
|
-
key
|
|
64
|
-
};
|
|
65
|
-
};
|
|
66
|
-
const copyToObject = func => arr => arr.reduce((o, k) => ({
|
|
67
|
-
...o,
|
|
68
|
-
[k]: func(k)
|
|
69
|
-
}), {});
|
|
70
|
-
const generateHeadings = keys => copyToObject(key => key)(keys);
|
|
71
|
-
const generateSkeleton = keys => copyToObject(() => "")(keys);
|
|
72
|
-
const line = (key, Cell, Skeleton, {
|
|
73
|
-
line,
|
|
74
|
-
left,
|
|
75
|
-
right,
|
|
76
|
-
cross,
|
|
77
|
-
padding
|
|
78
|
-
}) => (cells, index = "") => {
|
|
79
|
-
const fillWithLine = fillWith(line);
|
|
80
|
-
const columns = cells.map(({
|
|
81
|
-
width,
|
|
82
|
-
key,
|
|
83
|
-
value
|
|
84
|
-
}, i) => /*#__PURE__*/React.createElement(Cell, {
|
|
85
|
-
key: key + String(i),
|
|
86
|
-
cellData: {
|
|
87
|
-
key,
|
|
88
|
-
value,
|
|
89
|
-
row: index,
|
|
90
|
-
column: i,
|
|
91
|
-
width
|
|
92
|
-
}
|
|
93
|
-
}, line.repeat(padding), fillWithLine(width - padding)(toString(value))));
|
|
94
|
-
return /*#__PURE__*/React.createElement(Box, {
|
|
95
|
-
key: key + String(index)
|
|
96
|
-
}, /*#__PURE__*/React.createElement(Skeleton, null, left), intersperse(i => /*#__PURE__*/React.createElement(Skeleton, {
|
|
97
|
-
key: i
|
|
98
|
-
}, cross))(columns), /*#__PURE__*/React.createElement(Skeleton, null, right));
|
|
99
|
-
};
|
|
100
|
-
|
|
101
|
-
// Table ---------------------------------------------------------------------
|
|
102
|
-
|
|
103
|
-
// Config --------------------------------------------------------------------
|
|
104
|
-
|
|
105
|
-
const Table = ({
|
|
106
|
-
data,
|
|
107
|
-
padding,
|
|
108
|
-
header,
|
|
109
|
-
cell,
|
|
110
|
-
skeleton
|
|
111
|
-
}) => {
|
|
112
|
-
const topLine = line("top", skeleton, skeleton, {
|
|
113
|
-
line: "─",
|
|
114
|
-
left: "┌",
|
|
115
|
-
right: "┐",
|
|
116
|
-
cross: "┬",
|
|
117
|
-
padding
|
|
118
|
-
});
|
|
119
|
-
const bottomLine = line("bottom", skeleton, skeleton, {
|
|
120
|
-
line: "─",
|
|
121
|
-
left: "└",
|
|
122
|
-
right: "┘",
|
|
123
|
-
cross: "┴",
|
|
124
|
-
padding
|
|
125
|
-
});
|
|
126
|
-
const midLine = line("mid", skeleton, skeleton, {
|
|
127
|
-
line: "─",
|
|
128
|
-
left: "├",
|
|
129
|
-
right: "┤",
|
|
130
|
-
cross: "┼",
|
|
131
|
-
padding
|
|
132
|
-
});
|
|
133
|
-
const headers = line("header", header, skeleton, {
|
|
134
|
-
line: " ",
|
|
135
|
-
left: "│",
|
|
136
|
-
right: "│",
|
|
137
|
-
cross: "│",
|
|
138
|
-
padding
|
|
139
|
-
});
|
|
140
|
-
const row = line("row", cell, skeleton, {
|
|
141
|
-
line: " ",
|
|
142
|
-
left: "│",
|
|
143
|
-
right: "│",
|
|
144
|
-
cross: "│",
|
|
145
|
-
padding
|
|
146
|
-
});
|
|
147
|
-
const keys = union(...data.map(Object.keys));
|
|
148
|
-
const columns = keys.map(generateColumn(padding)(data));
|
|
149
|
-
const headings = generateHeadings(keys);
|
|
150
|
-
const _skeleton = generateSkeleton(keys);
|
|
151
|
-
const getRow = getCells(columns);
|
|
152
|
-
const headersRow = getRow(headings);
|
|
153
|
-
const emptyRow = getRow(_skeleton);
|
|
154
|
-
const rows = data.map((d, i) => row(getRow(d), i));
|
|
155
|
-
return /*#__PURE__*/React.createElement("span", null, topLine(emptyRow), intersperse(i => midLine(emptyRow, i))(rows), bottomLine(emptyRow));
|
|
156
|
-
};
|
|
157
|
-
Table.propTypes = {
|
|
158
|
-
data: PropTypes.any,
|
|
159
|
-
padding: PropTypes.number,
|
|
160
|
-
header: PropTypes.func,
|
|
161
|
-
cell: PropTypes.func,
|
|
162
|
-
skeleton: PropTypes.func
|
|
163
|
-
};
|
|
164
|
-
Table.defaultProps = {
|
|
165
|
-
data: [],
|
|
166
|
-
padding: 1,
|
|
167
|
-
header: Header,
|
|
168
|
-
cell: Cell,
|
|
169
|
-
skeleton: Skeleton
|
|
170
|
-
};
|
|
171
|
-
|
|
172
|
-
// Exports -------------------------------------------------------------------
|
|
173
|
-
|
|
174
|
-
export default Table;
|
|
175
|
-
export { Header, Cell, Skeleton };
|
|
176
|
-
|
|
177
|
-
// ---------------------------------------------------------------------------
|
|
@@ -1,221 +0,0 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
-
import React, { Component } from "react";
|
|
3
|
-
import PropTypes from "prop-types";
|
|
4
|
-
import { Box, Color, StdinContext } from "ink";
|
|
5
|
-
class Tab extends Component {
|
|
6
|
-
render() {
|
|
7
|
-
const {
|
|
8
|
-
children
|
|
9
|
-
} = this.props;
|
|
10
|
-
return children;
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
Tab.propTypes = {
|
|
14
|
-
children: PropTypes.node.isRequired,
|
|
15
|
-
name: PropTypes.string.isRequired // eslint-disable-line react/no-unused-prop-types
|
|
16
|
-
};
|
|
17
|
-
class TabsWithStdin extends Component {
|
|
18
|
-
constructor(props) {
|
|
19
|
-
super(props);
|
|
20
|
-
this.isColumn = this.isColumn.bind(this);
|
|
21
|
-
this.handleTabChange = this.handleTabChange.bind(this);
|
|
22
|
-
this.handleKeyPress = this.handleKeyPress.bind(this);
|
|
23
|
-
this.moveToNextTab = this.moveToNextTab.bind(this);
|
|
24
|
-
this.moveToPreviousTab = this.moveToPreviousTab.bind(this);
|
|
25
|
-
this.state = {
|
|
26
|
-
activeTab: 0
|
|
27
|
-
};
|
|
28
|
-
this.defaultKeyMap = {
|
|
29
|
-
useNumbers: true,
|
|
30
|
-
useTab: true,
|
|
31
|
-
previous: [this.isColumn() ? "up" : "left"],
|
|
32
|
-
next: [this.isColumn() ? "down" : "right"]
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
componentDidMount() {
|
|
36
|
-
const {
|
|
37
|
-
stdin,
|
|
38
|
-
setRawMode
|
|
39
|
-
} = this.props;
|
|
40
|
-
|
|
41
|
-
// use ink / node `setRawMode` to read key-by-key
|
|
42
|
-
setRawMode(true);
|
|
43
|
-
stdin.on("keypress", this.handleKeyPress);
|
|
44
|
-
|
|
45
|
-
// select the first tab on component mount
|
|
46
|
-
this.handleTabChange(0);
|
|
47
|
-
}
|
|
48
|
-
componentWillUnmount() {
|
|
49
|
-
const {
|
|
50
|
-
stdin,
|
|
51
|
-
setRawMode
|
|
52
|
-
} = this.props;
|
|
53
|
-
setRawMode(false); // remove set raw mode, as it might interfere with CTRL-C
|
|
54
|
-
stdin.removeListener("keypress", this.handleKeyPress);
|
|
55
|
-
}
|
|
56
|
-
handleTabChange(tabId) {
|
|
57
|
-
const {
|
|
58
|
-
children,
|
|
59
|
-
onChange
|
|
60
|
-
} = this.props;
|
|
61
|
-
const tab = children[tabId];
|
|
62
|
-
if (!tab) {
|
|
63
|
-
return;
|
|
64
|
-
}
|
|
65
|
-
this.setState({
|
|
66
|
-
activeTab: tabId
|
|
67
|
-
});
|
|
68
|
-
onChange(tab.props.name, tab);
|
|
69
|
-
}
|
|
70
|
-
handleKeyPress(ch, key) {
|
|
71
|
-
const {
|
|
72
|
-
keyMap
|
|
73
|
-
} = this.props;
|
|
74
|
-
if (!key) {
|
|
75
|
-
return;
|
|
76
|
-
}
|
|
77
|
-
const currentKeyMap = {
|
|
78
|
-
...this.defaultKeyMap,
|
|
79
|
-
...keyMap
|
|
80
|
-
};
|
|
81
|
-
const {
|
|
82
|
-
useNumbers,
|
|
83
|
-
useTab,
|
|
84
|
-
previous,
|
|
85
|
-
next
|
|
86
|
-
} = currentKeyMap;
|
|
87
|
-
if (previous.some(keyName => keyName === key.name)) {
|
|
88
|
-
this.moveToPreviousTab();
|
|
89
|
-
}
|
|
90
|
-
if (next.some(keyName => keyName === key.name)) {
|
|
91
|
-
this.moveToNextTab();
|
|
92
|
-
}
|
|
93
|
-
switch (key.name) {
|
|
94
|
-
case "tab":
|
|
95
|
-
{
|
|
96
|
-
if (!useTab) {
|
|
97
|
-
return;
|
|
98
|
-
}
|
|
99
|
-
if (key.shift === true) {
|
|
100
|
-
this.moveToPreviousTab();
|
|
101
|
-
} else {
|
|
102
|
-
this.moveToNextTab();
|
|
103
|
-
}
|
|
104
|
-
break;
|
|
105
|
-
}
|
|
106
|
-
case "0":
|
|
107
|
-
case "1":
|
|
108
|
-
case "2":
|
|
109
|
-
case "3":
|
|
110
|
-
case "4":
|
|
111
|
-
case "5":
|
|
112
|
-
case "6":
|
|
113
|
-
case "7":
|
|
114
|
-
case "8":
|
|
115
|
-
case "9":
|
|
116
|
-
{
|
|
117
|
-
if (!useNumbers) {
|
|
118
|
-
return;
|
|
119
|
-
}
|
|
120
|
-
if (key.meta === true) {
|
|
121
|
-
const tabId = key.name === "0" ? 9 : parseInt(key.name, 10) - 1;
|
|
122
|
-
this.handleTabChange(tabId);
|
|
123
|
-
}
|
|
124
|
-
break;
|
|
125
|
-
}
|
|
126
|
-
default:
|
|
127
|
-
break;
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
isColumn() {
|
|
131
|
-
const {
|
|
132
|
-
flexDirection
|
|
133
|
-
} = this.props;
|
|
134
|
-
return flexDirection === "column" || flexDirection === "column-reverse";
|
|
135
|
-
}
|
|
136
|
-
moveToNextTab() {
|
|
137
|
-
const {
|
|
138
|
-
children
|
|
139
|
-
} = this.props;
|
|
140
|
-
const {
|
|
141
|
-
activeTab
|
|
142
|
-
} = this.state;
|
|
143
|
-
let nextTabId = activeTab + 1;
|
|
144
|
-
if (nextTabId >= children.length) {
|
|
145
|
-
nextTabId = 0;
|
|
146
|
-
}
|
|
147
|
-
this.handleTabChange(nextTabId);
|
|
148
|
-
}
|
|
149
|
-
moveToPreviousTab() {
|
|
150
|
-
const {
|
|
151
|
-
children
|
|
152
|
-
} = this.props;
|
|
153
|
-
const {
|
|
154
|
-
activeTab
|
|
155
|
-
} = this.state;
|
|
156
|
-
let nextTabId = activeTab - 1;
|
|
157
|
-
if (nextTabId < 0) {
|
|
158
|
-
nextTabId = children.length - 1;
|
|
159
|
-
}
|
|
160
|
-
this.handleTabChange(nextTabId);
|
|
161
|
-
}
|
|
162
|
-
render() {
|
|
163
|
-
const {
|
|
164
|
-
children,
|
|
165
|
-
onChange,
|
|
166
|
-
flexDirection,
|
|
167
|
-
...rest
|
|
168
|
-
} = this.props;
|
|
169
|
-
const {
|
|
170
|
-
activeTab
|
|
171
|
-
} = this.state;
|
|
172
|
-
const separatorWidth = rest.width || 6;
|
|
173
|
-
const separator = this.isColumn() ? new Array(separatorWidth).fill("─").join("") : " | ";
|
|
174
|
-
return /*#__PURE__*/React.createElement(Box, _extends({
|
|
175
|
-
flexDirection: flexDirection
|
|
176
|
-
}, rest), children.map((child, key) => {
|
|
177
|
-
const {
|
|
178
|
-
name
|
|
179
|
-
} = child.props;
|
|
180
|
-
return /*#__PURE__*/React.createElement(Box, {
|
|
181
|
-
key: name,
|
|
182
|
-
flexDirection: flexDirection
|
|
183
|
-
}, key !== 0 && /*#__PURE__*/React.createElement(Color, {
|
|
184
|
-
dim: true
|
|
185
|
-
}, separator), /*#__PURE__*/React.createElement(Box, null, /*#__PURE__*/React.createElement(Color, {
|
|
186
|
-
keyword: "grey"
|
|
187
|
-
}, key + 1, ". "), /*#__PURE__*/React.createElement(Color, {
|
|
188
|
-
bgGreen: activeTab === key,
|
|
189
|
-
black: activeTab === key
|
|
190
|
-
}, child)));
|
|
191
|
-
}));
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
TabsWithStdin.defaultProps = {
|
|
195
|
-
flexDirection: "row",
|
|
196
|
-
keyMap: null
|
|
197
|
-
};
|
|
198
|
-
TabsWithStdin.propTypes = {
|
|
199
|
-
setRawMode: PropTypes.func.isRequired,
|
|
200
|
-
stdin: PropTypes.object.isRequired,
|
|
201
|
-
// eslint-disable-line react/forbid-prop-types
|
|
202
|
-
onChange: PropTypes.func.isRequired,
|
|
203
|
-
children: PropTypes.node.isRequired,
|
|
204
|
-
flexDirection: PropTypes.string,
|
|
205
|
-
keyMap: PropTypes.shape({
|
|
206
|
-
useNumbers: PropTypes.bool,
|
|
207
|
-
useTab: PropTypes.bool,
|
|
208
|
-
previous: PropTypes.arrayOf(PropTypes.string),
|
|
209
|
-
next: PropTypes.arrayOf(PropTypes.string)
|
|
210
|
-
})
|
|
211
|
-
};
|
|
212
|
-
function Tabs(props) {
|
|
213
|
-
return /*#__PURE__*/React.createElement(StdinContext.Consumer, null, ({
|
|
214
|
-
stdin,
|
|
215
|
-
setRawMode
|
|
216
|
-
}) => /*#__PURE__*/React.createElement(TabsWithStdin, _extends({
|
|
217
|
-
stdin: stdin,
|
|
218
|
-
setRawMode: setRawMode
|
|
219
|
-
}, props)));
|
|
220
|
-
}
|
|
221
|
-
export { Tab, Tabs };
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import chalk from "chalk";
|
|
2
|
-
import inquirer from "inquirer";
|
|
3
|
-
import { appendToFile, writeFile, boxInform, readJson, readFile } from "./utils/helpers.js";
|
|
4
|
-
import path from "path";
|
|
5
|
-
const projectDir = process.cwd();
|
|
6
|
-
const packagePath = path.join(projectDir, "package.json");
|
|
7
|
-
const gen = {
|
|
8
|
-
scripts: []
|
|
9
|
-
};
|
|
10
|
-
let mdfile = `# First category of scripts
|
|
11
|
-
|
|
12
|
-
Welcome to your new amazing fscripts.md file. It replaces the headaches of npm scripts! But so much more.
|
|
13
|
-
`;
|
|
14
|
-
gen.init = async () => {
|
|
15
|
-
try {
|
|
16
|
-
gen.packageJson = await readJson(packagePath);
|
|
17
|
-
Object.keys(gen.packageJson.scripts).forEach(scriptName => {
|
|
18
|
-
mdfile += `\n## ${scriptName}\n\n${gen.packageJson.scripts[scriptName]}\n\n\`\`\`bash\n${gen.packageJson.scripts[scriptName]}\n\`\`\`\n\n`;
|
|
19
|
-
});
|
|
20
|
-
await writeFile("./sample.fscripts.md", mdfile);
|
|
21
|
-
} catch (err) {
|
|
22
|
-
console.error(err);
|
|
23
|
-
}
|
|
24
|
-
};
|
|
25
|
-
export default gen.init;
|
package/dist/lib/generateToc.js
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import path from "path";
|
|
2
|
-
import chalk from "chalk";
|
|
3
|
-
import fs from "fs";
|
|
4
|
-
import tocPkg from "markdown-toc";
|
|
5
|
-
const toc = tocPkg.default || tocPkg;
|
|
6
|
-
import { writeFile } from "./utils/helpers.js";
|
|
7
|
-
// const projectDir = process.cwd();
|
|
8
|
-
|
|
9
|
-
const generateToc = async () => {
|
|
10
|
-
const filepath = path.resolve(process.cwd(), "fscripts.md");
|
|
11
|
-
if (!fs.existsSync(filepath)) {
|
|
12
|
-
console.warn(`${chalk.bold.red("You're missing the fscripts.md file!")}
|
|
13
|
-
${chalk.green("Please run 'fsr generate' to get started!")}`);
|
|
14
|
-
process.exit(0);
|
|
15
|
-
return null;
|
|
16
|
-
}
|
|
17
|
-
const data = fs.readFileSync(filepath, "utf-8");
|
|
18
|
-
if (data) {
|
|
19
|
-
console.warn(`${chalk.bold.green("Located fscripts.md file!")}`);
|
|
20
|
-
let newFile = ``;
|
|
21
|
-
let tocSplit = data.split("<!-- end toc -->");
|
|
22
|
-
if (tocSplit.length === 2) {
|
|
23
|
-
newFile = toc(tocSplit[1]).content + "\n<!-- end toc -->\n\n" + tocSplit[1].trim();
|
|
24
|
-
} else {
|
|
25
|
-
newFile = toc(data).content + "\n<!-- end toc -->\n\n" + data.trim();
|
|
26
|
-
}
|
|
27
|
-
await writeFile("./fscripts.md", newFile);
|
|
28
|
-
}
|
|
29
|
-
};
|
|
30
|
-
export default generateToc;
|