nodebb-plugin-fab-cards 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/.github/workflows/publish.yml +21 -0
- package/README.md +52 -0
- package/data/cards-index.json +14358 -0
- package/docker-compose.yml +50 -0
- package/library.js +135 -0
- package/package.json +32 -0
- package/plugin.json +18 -0
- package/public/css/style.css +24 -0
- package/public/lib/client.js +121 -0
- package/scripts/build-card-index.js +103 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
name: Publish Package to npmjs
|
|
2
|
+
on:
|
|
3
|
+
release:
|
|
4
|
+
types: [published]
|
|
5
|
+
jobs:
|
|
6
|
+
build:
|
|
7
|
+
runs-on: ubuntu-latest
|
|
8
|
+
permissions:
|
|
9
|
+
contents: read
|
|
10
|
+
id-token: write
|
|
11
|
+
steps:
|
|
12
|
+
- uses: actions/checkout@v6
|
|
13
|
+
# Setup .npmrc file to publish to npm
|
|
14
|
+
- uses: actions/setup-node@v6
|
|
15
|
+
with:
|
|
16
|
+
node-version: "20.x"
|
|
17
|
+
registry-url: "https://registry.npmjs.org"
|
|
18
|
+
- run: npm ci
|
|
19
|
+
- run: npm publish --provenance --access public
|
|
20
|
+
env:
|
|
21
|
+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
package/README.md
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# nodebb-plugin-fab-cards
|
|
2
|
+
|
|
3
|
+
A NodeBB plugin that automatically detects mentions of Flesh and Blood card names in posts, converts them into links to the official FAB card database, and shows a card image preview on hover/touch.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- Detects known card names in parsed post content
|
|
8
|
+
- Converts matches to links such as `https://cards.fabtcg.com/card/command-and-conquer-1/`
|
|
9
|
+
- Opens links in a new tab
|
|
10
|
+
- Shows preview image on hover (desktop) and first touch (mobile)
|
|
11
|
+
- Uses a static generated card index (`data/cards-index.json`) for fast runtime lookups
|
|
12
|
+
|
|
13
|
+
## Card data generation
|
|
14
|
+
|
|
15
|
+
The plugin uses:
|
|
16
|
+
|
|
17
|
+
- API endpoint: `https://cards.fabtcg.com/api/search/v1/cards/?`
|
|
18
|
+
- Build script: `scripts/build-card-index.js`
|
|
19
|
+
|
|
20
|
+
Generate/update the card index:
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
npm install
|
|
24
|
+
npm run build:cards
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Installation in NodeBB
|
|
28
|
+
|
|
29
|
+
In your plugin folder:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
npm link
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
In your NodeBB folder:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
npm link nodebb-plugin-fab-cards
|
|
39
|
+
./nodebb build
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Then activate `FAB Cards Auto-Link` in ACP (`/admin/extend/plugins`).
|
|
43
|
+
|
|
44
|
+
## Local development NodeBB setup
|
|
45
|
+
|
|
46
|
+
A local setup guide is included in [dev/README.md](dev/README.md).
|
|
47
|
+
|
|
48
|
+
## Notes
|
|
49
|
+
|
|
50
|
+
- The parser only transforms posts for `type=default` rendering.
|
|
51
|
+
- Existing links/code blocks are ignored to avoid corrupting content.
|
|
52
|
+
- Re-run `npm run build:cards` periodically to refresh card data.
|