@tiptap/cli 3.20.0 → 3.21.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 CHANGED
@@ -31,3 +31,45 @@ pnpm dlx @tiptap/cli add simple-editor --dry-run
31
31
  pnpm dlx @tiptap/cli add simple-editor --diff app/simple/page.tsx
32
32
  pnpm dlx @tiptap/cli info --json
33
33
  ```
34
+
35
+ ## Add Collaboration to a React editor
36
+
37
+ Run this in your React project to install Collaboration.
38
+
39
+ ```sh
40
+ pnpm dlx @tiptap/cli add --with collaboration
41
+ ```
42
+
43
+ If the CLI finds one editor, it asks before connecting it. To choose the file yourself or run the install in CI, pass `--editor`. With several candidates, the CLI lists their paths. With no editor chosen, it installs the setup files and prints the wiring steps. You can rerun the command after creating an editor.
44
+
45
+ ```sh
46
+ pnpm dlx @tiptap/cli add --with collaboration --dry-run
47
+ pnpm dlx @tiptap/cli add --with collaboration --editor src/ArticleEditor.tsx --diff src/ArticleEditor.tsx
48
+ pnpm dlx @tiptap/cli add --with collaboration --editor src/ArticleEditor.tsx
49
+ ```
50
+
51
+ The CLI puts the wrapper, hook and configuration in `tiptap-features/collaboration/` under your components directory. It uses your components alias when available, then falls back to `src/components` or `components`. Pass `--path src/editor` to choose the parent directory. A standalone install adds only the feature files and their packages. If the CLI cannot safely edit your component, it shows a patch you can adapt. If your editor sets initial content, seed the shared document once in your app.
52
+
53
+ Use `--overwrite` to refresh the feature’s source files. The CLI keeps your collaboration config, token route, and editor customizations. Preview the changes with `--overwrite --dry-run`.
54
+
55
+ The setup source is free, and previews need no account. Your package manager uses public npm for the Collaboration extension and Yjs. To download `@tiptap-pro/provider`, configure access to Tiptap's private npm registry. In an interactive install the CLI can help you sign in. To configure access in advance, run `pnpm dlx @tiptap/cli login --registry-only --write-config`. [Private registry setup](https://tiptap.dev/docs/guides/pro-extensions)
56
+
57
+ After installing, open the configuration file printed by the CLI. Set `appId` to your Document Server ID and `defaultDocumentName` to your default room. The CLI keeps your exported editor’s existing function signature. To choose a room per render, change the return line in that function to `return <CollaborativeSimpleEditor documentName={documentId} />`. Use the component name the CLI generated for your editor and a stable document ID from your app. On Next.js App Router, connect `authorizeDocument` in the generated token route to your session and document permissions. Set `TIPTAP_AUTH_ENVIRONMENT_ID` and `TIPTAP_AUTH_PRIVATE_KEY` on the server. On Vite and other frameworks, set `tokenEndpoint` to your own backend. It must authorize the requested `documentName` and return a short-lived JWT in the `token` field. [Install Collaboration](https://tiptap.dev/docs/collaboration/getting-started/install) and [authenticate a document](https://tiptap.dev/docs/collaboration/getting-started/authenticate).
58
+
59
+ To install a template and connect its editor in one step, name it. To see which features a template supports or includes, use `view`.
60
+
61
+ ```sh
62
+ pnpm dlx @tiptap/cli init simple-editor --with collaboration --framework next --name my-app
63
+ pnpm dlx @tiptap/cli add simple-editor --with collaboration
64
+ pnpm dlx @tiptap/cli view simple-editor
65
+ pnpm dlx @tiptap/cli view collaboration
66
+ pnpm dlx @tiptap/cli view --features
67
+ ```
68
+
69
+ ## Publish a feature
70
+
71
+ Define the feature once in `apps/web/registry/registry-features.ts`. Give it an ID, label, description, public registry items, integration kind, setup instructions and documentation URL. Use `frameworkItems` for framework-specific files. The registry builder publishes these definitions in `/r/features.json` with a top-level format version.
72
+
73
+ Keep source files together under a feature directory. Declare the required npm packages on the registry item and list private packages in `meta.privateNpmPackages`. Choose `files` to install files and dependencies, `editor-extension` to register a named export from the feature module, or `collaboration` to connect the shared-document wrapper. A template can opt in through `meta.editor` and `meta.featureSupport`. Mark a feature `built-in` if the template already ships it.
74
+
75
+ Run `pnpm --filter web validate:registry` and `pnpm --filter web build:registry`. Test the packed CLI against a staging registry with `TIPTAP_REGISTRY_URL`. Check discovery, preview, install and a second install before deploying. Once CLI 3.21.0 ships, adding a feature that uses these integration kinds takes a registry deploy. A new integration kind or an incompatible catalog format needs a CLI release.