Initial commit
This commit is contained in:
commit
b6089a75ed
8 changed files with 118 additions and 0 deletions
41
.github/workflows/deploy.yml
vendored
Normal file
41
.github/workflows/deploy.yml
vendored
Normal file
|
|
@ -0,0 +1,41 @@
|
||||||
|
name: Build and deploy
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [main]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
deploy:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Setup Node
|
||||||
|
uses: actions/setup-node@v3
|
||||||
|
with:
|
||||||
|
node-version: "18"
|
||||||
|
|
||||||
|
- name: Deps
|
||||||
|
run: |
|
||||||
|
npm install --global pnpm
|
||||||
|
pnpm i
|
||||||
|
|
||||||
|
- name: Build plugin(s)
|
||||||
|
run: pnpm lune ci
|
||||||
|
|
||||||
|
- name: Copy additional files
|
||||||
|
run: |
|
||||||
|
cp README.md dist/README.md
|
||||||
|
printf -- "---\npermalink: /404.html\n---\n" > dist/404.md
|
||||||
|
printf -- "> **Note:** You accessed a link that returned a 404, probably by clicking one of the plugin links. You're supposed to copy the link address and add it into shelter.\n\n" >> dist/404.md
|
||||||
|
cat README.md >> dist/404.md
|
||||||
|
|
||||||
|
# Documentation: https://github.com/peaceiris/actions-gh-pages
|
||||||
|
- name: Deploy to GitHub Pages
|
||||||
|
uses: peaceiris/actions-gh-pages@v3
|
||||||
|
with:
|
||||||
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
publish_dir: ./dist
|
||||||
|
# Makes it so the md files in the previous step get processed by GitHub Pages
|
||||||
|
enable_jekyll: true
|
||||||
4
.gitignore
vendored
Normal file
4
.gitignore
vendored
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
node_modules
|
||||||
|
dist
|
||||||
|
.pnpm-debug.log
|
||||||
|
.idea
|
||||||
37
README.md
Normal file
37
README.md
Normal file
|
|
@ -0,0 +1,37 @@
|
||||||
|
# [Your name here]'s shelter plugins
|
||||||
|
If you're reading this you should either change this README,
|
||||||
|
or you should run `npx degit uwu/shelter-template shelter-plugins`!
|
||||||
|
|
||||||
|
## Getting started
|
||||||
|
You should be using [pnpm](https://pnpm.io/) with this template ideally.
|
||||||
|
|
||||||
|
To install the dependencies and debug `hello-world` run:
|
||||||
|
```sh
|
||||||
|
pnpm i
|
||||||
|
pnpm lune dev plugins/hello-world
|
||||||
|
```
|
||||||
|
|
||||||
|
Ensure that Lune Dev Mode is enabled in Discord so that lune can connect to it.
|
||||||
|
|
||||||
|
Now you can start debugging. The plugin will automatically reload after every change.
|
||||||
|
|
||||||
|
## Installing
|
||||||
|
To then install your finished plugin in shelter you can either rely on GitHub pages and it's workflow or you can build and host them here temporarily.
|
||||||
|
|
||||||
|
### Building locally
|
||||||
|
To build and host your plugins locally run:
|
||||||
|
```sh
|
||||||
|
pnpm lune ci
|
||||||
|
npx http-server dist/ --cors
|
||||||
|
```
|
||||||
|
Then you can install your plugin in shelter with this URL `http://localhost:8080/hello-world`.
|
||||||
|
|
||||||
|
### Publishing via GitHub
|
||||||
|
If you have published this repo on GitHub the plugins will be built after every commit.
|
||||||
|
|
||||||
|
For the GitHub action to run flawlessly, make sure you have the following setting enabled:
|
||||||
|
`Repo settings > Actions > General > Workflow permissions > Read and write permissions`
|
||||||
|
|
||||||
|
And for it to be hosted correctly you need to configure the `gh-pages` branch after its been created by the GitHub action. You can do this in `Repo settings > Pages > Branch`.
|
||||||
|
|
||||||
|
If this worked, you will be able to install the plugin via `https://<username>.github.io/<repo>/hello-world`.
|
||||||
9
lune.config.js
Normal file
9
lune.config.js
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
// Welcome to your Lune config file!
|
||||||
|
// You can view documentation on Lune here:
|
||||||
|
// https://github.com/uwu/shelter/tree/main/packages/lune
|
||||||
|
|
||||||
|
import { defineConfig } from "@uwu/lune";
|
||||||
|
|
||||||
|
export default defineConfig({
|
||||||
|
// configure lune here
|
||||||
|
});
|
||||||
8
package.json
Normal file
8
package.json
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
{
|
||||||
|
"devDependencies": {
|
||||||
|
"@uwu/lune": "^1.2.1",
|
||||||
|
"@uwu/shelter-defs": "^1.1.0"
|
||||||
|
},
|
||||||
|
"type": "module",
|
||||||
|
"workspaces": ["plugins/*"]
|
||||||
|
}
|
||||||
12
plugins/hello-world/index.jsx
Normal file
12
plugins/hello-world/index.jsx
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
const {
|
||||||
|
util: { log }
|
||||||
|
} = shelter;
|
||||||
|
|
||||||
|
export function onLoad() {
|
||||||
|
// you can safely run onLoad actions at the top level!
|
||||||
|
log("Hello, World from shelter!")
|
||||||
|
}
|
||||||
|
|
||||||
|
export function onUnload() {
|
||||||
|
log("Goodbye, World from shelter!")
|
||||||
|
}
|
||||||
5
plugins/hello-world/plugin.json
Normal file
5
plugins/hello-world/plugin.json
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"name": "hello-world",
|
||||||
|
"author": "Your name here",
|
||||||
|
"description": "An example shelter plugin"
|
||||||
|
}
|
||||||
2
pnpm-workspace.yaml
Normal file
2
pnpm-workspace.yaml
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
packages:
|
||||||
|
- plugins/*
|
||||||
Loading…
Add table
Add a link
Reference in a new issue