@lightdash/cli 2.153.1 → 2.155.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.
@@ -0,0 +1,19 @@
1
+ # {{APP_NAME}} — Lightdash custom chart type (local copy)
2
+
3
+ Created or downloaded with the Lightdash CLI. This is a **custom chart type** (a reusable visualization): one chart component that Lightdash hands data and settings to. It runs no query of its own — the same component is reused across many different queries.
4
+
5
+ ## Edit → validate → upload
6
+ 1. Edit files under `src/`. The component's contract with Lightdash — the fields it maps and the config options viewers can change — is declared in `lightdash-app.yml` under `vizSchema` and must match what `src/App.jsx` reads (see `.claude/skills/reusable-visualization`).
7
+ 2. Run `lightdash apps validate` to check the source and manifest; `lightdash apps validate --build` adds the Cloud-parity Vite production build.
8
+ 3. `lightdash upload --chart-types <slug>` (the `slug` from `lightdash-app.yml`) — Lightdash rebuilds and serves it.
9
+ 4. Open any explore in Lightdash, run a query, and pick this chart type in the chart type picker to see it against real data.
10
+
11
+ There is no standalone preview: the component waits for the Lightdash host's data, so `npm run dev` shows a blank page. Upload and verify in the explorer.
12
+
13
+ ## What's read-only
14
+ Root config (`vite.config.js`, `tsconfig.json`, etc.) is read-only reference — the server rebuilds against a trusted template. Build within the template's fixed dependency set (see `package.json`); chart types published to the official registry must stay template-deps-only.
15
+
16
+ `.npmrc` sets `ignore-scripts=true` so dependencies' lifecycle scripts never run on your machine. Keep it; explicit commands such as `npm run build` still work.
17
+
18
+ ## Publishing to the official registry
19
+ Once it works in your instance, a chart type can be proposed for the official chart registry (`lightdash/lightdash-gallery`): copy this folder under that repo's `charts/<slug>/`, run `node scripts/prepare-chart.mjs charts/<slug>` there (it prunes the local scaffold and shapes the folder for the registry), add real screenshots, and open a PR — see that repo's README.
@@ -0,0 +1,46 @@
1
+ ---
2
+ name: developing-chart-types-locally
3
+ description: Use when editing a locally created or downloaded Lightdash custom chart type (data_app_viz) — the vizSchema/component lockstep contract, the upload-and-verify loop, why there is no standalone preview, and how a chart type reaches the official registry.
4
+ ---
5
+
6
+ # Developing Lightdash Custom Chart Types Locally
7
+
8
+ You are editing a Lightdash **custom chart type** (a reusable visualization, the `data_app_viz` template) that was created or downloaded with the Lightdash CLI. It is ONE chart component that Lightdash hands data and settings to — not a data app.
9
+
10
+ ## The contract is the reusable-visualization skill
11
+
12
+ Read `.claude/skills/reusable-visualization` before editing. It defines everything the component may do: `useVizContext()` is the only channel to the host (data, options, resolved colours), the component runs no query, owns no explore, and never fetches anything itself. App-level SDK APIs (query builder, `useLightdash`, filters, `externalFetch`) do not apply here and must not be introduced.
13
+
14
+ ## The declaration lives in lightdash-app.yml — keep it in lockstep
15
+
16
+ In the in-product builder the declaration is emitted by the generation run; **locally it is the `vizSchema` block in this folder's `lightdash-app.yml`**, and upload round-trips it to the server (without it the chart type never appears in the explorer's chart type picker).
17
+
18
+ The correspondence must be exact in both directions: every key the component reads from `fieldMapping` or `options` is declared in `vizSchema`, and everything declared there is read by the component. When an edit changes what the component reads — a new field, a renamed option, a removed control — update `vizSchema` in the same edit. A declared option nothing reads is a dead control; a read key nothing declares never receives a value.
19
+
20
+ ## The edit → validate → upload → verify loop
21
+
22
+ 1. Edit files under `src/` (and `vizSchema` when the declaration changes).
23
+ 2. `lightdash apps validate` checks source and manifest (including that `vizSchema` parses); `lightdash apps validate --build` adds the Cloud-parity Vite production build. A build failure is a validation error with the Vite output.
24
+ 3. `lightdash upload --chart-types <slug>` (the `slug` from `lightdash-app.yml`) — the server rebuilds and serves it.
25
+ 4. Verify in Lightdash: open any explore, run a query with at least the required fields' shapes (e.g. a dimension and a metric), pick this chart type in the chart type picker, and map its fields. Check every config option you declared actually changes the chart.
26
+
27
+ **There is no standalone preview.** `useVizContext()` waits for the Lightdash host to push context, so outside Lightdash the component renders nothing: `npm run dev` and `lightdash apps preview` show a blank page. Do not build a mock harness or feed the hook fake data to work around this — upload and verify in the explorer instead.
28
+
29
+ Saved charts already using this chart type may pin a version; unpinned charts move to the newly uploaded version right away. While iterating in a shared project, prefer verifying on a throwaway chart.
30
+
31
+ ## Dependencies: template-deps-only, strictly
32
+
33
+ Build with the template's preinstalled set (see `package.json` — React, Recharts, d3 and friends). Do not add npm packages and do not vendor library source into `src/`. This is stricter than for data apps: the official chart registry rejects any dependency drift from its template, so a chart type that grows custom dependencies becomes unpublishable.
34
+
35
+ Root config files (`vite.config.js`, `tsconfig.json`, ...) are read-only reference — the server rebuilds against a trusted template. `.npmrc` sets `ignore-scripts=true`; never remove it or run installs with scripts enabled.
36
+
37
+ ## Publishing to the official registry
38
+
39
+ Once the chart type works in an instance, it can be proposed for the official chart registry (the `lightdash/lightdash-gallery` repo, served to every Lightdash deployment with the chart type library enabled):
40
+
41
+ 1. Copy this folder into that repo under `charts/<slug>/`.
42
+ 2. Run `node scripts/prepare-chart.mjs charts/<slug>` there — it prunes the local scaffold (these skills, configs, AGENTS/README), scrubs instance-side manifest fields, and shapes the folder for the registry. The folder name becomes the **permanent official registry slug**; pass `--slug <official-slug>` if the local slug isn't the identity that should ship.
43
+ 3. Add real screenshots from the in-product preview under `screenshots/` (the first is the gallery thumbnail) and fill in `registry.yml` (version, tags, changelog). New versions default to the beta channel; releasing to customers requires an explicit `channel: stable`.
44
+ 4. Open a PR there. On merge, publishing is automatic; published versions are immutable — any later change needs a version bump.
45
+
46
+ Report the registry step as a suggestion to the user rather than doing it unprompted: publishing makes the chart type public.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lightdash/cli",
3
- "version": "2.153.1",
3
+ "version": "2.155.0",
4
4
  "description": "Lightdash CLI tool",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -45,8 +45,8 @@
45
45
  "unique-names-generator": "4.7.1",
46
46
  "uuid": "11.1.1",
47
47
  "yaml": "2.8.3",
48
- "@lightdash/common": "2.153.1",
49
- "@lightdash/warehouses": "2.153.1"
48
+ "@lightdash/common": "2.155.0",
49
+ "@lightdash/warehouses": "2.155.0"
50
50
  },
51
51
  "devDependencies": {
52
52
  "@types/inquirer": "8.2.4",