@backmatter/core 0.0.24 → 0.0.25
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/bin/backmatter.js +3 -1
- package/package.json +1 -1
- package/src/node/cli.ts +1 -1
- package/src/node/media-cli.ts +4 -2
package/bin/backmatter.js
CHANGED
package/package.json
CHANGED
package/src/node/cli.ts
CHANGED
|
@@ -554,7 +554,7 @@ export async function runInit(args: CliArgs): Promise<string[]> {
|
|
|
554
554
|
return notes;
|
|
555
555
|
}
|
|
556
556
|
|
|
557
|
-
async function main(argv: string[]): Promise<number> {
|
|
557
|
+
export async function main(argv: string[]): Promise<number> {
|
|
558
558
|
if (argv[0] === "login" || argv[0] === "media") {
|
|
559
559
|
return runMediaCli(argv);
|
|
560
560
|
}
|
package/src/node/media-cli.ts
CHANGED
|
@@ -12,6 +12,7 @@ export const MEDIA_USAGE = `Usage:
|
|
|
12
12
|
backmatter media url <id> [--width <px>] [--origin <url>]
|
|
13
13
|
|
|
14
14
|
login opens the browser and stores a personal token in ~/.backmatter/credentials.json.
|
|
15
|
+
media upload and list use --workspace, else BACKMATTER_WORKSPACE, else BACKMATTER_WORKSPACE_ID.
|
|
15
16
|
media url prints a CDN url. --width <px> appends width and format=auto.`;
|
|
16
17
|
|
|
17
18
|
type Credentials = { api: string; token: string; origin?: string };
|
|
@@ -121,9 +122,10 @@ async function media(
|
|
|
121
122
|
const creds = await readCredentials(io.home);
|
|
122
123
|
const api = (flags.api || creds?.api || io.env.BACKMATTER_API_URL || "").replace(/\/$/, "");
|
|
123
124
|
const token = creds?.token;
|
|
124
|
-
const workspace =
|
|
125
|
+
const workspace =
|
|
126
|
+
flags.workspace || io.env.BACKMATTER_WORKSPACE || io.env.BACKMATTER_WORKSPACE_ID;
|
|
125
127
|
if (!api || !token) throw new Error("run backmatter login first");
|
|
126
|
-
if (!workspace) throw new Error("pass --workspace <id>");
|
|
128
|
+
if (!workspace) throw new Error("pass --workspace <id> or set BACKMATTER_WORKSPACE_ID");
|
|
127
129
|
const fetchImpl = io.fetch ?? fetch;
|
|
128
130
|
if (sub === "list") {
|
|
129
131
|
const params = new URLSearchParams();
|