@boldvideo/bold-js 0.6.0 → 0.7.0
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/CHANGELOG.md +20 -0
- package/dist/index.cjs +299 -0
- package/dist/index.d.ts +197 -0
- package/dist/index.js +265 -0
- package/package.json +1 -1
- package/thoughts/shared/plans/2025-10-22-BOLD-759-portal-color-scheme.md +272 -0
- package/thoughts/shared/research/2025-10-22-BOLD-759-portal-color-scheme-settings.md +215 -0
- package/.changeset/README.md +0 -8
- package/.changeset/config.json +0 -11
- package/.github/dependabot.yml +0 -11
- package/.github/workflow/main.yml +0 -21
- package/.github/workflow/publish.yml +0 -29
- package/.github/workflows/changeset-release.yml +0 -51
- package/.github/workflows/ci.yml +0 -90
- package/.github/workflows/release.yml +0 -83
- package/CLAUDE.md +0 -76
- package/CONTRIBUTING.md +0 -103
- package/SECURITY.md +0 -66
- package/src/index.ts +0 -22
- package/src/lib/client.ts +0 -53
- package/src/lib/fetchers.ts +0 -96
- package/src/lib/tracking.ts +0 -117
- package/src/lib/types.ts +0 -217
- package/src/util/throttle.ts +0 -29
- package/tsconfig.json +0 -14
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
---
|
|
2
|
+
date: 2025-10-22T03:51:01+0000
|
|
3
|
+
researcher: Claude Code
|
|
4
|
+
git_commit: b74faa4e21936838e3aca23828c579b7d1da7a82
|
|
5
|
+
branch: main
|
|
6
|
+
repository: bold-js
|
|
7
|
+
topic: "Adding portal.color_scheme to Settings Type in bold-js SDK"
|
|
8
|
+
tags: [research, codebase, bold-js, settings, types, portal, BOLD-759]
|
|
9
|
+
status: complete
|
|
10
|
+
last_updated: 2025-10-22
|
|
11
|
+
last_updated_by: Claude Code
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
# Research: Adding portal.color_scheme to Settings Type in bold-js SDK
|
|
15
|
+
|
|
16
|
+
**Date**: 2025-10-22T03:51:01+0000
|
|
17
|
+
**Researcher**: Claude Code
|
|
18
|
+
**Git Commit**: b74faa4e21936838e3aca23828c579b7d1da7a82
|
|
19
|
+
**Branch**: main
|
|
20
|
+
**Repository**: bold-js
|
|
21
|
+
**Linear Ticket**: [BOLD-759](https://linear.app/boldvideo/issue/BOLD-759/add-portalcolor-scheme-to-settings-type-in-bold-js-sdk)
|
|
22
|
+
|
|
23
|
+
## Research Question
|
|
24
|
+
|
|
25
|
+
Where and how should the `color_scheme` field be added to the Settings type in the bold-js SDK to support the Next.js starter's theme configuration?
|
|
26
|
+
|
|
27
|
+
## Summary
|
|
28
|
+
|
|
29
|
+
The `color_scheme` field needs to be added to the `Portal` type definition in `/Users/marcelfahle/code/BOLD/code/_oss/bold-js/src/lib/types.ts` at line 133. The Portal type is already part of the Settings type (line 210), so adding the field to Portal will automatically make it available in Settings. The SDK already has established patterns for optional fields and will automatically export the updated type through the main index file.
|
|
30
|
+
|
|
31
|
+
## Detailed Findings
|
|
32
|
+
|
|
33
|
+
### Current Settings Type Structure
|
|
34
|
+
|
|
35
|
+
The Settings type is defined in `src/lib/types.ts:179-217` with the following key components:
|
|
36
|
+
|
|
37
|
+
**Portal Object Location**: `src/lib/types.ts:210`
|
|
38
|
+
```typescript
|
|
39
|
+
portal: Portal
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
The Portal type itself is defined at `src/lib/types.ts:133-138`:
|
|
43
|
+
```typescript
|
|
44
|
+
export type Portal = {
|
|
45
|
+
display: PortalDisplay;
|
|
46
|
+
layout: PortalLayout;
|
|
47
|
+
navigation: PortalNavigation;
|
|
48
|
+
theme: PortalTheme;
|
|
49
|
+
};
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### Where to Add color_scheme
|
|
53
|
+
|
|
54
|
+
The `color_scheme` field should be added directly to the `Portal` type definition at `src/lib/types.ts:133-138`. Based on the ticket requirements, it should be:
|
|
55
|
+
|
|
56
|
+
**Type**: `'toggle' | 'light' | 'dark'`
|
|
57
|
+
**Optional**: Yes (using the `?` suffix)
|
|
58
|
+
**Location**: Portal type definition
|
|
59
|
+
|
|
60
|
+
The field would be added as a new property alongside the existing nested objects (display, layout, navigation, theme).
|
|
61
|
+
|
|
62
|
+
### Existing Portal Structure
|
|
63
|
+
|
|
64
|
+
The Portal type currently contains four nested configuration objects:
|
|
65
|
+
|
|
66
|
+
1. **display: PortalDisplay** (`src/lib/types.ts:98-101`)
|
|
67
|
+
- `show_chapters: boolean`
|
|
68
|
+
- `show_transcripts: boolean`
|
|
69
|
+
|
|
70
|
+
2. **layout: PortalLayout** (`src/lib/types.ts:109-114`)
|
|
71
|
+
- `assistant_config: AssistantConfig | null`
|
|
72
|
+
- `show_playlists: boolean`
|
|
73
|
+
- `type: string`
|
|
74
|
+
- `videos_limit: number`
|
|
75
|
+
|
|
76
|
+
3. **navigation: PortalNavigation** (`src/lib/types.ts:116-120`)
|
|
77
|
+
- `show_ai_search: boolean`
|
|
78
|
+
- `show_header: boolean`
|
|
79
|
+
- `show_search: boolean`
|
|
80
|
+
|
|
81
|
+
4. **theme: PortalTheme** (`src/lib/types.ts:122-131`)
|
|
82
|
+
- `background: string`
|
|
83
|
+
- `font_body: string`
|
|
84
|
+
- `font_header: string`
|
|
85
|
+
- `foreground: string`
|
|
86
|
+
- `logo_height: number`
|
|
87
|
+
- `logo_url: string`
|
|
88
|
+
- `logo_width: number`
|
|
89
|
+
- `primary: string`
|
|
90
|
+
|
|
91
|
+
### Optional Field Pattern in Settings
|
|
92
|
+
|
|
93
|
+
The SDK has a consistent pattern for optional fields using the TypeScript `?:` syntax:
|
|
94
|
+
|
|
95
|
+
**Examples from Settings type** (`src/lib/types.ts:179-217`):
|
|
96
|
+
- `ai_greeting?: string` (line 187)
|
|
97
|
+
- `favicon_url?: string` (line 194)
|
|
98
|
+
- `logo_dark_url?: string` (line 195)
|
|
99
|
+
- `logo_url?: string` (line 196)
|
|
100
|
+
- `social_graph_image_url?: string` (line 204, nested in meta_data)
|
|
101
|
+
|
|
102
|
+
**Examples from Video type** (`src/lib/types.ts:33-80`):
|
|
103
|
+
- `chapters?: string`
|
|
104
|
+
- `attachments?: VideoAttachment[]`
|
|
105
|
+
- `internal_id?: string`
|
|
106
|
+
- `playback_speed?: number`
|
|
107
|
+
- `tags?: string[]`
|
|
108
|
+
- `transcript?: VideoTranscript`
|
|
109
|
+
|
|
110
|
+
### Union Type Pattern
|
|
111
|
+
|
|
112
|
+
Currently, the Settings type and its nested types don't extensively use string literal union types. The closest patterns are:
|
|
113
|
+
|
|
114
|
+
**Null unions**:
|
|
115
|
+
- `assistant_config: AssistantConfig | null` (`src/lib/types.ts:110`)
|
|
116
|
+
- `image: string | null` (`src/lib/types.ts:202`)
|
|
117
|
+
|
|
118
|
+
The proposed `'toggle' | 'light' | 'dark'` union type would be a new pattern for the Settings type, though it's a standard TypeScript pattern.
|
|
119
|
+
|
|
120
|
+
### Type Export Chain
|
|
121
|
+
|
|
122
|
+
The Portal type follows this export chain:
|
|
123
|
+
|
|
124
|
+
1. **Definition**: `src/lib/types.ts:133-138` - Portal type is exported
|
|
125
|
+
2. **Re-export**: `src/index.ts:12` - Portal is re-exported from main entry
|
|
126
|
+
3. **Compilation**: `dist/index.d.ts` - Type declarations are generated by tsup
|
|
127
|
+
4. **Consumption**: Available to consumers via `import type { Portal } from '@boldvideo/bold-js'`
|
|
128
|
+
|
|
129
|
+
Any changes to the Portal type will automatically flow through this chain when the project is rebuilt.
|
|
130
|
+
|
|
131
|
+
### Settings API Usage
|
|
132
|
+
|
|
133
|
+
The Settings type is fetched via the `fetchSettings` function in `src/lib/fetchers.ts:26-38`:
|
|
134
|
+
|
|
135
|
+
```typescript
|
|
136
|
+
export function fetchSettings(client: ApiClient) {
|
|
137
|
+
return async (videoLimit = 12) => {
|
|
138
|
+
try {
|
|
139
|
+
return await get<Response<Settings>>(
|
|
140
|
+
client,
|
|
141
|
+
`settings?limit=${videoLimit}`
|
|
142
|
+
);
|
|
143
|
+
} catch (error) {
|
|
144
|
+
console.error(`Error fetching settings with limit: ${videoLimit}`, error);
|
|
145
|
+
throw error;
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
The function returns a `Response<Settings>` wrapper type where Settings includes the portal object. The API endpoint is `settings?limit=${videoLimit}`.
|
|
152
|
+
|
|
153
|
+
## Code References
|
|
154
|
+
|
|
155
|
+
- `src/lib/types.ts:133-138` - Portal type definition (where color_scheme should be added)
|
|
156
|
+
- `src/lib/types.ts:179-217` - Settings type definition
|
|
157
|
+
- `src/lib/types.ts:210` - Portal field in Settings type
|
|
158
|
+
- `src/index.ts:12` - Portal type re-export
|
|
159
|
+
- `src/lib/fetchers.ts:26-38` - fetchSettings API implementation
|
|
160
|
+
|
|
161
|
+
## Architecture Documentation
|
|
162
|
+
|
|
163
|
+
### Type Definition Pattern
|
|
164
|
+
|
|
165
|
+
The SDK uses a modular type system where:
|
|
166
|
+
|
|
167
|
+
1. Small, focused types are defined for specific concepts (PortalDisplay, PortalLayout, etc.)
|
|
168
|
+
2. These types are composed into larger structures (Portal contains display, layout, navigation, theme)
|
|
169
|
+
3. The Settings type brings everything together at the top level
|
|
170
|
+
4. All types are exported individually, allowing consumers to use them independently
|
|
171
|
+
|
|
172
|
+
### Build and Type Generation
|
|
173
|
+
|
|
174
|
+
- **Build tool**: tsup
|
|
175
|
+
- **Source**: TypeScript files in `src/`
|
|
176
|
+
- **Output**: ESM and CommonJS in `dist/` with type declarations
|
|
177
|
+
- **Type declarations**: Generated automatically in `dist/index.d.ts`
|
|
178
|
+
|
|
179
|
+
### Backward Compatibility
|
|
180
|
+
|
|
181
|
+
The Settings type maintains backward compatibility by:
|
|
182
|
+
|
|
183
|
+
- Keeping legacy flat AI fields (`ai_avatar`, `ai_name`, `has_ai`) while adding new nested `account` structure
|
|
184
|
+
- Using optional fields for new additions to prevent breaking changes
|
|
185
|
+
- Defaulting to sensible values (as specified in the ticket: default to "toggle" if not specified)
|
|
186
|
+
|
|
187
|
+
## Related Research
|
|
188
|
+
|
|
189
|
+
This research is specific to BOLD-759. No previous research documents were found in the thoughts directory related to Settings type modifications.
|
|
190
|
+
|
|
191
|
+
## Implementation Context
|
|
192
|
+
|
|
193
|
+
According to the Linear ticket:
|
|
194
|
+
|
|
195
|
+
**Purpose**: The Next.js starter now reads `portal.color_scheme` from the settings API to control theme behavior, but this field is not yet defined in the bold-js SDK Settings type.
|
|
196
|
+
|
|
197
|
+
**Expected behavior**:
|
|
198
|
+
- `"toggle"`: Show theme toggle, allow user to switch between light/dark
|
|
199
|
+
- `"light"`: Force light mode, hide theme toggle
|
|
200
|
+
- `"dark"`: Force dark mode, hide theme toggle
|
|
201
|
+
- Default to `"toggle"` if not specified
|
|
202
|
+
|
|
203
|
+
**Already implemented**: The implementation is live in production in these commits:
|
|
204
|
+
- main: b31396f
|
|
205
|
+
- demo/founderwell: b42c9fe
|
|
206
|
+
- custom/yo: b9d8ee8
|
|
207
|
+
|
|
208
|
+
The API is already returning this field; the SDK types just need to be updated to reflect it.
|
|
209
|
+
|
|
210
|
+
## Notes
|
|
211
|
+
|
|
212
|
+
- No string literal union types currently exist in the Settings/Portal types, so this would introduce that pattern
|
|
213
|
+
- The field should be optional to maintain backward compatibility
|
|
214
|
+
- The type will automatically be available to consumers after the SDK is rebuilt and published
|
|
215
|
+
- No changes needed to the API fetcher code - it already returns the full Settings object
|
package/.changeset/README.md
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
# Changesets
|
|
2
|
-
|
|
3
|
-
Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
|
|
4
|
-
with multi-package repos, or single-package repos to help you version and publish your code. You can
|
|
5
|
-
find the full documentation for it [in our repository](https://github.com/changesets/changesets)
|
|
6
|
-
|
|
7
|
-
We have a quick list of common questions to get you started engaging with this project in
|
|
8
|
-
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
|
package/.changeset/config.json
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://unpkg.com/@changesets/config@2.3.0/schema.json",
|
|
3
|
-
"changelog": "@changesets/cli/changelog",
|
|
4
|
-
"commit": false,
|
|
5
|
-
"fixed": [],
|
|
6
|
-
"linked": [],
|
|
7
|
-
"access": "restricted",
|
|
8
|
-
"baseBranch": "main",
|
|
9
|
-
"updateInternalDependencies": "patch",
|
|
10
|
-
"ignore": []
|
|
11
|
-
}
|
package/.github/dependabot.yml
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
name: CI
|
|
2
|
-
on:
|
|
3
|
-
push:
|
|
4
|
-
branches:
|
|
5
|
-
- "**"
|
|
6
|
-
|
|
7
|
-
jobs:
|
|
8
|
-
build:
|
|
9
|
-
runs-on: ubuntu-latest
|
|
10
|
-
steps:
|
|
11
|
-
- uses: actions/checkout@v3
|
|
12
|
-
- uses: pnpm/action-setup@v2
|
|
13
|
-
with:
|
|
14
|
-
version: 7
|
|
15
|
-
- uses: actions/setup-node@v3
|
|
16
|
-
with:
|
|
17
|
-
node-version: 16.x
|
|
18
|
-
cache: "pnpm"
|
|
19
|
-
|
|
20
|
-
- run: pnpm install --frozen-lockfile
|
|
21
|
-
- run: pnpm run lint && pnpm run build
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
name: Publish
|
|
2
|
-
on:
|
|
3
|
-
push:
|
|
4
|
-
branches:
|
|
5
|
-
- "main"
|
|
6
|
-
|
|
7
|
-
concurrency: ${{ github.workflow }}-${{ github.ref }}
|
|
8
|
-
|
|
9
|
-
jobs:
|
|
10
|
-
build:
|
|
11
|
-
runs-on: ubuntu-latest
|
|
12
|
-
steps:
|
|
13
|
-
- uses: actions/checkout@v3
|
|
14
|
-
- uses: pnpm/action-setup@v2
|
|
15
|
-
with:
|
|
16
|
-
version: 7
|
|
17
|
-
- uses: actions/setup-node@v3
|
|
18
|
-
with:
|
|
19
|
-
node-version: 16.x
|
|
20
|
-
cache: "pnpm"
|
|
21
|
-
|
|
22
|
-
- run: pnpm install --frozen-lockfile
|
|
23
|
-
- name: Create Release Pull Request or Publish
|
|
24
|
-
id: changesets
|
|
25
|
-
uses: changesets/action@v1
|
|
26
|
-
with:
|
|
27
|
-
publish: pnpm run build
|
|
28
|
-
env:
|
|
29
|
-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
name: Changeset Release
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
push:
|
|
5
|
-
branches:
|
|
6
|
-
- main
|
|
7
|
-
|
|
8
|
-
concurrency: ${{ github.workflow }}-${{ github.ref }}
|
|
9
|
-
|
|
10
|
-
permissions:
|
|
11
|
-
contents: write
|
|
12
|
-
pull-requests: write
|
|
13
|
-
id-token: write # For npm provenance
|
|
14
|
-
|
|
15
|
-
jobs:
|
|
16
|
-
release:
|
|
17
|
-
name: Release
|
|
18
|
-
runs-on: ubuntu-latest
|
|
19
|
-
steps:
|
|
20
|
-
- name: Checkout code
|
|
21
|
-
uses: actions/checkout@v4
|
|
22
|
-
with:
|
|
23
|
-
fetch-depth: 0
|
|
24
|
-
|
|
25
|
-
- name: Install pnpm
|
|
26
|
-
uses: pnpm/action-setup@v2
|
|
27
|
-
with:
|
|
28
|
-
version: 10.12.2
|
|
29
|
-
|
|
30
|
-
- name: Setup Node.js
|
|
31
|
-
uses: actions/setup-node@v4
|
|
32
|
-
with:
|
|
33
|
-
node-version: 20.x
|
|
34
|
-
cache: 'pnpm'
|
|
35
|
-
registry-url: 'https://registry.npmjs.org'
|
|
36
|
-
|
|
37
|
-
- name: Install dependencies
|
|
38
|
-
run: pnpm install --frozen-lockfile
|
|
39
|
-
|
|
40
|
-
- name: Create Release Pull Request or Publish to npm
|
|
41
|
-
id: changesets
|
|
42
|
-
uses: changesets/action@v1
|
|
43
|
-
with:
|
|
44
|
-
title: "chore: release package"
|
|
45
|
-
commit: "chore: release package"
|
|
46
|
-
publish: pnpm changeset publish
|
|
47
|
-
createGithubReleases: true
|
|
48
|
-
env:
|
|
49
|
-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
50
|
-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
51
|
-
NPM_CONFIG_PROVENANCE: true
|
package/.github/workflows/ci.yml
DELETED
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
name: CI
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
push:
|
|
5
|
-
branches: [ main ]
|
|
6
|
-
pull_request:
|
|
7
|
-
branches: [ main ]
|
|
8
|
-
|
|
9
|
-
jobs:
|
|
10
|
-
test:
|
|
11
|
-
name: Test on Node ${{ matrix.node-version }}
|
|
12
|
-
runs-on: ubuntu-latest
|
|
13
|
-
|
|
14
|
-
strategy:
|
|
15
|
-
matrix:
|
|
16
|
-
node-version: [20.x, 22.x, 24.x]
|
|
17
|
-
|
|
18
|
-
steps:
|
|
19
|
-
- name: Checkout code
|
|
20
|
-
uses: actions/checkout@v4
|
|
21
|
-
|
|
22
|
-
- name: Install pnpm
|
|
23
|
-
uses: pnpm/action-setup@v2
|
|
24
|
-
with:
|
|
25
|
-
version: 10.12.2
|
|
26
|
-
|
|
27
|
-
- name: Use Node.js ${{ matrix.node-version }}
|
|
28
|
-
uses: actions/setup-node@v4
|
|
29
|
-
with:
|
|
30
|
-
node-version: ${{ matrix.node-version }}
|
|
31
|
-
cache: 'pnpm'
|
|
32
|
-
|
|
33
|
-
- name: Install dependencies
|
|
34
|
-
run: pnpm install --frozen-lockfile
|
|
35
|
-
|
|
36
|
-
- name: Run linter
|
|
37
|
-
run: pnpm run lint
|
|
38
|
-
|
|
39
|
-
- name: Build package
|
|
40
|
-
run: pnpm run build
|
|
41
|
-
|
|
42
|
-
- name: Check package exports
|
|
43
|
-
run: |
|
|
44
|
-
node -e "const pkg = require('./dist/index.cjs'); console.log('CJS import successful');"
|
|
45
|
-
node -e "import('./dist/index.js').then(() => console.log('ESM import successful'));"
|
|
46
|
-
|
|
47
|
-
- name: Check TypeScript declarations
|
|
48
|
-
run: |
|
|
49
|
-
if [ ! -f "dist/index.d.ts" ]; then
|
|
50
|
-
echo "TypeScript declarations not found!"
|
|
51
|
-
exit 1
|
|
52
|
-
fi
|
|
53
|
-
|
|
54
|
-
size-check:
|
|
55
|
-
name: Bundle Size Check
|
|
56
|
-
runs-on: ubuntu-latest
|
|
57
|
-
|
|
58
|
-
steps:
|
|
59
|
-
- name: Checkout code
|
|
60
|
-
uses: actions/checkout@v4
|
|
61
|
-
|
|
62
|
-
- name: Install pnpm
|
|
63
|
-
uses: pnpm/action-setup@v2
|
|
64
|
-
with:
|
|
65
|
-
version: 10.12.2
|
|
66
|
-
|
|
67
|
-
- name: Use Node.js
|
|
68
|
-
uses: actions/setup-node@v4
|
|
69
|
-
with:
|
|
70
|
-
node-version: 22.x
|
|
71
|
-
cache: 'pnpm'
|
|
72
|
-
|
|
73
|
-
- name: Install dependencies
|
|
74
|
-
run: pnpm install --frozen-lockfile
|
|
75
|
-
|
|
76
|
-
- name: Build package
|
|
77
|
-
run: pnpm run build
|
|
78
|
-
|
|
79
|
-
- name: Check bundle size
|
|
80
|
-
run: |
|
|
81
|
-
echo "Bundle sizes:"
|
|
82
|
-
ls -lh dist/
|
|
83
|
-
|
|
84
|
-
# Warn if bundle exceeds 50KB (adjust threshold as needed)
|
|
85
|
-
size=$(node -e "console.log(require('fs').statSync('dist/index.js').size)")
|
|
86
|
-
if [ $size -gt 51200 ]; then
|
|
87
|
-
echo "⚠️ Warning: Bundle size exceeds 50KB (current: ${size} bytes)"
|
|
88
|
-
else
|
|
89
|
-
echo "✅ Bundle size OK: ${size} bytes"
|
|
90
|
-
fi
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
name: Release
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
push:
|
|
5
|
-
tags:
|
|
6
|
-
- 'v*'
|
|
7
|
-
|
|
8
|
-
permissions:
|
|
9
|
-
contents: read
|
|
10
|
-
id-token: write # For npm provenance
|
|
11
|
-
|
|
12
|
-
jobs:
|
|
13
|
-
release:
|
|
14
|
-
name: Release to npm
|
|
15
|
-
runs-on: ubuntu-latest
|
|
16
|
-
|
|
17
|
-
steps:
|
|
18
|
-
- name: Checkout code
|
|
19
|
-
uses: actions/checkout@v4
|
|
20
|
-
with:
|
|
21
|
-
fetch-depth: 0 # Needed for changelog generation
|
|
22
|
-
|
|
23
|
-
- name: Install pnpm
|
|
24
|
-
uses: pnpm/action-setup@v2
|
|
25
|
-
with:
|
|
26
|
-
version: 10.12.2
|
|
27
|
-
|
|
28
|
-
- name: Setup Node.js
|
|
29
|
-
uses: actions/setup-node@v4
|
|
30
|
-
with:
|
|
31
|
-
node-version: 20.x
|
|
32
|
-
cache: 'pnpm'
|
|
33
|
-
registry-url: 'https://registry.npmjs.org'
|
|
34
|
-
|
|
35
|
-
- name: Install dependencies
|
|
36
|
-
run: pnpm install --frozen-lockfile
|
|
37
|
-
|
|
38
|
-
- name: Run CI checks
|
|
39
|
-
run: |
|
|
40
|
-
pnpm run lint
|
|
41
|
-
pnpm run build
|
|
42
|
-
|
|
43
|
-
- name: Verify version matches tag
|
|
44
|
-
run: |
|
|
45
|
-
PACKAGE_VERSION="v$(node -p "require('./package.json').version")"
|
|
46
|
-
if [ "$PACKAGE_VERSION" != "${{ github.ref_name }}" ]; then
|
|
47
|
-
echo "Error: Package version ($PACKAGE_VERSION) doesn't match tag (${{ github.ref_name }})"
|
|
48
|
-
exit 1
|
|
49
|
-
fi
|
|
50
|
-
|
|
51
|
-
- name: Check npm access
|
|
52
|
-
run: npm whoami
|
|
53
|
-
env:
|
|
54
|
-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
55
|
-
|
|
56
|
-
- name: Publish to npm with provenance
|
|
57
|
-
run: pnpm publish --access public --no-git-checks
|
|
58
|
-
env:
|
|
59
|
-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
60
|
-
NPM_CONFIG_PROVENANCE: true
|
|
61
|
-
|
|
62
|
-
- name: Create GitHub Release
|
|
63
|
-
uses: softprops/action-gh-release@v1
|
|
64
|
-
with:
|
|
65
|
-
generate_release_notes: true
|
|
66
|
-
body: |
|
|
67
|
-
## What's Changed
|
|
68
|
-
|
|
69
|
-
See [CHANGELOG.md](https://github.com/${{ github.repository }}/blob/main/CHANGELOG.md) for details.
|
|
70
|
-
|
|
71
|
-
## Installation
|
|
72
|
-
|
|
73
|
-
```bash
|
|
74
|
-
npm install @boldvideo/bold-js@${{ github.ref_name }}
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
```bash
|
|
78
|
-
pnpm add @boldvideo/bold-js@${{ github.ref_name }}
|
|
79
|
-
```
|
|
80
|
-
|
|
81
|
-
```bash
|
|
82
|
-
yarn add @boldvideo/bold-js@${{ github.ref_name }}
|
|
83
|
-
```
|
package/CLAUDE.md
DELETED
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
# CLAUDE.md
|
|
2
|
-
|
|
3
|
-
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
|
4
|
-
|
|
5
|
-
## Project Overview
|
|
6
|
-
|
|
7
|
-
This is the Bold JavaScript SDK (`@boldvideo/bold-js`) - a TypeScript client library for interacting with the Bold Video API. The SDK provides methods for fetching videos, playlists, channel settings, and tracking analytics events.
|
|
8
|
-
|
|
9
|
-
## Common Development Commands
|
|
10
|
-
|
|
11
|
-
```bash
|
|
12
|
-
# Install dependencies
|
|
13
|
-
pnpm install
|
|
14
|
-
|
|
15
|
-
# Build the project (outputs to dist/)
|
|
16
|
-
pnpm run build
|
|
17
|
-
|
|
18
|
-
# Run type checking/linting
|
|
19
|
-
pnpm run lint
|
|
20
|
-
|
|
21
|
-
# Publish new version (uses changesets)
|
|
22
|
-
pnpm changeset
|
|
23
|
-
pnpm changeset version
|
|
24
|
-
pnpm changeset publish
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
## Architecture & Key Components
|
|
28
|
-
|
|
29
|
-
### Client Structure
|
|
30
|
-
The SDK uses a factory pattern where `createClient(apiKey)` returns an object with namespaced methods:
|
|
31
|
-
- `bold.settings()` - Fetch channel settings
|
|
32
|
-
- `bold.videos.list()` / `.get(id)` / `.search(query)` - Video operations
|
|
33
|
-
- `bold.playlists.list()` / `.get(id)` - Playlist operations
|
|
34
|
-
- `bold.trackEvent()` / `bold.trackPageView()` - Analytics tracking
|
|
35
|
-
|
|
36
|
-
### Core Files
|
|
37
|
-
- `/src/index.ts` - Main entry point, exports `createClient` and all types
|
|
38
|
-
- `/src/lib/client.ts` - Client factory that creates the Bold instance with API key auth
|
|
39
|
-
- `/src/lib/fetchers.ts` - Individual API endpoint implementations
|
|
40
|
-
- `/src/lib/tracking.ts` - Analytics event tracking with throttling
|
|
41
|
-
- `/src/lib/types.ts` - TypeScript interfaces for Video, Playlist, Settings, etc.
|
|
42
|
-
- `/src/util/throttle.ts` - Throttling utility for rate-limiting event tracking
|
|
43
|
-
|
|
44
|
-
### Build Configuration
|
|
45
|
-
- Uses `tsup` for building TypeScript to both ESM and CommonJS formats
|
|
46
|
-
- Outputs to `/dist/` with type declarations
|
|
47
|
-
- TypeScript strict mode enabled
|
|
48
|
-
- Target: ES2016
|
|
49
|
-
|
|
50
|
-
## Development Workflow
|
|
51
|
-
|
|
52
|
-
1. The project uses GitHub Actions for CI/CD:
|
|
53
|
-
- All branches run lint and build checks
|
|
54
|
-
- Main branch can publish to npm using changesets
|
|
55
|
-
|
|
56
|
-
2. When making changes:
|
|
57
|
-
- Ensure TypeScript types are properly defined
|
|
58
|
-
- Run `pnpm run lint` before committing
|
|
59
|
-
- The SDK supports both ESM and CommonJS consumers
|
|
60
|
-
|
|
61
|
-
3. API Integration:
|
|
62
|
-
- Default base URL: `https://app.boldvideo.io/api/v1/`
|
|
63
|
-
- Authentication via API key in Authorization header
|
|
64
|
-
- All API methods return promises
|
|
65
|
-
|
|
66
|
-
4. Analytics Tracking:
|
|
67
|
-
- Events are throttled to prevent API rate limiting
|
|
68
|
-
- User IDs are auto-generated for each client instance
|
|
69
|
-
- Debug mode available for development
|
|
70
|
-
|
|
71
|
-
## Important Notes
|
|
72
|
-
|
|
73
|
-
- No test framework is currently configured
|
|
74
|
-
- The SDK is designed to be lightweight with minimal dependencies (only axios)
|
|
75
|
-
- All API responses follow the type definitions in `/src/lib/types.ts`
|
|
76
|
-
- The tracking system includes automatic throttling to handle high-frequency events like video progress updates
|