captions.js 0.3.0 → 0.4.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 +92 -0
- package/package.json +13 -1
package/README.md
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# 📖 captions.js Monorepo Scripts Cheat Sheet
|
|
2
|
+
|
|
3
|
+
This cheat sheet summarizes all the key scripts for working with the `captions.js` monorepo. Use `pnpm` to run scripts in individual packages.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 🌟 General `pnpm` Commands
|
|
8
|
+
|
|
9
|
+
| Command | Description |
|
|
10
|
+
| ------------------------------------------- | ------------------------------------------------------------ |
|
|
11
|
+
| `pnpm install` | Installs all dependencies for all packages in the monorepo. |
|
|
12
|
+
| `pnpm --filter <package> run <script>` | Runs a script `<script>` for a specific package `<package>`. |
|
|
13
|
+
| `pnpm build` | Builds all packages that have a `build` script. |
|
|
14
|
+
| `pnpm clean` | Cleans build artifacts if a `clean` script is defined. |
|
|
15
|
+
|
|
16
|
+
> **Note:** `<package>` refers to the package name in `packages/`, e.g., `@captions/core`, `captions-demo`, or `captions-storybook`.
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
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
|
+
```bash
|
|
29
|
+
pnpm --filter @captions/core run build
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## 🎨 Demo App: `captions-demo`
|
|
35
|
+
|
|
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
|
+
```bash
|
|
44
|
+
pnpm --filter captions-demo run dev
|
|
45
|
+
```
|
|
46
|
+
|
|
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. |
|
|
56
|
+
|
|
57
|
+
**Example:**
|
|
58
|
+
```bash
|
|
59
|
+
pnpm --filter captions-storybook run storybook
|
|
60
|
+
```
|
|
61
|
+
|
|
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
|
+
```
|
package/package.json
CHANGED
|
@@ -2,7 +2,19 @@
|
|
|
2
2
|
"name": "captions.js",
|
|
3
3
|
"private": false,
|
|
4
4
|
"description": "A cross-platform captions engine for client- and server-side video processing — ideal for AI video tools, editors, and streaming apps",
|
|
5
|
-
"
|
|
5
|
+
"keywords": [
|
|
6
|
+
"captions",
|
|
7
|
+
"subtitles",
|
|
8
|
+
"video",
|
|
9
|
+
"streaming",
|
|
10
|
+
"transcription",
|
|
11
|
+
"AI",
|
|
12
|
+
"machine learning",
|
|
13
|
+
"ffmpeg",
|
|
14
|
+
"client-side",
|
|
15
|
+
"server-side"
|
|
16
|
+
],
|
|
17
|
+
"version": "0.4.0",
|
|
6
18
|
"main": "dist/index.js",
|
|
7
19
|
"module": "dist/index.mjs",
|
|
8
20
|
"types": "dist/index.d.ts",
|