This commit is contained in:
frostime 2023-05-19 21:24:51 +08:00
parent 86fc5b3595
commit ba8e431dec
4 changed files with 171 additions and 83 deletions

View file

@ -1,6 +1,8 @@
# SiYuan plugin sample with vite and svelte
[中文版](./README_zh_CN.md)
1. Using vite for packaging
2. Use soft linking instead of putting the project into the plugins directory program development
3. Built-in support for the svelte framework
@ -9,30 +11,30 @@
## Get started
1. Make a copy of this repo as a template with the Use this template button, please note that the repo name must be the same as the plugin name, the default branch must be main
1. Make a copy of this repo as a template with the `Use this template` button, please note that the repo name must be the same as the plugin name, the default branch must be `main`
2. Clone your repo to a local development folder at any place
- Notice: we **don't recommand** you to place the folder under your {workspace}/data/plugins/ folder.
- Notice: we **don't recommand** you to place the folder under your `{workspace}/data/plugins/` folder.
3. Create development soft links
- It is recommended to create a symbolic link between your development directory and the plugins directory.
- If you have python environment in you device, run the command `python scripts/make_dev_link.py <plugin_dir>` script, `<plugin_dir>` is the absolute path to the plugins directory, e.g.
- If you have python environment in you device, run the command `python scripts/make_dev_link.py <plugin_dir>`, `<plugin_dir>` is the absolute path to the plugins directory, e.g.
```powershell
>>> sudo python . \scripts\make_dev_link.py "H:\SiYuanDevSpace\data\plugins"
Symlink created: H:\SiYuanDevSpace\data\plugins\plugin-sample
```
- You may need to run it as administration, normal windows users can first open the command line as administrator and then run it. Or if you have scoop installed in you windows system, you install `scoop install sudo` and run with sudo.
- If you haven't installed python in your environment, you can also manually make a soft link, reference to [mklink](https://learn.microsoft.com/windows-server/administration/windows-commands/mklink)
- If you haven't installed python in your environment, you can also manually make a soft link
- Create directory `dev` in you workspace
- Window user use [mklink](https://learn.microsoft.com/windows-server/administration/windows-commands/mklink); and unix user use ln command
- Notice: make sure that the name of soft link is same as the name in your plugin.json
- As the generated softlink is the same as the plugin name, **do not put the project directory under plugins** (this is contrary to the webpack version)
4. Develope
- Install NodeJS and pnpm, then run pnpm i in the command line under your repo folder
- Execute pnpm run dev for real-time compilation
- Open SiYuan marketplace and enable plugin in downloaded tab
4. Install NodeJS and pnpm, then run pnpm i in the command line under your repo folder
5. Execute pnpm run dev for real-time compilation
6. Open SiYuan marketplace and enable plugin in downloaded tab
## I18n