@batadata/cli 0.2.14 → 0.2.15
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/api.js +2 -1
- package/dist/index.js +1 -5
- package/dist/utils/logger.js +2 -1
- package/dist/version.d.ts +1 -0
- package/dist/version.js +11 -0
- package/package.json +1 -1
package/dist/api.js
CHANGED
|
@@ -3,6 +3,7 @@ import * as http from "node:http";
|
|
|
3
3
|
import { URL } from "node:url";
|
|
4
4
|
import { getApiUrl, loadConfig, getTokenSource, isJsonMode } from "./config.js";
|
|
5
5
|
import { colors } from "./utils/logger.js";
|
|
6
|
+
import { VERSION } from "./version.js";
|
|
6
7
|
export async function request(method, path, options = {}) {
|
|
7
8
|
const baseUrl = getApiUrl();
|
|
8
9
|
const url = new URL(path, baseUrl);
|
|
@@ -15,7 +16,7 @@ export async function request(method, path, options = {}) {
|
|
|
15
16
|
}
|
|
16
17
|
const headers = {
|
|
17
18
|
"Content-Type": "application/json",
|
|
18
|
-
"User-Agent":
|
|
19
|
+
"User-Agent": `@batadata/cli ${VERSION}`,
|
|
19
20
|
};
|
|
20
21
|
if (options.token) {
|
|
21
22
|
headers["Authorization"] = `Bearer ${options.token}`;
|
package/dist/index.js
CHANGED
|
@@ -24,11 +24,7 @@ import { parseGlobalFlags } from "./args.js";
|
|
|
24
24
|
import { isJsonMode } from "./config.js";
|
|
25
25
|
import { colors, log, banner } from "./utils/logger.js";
|
|
26
26
|
import { exitCodeFor, isRetryable } from "./utils/errors.js";
|
|
27
|
-
import {
|
|
28
|
-
// Read the version from package.json (dist/index.js → ../package.json) instead
|
|
29
|
-
// of a hardcoded constant — the constant sat at "0.1.4" while releases shipped
|
|
30
|
-
// through 0.1.19, so every published CLI misreported `--version`.
|
|
31
|
-
const VERSION = createRequire(import.meta.url)("../package.json").version;
|
|
27
|
+
import { VERSION } from "./version.js";
|
|
32
28
|
function help() {
|
|
33
29
|
banner();
|
|
34
30
|
log(` ${colors.bold("Usage")}`);
|
package/dist/utils/logger.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { isJsonMode } from "../config.js";
|
|
2
|
+
import { VERSION } from "../version.js";
|
|
2
3
|
// ANSI color codes
|
|
3
4
|
const ESC = "\x1b[";
|
|
4
5
|
const RESET = `${ESC}0m`;
|
|
@@ -124,6 +125,6 @@ export function kvList(items) {
|
|
|
124
125
|
// Banner
|
|
125
126
|
export function banner() {
|
|
126
127
|
log();
|
|
127
|
-
log(` ${colors.cyan(colors.bold("BataDB"))} ${colors.dim(
|
|
128
|
+
log(` ${colors.cyan(colors.bold("BataDB"))} ${colors.dim(`v${VERSION}`)} ${colors.dim("— serverless Postgres platform")}`);
|
|
128
129
|
log();
|
|
129
130
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const VERSION: string;
|
package/dist/version.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { createRequire } from "node:module";
|
|
2
|
+
// The single source of truth for the CLI's version.
|
|
3
|
+
//
|
|
4
|
+
// This used to be a hardcoded constant copied into three places, and all three
|
|
5
|
+
// drifted: `--version` read 0.2.12, the help banner said v0.1.4, and the
|
|
6
|
+
// User-Agent we sent to the API claimed 0.1.4 as well. A bug report citing the
|
|
7
|
+
// banner version sent us hunting through the wrong release.
|
|
8
|
+
//
|
|
9
|
+
// Resolved relative to this module's own URL, so it works from dist/version.js
|
|
10
|
+
// regardless of how deeply the importing module is nested.
|
|
11
|
+
export const VERSION = createRequire(import.meta.url)("../package.json").version;
|