bqcost 0.1.1 → 0.1.3

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.
Files changed (3) hide show
  1. package/README.md +12 -1
  2. package/dist/cli.js +5 -1
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  [![npm](https://img.shields.io/npm/v/bqcost?color=cb3837&logo=npm)](https://www.npmjs.com/package/bqcost)
4
4
  [![CI](https://github.com/dagryazev/bqcost/actions/workflows/ci.yml/badge.svg)](https://github.com/dagryazev/bqcost/actions/workflows/ci.yml)
5
+ [![provenance](https://img.shields.io/badge/provenance-signed-brightgreen?logo=npm&logoColor=white)](https://www.npmjs.com/package/bqcost#provenance)
5
6
  [![license: MIT](https://img.shields.io/npm/l/bqcost)](LICENSE)
6
7
  [![node](https://img.shields.io/node/v/bqcost)](https://www.npmjs.com/package/bqcost)
7
8
 
@@ -20,6 +21,16 @@ comments the number on the PR — before you merge.
20
21
 
21
22
  ---
22
23
 
24
+ ## Install
25
+
26
+ ```bash
27
+ npm i -g bqcost # global CLI
28
+ # …or run without installing: npx bqcost lint ./models
29
+ ```
30
+
31
+ Published with [npm provenance](https://docs.npmjs.com/generating-provenance-statements) — every
32
+ release is built and signed by GitHub Actions (the ✓ on the npm page).
33
+
23
34
  ## Quickstart (≈30 seconds)
24
35
 
25
36
  ```bash
@@ -27,7 +38,7 @@ comments the number on the PR — before you merge.
27
38
  gcloud auth application-default login
28
39
 
29
40
  # lint a file or a directory of .sql
30
- npx bqcost lint ./models
41
+ bqcost lint ./models # or: npx bqcost lint ./models
31
42
  ```
32
43
 
33
44
  ```text
package/dist/cli.js CHANGED
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  // src/cli.ts
4
+ import { readFileSync as readFileSync5 } from "fs";
4
5
  import { Command } from "commander";
5
6
 
6
7
  // src/core/config.ts
@@ -469,6 +470,9 @@ var BqClient = class {
469
470
  };
470
471
 
471
472
  // src/cli.ts
473
+ var { version } = JSON.parse(
474
+ readFileSync5(new URL("../package.json", import.meta.url), "utf8")
475
+ );
472
476
  function bqFromEnv(pricePerTiB) {
473
477
  return process.env.GOOGLE_APPLICATION_CREDENTIALS ? new BqClient({
474
478
  projectId: process.env.BQCOST_PROJECT_ID,
@@ -477,7 +481,7 @@ function bqFromEnv(pricePerTiB) {
477
481
  }) : null;
478
482
  }
479
483
  var program = new Command();
480
- program.name("bqcost").description("Catch the BigQuery query that would've cost $10k \u2014 in your PR.").version("0.0.0");
484
+ program.name("bqcost").description("Catch the BigQuery query that would've cost $10k \u2014 in your PR.").version(version);
481
485
  program.command("lint").argument("<paths...>", "files or directories of .sql to lint").action(async (paths) => {
482
486
  const config = loadConfig();
483
487
  const bq = bqFromEnv(config.pricePerTiB);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bqcost",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "description": "Catch the BigQuery query that would've cost $10k — in your PR. Dry-run cost + regression gate for CI.",
5
5
  "keywords": [
6
6
  "bigquery",