@funnest/charts-cli 0.6.19 → 0.6.21
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/README.md +8 -10
- package/dist/cli.js +6 -1
- package/dist/i18n.d.ts +2 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +6 -0
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
# @funnest/charts-cli
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
Command line: validate JSON chart specs, render SVG/PNG/HTML, suggest charts, generate React code.
|
|
3
|
+
Command line for Funnest Charts: validate JSON chart specs, render SVG/PNG/HTML, suggest charts for your data and generate React code.
|
|
6
4
|
|
|
7
5
|
```bash
|
|
8
6
|
npx @funnest/charts-cli list
|
|
@@ -10,15 +8,15 @@ npx @funnest/charts-cli info bar
|
|
|
10
8
|
npx @funnest/charts-cli example line --out spec.json
|
|
11
9
|
npx @funnest/charts-cli validate spec.json
|
|
12
10
|
npx @funnest/charts-cli render spec.json --out chart.png --theme dark --scale 2
|
|
13
|
-
npx @funnest/charts-cli render spec.json --out Chart.tsx #
|
|
11
|
+
npx @funnest/charts-cli render spec.json --out Chart.tsx # the same chart as React code
|
|
14
12
|
npx @funnest/charts-cli suggest data.csv --out-dir charts
|
|
15
13
|
```
|
|
16
14
|
|
|
17
|
-
|
|
18
|
-
PNG
|
|
15
|
+
Installed in a project, the command is `funnest-charts`. Messages follow your system language (English, or Korean on a Korean system); `--locale en` or `--locale ko` picks one.
|
|
16
|
+
PNG rendering uses the optional dependency `@resvg/resvg-js`.
|
|
19
17
|
|
|
20
|
-
##
|
|
18
|
+
## Links
|
|
21
19
|
|
|
22
|
-
-
|
|
23
|
-
- GitHub: https://github.com/funnest-xyz/funnest-charts
|
|
24
|
-
-
|
|
20
|
+
- Docs: https://charts.funnest.xyz/docs/
|
|
21
|
+
- GitHub: https://github.com/funnest-xyz/funnest-charts ([한국어](https://github.com/funnest-xyz/funnest-charts/blob/main/README.ko.md))
|
|
22
|
+
- License: Apache-2.0
|
package/dist/cli.js
CHANGED
|
@@ -204,6 +204,11 @@ Every command accepts --locale ko|en.`,
|
|
|
204
204
|
}
|
|
205
205
|
};
|
|
206
206
|
var messages = (locale = "ko") => MESSAGES[locale];
|
|
207
|
+
function systemLocale() {
|
|
208
|
+
const env = typeof process !== "undefined" ? process.env : {};
|
|
209
|
+
const tag = env.LC_ALL || env.LC_MESSAGES || env.LANG || Intl.DateTimeFormat().resolvedOptions().locale || "";
|
|
210
|
+
return tag.toLowerCase().startsWith("ko") ? "ko" : "en";
|
|
211
|
+
}
|
|
207
212
|
|
|
208
213
|
// src/render.tsx
|
|
209
214
|
import { AreaChart, BarChart, CandlestickChart, DonutChart, LineChart, Point, ReferenceLine, TreemapChart } from "@funnest/charts-react";
|
|
@@ -1076,7 +1081,7 @@ function chartType(name, locale) {
|
|
|
1076
1081
|
}
|
|
1077
1082
|
async function main() {
|
|
1078
1083
|
const { _: [command, ...rest], flags } = parseArgs(process.argv.slice(2));
|
|
1079
|
-
const locale = flags.locale === "en"
|
|
1084
|
+
const locale = flags.locale === "en" || flags.locale === "ko" ? flags.locale : systemLocale();
|
|
1080
1085
|
const t = messages(locale);
|
|
1081
1086
|
const json = (v) => JSON.stringify(v, null, 2);
|
|
1082
1087
|
switch (command) {
|
package/dist/i18n.d.ts
CHANGED
|
@@ -64,3 +64,5 @@ Every command accepts --locale ko|en.`;
|
|
|
64
64
|
readonly suggested: (n: number) => string;
|
|
65
65
|
readonly initDone: (dir: string) => string;
|
|
66
66
|
};
|
|
67
|
+
/** The machine's language: Korean when the system says so (LC_ALL / LC_MESSAGES / LANG, then Intl), else English. */
|
|
68
|
+
export declare function systemLocale(): CliLocale;
|
package/dist/index.d.ts
CHANGED
|
@@ -8,5 +8,5 @@
|
|
|
8
8
|
export { CHARTS, CHART_TYPES, chartSchema, closest, exampleSpec, validateSpec, type ChartDef, type ChartSpec, type ChartType, type FieldDef, type PointSpec, type ReferenceLineSpec, type Row, type ValidationIssue, } from './spec';
|
|
9
9
|
export { reactCode, renderHtml, renderPng, renderSvg, valueFormatter, type RenderOptions } from './render';
|
|
10
10
|
export { parseCsv, parseData, suggestCharts, type Suggestion } from './data';
|
|
11
|
-
export { messages, type CliLocale } from './i18n';
|
|
11
|
+
export { messages, systemLocale, type CliLocale } from './i18n';
|
|
12
12
|
export { datafeedTemplate, type DatafeedTemplateKind } from './templates';
|
package/dist/index.js
CHANGED
|
@@ -68,6 +68,11 @@ Every command accepts --locale ko|en.`,
|
|
|
68
68
|
}
|
|
69
69
|
};
|
|
70
70
|
var messages = (locale = "ko") => MESSAGES[locale];
|
|
71
|
+
function systemLocale() {
|
|
72
|
+
const env = typeof process !== "undefined" ? process.env : {};
|
|
73
|
+
const tag = env.LC_ALL || env.LC_MESSAGES || env.LANG || Intl.DateTimeFormat().resolvedOptions().locale || "";
|
|
74
|
+
return tag.toLowerCase().startsWith("ko") ? "ko" : "en";
|
|
75
|
+
}
|
|
71
76
|
|
|
72
77
|
// src/spec.ts
|
|
73
78
|
var COMMON = {
|
|
@@ -1148,6 +1153,7 @@ export {
|
|
|
1148
1153
|
renderPng,
|
|
1149
1154
|
renderSvg,
|
|
1150
1155
|
suggestCharts,
|
|
1156
|
+
systemLocale,
|
|
1151
1157
|
validateSpec,
|
|
1152
1158
|
valueFormatter
|
|
1153
1159
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@funnest/charts-cli",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.21",
|
|
4
4
|
"description": "Funnest Charts command line: list charts, validate JSON specs, render SVG/PNG/HTML, suggest charts for your data, generate React code",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"chart",
|
|
@@ -48,8 +48,8 @@
|
|
|
48
48
|
"dependencies": {
|
|
49
49
|
"react": "^19.3.1",
|
|
50
50
|
"react-dom": "^19.3.1",
|
|
51
|
-
"@funnest/charts-react": "0.6.
|
|
52
|
-
"@funnest/charts-viz": "0.6.
|
|
51
|
+
"@funnest/charts-react": "0.6.21",
|
|
52
|
+
"@funnest/charts-viz": "0.6.21"
|
|
53
53
|
},
|
|
54
54
|
"optionalDependencies": {
|
|
55
55
|
"@resvg/resvg-js": "^2.6.2"
|