@bonnard/cli
Advanced tools
| import { n as resolveEnvVarsInCredentials, r as post, t as getLocalDatasource } from "./bon.mjs"; | ||
| import pc from "picocolors"; | ||
| import "@inquirer/prompts"; | ||
| //#region src/commands/datasource/push.ts | ||
| /** | ||
| * Push a datasource programmatically (for use by deploy command) | ||
| * Returns true on success, false on failure | ||
| */ | ||
| async function pushDatasource(name, options = {}) { | ||
| const datasource = getLocalDatasource(name); | ||
| if (!datasource) { | ||
| if (!options.silent) console.error(pc.red(`Datasource "${name}" not found locally`)); | ||
| return false; | ||
| } | ||
| const { resolved, missing } = resolveEnvVarsInCredentials(datasource.credentials); | ||
| if (missing.length > 0) { | ||
| if (!options.silent) console.error(pc.red(`Missing env vars for "${name}": ${missing.join(", ")}`)); | ||
| return false; | ||
| } | ||
| try { | ||
| await post("/api/datasources", { | ||
| name: datasource.name, | ||
| warehouse_type: datasource.type, | ||
| config: datasource.config, | ||
| credentials: resolved | ||
| }); | ||
| return true; | ||
| } catch { | ||
| return false; | ||
| } | ||
| } | ||
| //#endregion | ||
| export { pushDatasource }; |
@@ -38,6 +38,6 @@ # CLI | ||
| ```bash | ||
| bon deploy --ci --push-datasources -m "CI deploy" | ||
| bon deploy --ci -m "CI deploy" | ||
| ``` | ||
| Non-interactive mode with automatic datasource sync. Fails fast if anything is misconfigured. | ||
| Non-interactive mode. Datasources are synced automatically. Fails fast if anything is misconfigured. | ||
@@ -44,0 +44,0 @@ ## Deployment versioning |
@@ -22,11 +22,12 @@ # Deploy | ||
| | `-m "message"` | **Required.** Deployment description | | ||
| | `--ci` | Non-interactive mode (fails on missing datasources) | | ||
| | `--push-datasources` | Auto-push missing datasources to Bonnard | | ||
| | `--ci` | Non-interactive mode | | ||
| Datasources are always synced automatically during deploy. | ||
| ### CI/CD | ||
| For automated pipelines, combine `--ci` with `--push-datasources`: | ||
| For automated pipelines, use `--ci` for non-interactive mode: | ||
| ```bash | ||
| bon deploy --ci --push-datasources -m "CI deploy" | ||
| bon deploy --ci -m "CI deploy" | ||
| ``` | ||
@@ -33,0 +34,0 @@ |
@@ -33,3 +33,3 @@ --- | ||
| Supported types: `postgres` (also works for Redshift), `snowflake`, `bigquery`, `databricks`. | ||
| Supported types: `postgres`, `redshift`, `snowflake`, `bigquery`, `databricks`. | ||
@@ -36,0 +36,0 @@ The demo option adds a read-only Contoso retail dataset with tables like |
@@ -68,3 +68,3 @@ --- | ||
| Supported types: `postgres` (also works for Redshift), `snowflake`, `bigquery`, `databricks`. | ||
| Supported types: `postgres`, `redshift`, `snowflake`, `bigquery`, `databricks`. | ||
@@ -71,0 +71,0 @@ The connection will be tested automatically during `bon deploy`. |
@@ -68,3 +68,3 @@ # Bonnard Semantic Layer | ||
| | `bon deploy -m "message"` | Deploy to Bonnard (requires login, message required) | | ||
| | `bon deploy --ci` | Non-interactive deploy (fails on missing datasources) | | ||
| | `bon deploy --ci` | Non-interactive deploy | | ||
| | `bon deployments` | List recent deployments (add `--all` for full history) | | ||
@@ -121,3 +121,3 @@ | `bon diff <deployment-id>` | Show changes in a deployment (`--breaking` for breaking only) | | ||
| For CI/CD pipelines, use `bon deploy --ci -m "message"` (non-interactive, fails on issues) or `bon deploy --push-datasources -m "message"` to auto-push missing datasources. | ||
| For CI/CD pipelines, use `bon deploy --ci -m "message"` (non-interactive, fails on issues). Datasources are always synced automatically during deploy. | ||
@@ -124,0 +124,0 @@ ## Best Practices |
+1
-1
| { | ||
| "name": "@bonnard/cli", | ||
| "version": "0.2.3", | ||
| "version": "0.2.4", | ||
| "type": "module", | ||
@@ -5,0 +5,0 @@ "bin": { |
| import { n as resolveEnvVarsInCredentials, r as post, t as getLocalDatasource } from "./bon.mjs"; | ||
| import pc from "picocolors"; | ||
| import { confirm } from "@inquirer/prompts"; | ||
| //#region src/commands/datasource/push.ts | ||
| /** | ||
| * Push a datasource programmatically (for use by deploy command) | ||
| * Returns true on success, false on failure | ||
| */ | ||
| async function pushDatasource(name, options = {}) { | ||
| const datasource = getLocalDatasource(name); | ||
| if (!datasource) { | ||
| if (!options.silent) console.error(pc.red(`Datasource "${name}" not found locally`)); | ||
| return false; | ||
| } | ||
| const { resolved, missing } = resolveEnvVarsInCredentials(datasource.credentials); | ||
| if (missing.length > 0) { | ||
| if (!options.silent) console.error(pc.red(`Missing env vars for "${name}": ${missing.join(", ")}`)); | ||
| return false; | ||
| } | ||
| try { | ||
| await post("/api/datasources", { | ||
| name: datasource.name, | ||
| warehouse_type: datasource.type, | ||
| config: datasource.config, | ||
| credentials: resolved | ||
| }); | ||
| return true; | ||
| } catch { | ||
| return false; | ||
| } | ||
| } | ||
| //#endregion | ||
| export { pushDatasource }; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
AI-detected potential code anomaly
Supply chain riskAI has identified unusual behaviors that may pose a security risk.
Found 1 instance in 1 package
7
-12.5%324820
-0.36%4282
-0.12%