📝 | Fix documentation... again.
This commit is contained in:
@@ -10,7 +10,7 @@ This guide walks you through hosting the built plugin files using NGINX on your
|
|||||||
|
|
||||||
## Step 1: Prepare the Plugin Files
|
## Step 1: Prepare the Plugin Files
|
||||||
|
|
||||||
First, build the plugins locally using Lune:
|
First, build the plugins and static site using Lune:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Install pnpm if you haven't already
|
# Install pnpm if you haven't already
|
||||||
@@ -19,22 +19,31 @@ npm install -g pnpm
|
|||||||
# Install dependencies
|
# Install dependencies
|
||||||
pnpm install
|
pnpm install
|
||||||
|
|
||||||
# Build the plugins
|
# Build plugins and generate static website
|
||||||
pnpm lune ci
|
|
||||||
```
|
|
||||||
|
|
||||||
This creates the built plugin files in the `dist/` directory. Each plugin gets a folder matching its name (e.g., `dist/gpt-unslothed/`), containing:
|
|
||||||
|
|
||||||
- `plugin.js` — the bundled plugin code (all JSX/JS sources are bundled into a single file)
|
|
||||||
- `plugin.json` — the plugin manifest
|
|
||||||
|
|
||||||
Optionally, build the static website (SSG) for plugin documentation pages:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Build the static website (includes plugin pages and index)
|
|
||||||
pnpm lune ssg ci
|
pnpm lune ssg ci
|
||||||
```
|
```
|
||||||
|
|
||||||
|
The `dist/` directory contains:
|
||||||
|
|
||||||
|
```
|
||||||
|
dist/
|
||||||
|
├── index.html # Plugin listing page
|
||||||
|
├── styles.css # Shared stylesheet
|
||||||
|
└── gpt-unslothed/
|
||||||
|
├── index.html # Plugin documentation page
|
||||||
|
├── plugin.js # Bundled plugin code
|
||||||
|
└── plugin.json # Plugin manifest
|
||||||
|
```
|
||||||
|
|
||||||
|
Lune SSG (Static Site Generator) produces:
|
||||||
|
- `index.html` — a listing page for all plugins in your monorepo
|
||||||
|
- `<plugin-name>/index.html` — individual documentation pages for each plugin
|
||||||
|
- `plugin.js` — the bundled plugin code (all JSX/JS sources bundled into a single file)
|
||||||
|
- `plugin.json` — the plugin manifest
|
||||||
|
- `styles.css` — the shared stylesheet
|
||||||
|
|
||||||
|
**Note:** To build only the plugin bundles (without the static website), run `pnpm lune ci` instead.
|
||||||
|
|
||||||
## Step 2: Set Up the Web Directory
|
## Step 2: Set Up the Web Directory
|
||||||
|
|
||||||
Create a directory for the static files:
|
Create a directory for the static files:
|
||||||
@@ -65,17 +74,11 @@ server {
|
|||||||
root /var/www/shelter-plugins;
|
root /var/www/shelter-plugins;
|
||||||
index index.html;
|
index index.html;
|
||||||
|
|
||||||
# Serve plugin files (JS and JSON)
|
# Serve plugin directories (each plugin has its own page and files)
|
||||||
location /gpt-unslothed {
|
location /gpt-unslothed {
|
||||||
try_files $uri $uri/ =404;
|
try_files $uri $uri/ =404;
|
||||||
}
|
}
|
||||||
|
|
||||||
# Serve preview images
|
|
||||||
location /previews {
|
|
||||||
default_type image/png;
|
|
||||||
try_files $uri $uri/ =404;
|
|
||||||
}
|
|
||||||
|
|
||||||
# Catch-all for 404
|
# Catch-all for 404
|
||||||
location = /404.html {
|
location = /404.html {
|
||||||
internal;
|
internal;
|
||||||
@@ -91,8 +94,8 @@ server {
|
|||||||
### Configuration Notes
|
### Configuration Notes
|
||||||
|
|
||||||
- Change `plugins.your-domain.com` to your actual domain or IP address
|
- Change `plugins.your-domain.com` to your actual domain or IP address
|
||||||
- The `try_files` directive lets NGINX auto-detect the correct MIME type for each file
|
- The `try_files` directive lets NGINX auto-detect the correct MIME type for each file (HTML, CSS, JS, JSON)
|
||||||
- The configuration serves plugins from paths like `http://plugins.your-domain.com/gpt-unslothed/`
|
- Each plugin directory is served from its own URL path (e.g., `http://plugins.your-domain.com/gpt-unslothed/`)
|
||||||
|
|
||||||
## Step 4: Enable the Site
|
## Step 4: Enable the Site
|
||||||
|
|
||||||
@@ -109,7 +112,9 @@ sudo systemctl reload nginx
|
|||||||
|
|
||||||
## Step 5: Use in Shelter
|
## Step 5: Use in Shelter
|
||||||
|
|
||||||
In Shelter, add the plugin using the URL:
|
### Installing plugins
|
||||||
|
|
||||||
|
In Shelter, add the plugin using the plugin manifest URL:
|
||||||
|
|
||||||
```
|
```
|
||||||
http://plugins.your-domain.com/gpt-unslothed/plugin.json
|
http://plugins.your-domain.com/gpt-unslothed/plugin.json
|
||||||
@@ -121,6 +126,24 @@ Or if using HTTPS (recommended):
|
|||||||
https://plugins.your-domain.com/gpt-unslothed/plugin.json
|
https://plugins.your-domain.com/gpt-unslothed/plugin.json
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Viewing the plugin page
|
||||||
|
|
||||||
|
Visiting the plugin directory URL serves the documentation page:
|
||||||
|
|
||||||
|
```
|
||||||
|
http://plugins.your-domain.com/gpt-unslothed/
|
||||||
|
```
|
||||||
|
|
||||||
|
This displays the SSG-generated plugin page with a copy-to-clipboard button for the plugin URL.
|
||||||
|
|
||||||
|
### Viewing the index page
|
||||||
|
|
||||||
|
The main plugin listing page is served at:
|
||||||
|
|
||||||
|
```
|
||||||
|
http://plugins.your-domain.com/
|
||||||
|
```
|
||||||
|
|
||||||
## Optional: Set Up HTTPS with Let's Encrypt
|
## Optional: Set Up HTTPS with Let's Encrypt
|
||||||
|
|
||||||
Install Certbot and get an SSL certificate:
|
Install Certbot and get an SSL certificate:
|
||||||
@@ -146,12 +169,8 @@ To make updates easier, you can create a simple deployment script:
|
|||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
# Build plugins
|
# Build plugins and static website
|
||||||
echo "Building plugins..."
|
echo "Building plugins and static website..."
|
||||||
pnpm lune ci
|
|
||||||
|
|
||||||
# Build static website (optional, for documentation pages)
|
|
||||||
echo "Building static website..."
|
|
||||||
pnpm lune ssg ci
|
pnpm lune ssg ci
|
||||||
|
|
||||||
# Copy files
|
# Copy files
|
||||||
@@ -171,15 +190,18 @@ chmod +x deploy.sh
|
|||||||
./deploy.sh
|
./deploy.sh
|
||||||
```
|
```
|
||||||
|
|
||||||
## File Structure
|
## Server File Structure
|
||||||
|
|
||||||
After deployment, your server should look like this:
|
After deployment, your server should look like this:
|
||||||
|
|
||||||
```
|
```
|
||||||
/var/www/shelter-plugins/
|
/var/www/shelter-plugins/
|
||||||
|
├── index.html
|
||||||
|
├── styles.css
|
||||||
└── gpt-unslothed/
|
└── gpt-unslothed/
|
||||||
├── plugin.json
|
├── index.html
|
||||||
└── plugin.js
|
├── plugin.js
|
||||||
|
└── plugin.json
|
||||||
```
|
```
|
||||||
|
|
||||||
## Troubleshooting
|
## Troubleshooting
|
||||||
|
|||||||
Reference in New Issue
Block a user