simple-ascii-chart-cli 1.1.0 → 1.2.0
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/cli.js +10 -2
- package/dist/tests/cli.test.js +1 -1
- package/dist/tests/validators.test.js +13 -1
- package/package.json +3 -3
package/dist/cli.js
CHANGED
|
@@ -63,6 +63,14 @@ var argv = yargs
|
|
|
63
63
|
.option('hideXAxis', {
|
|
64
64
|
type: 'boolean',
|
|
65
65
|
description: 'Hide the x-axis if set to true',
|
|
66
|
+
})
|
|
67
|
+
.option('barChart', {
|
|
68
|
+
type: 'boolean',
|
|
69
|
+
description: 'Draw bar chart if set to true',
|
|
70
|
+
})
|
|
71
|
+
.option('horizontalBarChart', {
|
|
72
|
+
type: 'boolean',
|
|
73
|
+
description: 'Draw horizontal bar chart if set to true',
|
|
66
74
|
})
|
|
67
75
|
.option('hideYAxis', {
|
|
68
76
|
type: 'boolean',
|
|
@@ -150,11 +158,11 @@ var execute = function (_a) {
|
|
|
150
158
|
});
|
|
151
159
|
};
|
|
152
160
|
var prepareParams = function (_a) {
|
|
153
|
-
var input = _a.input, options = _a.options, width = _a.width, height = _a.height, hideYAxis = _a.hideYAxis, hideXAxis = _a.hideXAxis, fillArea = _a.fillArea, title = _a.title, xLabel = _a.xLabel, yLabel = _a.yLabel, color = _a.color, axisCenter = _a.axisCenter, yRange = _a.yRange, showTickLabel = _a.showTickLabel, thresholds = _a.thresholds, legend = _a.legend, formatter = _a.formatter, lineFormatter = _a.lineFormatter, symbols = _a.symbols;
|
|
161
|
+
var input = _a.input, options = _a.options, width = _a.width, height = _a.height, hideYAxis = _a.hideYAxis, hideXAxis = _a.hideXAxis, fillArea = _a.fillArea, title = _a.title, xLabel = _a.xLabel, yLabel = _a.yLabel, color = _a.color, axisCenter = _a.axisCenter, yRange = _a.yRange, showTickLabel = _a.showTickLabel, thresholds = _a.thresholds, legend = _a.legend, formatter = _a.formatter, lineFormatter = _a.lineFormatter, symbols = _a.symbols, barChart = _a.barChart, horizontalBarChart = _a.horizontalBarChart;
|
|
154
162
|
var currentOptions = options ? JSON.parse(options) : {};
|
|
155
163
|
return {
|
|
156
164
|
input: JSON.parse(input),
|
|
157
|
-
options: __assign(__assign({}, currentOptions), { width: width, height: height, hideYAxis: hideYAxis, hideXAxis: hideXAxis, title: title, xLabel: xLabel, yLabel: yLabel, fillArea: fillArea, color: color ? (0, validators_1.validateColors)(color) : undefined, axisCenter: (0, validators_1.validateAxisCenter)(axisCenter), yRange: (0, validators_1.validateYRange)(yRange), // Validate and format yRange
|
|
165
|
+
options: __assign(__assign({}, currentOptions), { width: width, height: height, hideYAxis: hideYAxis, hideXAxis: hideXAxis, title: title, xLabel: xLabel, yLabel: yLabel, fillArea: fillArea, barChart: barChart, horizontalBarChart: horizontalBarChart, color: color ? (0, validators_1.validateColors)(color) : undefined, axisCenter: (0, validators_1.validateAxisCenter)(axisCenter), yRange: (0, validators_1.validateYRange)(yRange), // Validate and format yRange
|
|
158
166
|
showTickLabel: showTickLabel, thresholds: (0, validators_1.validateThresholds)(thresholds), legend: (0, validators_1.validateLegend)(legend), formatter: (0, validators_1.validateFormatter)(formatter), lineFormatter: (0, validators_1.validateLineFormatter)(lineFormatter), symbols: (0, validators_1.validateSymbols)(symbols) }),
|
|
159
167
|
};
|
|
160
168
|
};
|
package/dist/tests/cli.test.js
CHANGED
|
@@ -4,7 +4,7 @@ var child_process_1 = require("child_process");
|
|
|
4
4
|
describe('plotter script', function () {
|
|
5
5
|
// @ts-expect-error tests
|
|
6
6
|
var execPlotterScript = function (args, callback) {
|
|
7
|
-
(0, child_process_1.exec)("node dist/cli.js ".concat(args), callback);
|
|
7
|
+
(0, child_process_1.exec)("node node_modules/simple-ascii-chart/dist/cli.js ".concat(args), callback);
|
|
8
8
|
};
|
|
9
9
|
it('should require the --input option', function (done) {
|
|
10
10
|
// @ts-expect-error tests
|
|
@@ -71,7 +71,19 @@ describe('Utility Functions Tests', function () {
|
|
|
71
71
|
it('returns a valid LineFormatter function for correct string input', function () {
|
|
72
72
|
var lineFormatterStr = '(args) => ({ x: args.x, y: args.y, symbol: "*" })';
|
|
73
73
|
var lineFormatter = (0, validators_1.validateLineFormatter)(lineFormatterStr);
|
|
74
|
-
expect(lineFormatter({
|
|
74
|
+
expect(lineFormatter({
|
|
75
|
+
x: 1,
|
|
76
|
+
y: 2,
|
|
77
|
+
plotX: 1,
|
|
78
|
+
plotY: 2,
|
|
79
|
+
input: [],
|
|
80
|
+
index: 0,
|
|
81
|
+
minX: 0,
|
|
82
|
+
minY: 0,
|
|
83
|
+
expansionX: [0, 0],
|
|
84
|
+
expansionY: [0, 0],
|
|
85
|
+
toPlotCoordinates: function () { return [0, 0]; },
|
|
86
|
+
})).toEqual({
|
|
75
87
|
x: 1,
|
|
76
88
|
y: 2,
|
|
77
89
|
symbol: '*',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "simple-ascii-chart-cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "Simple ascii chart generator CLI",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
21
|
"@types/jest": "^29.5.14",
|
|
22
|
-
"@types/node": "^22.8.
|
|
22
|
+
"@types/node": "^22.8.1",
|
|
23
23
|
"@typescript-eslint/eslint-plugin": "^8.11.0",
|
|
24
24
|
"@typescript-eslint/parser": "^8.11.0",
|
|
25
25
|
"eslint": "^9.13.0",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"dist/**/*"
|
|
53
53
|
],
|
|
54
54
|
"dependencies": {
|
|
55
|
-
"simple-ascii-chart": "^4.
|
|
55
|
+
"simple-ascii-chart": "^4.2.0",
|
|
56
56
|
"yargs": "^17.7.2"
|
|
57
57
|
}
|
|
58
58
|
}
|