Skip to content

Commit

Permalink
feat: 插件挂件源码合并 terwer/sy-post-publisher#89 #522
Browse files Browse the repository at this point in the history
  • Loading branch information
terwer committed Aug 1, 2023
1 parent c18023f commit edb1596
Show file tree
Hide file tree
Showing 39 changed files with 4,842 additions and 100 deletions.
1 change: 0 additions & 1 deletion .env.development.example

This file was deleted.

1 change: 0 additions & 1 deletion .env.production.example

This file was deleted.

1 change: 0 additions & 1 deletion .env.test.example

This file was deleted.

40 changes: 38 additions & 2 deletions .eslintrc.cjs
@@ -1,4 +1,40 @@
module.exports = {
root: true,
extends: ["./node_modules/@terwer/eslint-config-custom/typescript/index.cjs"],
extends: [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:svelte/recommended",
"turbo",
"prettier",
],

parser: "@typescript-eslint/parser",

overrides: [
{
files: ["*.svelte"],
parser: "svelte-eslint-parser",
// Parse the script in `.svelte` as TypeScript by adding the following configuration.
parserOptions: {
parser: "@typescript-eslint/parser",
},
},
],

plugins: ["@typescript-eslint", "prettier"],

rules: {
// Note: you must disable the base rule as it can report incorrect errors
semi: "off",
quotes: "off",
"no-undef": "off",
"no-async-promise-executor": "off",
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/no-var-requires": "off",
"@typescript-eslint/no-this-alias": "off",
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/no-unused-vars": "off",
"@typescript-eslint/no-explicit-any": "off",
"turbo/no-undeclared-env-vars": "off",
"prettier/prettier": "error",
},
}
1 change: 1 addition & 0 deletions .gitignore
@@ -1,5 +1,6 @@
# idea
.idea
.DS_Store

# build
dist
Expand Down
11 changes: 11 additions & 0 deletions .prettierignore
@@ -0,0 +1,11 @@
# platform

# Ignore artifacts:
dist
node_modules

# Ignore all dts files:
*.d.ts

# lib
/pnpm-lock.yaml
31 changes: 31 additions & 0 deletions .prettierrc.cjs
@@ -0,0 +1,31 @@
/*
* Copyright (c) 2023, Terwer . All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Terwer designates this
* particular file as subject to the "Classpath" exception as provided
* by Terwer in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Terwer, Shenzhen, Guangdong, China, youweics@163.com
* or visit www.terwer.space if you need additional information or have any
* questions.
*/

module.exports = {
semi: false,
singleQuote: false,
printWidth: 120,
plugins: ["prettier-plugin-svelte"]
}
64 changes: 64 additions & 0 deletions CHANGELOG.md
@@ -0,0 +1,64 @@
# Changelog

