Skip to content

SiYuan plugin sample with vite and vue

License

Notifications You must be signed in to change notification settings

siyuan-note/plugin-sample-vite-vue

Repository files navigation

Siyuan Plugin Template - Vite & Vue3

简体中文

Consistent with siyuan/plugin-sample.

  1. Use Vite for packaging
  2. Use Vue3 for development
  3. Provides a github action template to automatically generate package.zip and upload to new release
  4. Provides a script to auto create tag and release. link

Note

Before your start, you need install NodeJS and pnpm first.

Get started

  1. 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.

  1. Use git clone to clone the copied repo to your computer.

  2. Use pnpm i to install the dependencies.

  3. Copy the .env.example file as .env, set the VITE_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.

  1. Use pnpm dev to run the project. If successed, you will find the plugin in Siyuan - Settings - Marketplace, named as plugin-sample-vite-vue.

  2. 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

List on the Marketplace

Use Github Action

  1. You can create a new tag, use your new version number as the Tag version in your local.
  2. 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:

  1. In your repo setting page https://github.com/OWNER/REPO/settings/actions, down to Workflow Permissions and open the configuration like this:

img

  1. Push a tag in the format v* and github will automatically create a new release with new bulit package.zip
  2. 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

Manual

  1. Use pnpm build to generate package.zip
  2. 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
  3. Upload the file package.zip as binary attachments
  4. 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.

About

SiYuan plugin sample with vite and vue

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published