Consistent with siyuan/plugin-sample.
- Use Vite for packaging
- Use Vue3 for development
- Provides a github action template to automatically generate package.zip and upload to new release
- Provides a script to auto create tag and release. link
- Use the
Use the template
button to make a copy of this repo as template.
Warning
That the repository name should match the plugin name, and the default branch must be main
.
-
Use
git clone
to clone the copied repo to your computer. -
Use
pnpm i
to install the dependencies. -
Copy the
.env.example
file as.env
, set theVITE_SIYUAN_WORKSPACE_PATH
to your SiYuan workspace.
Tip
If you don't like build the project into your workspace, you can use Symbolic Link
to link the folder.
Set VITE_DEV_DIST_DIR
to any folder, and use Symbolic Link
to link siyuan_workspace/data/plugins/your_plugin_name
to VITE_DEV_DIST_DIR
.
-
Use
pnpm dev
to run the project. If successed, you will find the plugin inSiyuan - Settings - Marketplace
, named asplugin-sample-vite-vue
. -
Enable the plugin, and check the
App.vue
file to start your development.This file contains some example codes.
Tip
More plugin code examples, please check siyuan/plugin-sample/src/index.ts
- You can create a new tag, use your new version number as the
Tag version
in your local. - Then push the tag to Github. The Github Action will create a new Release for you.
Tip
This template provided a script to auto create tag and release. You can use `pnpm release` to create a patch version.You can add --mode=manual|patch|minor|major
arg to set release mode, or run with arg like pnpm release:manual
.
All the scripts please see the package.json
file.
The github action is included in this sample, you can use it to publish your new realse to marketplace automatically:
- In your repo setting page
https://github.com/OWNER/REPO/settings/actions
, down to Workflow Permissions and open the configuration like this:
- Push a tag in the format
v*
and github will automatically create a new release with new bulit package.zip - By default, it will only publish a pre-release, if you don't think this is necessary, change the settings in release.yml
- name: Release
uses: ncipollo/release-action@v1
with.
allowUpdates: true
artifactErrorsFailBuild: true
artifacts: 'package.zip'
token: ${{ secrets.GITHUB_TOKEN }}
prerelease: true # change this to false
- Use
pnpm build
to generatepackage.zip
- Create a new Github release using your new version number as the "Tag version". See here for an example: https://github.com/siyuan-note/plugin-sample/releases
- Upload the file package.zip as binary attachments
- Publish the release
Note
If it is the first release, please create a pull request to the Community Bazaar repository and modify the plugins.json file in it. This file is the index of all community plugin repositories, the format is:
{
"repos": [
"username/reponame"
]
}
More other plugin info, please check in siyuan/plugin-sample.