## [1.0.0](https://github.com/terwer/siyuan-plugin-publisher/compare/v0.8.0...v1.0.0) (2023-07-31)
### ⚠ BREAKING CHANGES
* 全面采用插件系统api重构,并进行细节性优化和bug修复,除了菜单插槽移除之外,其他原有功能将完全移植。
### Features
* add publisher hook and bridge ([dc34341](https://github.com/terwer/siyuan-plugin-publisher/commit/dc343414cd1f120a6dde6bf34420ec8c30b42454))
* fix ci ([30982fe](https://github.com/terwer/siyuan-plugin-publisher/commit/30982fe6160805efbcfc1313e716e069e92d37b4))
* **publisher-main:** 加载插件菜单 ([a621fbf](https://github.com/terwer/siyuan-plugin-publisher/commit/a621fbf722cc04f5a18adca71524e33a7b43d4ab))
* **publisher-main:** 集成 svelte 到插件 ([22b7b67](https://github.com/terwer/siyuan-plugin-publisher/commit/22b7b6776ebcf586420419fb55eb1e332d1b8fa6))
* 修改图标 ([25a750e](https://github.com/terwer/siyuan-plugin-publisher/commit/25a750ef9db8789b028641c6906b495cabacdeaa))
* 兼容 siyuanhook ([a0017c3](https://github.com/terwer/siyuan-plugin-publisher/commit/a0017c39cf50e9960b4d459b5d66e622104dc0c4))
* 兼容挂件版 ([e6754fa](https://github.com/terwer/siyuan-plugin-publisher/commit/e6754fac6ebce00aaf74ee4dd1dbf15dc0f7a740))
* 发布工具插件版第一版-优化信息提示 ([69bd749](https://github.com/terwer/siyuan-plugin-publisher/commit/69bd7495bf1642e16815359e2bff6e12c640d68a))
* 发布工具插件版第一版-修改设置菜单 ([618415a](https://github.com/terwer/siyuan-plugin-publisher/commit/618415a1c561a9d284dd826b00126cdb4855774b))
* 发布工具插件版第一版-初始化 ([5e6ad90](https://github.com/terwer/siyuan-plugin-publisher/commit/5e6ad904a20ed5536c7dbc215199676d6b830764))
* 发布工具插件版第一版-动态读取发布菜单 ([b9ef233](https://github.com/terwer/siyuan-plugin-publisher/commit/b9ef233b5c9d8ad5c50cbec8d046e0ad9d74461e))
* 发布工具插件版第一版-发布内测版 ([4b40550](https://github.com/terwer/siyuan-plugin-publisher/commit/4b405502610894f0ff18221d69ac2679aba97605))
* 发布工具插件版第一版-支持发布预览 ([4fc2d56](https://github.com/terwer/siyuan-plugin-publisher/commit/4fc2d56b0c9cd4f20255073f5404bb147f0d9b59))
* 发布工具插件版第一版-整合插件与挂件 ([21e3afd](https://github.com/terwer/siyuan-plugin-publisher/commit/21e3afd68cdfd54d115ed14b9dc3689ef6d0500f))
* 发布工具插件版第一版-新增应用项目 ([4f275e1](https://github.com/terwer/siyuan-plugin-publisher/commit/4f275e1f5da54605d0bf89089a2020e09886da6a))
* 发布工具插件版第一版-更新文档 ([e926ac7](https://github.com/terwer/siyuan-plugin-publisher/commit/e926ac7769ad06da6bd21e5f19a11b108b48204f))
* 发布工具插件版第一版-构建脚本兼容windows ([017a31b](https://github.com/terwer/siyuan-plugin-publisher/commit/017a31b302f52c7651d698774aa039b0b5d7f242))
* 发布工具插件版第一版-调整菜单 ([10df790](https://github.com/terwer/siyuan-plugin-publisher/commit/10df790779e06d69c81dd0438070db0aab0c4ec0))
* 图床直接调用挂件 ([ba57fe3](https://github.com/terwer/siyuan-plugin-publisher/commit/ba57fe3c95fd3296a6efeded5abcb356277d3b9f))
* 增加日志 ([07a075e](https://github.com/terwer/siyuan-plugin-publisher/commit/07a075ed4a8c324491cacb0cc1ae1fa5a4029316))
* 支持复制文档id ([21a5372](https://github.com/terwer/siyuan-plugin-publisher/commit/21a5372de30f2975456bc31039ca21efb8817d96))
* 支持开发模式全自动热重载 ([bc7b5cb](https://github.com/terwer/siyuan-plugin-publisher/commit/bc7b5cb81c5c1800eb42844ed9cb7606d4aaacff))
* 新增 publisher-hook ([c8192cf](https://github.com/terwer/siyuan-plugin-publisher/commit/c8192cf337b9107af8cb9c23a8cdcd8c34be19e1))
* 新增发布 sdk ([b818b47](https://github.com/terwer/siyuan-plugin-publisher/commit/b818b4726a9000f81fce98ba3e3a9dd21c079bfc))
* 新增发布菜单、页面路由 ([70bc06b](https://github.com/terwer/siyuan-plugin-publisher/commit/70bc06b9a56f105ddf6db47620e52b9773b2a6f5))
* 新增打包脚本 ([fc49b74](https://github.com/terwer/siyuan-plugin-publisher/commit/fc49b74abd89f4f419d790f660fcbb521d4007c8))
* 更新图标与项目说明 ([c05d92f](https://github.com/terwer/siyuan-plugin-publisher/commit/c05d92f2dbfd2781fb7d19cca8e9bb73e0d5aff3))
* 更新挂件版 siyuanhook ([4764b0c](https://github.com/terwer/siyuan-plugin-publisher/commit/4764b0c78379be1f5f1e74ca56641c14a0652286))
* 更新项目说明 ([2ef9a1f](https://github.com/terwer/siyuan-plugin-publisher/commit/2ef9a1f886c3dfaae25abad79926328f75b4939f))
* 校验打包 ([c771f12](https://github.com/terwer/siyuan-plugin-publisher/commit/c771f12c688faa8f9505ca4bd2eeba161c75820c))
* 添加菜单和图标 ([9bb152c](https://github.com/terwer/siyuan-plugin-publisher/commit/9bb152cda8edb1385182caecee2dfe8c684298d6))
* 版本号同步 ([4192aa1](https://github.com/terwer/siyuan-plugin-publisher/commit/4192aa13c90a839fc3033e8a242c25d61c6cc7cf))
* 移动 sdk 到类库项目 ([e19d45c](https://github.com/terwer/siyuan-plugin-publisher/commit/e19d45c32e4c1933d8597f497658d62d940f9c72))
* 迁移仓库到集市挂件仓库 ([1343906](https://github.com/terwer/siyuan-plugin-publisher/commit/13439061349c43b080cb0c8fa1070e7af3e0b126))
### Bug Fixes
* allow toc in hexo as default ([1650edc](https://github.com/terwer/siyuan-plugin-publisher/commit/1650edc8aaeb6f31eb72a4857bda50124e02d6d6))
* **deps:** bump pnpm/action-setup from 2.2.4 to 2.4.0 ([255b55a](https://github.com/terwer/siyuan-plugin-publisher/commit/255b55a488802c1e738ab4300346851cce749afc))
* **deps:** bump zhi-lib-base from 0.2.6 to 0.4.2 ([f879df2](https://github.com/terwer/siyuan-plugin-publisher/commit/f879df2e00be10709770dbaa172b4d6599ed0fde))
* fix import ([07f5bb5](https://github.com/terwer/siyuan-plugin-publisher/commit/07f5bb58f925faf92e203a8b24495b4d5f9cc793))
* 调整版本号规则 ([23e228d](https://github.com/terwer/siyuan-plugin-publisher/commit/23e228d60f76f006d6d119ee32a92d596c2dbb5b))
### Code Refactoring
* 优化插件菜单 ([f96202a](https://github.com/terwer/siyuan-plugin-publisher/commit/f96202aac973d7ff8379acaa4d9f44d548499626))
* 全新升级为插件版 ([0337410](https://github.com/terwer/siyuan-plugin-publisher/commit/0337410b2f4c6b8d4fc4519ac0526aa2fc40505c)), closes [#502](https://github.com/terwer/siyuan-plugin-publisher/issues/502)
* 切换为单项目 ([740f4c5](https://github.com/terwer/siyuan-plugin-publisher/commit/740f4c5ac8da2ee4202f216b8effa1f883d4a61b))
* 切换为单项目-polyfill 动态加载模块(zhi-publisher-shk),拆分zhi-publisher-shk ([57297ab](https://github.com/terwer/siyuan-plugin-publisher/commit/57297ab015e639a283e0820288c4f4f069ae7e4a))
* 切换为单项目-拆分部分类库,减小打包体积 ([ee2e562](https://github.com/terwer/siyuan-plugin-publisher/commit/ee2e562b4f9c4a2f8b30c42f44253bdd8b25604e))
* 引入 electron 工具类 ([d8bb857](https://github.com/terwer/siyuan-plugin-publisher/commit/d8bb857f17611e5321131ea27bb8d3ba5c38f0d5))
* 新增基本页面 ([7d275f7](https://github.com/terwer/siyuan-plugin-publisher/commit/7d275f7a91d7da11b307222925d7855fdb414232))
* 新增按钮菜单 ([664ac12](https://github.com/terwer/siyuan-plugin-publisher/commit/664ac12223e10f2f572cde4b3fff0dc5dffe7c2e))
* 新增页面路由 ([a8cd654](https://github.com/terwer/siyuan-plugin-publisher/commit/a8cd6543413e8cd8d88bb443e9b915c509b2a470))
* 更新代码校验规则 ([1be577b](https://github.com/terwer/siyuan-plugin-publisher/commit/1be577b8842cc8772e50f3db2820c07b27913e97))
* 项目结构重构 ([1129f3d](https://github.com/terwer/siyuan-plugin-publisher/commit/1129f3d83e5bd297664bbd91e0d083af71ca1719))
### Miscellaneous
* **deps-dev:** bump svelte from 3.59.2 to 4.1.2 ([03393d2](https://github.com/terwer/siyuan-plugin-publisher/commit/03393d2ec1a0373aea298dbfd685dd3e1fec8ff2))
* **deps-dev:** bump vite-plugin-static-copy from 0.16.0 to 0.17.0 ([feea39d](https://github.com/terwer/siyuan-plugin-publisher/commit/feea39d39bff74051fe0d68153b0628b00bff53f))
* **deps-dev:** bump vitest from 0.32.4 to 0.33.0 ([f2ce507](https://github.com/terwer/siyuan-plugin-publisher/commit/f2ce507ea537601d7dba21de84524274ec1cbee4))
* release 0.8.0 ([29336cd](https://github.com/terwer/siyuan-plugin-publisher/commit/29336cd847064971bc842e44aee75a8e90c226a8))
* 优化构建流程 ([f4aeea1](https://github.com/terwer/siyuan-plugin-publisher/commit/f4aeea1c618638a7774105a87b3e690d6d5d3927))
21 changes: 21 additions & 0 deletions LICENSE
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 Terwer

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
144 changes: 140 additions & 4 deletions README.md
@@ -1,6 +1,142 @@
# siyuan-plugin-publisher
Publishing articles from siyuan-note to platforms such as Yuque, Cnblogs, WordPress, Typecho, Hexo, Hugo and more
[中文](README_zh_CN.md)

## How to use
# Publisher

For more detail, please go to [zhi-cli](https://github.com/terwer/zhi/tree/dev/apps/zhi-cli)
![](https://raw.githubusercontent.com/terwer/siyuan-plugin-publisher/main/icon.png)

Publishing articles from siyuan-note to platforms such as Yuque, Cnblogs, WordPress, Typecho, Hexo, Hugo and more.

Support features such as fast publishing, image bed management, platform expansion, smart labels, etc.

This plugin promises that the basic functions will be free forever, and the follow-up related to intelligent AI may be charged, and the closed beta stage is completely free. If you want to support developers, please [feel free to support](https://github.com/terwer/siyuan-plugin-publisher/blob/main/README_zh_CN.md#Donate) here.

> 🌹 Tips: This plugin is an upgraded version of the original 'Siyuan Note Publishing Tool' widget, which includes all the functions provided by the original widget, provides a convenient menu operation entry, and has carried out a series of problem fixes and experience optimizations.
>
> In addition to [Release Preview] requires [Online Sharing] plugin support, the graph bed function requires [PicGo plugin] support, **Other functions do not need any other dependencies**, no need to download the previous widget, the plug-in is already built-in.
## Core Features

- [X] **Extremely fast release**: One-time configuration, one-click release
- [ ] **Picture bed management**: Integrate PicGO picture bed, support s3, minio, watermark plugin
- [X] **Support for extensions**: Based on the unified blog API specification, built-in support for metaweblogAPI, WordPress
and GitHub, and provides a unified adapter, which can theoretically be extended to any platform
- [X] **Platform switch**: All platforms support enabling and disabling, the blog garden is enabled by default, and can be
disabled at any time
- [X] **Dynamic Newly Added**: Support custom adding platform
- [ ] **Smart Classification**: Support smart tags, smart slug aliases, smart summaries, and continue to improve
- [ ] **Article Binding**: Support linking existing platform articles to Siyuan Notes to facilitate follow-up management,
support Siyuan->platform one-way synchronization
- [X] **Adapt to Theme**: Automatically adapt to dark mode and light mode
- [X] **Language support**: multi-language support, support Chinese version and English version
- [ ] **Release view**: Support multiple release views, simple mode, detailed mode and source code mode
- [X] **Multiple deployments**: support Siyuan notes plugin<sup>Highly recommended</sup>, Chrome browser extension, self-deployment

## Platform List

Names not listed in order

- [X] Cnblogs
- [ ] WordPress
- [X] Yuque
- [ ] Github
- [ ] Hexo
- [ ] Hugo

## Platform Adaptation Plan

If you have a platform you want to use, but this tool has not yet been implemented, you can submit
the [Siyuan Note Publishing Tool Plugin Platform Adaptation Tracking Form](https://terwergreen.feishu.cn/share/base/form/shrcnGRdThUiqnhBg15xgclMM0c%20)
, the developer will consider including it in the development plan.

For platform adaptation, please refer
to [Latest Adaptation](https://terwergreen.feishu.cn/share/base/view/shrcnWT2IGIz1r94z9qvqUghDzd)

## FAQ

* Q1:How to install the publishing tool plugin? Where can I find his entrance after installation?

A1:Find **`Bazaar->Plugins->Publishing Tools`** to download and enable.

The installation process requires no further action. This is no different from the download and installation of other plugins.

After the installation is complete, find the ✈️ icon on the top right toolbar, click the menu, and follow the corresponding instructions to use it.


* Q2:After installing the publishing tool plugin, do I still need to install the widget?

A2:**unnecessary. ​**

The plugin version contains all the functions of the widget version.


* Q3:I am not used to the operation of the new version, and I want to continue to use the previous widget through the plugin, is that possible?

A3:**Yes.**

The plugin has a builtin bridge by default, which can invoke the widget through the plugin. This feature needs to be turned on in `Settings -> Use WidgetInvoke`​.

<u>Note 1: The plugin version uses the builtin menu of the plugin system, and the menu slot will be disabled when the widget version is activated via plugin. ​</u>

<u>Note 2: After opening the widget version, all functions of the plugin version will be disabled to avoid confusion.</u>

**We strongly recommend you to use the plugin version, because the plugin version will be the main version for long-term maintenance in the future, and the widget version is obsolete, and it is only used to fix problems and compatible with historical users.**


* Q4:I used to use `Custom JS Fragment`​ or add `WidgetInvoke`​ directly, do I still need to download the plugin now?

A4:**Optional.** But we highly recommended to remove JS snippets and widgets to download the plugin version.

If you don't want to use the plugin version, you don't need to download it, just use the original `custom JS fragment`​ or add `widget`​ to continue using.

If you want to use the plugin version, then we strongly recommend that you delete the previously added `custom JS snippets`​ and `widgets`​, download the plugin version directly, and enable it. No other additional action is required.


* Q5:Is it possible to migrate my historical configuration data items to the plugin?

* A5:**Yes.**

Please go to `Settings->Import and Export->Import the historical data of the widget version. ` Operation.

Note: The widget version configuration data import only supports `sy-p-cfg-v0.8.0.json` and `picgo.json`.


* Q6:What should I do if the platform I need to publish is not provided by the publishing tool?
* A6:Reference: [Platform Adaptation Plan](https://github.com/terwer/siyuan-plugin-publisher/blob/main/README_zh_CN.md#platform-adaptation-plan "Platform Adaptation Plan")


## Donate

If you approve of this project, invite me to have a cup of coffee, which will encourage me to keep updating and create
more useful tools~

### Wechat

<div>
<img src="https://static-rs-terwer.oss-cn-beijing.aliyuncs.com/donate/wechat.jpg" alt="wechat" style="width:280px;height:375px;" />
</div>

### Alipay

<div>
<img src="https://static-rs-terwer.oss-cn-beijing.aliyuncs.com/donate/alipay.jpg" alt="alipay" style="width:280px;height:375px;" />
</div>

# Thanks

- Thanks to the third-party framework for supporting the bottom layer of this project

Names not listed in order

|Name|version|vendor|
| :---------: | :-----: | :---------: |
|turbo|1.9+|Vercel|
|vite|4.2+|Evan You|
|Svelte|3.57+|Rich Harris|
|TypeScript|5.0+|Microsoft|
|siyuan-note|2.9.0+|D,V|
- Thanks to [leolee9086](https://github.com/leolee9086) for the icon resource

0 comments on commit edb1596

Please sign in to comment.