bqcost 0.1.1 → 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/dist/cli.js +5 -1
- package/package.json +1 -1
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(
|
|
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);
|