@lightdash/cli 1.49.0 → 1.50.1
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 +30 -0
- package/dist/.tsbuildinfo +1 -1
- package/dist/handlers/apps/createApp.d.ts +21 -0
- package/dist/handlers/apps/createApp.d.ts.map +1 -0
- package/dist/handlers/apps/createApp.js +261 -0
- package/dist/handlers/apps/createApp.test.d.ts +2 -0
- package/dist/handlers/apps/createApp.test.d.ts.map +1 -0
- package/dist/handlers/apps/createApp.test.js +264 -0
- package/dist/handlers/apps/scaffolding.d.ts +1 -0
- package/dist/handlers/apps/scaffolding.d.ts.map +1 -1
- package/dist/handlers/apps/scaffolding.js +6 -1
- package/dist/handlers/apps/scaffolding.test.js +22 -5
- package/dist/index.js +15 -0
- package/dist/vendor/authoring/AGENTS.md.tmpl +2 -2
- package/dist/vendor/authoring/README.md.tmpl +3 -3
- package/dist/vendor/authoring/developing-data-apps-locally/SKILL.md +5 -5
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -8,6 +8,7 @@ const uuid_1 = require("uuid");
|
|
|
8
8
|
const env_1 = require("./env");
|
|
9
9
|
const error_1 = require("./error");
|
|
10
10
|
const globalState_1 = tslib_1.__importDefault(require("./globalState"));
|
|
11
|
+
const createApp_1 = require("./handlers/apps/createApp");
|
|
11
12
|
const preview_1 = require("./handlers/apps/preview");
|
|
12
13
|
const compile_1 = require("./handlers/compile");
|
|
13
14
|
const connectSnowflake_1 = require("./handlers/connectSnowflake");
|
|
@@ -102,6 +103,20 @@ ${styles.bold('Examples:')}
|
|
|
102
103
|
${styles.title('⚡')}️lightdash ${styles.bold('deploy')} ${styles.secondary('-- compiles and deploys Lightdash metrics to active project')}
|
|
103
104
|
${styles.title('⚡')}️lightdash ${styles.bold('login https://lightdash.domain.com')} ${styles.secondary('-- logs in to a Lightdash instance')}
|
|
104
105
|
`);
|
|
106
|
+
const createProgram = commander_1.program
|
|
107
|
+
.command('create')
|
|
108
|
+
.description('Creates Lightdash content locally');
|
|
109
|
+
createProgram
|
|
110
|
+
.command('app <name>')
|
|
111
|
+
.description('Creates a new data app locally')
|
|
112
|
+
.option('--description <text>', 'Set the app description', '')
|
|
113
|
+
.option('--slug <slug>', 'Override the app slug')
|
|
114
|
+
.option('-p, --path <path>', 'Specify the Lightdash content root (default: ./lightdash)')
|
|
115
|
+
.option('--project <project uuid>', 'Specify the project the app will use', parseProjectArgument, undefined)
|
|
116
|
+
.option('-y, --assume-yes', 'approve npm package installation', false)
|
|
117
|
+
.option('--verbose', undefined, false)
|
|
118
|
+
.addHelpText('after', `\n${styles.bold('Example:')}\n ${styles.title('⚡')}️lightdash ${styles.bold('create app "Revenue explorer"')} ${styles.secondary('-- creates ./lightdash/apps/revenue-explorer')}\n`)
|
|
119
|
+
.action(createApp_1.createAppHandler);
|
|
105
120
|
commander_1.program
|
|
106
121
|
.command('connect-snowflake')
|
|
107
122
|
.description('Connects Lightdash to Snowflake using browser-based SSO')
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
Two skills in `.claude/skills/` describe how to edit this app:
|
|
4
4
|
- `lightdash-data-app` — the Lightdash SDK surface (querying data, filters, downloads).
|
|
5
|
-
- `developing-data-apps-locally` — the local workflow: edit `src/`, `npm run build`, `lightdash upload --apps <
|
|
5
|
+
- `developing-data-apps-locally` — the local workflow: edit `src/`, `npm run build`, `lightdash apps preview`, `lightdash upload --apps <slug>`; the SDK is the only data access; `.lightdash/context/` holds the project's semantic layer and theme.
|
|
6
6
|
|
|
7
7
|
Edit only `src/`. Root config files are read-only reference — the server rebuilds against a trusted template.
|
|
8
8
|
|
|
9
|
-
The local `npm install && npm run build`
|
|
9
|
+
The local build is an optional pre-check. Apps made with `lightdash create app` already have dependencies installed and can run `npm run build`; after `lightdash download`, use `npm install && npm run build` if you choose to build locally. If install fails, skip it and upload — never modify machine config, npmrc, or dependency files to force it; the server rebuild is authoritative.
|
|
10
10
|
|
|
11
11
|
Build with the template's preinstalled dependency set (see `package.json`). Adding new npm packages only works when the instance has custom dependencies enabled — assume it does not; ask the user before considering a new library, and never vendor library source into `src/` as a workaround. Where enabled, adding a dependency is the one workflow that still requires pnpm: upload requires a matching `pnpm-lock.yaml`, so `pnpm add <pkg>` (or `pnpm install --lockfile-only`) must succeed locally. If it fails, stop and report the error — hand-editing `package.json` without the lockfile makes the upload fail.
|
|
12
12
|
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
# {{APP_NAME}} — Lightdash data app (local copy)
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Created or downloaded with the Lightdash CLI.
|
|
4
4
|
|
|
5
5
|
## Edit → build → upload
|
|
6
6
|
1. Edit files under `src/`.
|
|
7
|
-
2. Optionally, `npm
|
|
7
|
+
2. Optionally, run `npm run build` to check it compiles locally. `lightdash create app` installs the initial dependencies after asking permission; after `lightdash download`, run `npm install` first if `node_modules` is absent. If install fails in your environment, skip the local build — the server build on upload is authoritative and surfaces errors on the app page. Don't change machine or registry config to force it.
|
|
8
8
|
3. Optionally, preview against real data: `lightdash apps preview` (needs a successful `npm install`).
|
|
9
|
-
4. `lightdash upload --apps` — Lightdash rebuilds and serves the app.
|
|
9
|
+
4. `lightdash upload --apps <slug>` (the `slug` from `lightdash-app.yml`) — Lightdash rebuilds and serves the app.
|
|
10
10
|
|
|
11
11
|
Local preview uses your existing CLI login through a project- and route-restricted loopback proxy; the credential is not written into this folder or exposed to browser code. It runs local tooling as your OS user (with access to that user's files, including the existing CLI config) and shows data under your own permissions, so preview only source/dependencies you trust. Host-mediated features such as external connections and data-app-viz context still need testing after upload.
|
|
12
12
|
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: developing-data-apps-locally
|
|
3
|
-
description: Use when editing a downloaded Lightdash data app
|
|
3
|
+
description: Use when editing a locally created or downloaded Lightdash data app — how local editing, building, and uploading work, and what is read-only.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Developing Lightdash Data Apps Locally
|
|
7
7
|
|
|
8
|
-
You are editing a Lightdash **data app** that was downloaded with the Lightdash CLI
|
|
8
|
+
You are editing a Lightdash **data app** that was created or downloaded with the Lightdash CLI.
|
|
9
9
|
|
|
10
10
|
## The only way to reach data is the SDK
|
|
11
11
|
|
|
@@ -28,8 +28,8 @@ You are editing a Lightdash **data app** that was downloaded with the Lightdash
|
|
|
28
28
|
## The edit → build → upload loop
|
|
29
29
|
|
|
30
30
|
1. Edit files under `src/` only.
|
|
31
|
-
2. Optionally,
|
|
32
|
-
3. `lightdash upload --apps <
|
|
31
|
+
2. Optionally, run `npm run build` to check it compiles. Apps made with `lightdash create app` already have their initial dependencies installed. After `lightdash download`, if you choose to do the local pre-check and `node_modules` is absent, run `npm install` first. This is an **optional local pre-check** — see below.
|
|
32
|
+
3. `lightdash upload --apps <slug>` (the `slug` from this folder's `lightdash-app.yml`) — the **server** rebuilds and serves the app. The server rebuild, not your local build, is what ships.
|
|
33
33
|
|
|
34
34
|
## The local build is optional — never fight a failing install
|
|
35
35
|
|
|
@@ -37,7 +37,7 @@ You are editing a Lightdash **data app** that was downloaded with the Lightdash
|
|
|
37
37
|
- Do **not** modify machine configuration, `.npmrc` files, registry settings, or the project's dependency files to force an install to work.
|
|
38
38
|
- A missing `node_modules` is a normal state, not a problem to fix. Never run installs just because it is absent.
|
|
39
39
|
- **Exception — adding a dependency** (only on instances with custom dependencies enabled — see "Library boundaries" above). This is the one workflow that still requires pnpm: upload rejects new dependencies unless `pnpm-lock.yaml` was regenerated to match `package.json`, so dependency resolution MUST succeed locally. Use `pnpm add <pkg>` — prefixed with Socket Firewall when available (`sfw pnpm add <pkg>`; check with `command -v sfw`) to block known-malicious packages — or after editing `package.json` run `pnpm install --lockfile-only` (updates the lockfile without installing). If resolution fails, **stop and report the exact pnpm error to the user** — never hand-edit `package.json` and proceed without the lockfile; the upload will fail.
|
|
40
|
-
- **Never run dependency lifecycle scripts.** The app's `.npmrc` sets `ignore-scripts=true` — leave it. A downloaded app can be authored by someone else, and their dependencies' install scripts must not execute on this machine. Explicit
|
|
40
|
+
- **Never run dependency lifecycle scripts.** The app's `.npmrc` sets `ignore-scripts=true` — leave it. A downloaded app can be authored by someone else, and their dependencies' install scripts must not execute on this machine. Explicit `npm run build`/`npm run dev` and `pnpm build`/`pnpm dev` commands still work.
|
|
41
41
|
|
|
42
42
|
## Preview locally against real data
|
|
43
43
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lightdash/cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.50.1",
|
|
4
4
|
"description": "Lightdash CLI tool",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -41,8 +41,8 @@
|
|
|
41
41
|
"unique-names-generator": "4.7.1",
|
|
42
42
|
"uuid": "11.1.1",
|
|
43
43
|
"yaml": "2.8.3",
|
|
44
|
-
"@lightdash/common": "1.
|
|
45
|
-
"@lightdash/warehouses": "1.
|
|
44
|
+
"@lightdash/common": "1.50.1",
|
|
45
|
+
"@lightdash/warehouses": "1.50.1"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"@types/inquirer": "8.2.4",
|