captions.js 0.4.0 → 0.5.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/README.md +17 -74
- package/package.json +6 -1
package/README.md
CHANGED
|
@@ -1,92 +1,35 @@
|
|
|
1
|
-
|
|
1
|
+
> [!WARNING]
|
|
2
|
+
> This project is a work in progress.
|
|
2
3
|
|
|
3
|
-
|
|
4
|
+
# Captions.js
|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
A modern JavaScript library for adding captions to HTML5 videos with ease.
|
|
6
7
|
|
|
7
|
-
##
|
|
8
|
+
## Features
|
|
8
9
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
| `pnpm build` | Builds all packages that have a `build` script. |
|
|
14
|
-
| `pnpm clean` | Cleans build artifacts if a `clean` script is defined. |
|
|
10
|
+
- **Easy Integration**: Simple API to add captions to your videos.
|
|
11
|
+
- **Customizable Styles**: Fully customizable caption styles via configurations.
|
|
12
|
+
- **Multiple Formats**: Supports various caption formats including WebVTT and SRT.
|
|
13
|
+
- **Responsive Design**: Captions adapt to different screen sizes and orientations.
|
|
15
14
|
|
|
16
|
-
|
|
15
|
+
## Installation
|
|
17
16
|
|
|
18
|
-
|
|
17
|
+
To install Captions.js, use npm or yarn:
|
|
19
18
|
|
|
20
|
-
## 📦 Package: `@captions/core`
|
|
21
|
-
|
|
22
|
-
| Script | Command | Description |
|
|
23
|
-
| ------- | ----------------------------------------- | ------------------------------------------------------------------------ |
|
|
24
|
-
| `build` | `pnpm --filter @captions/core run build` | Builds the library using `tsup` (CJS, ESM, and TypeScript declarations). |
|
|
25
|
-
| `clean` | `pnpm --filter @captions/core run clean` | Deletes the build folder (`dist`). |
|
|
26
|
-
|
|
27
|
-
**Example:**
|
|
28
19
|
```bash
|
|
29
|
-
|
|
20
|
+
npm install captions.js
|
|
30
21
|
```
|
|
31
22
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
## 🎨 Demo App: `captions-demo`
|
|
23
|
+
or
|
|
35
24
|
|
|
36
|
-
| Script | Command | Description |
|
|
37
|
-
| --------- | --------------------------------------- | ------------------------------------------------------------------ |
|
|
38
|
-
| `dev` | `pnpm --filter captions-demo run dev` | Runs the demo locally with Vite (default: `http://localhost:5173`). |
|
|
39
|
-
| `build` | `pnpm --filter captions-demo run build` | Builds the demo for production into the `dist` folder. |
|
|
40
|
-
| `preview` | `pnpm --filter captions-demo run preview` | Serves the built demo locally for preview. |
|
|
41
|
-
|
|
42
|
-
**Example:**
|
|
43
25
|
```bash
|
|
44
|
-
|
|
26
|
+
yarn add captions.js
|
|
45
27
|
```
|
|
46
28
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
## 📚 Storybook: `captions-storybook`
|
|
50
|
-
|
|
51
|
-
| Script | Command | Description |
|
|
52
|
-
| ----------------- | ------------------------------------------------- | ---------------------------------------------------------- |
|
|
53
|
-
| `storybook` | `pnpm --filter captions-storybook run storybook` | Runs Storybook locally with Vite (`http://localhost:6006`). |
|
|
54
|
-
| `build-storybook` | `pnpm --filter captions-storybook run build-storybook` | Builds a static Storybook site into `storybook-static`. |
|
|
55
|
-
| `deploy` | `pnpm --filter captions-storybook run deploy` | Builds and deploys Storybook to GitHub Pages. |
|
|
29
|
+
For development see [DEVELOPMENT.md](./DEVELOPMENT.md).
|
|
56
30
|
|
|
57
|
-
**Example:**
|
|
58
31
|
```bash
|
|
59
|
-
|
|
32
|
+
yarn add captions.js
|
|
60
33
|
```
|
|
61
34
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
## ⚡ Tips & Recommendations
|
|
65
|
-
|
|
66
|
-
1. **Targeted Scripts:** Always run scripts using `pnpm --filter` to ensure you're using the correct local binaries for that package.
|
|
67
|
-
```bash
|
|
68
|
-
pnpm --filter <package> run <script>
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
2. **Troubleshooting:** If you encounter issues after updating packages, run this sequence to perform a clean reinstall:
|
|
72
|
-
```bash
|
|
73
|
-
# Clean up all node_modules and lockfile
|
|
74
|
-
rm -rf node_modules packages/*/node_modules
|
|
75
|
-
rm pnpm-lock.yaml
|
|
76
|
-
|
|
77
|
-
# Prune the pnpm store and reinstall
|
|
78
|
-
pnpm store prune
|
|
79
|
-
pnpm install
|
|
80
|
-
```
|
|
81
|
-
|
|
82
|
-
3. **Global Build Script (Optional):** For convenience, you can add a global `build` script to the root `package.json` to build the entire monorepo with one command.
|
|
83
|
-
|
|
84
|
-
```json
|
|
85
|
-
"scripts": {
|
|
86
|
-
"build": "pnpm --filter @captions/core run build && pnpm --filter captions-demo run build && pnpm --filter captions-storybook run build-storybook"
|
|
87
|
-
}
|
|
88
|
-
```
|
|
89
|
-
Then, you can simply run:
|
|
90
|
-
```bash
|
|
91
|
-
pnpm run build
|
|
92
|
-
```
|
|
35
|
+
For development see [DEVELOPMENT.md](./DEVELOPMENT.md).
|
package/package.json
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "captions.js",
|
|
3
|
+
"version": "0.5.0",
|
|
3
4
|
"private": false,
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/maskin25/captions.js"
|
|
9
|
+
},
|
|
4
10
|
"description": "A cross-platform captions engine for client- and server-side video processing — ideal for AI video tools, editors, and streaming apps",
|
|
5
11
|
"keywords": [
|
|
6
12
|
"captions",
|
|
@@ -14,7 +20,6 @@
|
|
|
14
20
|
"client-side",
|
|
15
21
|
"server-side"
|
|
16
22
|
],
|
|
17
|
-
"version": "0.4.0",
|
|
18
23
|
"main": "dist/index.js",
|
|
19
24
|
"module": "dist/index.mjs",
|
|
20
25
|
"types": "dist/index.d.ts",
|