@bangerpage/cli 0.1.0 → 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.
@@ -0,0 +1,79 @@
1
+ export declare const DEFAULT_HOST = "https://banger.page";
2
+ /** The banger.page origin to talk to: `BANGER_HOST` (for staging and tests) or banger.page. */
3
+ export declare function platformHost(env?: NodeJS.ProcessEnv): string;
4
+ export declare function credentialsPath(env?: NodeJS.ProcessEnv): string;
5
+ export declare function saveToken(host: string, token: string, username: string | undefined, env?: NodeJS.ProcessEnv): void;
6
+ /** Forgets the token for `host`. Returns whether one was stored. */
7
+ export declare function forgetToken(host: string, env?: NodeJS.ProcessEnv): boolean;
8
+ /** `BANGER_TOKEN` (for CI) wins over the token stored by `banger login`. */
9
+ export declare function tokenFor(host: string, env?: NodeJS.ProcessEnv): string | null;
10
+ export declare const CLIENT_ID = "banger-cli";
11
+ /** Trades an authorization code from the browser for a token (OAuth with PKCE; banger-cli is a public client). */
12
+ export declare function exchangeCode(host: string, params: {
13
+ code: string;
14
+ verifier: string;
15
+ redirectUri: string;
16
+ }, fetchImpl?: typeof fetch): Promise<string>;
17
+ /** Revokes a token on the site. The site answers 200 whether or not it knew the token. */
18
+ export declare function revokeToken(host: string, token: string, fetchImpl?: typeof fetch): Promise<void>;
19
+ /** The token stored for `host` by `banger login`, ignoring `BANGER_TOKEN`. */
20
+ export declare function storedToken(host: string, env?: NodeJS.ProcessEnv): string | null;
21
+ export declare class ApiError extends Error {
22
+ readonly status: number;
23
+ readonly code: string;
24
+ constructor(status: number, code: string, message: string);
25
+ }
26
+ export interface UploadFile {
27
+ path: string;
28
+ sha256: string;
29
+ size: number;
30
+ }
31
+ export interface UploadPlan {
32
+ upload_id: string;
33
+ expires_at?: string;
34
+ /** Only the files banger.page does not have yet; each is sent to its `url`. */
35
+ uploads: {
36
+ path: string;
37
+ sha256: string;
38
+ method?: string;
39
+ url: string;
40
+ }[];
41
+ }
42
+ export interface DeckResult {
43
+ url: string;
44
+ slug: string;
45
+ version?: number;
46
+ runtime_version?: string;
47
+ direct_url?: string;
48
+ }
49
+ export interface Me {
50
+ username: string;
51
+ display_name?: string;
52
+ plan?: string;
53
+ }
54
+ /** The banger.page HTTP API (`/api/v1`). Its shape is defined by the platform; this is only the caller. */
55
+ export declare class PlatformClient {
56
+ readonly host: string;
57
+ private readonly token;
58
+ private readonly fetchImpl;
59
+ constructor(host: string, token: string, fetchImpl?: typeof fetch);
60
+ me(): Promise<Me>;
61
+ beginUpload(files: UploadFile[]): Promise<UploadPlan>;
62
+ putBlob(url: string, body: Uint8Array, method?: string): Promise<void>;
63
+ publish(body: {
64
+ upload_id: string;
65
+ slug?: string;
66
+ title?: string;
67
+ visibility?: string;
68
+ strict?: boolean;
69
+ idempotency_key: string;
70
+ }): Promise<DeckResult>;
71
+ update(slug: string, body: {
72
+ upload_id: string;
73
+ title?: string;
74
+ visibility?: string;
75
+ strict?: boolean;
76
+ idempotency_key: string;
77
+ }): Promise<DeckResult>;
78
+ private call;
79
+ }
@@ -37,6 +37,7 @@ description: HTML 1 枚で「めくらない」プレゼンテーション (キ
37
37
  - `banger export [file] --pdf [--out path] [--steps last|all]`: 停止点ごとに 1 ページの PDF にする。
38
38
  - `banger theme init [file] [--from <preset>] [--force]`: 同梱のひな形 (`signal` `signal-dark` `sunshine` `midnight`) から `theme.json` を作る。
39
39
  - `banger theme apply <theme.json> <deck.html>`: `theme.json` を発表に埋め込み、`theme="custom"` にする。何度実行しても結果は同じ。
40
+ - `banger publish [dir] [--slug <slug>]`: 発表を banger.page に公開する。2 回目からは同じ発表の更新になる。公開は外に出す操作なので、人が頼んだときだけ実行する。ログインしていなければ、人に `banger login` を頼む (ブラウザでログインして許可する)。公開の前に `banger export --pdf --out deck.pdf` で PDF を作っておくと、発表ページから PDF を落とせる。
40
41
 
41
42
  ## エスケープハッチ
42
43
 
@@ -1,4 +1,4 @@
1
1
  {
2
- "skillVersion": "0.1.0",
3
- "runtimeVersion": "0.1.0"
2
+ "skillVersion": "0.1.2",
3
+ "runtimeVersion": "0.1.2"
4
4
  }
@@ -6,7 +6,7 @@
6
6
  <title>Starter</title>
7
7
  </head>
8
8
  <body>
9
- <script type="module" src="https://cdn.jsdelivr.net/npm/@bangerpage/core@0.1.0/dist/index.js"></script>
9
+ <script type="module" src="https://cdn.jsdelivr.net/npm/@bangerpage/core@0.1.2/dist/index.js"></script>
10
10
  <bang-root theme="light">
11
11
  <bang-frame id="intro" at="0,0">
12
12
  <bang-title>めくらないプレゼン</bang-title>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bangerpage/cli",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "The banger command: preview, snap and export Banger presentations to PNG and PDF.",
5
5
  "keywords": [
6
6
  "presentation",
@@ -44,7 +44,7 @@
44
44
  "@cantoo/pdf-lib": "^2.11.1",
45
45
  "parse5": "^8.1.1",
46
46
  "playwright-core": "^1.65.1",
47
- "@bangerpage/core": "0.1.0"
47
+ "@bangerpage/core": "0.1.2"
48
48
  },
49
49
  "devDependencies": {
50
50
  "@types/node": "^24.0.0",