dithercharts 0.1.0 → 0.1.2
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 +4 -2
- package/assets/cli-banner-on-white.png +0 -0
- package/assets/cli-banner.png +0 -0
- package/dist/commands/add.js +12 -3
- package/package.json +23 -6
package/README.md
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+

|
|
2
|
+
|
|
1
3
|
# dithercharts
|
|
2
4
|
|
|
3
|
-
The CLI for [DitherCharts](https://dithercharts.vercel.app), dithered
|
|
5
|
+
The CLI for [DitherCharts](https://dithercharts.vercel.app), dithered chart components for React. It copies chart source into your React app, so you own and can edit every line.
|
|
4
6
|
|
|
5
|
-
You need a DitherCharts Pro subscription, Node 20 or later, and a React 19 app with TypeScript. Tailwind
|
|
7
|
+
You need a DitherCharts Pro subscription, Node 20 or later, and a React 19 app with TypeScript. Tailwind and shadcn/ui are optional.
|
|
6
8
|
|
|
7
9
|
## Usage
|
|
8
10
|
|
|
Binary file
|
|
Binary file
|
package/dist/commands/add.js
CHANGED
|
@@ -4,6 +4,12 @@ import { CliError } from "../errors.js";
|
|
|
4
4
|
import { applyFiles, planFiles, resolveOrder } from "../install.js";
|
|
5
5
|
import { componentName, defaultDir, detectPackageManager, findProjectRoot, importBase, installCommand, missing, reactMajor, readConfig, readPackageJson, writeConfig, } from "../project.js";
|
|
6
6
|
const unique = (list) => [...new Set(list)];
|
|
7
|
+
// The items that only support the charts and controls, and the stylesheet each one brings.
|
|
8
|
+
const SUPPORT = new Set(["engine", "core", "controls"]);
|
|
9
|
+
const STYLESHEETS = [
|
|
10
|
+
["core", "dithercharts.css"],
|
|
11
|
+
["controls", "controls.css"],
|
|
12
|
+
];
|
|
7
13
|
const MARK = { written: "✓", unchanged: "=", skipped: "!" };
|
|
8
14
|
export async function add(opts, deps) {
|
|
9
15
|
const root = findProjectRoot(deps.cwd);
|
|
@@ -21,7 +27,7 @@ export async function add(opts, deps) {
|
|
|
21
27
|
const index = await deps.api.index();
|
|
22
28
|
const names = opts.all ? index.items.map((item) => item.name) : opts.names;
|
|
23
29
|
if (names.length === 0)
|
|
24
|
-
throw new CliError("Name a chart, e.g. `npx dithercharts add area-chart`, or pass --all.", 2);
|
|
30
|
+
throw new CliError("Name a chart or control, e.g. `npx dithercharts add area-chart`, or pass --all.", 2);
|
|
25
31
|
// Every item is fetched before any file is written, so a failure leaves the app untouched.
|
|
26
32
|
const items = await Promise.all(resolveOrder(index, names).map((name) => deps.api.item(name)));
|
|
27
33
|
const results = await applyFiles(planFiles(join(root, dir), items), {
|
|
@@ -51,8 +57,11 @@ export async function add(opts, deps) {
|
|
|
51
57
|
}
|
|
52
58
|
const base = importBase(dir);
|
|
53
59
|
deps.log("");
|
|
54
|
-
|
|
55
|
-
|
|
60
|
+
for (const [owner, sheet] of STYLESHEETS) {
|
|
61
|
+
if (items.some((i) => i.name === owner))
|
|
62
|
+
deps.log(`import "${base}/${sheet}"`);
|
|
63
|
+
}
|
|
64
|
+
for (const name of names.filter((n) => !SUPPORT.has(n))) {
|
|
56
65
|
deps.log(`import { ${componentName(name)} } from "${base}/${name}"`);
|
|
57
66
|
}
|
|
58
67
|
return 0;
|
package/package.json
CHANGED
|
@@ -1,13 +1,30 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dithercharts",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "Install DitherCharts Pro charts into your React app.",
|
|
5
|
-
"keywords": [
|
|
5
|
+
"keywords": [
|
|
6
|
+
"dithercharts",
|
|
7
|
+
"charts",
|
|
8
|
+
"react",
|
|
9
|
+
"dither",
|
|
10
|
+
"shadcn-ui",
|
|
11
|
+
"cli"
|
|
12
|
+
],
|
|
6
13
|
"homepage": "https://dithercharts.vercel.app/docs/installation",
|
|
7
14
|
"type": "module",
|
|
8
|
-
"bin": {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
"
|
|
15
|
+
"bin": {
|
|
16
|
+
"dithercharts": "dist/bin.js"
|
|
17
|
+
},
|
|
18
|
+
"files": [
|
|
19
|
+
"dist",
|
|
20
|
+
"assets"
|
|
21
|
+
],
|
|
22
|
+
"engines": {
|
|
23
|
+
"node": ">=20"
|
|
24
|
+
},
|
|
25
|
+
"scripts": {
|
|
26
|
+
"build": "tsc -p . && chmod +x dist/bin.js",
|
|
27
|
+
"prepublishOnly": "npm run build"
|
|
28
|
+
},
|
|
12
29
|
"license": "UNLICENSED"
|
|
13
30
|
}
|