This commit is contained in:
Zef Hemel
2023-08-22 10:36:42 +02:00
parent 211e9f892c
commit d289d96f68
4 changed files with 26 additions and 40 deletions

View File

@@ -1,22 +1,10 @@
# SilverBullet plug for saying hello to the user
# SilverBullet plug template
A well behaved plug that will greet your users.
## Wait, SilverBullet?
If you don't know what it is, check its [webpage](https://silverbullet.md), but if
you want me to spoil the fun: it is an extensible note taking app with markdown and plain files at its core
(well... there is a bit of magic in there too, but what good it would be without a little magic?)
Insert your plug description here
## Build
To build this plug, make sure you have `plugos-bundle` installed. If not, be sure to have [Deno](https://deno.land) installed first, then run:
```shell
deno install -f -A --unstable --importmap https://deno.land/x/silverbullet/import_map.json https://deno.land/x/silverbullet/plugos/bin/plugos-bundle.ts
```
After this, build the plug with
To build this plug, make sure you have [SilverBullet installed](https://silverbullet.md/Install). Then, build the plug with:
```shell
deno task build
@@ -28,22 +16,19 @@ Or to watch for changes and rebuild automatically
deno task watch
```
Then, load the locally built plug, add it to your `PLUGS` note with an absolute path, for instance:
Then, copy the resulting `.plug.js` file into your space's `_plug` folder. Or build and copy in one command:
```
- file:/Users/you/path/to/hello.plug.json
```shell
deno task build && cp *.plug.js /my/space/_plug/
```
And run the `Plugs: Update` command in SilverBullet.
SilverBullet will automatically sync and load the new version of the plug (or speed up this process by running the {[Sync: Now]} command).
## Installation
If you would like to install this plug straight from Github, make sure you have the `.json` file committed to the repo and simply add
If you would like to install this plug straight from Github, make sure you have the `.js` file committed to the repo and simply add
```
- github:user/plugname/plugname.plug.json
- github:user/plugname/plugname.plug.js
```
to your `PLUGS` file, run `Plugs: Update` command and off you go!
## What's with all that Lone Ranger quotes
Don't you know that the [Lone Ranger used silver bullets to solve all the problems](https://en.wikipedia.org/wiki/Silver_bullet#Lone_Ranger)?

View File

@@ -1,7 +1,19 @@
{
"importMap": "import_map.json",
"tasks": {
"build": "silverbullet plug:compile --importmap import_map.json hello.plug.yaml",
"watch": "silverbullet plug:compile -w --importmap import_map.json hello.plug.yaml"
"build": "silverbullet plug:compile hello.plug.yaml",
"watch": "silverbullet plug:compile hello.plug.yaml -w"
},
"lint": {
"rules": {
"exclude": ["no-explicit-any"]
}
},
"fmt": {
"exclude": [
"*.md",
"**/*.md",
"*.plug.js"
]
}
}

View File

@@ -1,14 +1,5 @@
import { editor } from "$sb/silverbullet-syscall/mod.ts";
const loneRangerQuotes = [
"Hi-Yo! Silver",
"Hi-Yo! Silver! Away!",
"Kemo Sabe",
"Get-um up, Scout!",
];
export async function helloWorld() {
await editor.flashNotification(
loneRangerQuotes[Math.floor(Math.random() * loneRangerQuotes.length)],
);
await editor.flashNotification("Hello world!");
}

View File

@@ -1,7 +1,5 @@
{
"imports": {
"$sb/": "https://deno.land/x/silverbullet@0.1.2/plug-api/",
"handlebars": "https://esm.sh/handlebars",
"yaml": "https://deno.land/std/encoding/yaml.ts"
"$sb/": "https://deno.land/x/silverbullet/plug-api/"
}
}