commentation 0.1.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 +63 -0
- package/dist/embed.js +243 -0
- package/package.json +39 -0
- package/vite-plugin-commentation.ts +399 -0
package/README.md
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# commentation
|
|
2
|
+
|
|
3
|
+
Pin-based contextual comments overlay for websites. Local-first, sync via Git.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install commentation
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Setup
|
|
12
|
+
|
|
13
|
+
### 1. Add the Vite plugin
|
|
14
|
+
|
|
15
|
+
**vite.config.ts:**
|
|
16
|
+
```ts
|
|
17
|
+
import { defineConfig } from "vite";
|
|
18
|
+
import react from "@vitejs/plugin-react";
|
|
19
|
+
import { commentationPlugin } from "commentation";
|
|
20
|
+
|
|
21
|
+
export default defineConfig({
|
|
22
|
+
plugins: [react(), commentationPlugin()],
|
|
23
|
+
});
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### 2. Add the script tag
|
|
27
|
+
|
|
28
|
+
**index.html** (before `</body>`):
|
|
29
|
+
```html
|
|
30
|
+
<script src="/__commentation__/embed.js" data-project-id="my-project" type="module"></script>
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
The plugin serves the embed at `/__commentation__/embed.js` automatically. No need to copy files.
|
|
34
|
+
|
|
35
|
+
### 3. Done
|
|
36
|
+
|
|
37
|
+
Comments are written to `.commentation/data.json` at your project root. Commit and push to sync with your team.
|
|
38
|
+
|
|
39
|
+
## Usage
|
|
40
|
+
|
|
41
|
+
1. Run your dev server (`npm run dev`)
|
|
42
|
+
2. Click the 💬 button in the bottom-right
|
|
43
|
+
3. Turn on comment mode and click anywhere on the page to add a pin
|
|
44
|
+
4. Use the sidebar to view threads, reply, resolve, and assign
|
|
45
|
+
|
|
46
|
+
## Production
|
|
47
|
+
|
|
48
|
+
For production builds, copy the embed to your public folder:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
cp node_modules/commentation/dist/embed.js public/
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Then use:
|
|
55
|
+
```html
|
|
56
|
+
<script src="/embed.js" data-project-id="my-project"></script>
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Without the plugin in production, comments fall back to in-memory storage (won't persist). Use the plugin in dev for full functionality.
|
|
60
|
+
|
|
61
|
+
## License
|
|
62
|
+
|
|
63
|
+
MIT
|