ztd-charts-cli 0.11.2 → 0.12.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/api.d.ts +32 -32
- package/dist/api.js +1 -1
- package/dist/{chunk-6RWRYJ22.js → chunk-KNBUVTZ2.js} +55 -31
- package/dist/cli.js +7 -2
- package/dist/client/area.js +5 -5
- package/dist/client/bar.js +9 -9
- package/dist/client/barRace.js +5 -5
- package/dist/client/beeswarm.js +5 -5
- package/dist/client/box.js +9 -9
- package/dist/client/bubble.js +7 -7
- package/dist/client/bullet.js +4 -4
- package/dist/client/bump.js +6 -6
- package/dist/client/calendar.js +5 -5
- package/dist/client/candlestick.js +6 -6
- package/dist/client/chord.js +5 -5
- package/dist/client/choropleth.js +4 -4
- package/dist/client/donut.js +6 -6
- package/dist/client/dumbbell.js +5 -5
- package/dist/client/flowMap.js +5 -5
- package/dist/client/funnel.js +9 -9
- package/dist/client/gauge.js +3 -3
- package/dist/client/heatmap.js +5 -5
- package/dist/client/histogram.js +5 -5
- package/dist/client/line.js +5 -5
- package/dist/client/lollipop.js +1 -1
- package/dist/client/marimekko.js +6 -6
- package/dist/client/network.js +8 -8
- package/dist/client/parallel.js +6 -6
- package/dist/client/pareto.js +1 -1
- package/dist/client/pie.js +6 -6
- package/dist/client/radar.js +7 -7
- package/dist/client/radialBar.js +1 -1
- package/dist/client/ridgeline.js +4 -4
- package/dist/client/sankey.js +10 -10
- package/dist/client/scatter.js +10 -10
- package/dist/client/segmented.js +5 -5
- package/dist/client/skyline.js +9 -9
- package/dist/client/slope.js +6 -6
- package/dist/client/sparkline.js +6 -6
- package/dist/client/stream.js +6 -6
- package/dist/client/sunburst.js +4 -4
- package/dist/client/symbolMap.js +3 -3
- package/dist/client/tileMap.js +4 -4
- package/dist/client/timeline.js +8 -8
- package/dist/client/tree.js +2 -2
- package/dist/client/treemap.js +3 -3
- package/dist/client/waffle.js +5 -5
- package/dist/client/waterfall.js +4 -4
- package/package.json +2 -2
package/dist/api.d.ts
CHANGED
|
@@ -21,8 +21,8 @@ interface ChartSummary {
|
|
|
21
21
|
}
|
|
22
22
|
declare function summarize(def: ChartDef): ChartSummary;
|
|
23
23
|
/**
|
|
24
|
-
*
|
|
25
|
-
* locale
|
|
24
|
+
* Chart list. Filters group and level by id ("flow", "basic") or by English or Korean name ("흐름", "기본").
|
|
25
|
+
* With locale "ko", names and descriptions are in Korean; English by default
|
|
26
26
|
*/
|
|
27
27
|
declare function listCharts(filter?: {
|
|
28
28
|
group?: string;
|
|
@@ -30,9 +30,9 @@ declare function listCharts(filter?: {
|
|
|
30
30
|
locale?: string;
|
|
31
31
|
}): ChartSummary[];
|
|
32
32
|
declare function resolveType(type: string): ChartDef | undefined;
|
|
33
|
-
/**
|
|
33
|
+
/** JSON Schema for all charts or for one chart. With locale "ko", descriptions are in Korean */
|
|
34
34
|
declare function getChartSchema(type?: string, locale?: string): JSONSchema;
|
|
35
|
-
/**
|
|
35
|
+
/** One chart's description, schema, example and React code. With locale "ko", the text and example are in Korean */
|
|
36
36
|
declare function getChartInfo(type: string, locale?: string): {
|
|
37
37
|
why: string;
|
|
38
38
|
options: {
|
|
@@ -44,7 +44,7 @@ declare function getChartInfo(type: string, locale?: string): {
|
|
|
44
44
|
schema: JSONSchema | null;
|
|
45
45
|
example: ChartSpec;
|
|
46
46
|
react: string;
|
|
47
|
-
/**
|
|
47
|
+
/** Named variants: options laid over the example's options, plus encoding for variants that add fields, such as a range band (ztd-charts example <type> --variant <id>) */
|
|
48
48
|
variants: ztd_charts_spec.ChartVariant[];
|
|
49
49
|
type: string;
|
|
50
50
|
component: string;
|
|
@@ -62,20 +62,20 @@ declare function getChartInfo(type: string, locale?: string): {
|
|
|
62
62
|
description: string;
|
|
63
63
|
}[];
|
|
64
64
|
};
|
|
65
|
-
/**
|
|
65
|
+
/** Validates a spec. With locale "ko", messages are in Korean */
|
|
66
66
|
declare function validate(spec: unknown, locale?: string): ValidationResult;
|
|
67
|
-
/**
|
|
67
|
+
/** A spec as React code (using the component directly). With locale "ko", the comments are in Korean */
|
|
68
68
|
declare function reactSnippet(spec: ChartSpec, opts?: {
|
|
69
69
|
dataVar?: string;
|
|
70
70
|
inlineData?: boolean;
|
|
71
71
|
locale?: string;
|
|
72
72
|
}): string;
|
|
73
|
-
/**
|
|
73
|
+
/** React code that uses the spec as is. The ChartSpec annotation keeps values such as card.legend: "auto" from widening to string, so it compiles in TS as is */
|
|
74
74
|
declare function specSnippet(spec: ChartSpec): string;
|
|
75
|
-
/**
|
|
75
|
+
/** Font files to use for PNGs that contain Korean text */
|
|
76
76
|
declare function findFonts(extra?: string[]): string[];
|
|
77
77
|
interface FetchOptions {
|
|
78
|
-
/** false
|
|
78
|
+
/** When false, blocks data URLs that point to a private network or this machine (addresses such as 127.0.0.1, 10.x, 192.168.x, 169.254.169.254). Default true; the MCP server uses false */
|
|
79
79
|
allowPrivate?: boolean;
|
|
80
80
|
}
|
|
81
81
|
interface RenderOptions extends FetchOptions {
|
|
@@ -83,14 +83,14 @@ interface RenderOptions extends FetchOptions {
|
|
|
83
83
|
width?: number;
|
|
84
84
|
height?: number;
|
|
85
85
|
theme?: "dark" | "light";
|
|
86
|
-
/** PNG
|
|
86
|
+
/** PNG scale. Default 2 */
|
|
87
87
|
scale?: number;
|
|
88
|
-
/**
|
|
88
|
+
/** Card frame. Default: true when spec.card is set */
|
|
89
89
|
frame?: boolean;
|
|
90
|
-
/** HTML
|
|
90
|
+
/** Embeds a script in the HTML that brings back animation and interaction */
|
|
91
91
|
interactive?: boolean;
|
|
92
92
|
fonts?: string[];
|
|
93
|
-
/**
|
|
93
|
+
/** Locale for chart text, number format and error messages. "ko" gives Korean (1.2만). Without it, the spec's options.locale, then "en-US" (1.2K) */
|
|
94
94
|
locale?: string;
|
|
95
95
|
}
|
|
96
96
|
interface RenderResult {
|
|
@@ -100,34 +100,34 @@ interface RenderResult {
|
|
|
100
100
|
html?: string;
|
|
101
101
|
width?: number;
|
|
102
102
|
height?: number;
|
|
103
|
-
/**
|
|
103
|
+
/** What was changed while rendering (such as emoji removed from the PNG). Shown like warnings */
|
|
104
104
|
notes?: string[];
|
|
105
105
|
}
|
|
106
106
|
/**
|
|
107
|
-
*
|
|
108
|
-
*
|
|
107
|
+
* Removes emoji from SVG text before converting to PNG. resvg cannot draw color emoji fonts, so a whole text run containing an emoji comes out as boxes.
|
|
108
|
+
* Collapses the doubled spaces left where emoji were removed and trims leading and trailing spaces. Returns the number removed
|
|
109
109
|
*/
|
|
110
110
|
declare function stripEmoji(svg: string): {
|
|
111
111
|
svg: string;
|
|
112
112
|
removed: number;
|
|
113
113
|
};
|
|
114
|
-
/**
|
|
114
|
+
/** Time and size limits for fetching a data URL */
|
|
115
115
|
declare const FETCH_TIMEOUT_MS = 15000;
|
|
116
116
|
declare const MAX_FETCH_BYTES: number;
|
|
117
117
|
/**
|
|
118
|
-
* http(s)
|
|
119
|
-
* allowPrivate
|
|
120
|
-
*
|
|
118
|
+
* Fetches an http(s) URL within the time (FETCH_TIMEOUT_MS) and size (MAX_FETCH_BYTES) limits.
|
|
119
|
+
* When allowPrivate is false, blocks URLs that point to a private network or this machine (MCP server). On failure, throws an error that includes the URL.
|
|
120
|
+
* The returned Response holds only the fully received body and content-type
|
|
121
121
|
*/
|
|
122
122
|
declare function fetchUrl(url: string, locale?: string, opts?: FetchOptions): Promise<Response>;
|
|
123
123
|
/**
|
|
124
|
-
*
|
|
125
|
-
*
|
|
124
|
+
* Renders a spec to SVG, PNG or HTML. Validates the spec first (URL data without field checks), fetches { url } data, then validates again with the rows.
|
|
125
|
+
* Fetching, validation and rendering use the same locale (locale, then the spec's options.locale)
|
|
126
126
|
*/
|
|
127
127
|
declare function render(input: ChartSpec, opts?: RenderOptions): Promise<RenderResult>;
|
|
128
128
|
/**
|
|
129
|
-
* SVG
|
|
130
|
-
* MCP
|
|
129
|
+
* SVG to PNG (resvg). Removes emoji and reports how many in notes, in the locale's language.
|
|
130
|
+
* MCP uses this to convert an already rendered SVG when it is too large to send as text
|
|
131
131
|
*/
|
|
132
132
|
declare function svgToPng(svg: string, opts?: {
|
|
133
133
|
scale?: number;
|
|
@@ -138,20 +138,20 @@ declare function svgToPng(svg: string, opts?: {
|
|
|
138
138
|
notes?: string[];
|
|
139
139
|
}>;
|
|
140
140
|
/**
|
|
141
|
-
*
|
|
141
|
+
* Maximum pixel count of one PNG. Allows up to 10,000 × 5,000px, or a 2400 × 1000px chart at scale 4 (about 38 million); at 4 bytes per pixel the bitmap tops out at about 200MB
|
|
142
142
|
*/
|
|
143
143
|
declare const PNG_MAX_PIXELS = 50000000;
|
|
144
144
|
/**
|
|
145
|
-
* PNG
|
|
146
|
-
*
|
|
147
|
-
*
|
|
145
|
+
* PNG scale. When the outer <svg> size of the SVG to render × scale² exceeds PNG_MAX_PIXELS, lowers the scale to stay within it (decided before the bitmap is allocated).
|
|
146
|
+
* The size is measured unshrunk (some documents, such as small multiples or long legends, are larger than the per-side chart limit).
|
|
147
|
+
* null, so nothing is drawn, when the outer <svg> has no pixel width and height, or they are 0 or less, or not finite (the limit cannot be proven)
|
|
148
148
|
*/
|
|
149
149
|
declare function pngZoom(svg: string, scale: number): number | null;
|
|
150
|
-
/** http(s)
|
|
150
|
+
/** Whether it is an http(s) URL. loadRows, CLI suggest and MCP suggest_chart use the same rule (case-insensitive) */
|
|
151
151
|
declare function isHttpUrl(source: string): boolean;
|
|
152
|
-
/**
|
|
152
|
+
/** A file path, URL, or CSV/JSON string to an array of rows */
|
|
153
153
|
declare function loadRows(source: string, locale?: string, opts?: FetchOptions): Promise<Record<string, unknown>[]>;
|
|
154
|
-
/**
|
|
154
|
+
/** Chart suggestions from data. With locale "ko", the reasons and card text are in Korean */
|
|
155
155
|
declare function suggest(rows: Record<string, unknown>[], opts?: {
|
|
156
156
|
limit?: number;
|
|
157
157
|
locale?: string;
|
package/dist/api.js
CHANGED
|
@@ -9,32 +9,45 @@ import { langOf, mapExportName, renderSpecToHTML, renderSpecToSVG, resolveDef, r
|
|
|
9
9
|
|
|
10
10
|
// src/messages.ts
|
|
11
11
|
import { plural } from "ztd-charts/server";
|
|
12
|
-
var VERSION = "0.
|
|
12
|
+
var VERSION = "0.12.0";
|
|
13
13
|
var SCHEMA_URL = "https://unpkg.com/ztd-charts/schema/chart-spec.schema.json";
|
|
14
|
+
var enUsage = {
|
|
15
|
+
list: " ztd-charts list [--group proportion] [--level basic] [--json]",
|
|
16
|
+
info: " ztd-charts info <type> [--json] Chart description, options, example spec, React code",
|
|
17
|
+
schema: " ztd-charts schema [type] [--out file] JSON Schema (all charts or one)",
|
|
18
|
+
example: ` ztd-charts example <type> [--variant id] [--out file]
|
|
19
|
+
Example spec JSON (a named variant with --variant)`,
|
|
20
|
+
validate: " ztd-charts validate <spec.json> [--json]",
|
|
21
|
+
render: ` ztd-charts render <spec.json> --out chart.svg|chart.png|chart.html
|
|
22
|
+
[--width 720] [--height 240] [--theme dark|light] [--scale 2]
|
|
23
|
+
[--no-frame] [--interactive] [--font path.otf]`,
|
|
24
|
+
init: " ztd-charts init [dir] [--type pie] [--force]",
|
|
25
|
+
suggest: " ztd-charts suggest <data.csv|data.json|URL> [--limit 5] [--json] [--out-dir dir]",
|
|
26
|
+
snippet: " ztd-charts snippet <spec.json> React code for the spec"
|
|
27
|
+
};
|
|
28
|
+
var COMMANDS = Object.keys(enUsage);
|
|
29
|
+
var enEvery = `Every command
|
|
30
|
+
--locale <code> Language of messages and chart text, and number format: en (default) or ko`;
|
|
14
31
|
var en = {
|
|
15
32
|
help: `ztd-charts ${VERSION} CLI for 44 React chart types
|
|
16
33
|
|
|
17
34
|
Usage
|
|
18
|
-
|
|
19
|
-
ztd-charts info <type> [--json] Chart description, options, example spec, React code
|
|
20
|
-
ztd-charts schema [type] [--out file] JSON Schema (all charts or one)
|
|
21
|
-
ztd-charts example <type> [--variant id] [--out file]
|
|
22
|
-
Example spec JSON (a named variant with --variant)
|
|
23
|
-
ztd-charts validate <spec.json> [--json]
|
|
24
|
-
ztd-charts render <spec.json> --out chart.svg|chart.png|chart.html
|
|
25
|
-
[--width 720] [--height 240] [--theme dark|light] [--scale 2]
|
|
26
|
-
[--no-frame] [--interactive] [--font path.otf]
|
|
27
|
-
ztd-charts init [dir] [--type pie] [--force]
|
|
28
|
-
ztd-charts suggest <data.csv|data.json|URL> [--limit 5] [--json] [--out-dir dir]
|
|
35
|
+
${Object.values(enUsage).join("\n")}
|
|
29
36
|
|
|
30
|
-
|
|
31
|
-
--locale <code> Language of messages and chart text, and number format: en (default) or ko
|
|
37
|
+
${enEvery}
|
|
32
38
|
|
|
33
39
|
Examples
|
|
34
40
|
ztd-charts init
|
|
35
41
|
ztd-charts suggest charts/sales.csv --out-dir charts
|
|
36
42
|
ztd-charts render charts/01-line.json --out line.png --theme light
|
|
37
43
|
ztd-charts render charts/01-line.json --out line.svg --locale ko
|
|
44
|
+
`,
|
|
45
|
+
commandHelp: (cmd) => `Usage
|
|
46
|
+
${enUsage[cmd]}
|
|
47
|
+
|
|
48
|
+
${enEvery}
|
|
49
|
+
|
|
50
|
+
All commands: ztd-charts --help
|
|
38
51
|
`,
|
|
39
52
|
needSpec: "Missing the spec file path",
|
|
40
53
|
noFile: (f) => `File not found: ${f}`,
|
|
@@ -48,7 +61,7 @@ Examples
|
|
|
48
61
|
badOut: (file) => `Can't save ${file}: end the file name with .svg, .png or .html`,
|
|
49
62
|
unknownFilter: (flag, v, choices) => `--${flag} takes one of: ${choices.join(", ")}. Got: ${v}`,
|
|
50
63
|
error: (m) => `Error: ${m}`,
|
|
51
|
-
/** list
|
|
64
|
+
/** list table headers and column widths */
|
|
52
65
|
listHead: ["type", "name", "level", "group", "summary"],
|
|
53
66
|
listWidths: [12, 22, 14, 14],
|
|
54
67
|
listFoot: (n) => `
|
|
@@ -77,14 +90,14 @@ ${n} charts. Details: ztd-charts info <type>`,
|
|
|
77
90
|
`,
|
|
78
91
|
noFit: "No chart fits this data. Check the column names and formats",
|
|
79
92
|
score: "score",
|
|
80
|
-
/**
|
|
93
|
+
/** Fetching a data URL (render's data.url, suggest's URL) */
|
|
81
94
|
fetchFailed: (url, m) => `Couldn't load data from ${url}: ${m}`,
|
|
82
95
|
httpOnly: "only http:// and https:// addresses can be fetched",
|
|
83
96
|
timeout: (s) => `no response within ${s} seconds`,
|
|
84
97
|
tooLarge: (mb) => `the response is larger than ${mb} MB`,
|
|
85
98
|
privateUrl: "the address points to a private or local network, which is blocked. To allow it, run the MCP server with ZTD_CHARTS_ALLOW_PRIVATE_URLS=1",
|
|
86
99
|
tooManyRedirects: "too many redirects",
|
|
87
|
-
/** ztd-charts init
|
|
100
|
+
/** Example files that ztd-charts init creates */
|
|
88
101
|
init: (type) => ({
|
|
89
102
|
"charts/sales.csv": "month,channel,revenue\n2025-01,Search,120\n2025-01,Social,64\n2025-02,Search,128\n2025-02,Social,75\n2025-03,Search,131\n2025-03,Social,92\n2025-04,Search,140\n2025-04,Social,104\n",
|
|
90
103
|
"charts/Dashboard.tsx": dashboard(type, {
|
|
@@ -103,29 +116,39 @@ ${n} charts. Details: ztd-charts info <type>`,
|
|
|
103
116
|
`
|
|
104
117
|
})
|
|
105
118
|
};
|
|
119
|
+
var koUsage = {
|
|
120
|
+
list: " ztd-charts list [--group \uBE44\uC728] [--level \uAE30\uBCF8] [--json]",
|
|
121
|
+
info: " ztd-charts info <type> [--json] \uCC28\uD2B8 \uC124\uBA85, \uC635\uC158, \uC608\uC2DC \uC2A4\uD399, React \uCF54\uB4DC",
|
|
122
|
+
schema: " ztd-charts schema [type] [--out file] JSON Schema (\uC804\uCCB4 \uB610\uB294 \uCC28\uD2B8 \uD558\uB098)",
|
|
123
|
+
example: ` ztd-charts example <type> [--variant id] [--out file]
|
|
124
|
+
\uC608\uC2DC \uC2A4\uD399 JSON (--variant\uB85C \uC774\uB984 \uBD99\uC740 \uBCC0\uD615)`,
|
|
125
|
+
validate: enUsage.validate,
|
|
126
|
+
render: enUsage.render,
|
|
127
|
+
init: enUsage.init,
|
|
128
|
+
suggest: enUsage.suggest,
|
|
129
|
+
snippet: " ztd-charts snippet <spec.json> \uC2A4\uD399\uC744 \uADF8\uB9AC\uB294 React \uCF54\uB4DC"
|
|
130
|
+
};
|
|
131
|
+
var koEvery = `\uBAA8\uB4E0 \uBA85\uB839
|
|
132
|
+
--locale <code> \uC548\uB0B4 \uBB38\uAD6C, \uCC28\uD2B8 \uAE00\uC790, \uC22B\uC790 \uD615\uC2DD\uC758 \uC5B8\uC5B4: en(\uAE30\uBCF8) \uB610\uB294 ko`;
|
|
106
133
|
var ko = {
|
|
107
134
|
help: `ztd-charts ${VERSION} React \uCC28\uD2B8 44\uC885\uC744 \uC704\uD55C CLI
|
|
108
135
|
|
|
109
136
|
\uC0AC\uC6A9\uBC95
|
|
110
|
-
|
|
111
|
-
ztd-charts info <type> [--json] \uCC28\uD2B8 \uC124\uBA85, \uC635\uC158, \uC608\uC2DC \uC2A4\uD399, React \uCF54\uB4DC
|
|
112
|
-
ztd-charts schema [type] [--out file] JSON Schema (\uC804\uCCB4 \uB610\uB294 \uCC28\uD2B8 \uD558\uB098)
|
|
113
|
-
ztd-charts example <type> [--variant id] [--out file]
|
|
114
|
-
\uC608\uC2DC \uC2A4\uD399 JSON (--variant\uB85C \uC774\uB984 \uBD99\uC740 \uBCC0\uD615)
|
|
115
|
-
ztd-charts validate <spec.json> [--json]
|
|
116
|
-
ztd-charts render <spec.json> --out chart.svg|chart.png|chart.html
|
|
117
|
-
[--width 720] [--height 240] [--theme dark|light] [--scale 2]
|
|
118
|
-
[--no-frame] [--interactive] [--font path.otf]
|
|
119
|
-
ztd-charts init [dir] [--type pie] [--force]
|
|
120
|
-
ztd-charts suggest <data.csv|data.json|URL> [--limit 5] [--json] [--out-dir dir]
|
|
137
|
+
${Object.values(koUsage).join("\n")}
|
|
121
138
|
|
|
122
|
-
|
|
123
|
-
--locale <code> \uC548\uB0B4 \uBB38\uAD6C, \uCC28\uD2B8 \uAE00\uC790, \uC22B\uC790 \uD615\uC2DD\uC758 \uC5B8\uC5B4: en(\uAE30\uBCF8) \uB610\uB294 ko
|
|
139
|
+
${koEvery}
|
|
124
140
|
|
|
125
141
|
\uC608\uC2DC
|
|
126
142
|
ztd-charts init --locale ko
|
|
127
143
|
ztd-charts suggest charts/sales.csv --out-dir charts --locale ko
|
|
128
144
|
ztd-charts render charts/01-line.json --out line.png --theme light --locale ko
|
|
145
|
+
`,
|
|
146
|
+
commandHelp: (cmd) => `\uC0AC\uC6A9\uBC95
|
|
147
|
+
${koUsage[cmd]}
|
|
148
|
+
|
|
149
|
+
${koEvery}
|
|
150
|
+
|
|
151
|
+
\uBAA8\uB4E0 \uBA85\uB839 \uBCF4\uAE30: ztd-charts --help
|
|
129
152
|
`,
|
|
130
153
|
needSpec: "\uC2A4\uD399 \uD30C\uC77C \uACBD\uB85C\uB97C \uB123\uC5B4 \uC8FC\uC138\uC694",
|
|
131
154
|
noFile: (f) => `\uD30C\uC77C\uC774 \uC5C6\uC5B4\uC694: ${f}`,
|
|
@@ -264,7 +287,7 @@ function getChartInfo(type, locale) {
|
|
|
264
287
|
schema: schemaForIn(def.type, lang),
|
|
265
288
|
example: def.example,
|
|
266
289
|
react: reactSnippet(def.example, { locale }),
|
|
267
|
-
/**
|
|
290
|
+
/** Named variants: options laid over the example's options, plus encoding for variants that add fields, such as a range band (ztd-charts example <type> --variant <id>) */
|
|
268
291
|
variants: variantsIn(def.type, lang)
|
|
269
292
|
};
|
|
270
293
|
}
|
|
@@ -514,6 +537,7 @@ function suggest(rows, opts = {}) {
|
|
|
514
537
|
export {
|
|
515
538
|
VERSION,
|
|
516
539
|
SCHEMA_URL,
|
|
540
|
+
COMMANDS,
|
|
517
541
|
CLI_TEXT,
|
|
518
542
|
CHARTS,
|
|
519
543
|
summarize,
|
package/dist/cli.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
CLI_TEXT,
|
|
4
|
+
COMMANDS,
|
|
4
5
|
SCHEMA_URL,
|
|
5
6
|
VERSION,
|
|
6
7
|
getChartInfo,
|
|
@@ -13,7 +14,7 @@ import {
|
|
|
13
14
|
resolveType,
|
|
14
15
|
suggest,
|
|
15
16
|
validate
|
|
16
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-KNBUVTZ2.js";
|
|
17
18
|
|
|
18
19
|
// src/cli.ts
|
|
19
20
|
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
|
|
@@ -81,6 +82,10 @@ async function main(argv0) {
|
|
|
81
82
|
`);
|
|
82
83
|
return;
|
|
83
84
|
}
|
|
85
|
+
if (COMMANDS.includes(cmd) && rest.some((a) => a === "--help" || a === "-h")) {
|
|
86
|
+
process.stdout.write(t.commandHelp(cmd));
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
84
89
|
const { values: f, positionals: pos } = parseArgs({
|
|
85
90
|
args: rest,
|
|
86
91
|
allowPositionals: true,
|
|
@@ -189,7 +194,7 @@ ${info.react}`);
|
|
|
189
194
|
const scale = numberFlag(f, "scale");
|
|
190
195
|
const res = await render(spec, {
|
|
191
196
|
format,
|
|
192
|
-
//
|
|
197
|
+
// Each side goes up to MAX_CHART_SIZE (10,000px). Larger sizes are reduced to it
|
|
193
198
|
width: capChartSize(numberFlag(f, "width")),
|
|
194
199
|
height: capChartSize(numberFlag(f, "height")),
|
|
195
200
|
theme,
|