diff --git a/libs/publisher-sdk/.env.development.local.example b/libs/publisher-sdk/.env.development.local.example
deleted file mode 100644
index 04f0ca42..00000000
--- a/libs/publisher-sdk/.env.development.local.example
+++ /dev/null
@@ -1 +0,0 @@
-VITE_DEBUG_MODE=true
diff --git a/libs/publisher-sdk/.eslintrc.cjs b/libs/publisher-sdk/.eslintrc.cjs
deleted file mode 100644
index a1993b7b..00000000
--- a/libs/publisher-sdk/.eslintrc.cjs
+++ /dev/null
@@ -1,4 +0,0 @@
-module.exports = {
- root: true,
- extends: ["./node_modules/@terwer/eslint-config-custom/typescript/index.cjs"],
-}
diff --git a/libs/publisher-sdk/.gitignore b/libs/publisher-sdk/.gitignore
deleted file mode 100644
index 1f1025f2..00000000
--- a/libs/publisher-sdk/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-.idea
-.DS_Store
\ No newline at end of file
diff --git a/libs/publisher-sdk/.prettierignore b/libs/publisher-sdk/.prettierignore
deleted file mode 100644
index 8f9d2dfa..00000000
--- a/libs/publisher-sdk/.prettierignore
+++ /dev/null
@@ -1,11 +0,0 @@
-# platform
-
-# Ignore artifacts:
-dist
-node_modules
-
-# Ignore all dts files:
-*.d.ts
-
-# lib
-/pnpm-lock.yaml
diff --git a/libs/publisher-sdk/.prettierrc.cjs b/libs/publisher-sdk/.prettierrc.cjs
deleted file mode 100644
index eec8622f..00000000
--- a/libs/publisher-sdk/.prettierrc.cjs
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * 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
-}
diff --git a/libs/publisher-sdk/README.md b/libs/publisher-sdk/README.md
deleted file mode 100644
index e25f1f17..00000000
--- a/libs/publisher-sdk/README.md
+++ /dev/null
@@ -1,41 +0,0 @@
-# publisher-sdk
-
-a common sdk for publishing post to every platform
-
-## Usage
-
-```js
-// usage
-```
-
-## Deps
-
-```
-## Congregations! publisher-sdk need no deps, it is just pure js code 🎉
-```
-
-## Dev
-
-```bash
-pnpm dev -F publisher-sdk
-```
-
-## Build
-
-```bash
-pnpm build -F publisher-sdk
-```
-
-## Test
-
-Execute the unit tests via [vitest](https://vitest.dev)
-
-```bash
-pnpm test -F publisher-sdk
-```
-
-## Publish
-
-```bash
-pnpm publish -F publisher-sdk --tag latest
-```
\ No newline at end of file
diff --git a/libs/publisher-sdk/index.html b/libs/publisher-sdk/index.html
deleted file mode 100644
index 9ecb5ed8..00000000
--- a/libs/publisher-sdk/index.html
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
-
-
- Vite + Vue + TS
-
-
- This file is for lib hot-load test only, see /src/index.ts
-
-
-
diff --git a/libs/publisher-sdk/package.json b/libs/publisher-sdk/package.json
deleted file mode 100644
index c8316a5d..00000000
--- a/libs/publisher-sdk/package.json
+++ /dev/null
@@ -1,34 +0,0 @@
-{
- "name": "@terwer/publisher-sdk",
- "version": "0.0.1",
- "type": "module",
- "description": "a common sdk for publishing post to every platform",
- "main": "./dist/index.js",
- "typings": "./dist/index.d.ts",
- "repository": "terwer/siyuan-plugin-publisher",
- "homepage": "https://github.com/terwer/siyuan-plugin-publisher/tree/main/libs/publisher-sdk",
- "author": "terwer",
- "license": "GPL",
- "files": [
- "dist",
- "README.md"
- ],
- "keywords": [
- "zhi",
- "lib"
- ],
- "scripts": {
- "serve": "vite",
- "dev": "vite build --watch",
- "build": "vite build",
- "start": "vite preview",
- "test": "vitest --watch"
- },
- "devDependencies": {
- "@terwer/eslint-config-custom": "^1.2.0",
- "@terwer/vite-config-custom": "^0.2.0"
- },
- "dependencies": {
- "zhi-siyuan-api": "^1.1.1"
- }
-}
diff --git a/libs/publisher-sdk/src/index.spec.ts b/libs/publisher-sdk/src/index.spec.ts
deleted file mode 100644
index ec837a46..00000000
--- a/libs/publisher-sdk/src/index.spec.ts
+++ /dev/null
@@ -1,7 +0,0 @@
-import { describe, it } from "vitest"
-
-describe("index", () => {
- it("test index", () => {
- console.log("hello")
- })
-})
diff --git a/libs/publisher-sdk/src/index.ts b/libs/publisher-sdk/src/index.ts
deleted file mode 100644
index 30c1f9be..00000000
--- a/libs/publisher-sdk/src/index.ts
+++ /dev/null
@@ -1,2 +0,0 @@
-import PublishSdk from "./publish-sdk"
-export { PublishSdk }
diff --git a/libs/publisher-sdk/src/publish-sdk.ts b/libs/publisher-sdk/src/publish-sdk.ts
deleted file mode 100644
index d6467e70..00000000
--- a/libs/publisher-sdk/src/publish-sdk.ts
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * 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.
- */
-
-import { Env } from "zhi-env"
-import { BlogApi, BlogConstants, BlogTypeEnum } from "zhi-blog-api"
-import { SiYuanApiAdaptor, SiyuanConfig, SiyuanConstants } from "zhi-siyuan-api"
-
-/**
- * 发布 SDK
- *
- * @author terwer
- * @version 1.0.0
- * @since 1.0.0
- */
-class PublishSdk {
- private static bApi: BlogApi
-
- /**
- * 获取 siyuan-kernel-api 实例
- */
- public static blogApi(type?: Env | BlogTypeEnum): BlogApi {
- if (!this.bApi) {
- let apiAdaptor
- let blogType
- if (type instanceof Env) {
- blogType = type.getEnv(BlogConstants.DEFAULT_BLOG_TYPE_KEY)
- }
- switch (blogType) {
- case BlogTypeEnum.BlogTypeEnum_Wordpress:
- break
- default: {
- if (type instanceof Env) {
- const apiUrl = type.getEnvOrDefault(SiyuanConstants.VITE_SIYUAN_API_URL_KEY, "http://127.0.0.1:6806")
- const token = type.getStringEnv(SiyuanConstants.VITE_SIYUAN_AUTH_TOKEN_KEY)
-
- const siyuanConfig = new SiyuanConfig(apiUrl, token)
- // 显示指定修复标题
- siyuanConfig.fixTitle = true
- apiAdaptor = new SiYuanApiAdaptor(siyuanConfig)
- }
- break
- }
- }
-
- if (!apiAdaptor) {
- throw new Error("ApiAdaptor cannot be null")
- }
- this.bApi = new BlogApi(apiAdaptor)
- }
- return this.bApi
- }
-}
-
-export default PublishSdk
diff --git a/libs/publisher-sdk/tsconfig.json b/libs/publisher-sdk/tsconfig.json
deleted file mode 100644
index 08cfe0c6..00000000
--- a/libs/publisher-sdk/tsconfig.json
+++ /dev/null
@@ -1,42 +0,0 @@
-{
- "compilerOptions": {
- "target": "ES2020",
- "useDefineForClassFields": true,
- "module": "ESNext",
- "lib": [
- "ES2020",
- "DOM",
- "DOM.Iterable"
- ],
- "skipLibCheck": true,
- /* Bundler mode */
- "moduleResolution": "Node",
- // "allowImportingTsExtensions": true,
- "allowSyntheticDefaultImports": true,
- "resolveJsonModule": true,
- "isolatedModules": true,
- "noEmit": true,
- "jsx": "preserve",
- /* Linting */
- "strict": true,
- "noUnusedLocals": true,
- "noUnusedParameters": true,
- "noFallthroughCasesInSwitch": true,
- "types": [
- "node",
- "vite/client"
- ]
- },
- "include": [
- "src/**/*.ts",
- "src/**/*.d.ts",
- "src/**/*.tsx",
- "src/**/*.vue"
- ],
- "references": [
- {
- "path": "./tsconfig.node.json"
- }
- ],
- "root": "."
-}
diff --git a/libs/publisher-sdk/tsconfig.node.json b/libs/publisher-sdk/tsconfig.node.json
deleted file mode 100644
index 7065ca9a..00000000
--- a/libs/publisher-sdk/tsconfig.node.json
+++ /dev/null
@@ -1,10 +0,0 @@
-{
- "compilerOptions": {
- "composite": true,
- "skipLibCheck": true,
- "module": "ESNext",
- "moduleResolution": "Node",
- "allowSyntheticDefaultImports": true
- },
- "include": ["vite.config.ts"]
-}
diff --git a/libs/publisher-sdk/vite.config.ts b/libs/publisher-sdk/vite.config.ts
deleted file mode 100644
index 5b50f096..00000000
--- a/libs/publisher-sdk/vite.config.ts
+++ /dev/null
@@ -1,33 +0,0 @@
-///
-
-import { resolve } from "path"
-import { defineConfig } from "vite"
-import dts from "vite-plugin-dts"
-
-export default defineConfig({
- plugins: [dts()],
-
- build: {
- lib: {
- // Could also be a dictionary or array of multiple entry points
- entry: resolve(__dirname, "src/index.ts"),
- // the proper extensions will be added
- fileName: "index",
- formats: ["es"],
- },
- rollupOptions: {
- // make sure to externalize deps that shouldn't be bundled
- // into your library
- external: [],
- output: {
- entryFileNames: "[name].js",
- },
- },
- },
-
- test: {
- globals: true,
- environment: "jsdom",
- include: ["src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}"],
- },
-})
diff --git a/plugins/publisher-main/package.json b/plugins/publisher-main/package.json
index e7250672..a05fde9c 100644
--- a/plugins/publisher-main/package.json
+++ b/plugins/publisher-main/package.json
@@ -21,6 +21,8 @@
"svelte-routing": "^1.8.8"
},
"dependencies": {
- "@terwer/publisher-sdk": "workspace:*"
+ "zhi-blog-api": "/Users/terwer/Documents/mydocs/zhi-framework/zhi/libs/zhi-blog-api",
+ "zhi-siyuan-api": "/Users/terwer/Documents/mydocs/zhi-framework/zhi/libs/zhi-siyuan-api",
+ "zhi-publisher-sdk": "/Users/terwer/Documents/mydocs/zhi-framework/zhi/libs/zhi-publisher-sdk"
}
}
\ No newline at end of file
diff --git a/plugins/publisher-main/src/index.ts b/plugins/publisher-main/src/index.ts
index 7bf7f0bb..db8a4c73 100644
--- a/plugins/publisher-main/src/index.ts
+++ b/plugins/publisher-main/src/index.ts
@@ -8,7 +8,7 @@ import Constants from "./utils/constants"
import iconPublish from "./utils/svg"
import HtmlUtils from "./utils/htmlUtils"
import { SiyuanKernelApi } from "zhi-siyuan-api"
-import { PublishSdk } from "@terwer/publisher-sdk"
+import { PublishSdk } from "zhi-publisher-sdk"
import { BlogTypeEnum } from "zhi-blog-api"
const STORAGE_NAME = "menu-config"
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 721303ac..bf55efe6 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -98,19 +98,6 @@ importers:
specifier: ^0.2.0
version: registry.npmjs.org/@terwer/vite-config-custom@0.2.0(jsdom@22.0.0)(tslib@2.5.0)(typescript@5.0.4)(vite-plugin-css-injected-by-js@3.1.1)(vite-plugin-dts@2.3.0)(vite-plugin-static-copy@0.15.0)(vite-tsconfig-paths@4.2.0)(vite@4.3.5)(vitest@0.31.0)
- libs/publisher-sdk:
- dependencies:
- zhi-siyuan-api:
- specifier: ^1.1.1
- version: registry.npmjs.org/zhi-siyuan-api@1.1.1
- devDependencies:
- '@terwer/eslint-config-custom':
- specifier: ^1.2.0
- version: registry.npmjs.org/@terwer/eslint-config-custom@1.2.0(@nuxt/eslint-config@0.1.1)(@typescript-eslint/eslint-plugin@5.59.5)(astro-eslint-parser@0.13.3)(eslint-config-prettier@8.8.0)(eslint-config-turbo@1.9.4)(eslint-plugin-prettier@4.2.1)(eslint-plugin-svelte@2.28.0)(eslint-plugin-vue@9.12.0)(eslint@8.40.0)(prettier-plugin-svelte@2.10.0)(prettier@2.8.8)(typescript@5.0.4)
- '@terwer/vite-config-custom':
- specifier: ^0.2.0
- version: registry.npmjs.org/@terwer/vite-config-custom@0.2.0(jsdom@22.0.0)(tslib@2.5.0)(typescript@5.0.4)(vite-plugin-css-injected-by-js@3.1.1)(vite-plugin-dts@2.3.0)(vite-plugin-static-copy@0.15.0)(vite-tsconfig-paths@4.2.0)(vite@4.3.5)(vitest@0.31.0)
-
libs/siyuan-hook:
dependencies:
'@terwer/publisher-hook':
@@ -126,9 +113,15 @@ importers:
plugins/publisher-main:
dependencies:
- '@terwer/publisher-sdk':
- specifier: workspace:*
- version: link:../../libs/publisher-sdk
+ zhi-blog-api:
+ specifier: /Users/terwer/Documents/mydocs/zhi-framework/zhi/libs/zhi-blog-api
+ version: link:../../../../zhi-framework/zhi/libs/zhi-blog-api
+ zhi-publisher-sdk:
+ specifier: /Users/terwer/Documents/mydocs/zhi-framework/zhi/libs/zhi-publisher-sdk
+ version: link:../../../../zhi-framework/zhi/libs/zhi-publisher-sdk
+ zhi-siyuan-api:
+ specifier: /Users/terwer/Documents/mydocs/zhi-framework/zhi/libs/zhi-siyuan-api
+ version: link:../../../../zhi-framework/zhi/libs/zhi-siyuan-api
devDependencies:
'@sveltejs/vite-plugin-svelte':
specifier: ^2.0.3
@@ -6297,6 +6290,8 @@ packages:
version: 9.5.0
engines: {node: ^12.20.0 || >=14}
requiresBuild: true
+ dev: true
+ optional: true
registry.npmjs.org/commitizen@4.3.0:
resolution: {integrity: sha512-H0iNtClNEhT0fotHvGV3E9tDejDeS04sN1veIebsKYGMuGscFaswRoYJKmT3eW85eIJAs0F28bG2+a/9wCOfPw==, registry: https://registry.npmjs.com/, tarball: https://registry.npmjs.org/commitizen/-/commitizen-4.3.0.tgz}
@@ -6339,12 +6334,6 @@ packages:
dot-prop: registry.npmjs.org/dot-prop@5.3.0
dev: true
- registry.npmjs.org/compare-versions@5.0.3:
- resolution: {integrity: sha512-4UZlZP8Z99MGEY+Ovg/uJxJuvoXuN4M6B3hKaiackiHrgzQFEe3diJi1mf1PNHbFujM7FvLrK2bpgIaImbtZ1A==, registry: https://registry.npmjs.com/, tarball: https://registry.npmjs.org/compare-versions/-/compare-versions-5.0.3.tgz}
- name: compare-versions
- version: 5.0.3
- dev: false
-
registry.npmjs.org/compress-commons@4.1.1:
resolution: {integrity: sha512-QLdDLCKNV2dtoTorqgxngQCMA+gWXkM/Nwu7FpeBhk/RdkzimqC3jueb/FDmaZeXh+uby1jkBqE3xArsLBE5wQ==, registry: https://registry.npmjs.com/, tarball: https://registry.npmjs.org/compress-commons/-/compress-commons-4.1.1.tgz}
name: compress-commons
@@ -13005,15 +12994,6 @@ packages:
vscode-textmate: registry.npmjs.org/vscode-textmate@8.0.0
dev: true
- registry.npmjs.org/showdown@2.1.0:
- resolution: {integrity: sha512-/6NVYu4U819R2pUIk79n67SYgJHWCce0a5xTP979WbNp0FL9MN1I1QK662IDU1b6JzKTvmhgI7T7JYIxBi3kMQ==, registry: https://registry.npmjs.com/, tarball: https://registry.npmjs.org/showdown/-/showdown-2.1.0.tgz}
- name: showdown
- version: 2.1.0
- hasBin: true
- dependencies:
- commander: registry.npmjs.org/commander@9.5.0
- dev: false
-
registry.npmjs.org/side-channel@1.0.4:
resolution: {integrity: sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==, registry: https://registry.npmjs.com/, tarball: https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz}
name: side-channel
@@ -15331,29 +15311,6 @@ packages:
commander: registry.npmjs.org/commander@9.5.0
dev: true
- registry.npmjs.org/zhi-blog-api@1.1.0:
- resolution: {integrity: sha512-n66lw94Fx/DHzdfX8FYz3uk++PFfTm65lnf9JpP3nkDU/UNpPZImteClREtsdg9fq2yRK/wnBUYERrkLfwAu2g==, registry: https://registry.npmjs.com/, tarball: https://registry.npmjs.org/zhi-blog-api/-/zhi-blog-api-1.1.0.tgz}
- name: zhi-blog-api
- version: 1.1.0
- dependencies:
- zhi-common: registry.npmjs.org/zhi-common@1.5.2
- zhi-env: registry.npmjs.org/zhi-env@1.17.0
- zhi-log: registry.npmjs.org/zhi-log@1.13.0
- dev: false
-
- registry.npmjs.org/zhi-common@1.5.2:
- resolution: {integrity: sha512-AbypXF7USpGGYl3zIjqm4W50gRlbkx3VV4UB5d72pvl+uFZQLWbAct/M9v8btTxEtndwDpBnAsyvIWhnvIrScA==, registry: https://registry.npmjs.com/, tarball: https://registry.npmjs.org/zhi-common/-/zhi-common-1.5.2.tgz}
- name: zhi-common
- version: 1.5.2
- dependencies:
- ajv: registry.npmjs.org/ajv@8.12.0
- compare-versions: registry.npmjs.org/compare-versions@5.0.3
- showdown: registry.npmjs.org/showdown@2.1.0
- zhi-device: registry.npmjs.org/zhi-device@0.5.0
- zhi-env: registry.npmjs.org/zhi-env@1.17.0
- zhi-log: registry.npmjs.org/zhi-log@1.13.0
- dev: false
-
registry.npmjs.org/zhi-device@0.5.0:
resolution: {integrity: sha512-fa3oPl7zA76ecSHTkPG4v3t66fd8uvPxIGgoddI17ORx/TuyYW8LaKP0ULy7y2O+ZpUQc2+Hr+Qb76kf35Gf9w==, registry: https://registry.npmjs.com/, tarball: https://registry.npmjs.org/zhi-device/-/zhi-device-0.5.0.tgz}
name: zhi-device
@@ -15380,17 +15337,6 @@ packages:
zhi-env: registry.npmjs.org/zhi-env@1.17.0
dev: false
- registry.npmjs.org/zhi-siyuan-api@1.1.1:
- resolution: {integrity: sha512-DFCVAEPJ0JhW6Rz/jUYXVoG+G6gqgP/CYlQC3f+YwDWBiACVRaf2Geu+pHDE9nXbBhhuexqk370Ac5qsGHRRYw==, registry: https://registry.npmjs.com/, tarball: https://registry.npmjs.org/zhi-siyuan-api/-/zhi-siyuan-api-1.1.1.tgz}
- name: zhi-siyuan-api
- version: 1.1.1
- dependencies:
- zhi-blog-api: registry.npmjs.org/zhi-blog-api@1.1.0
- zhi-common: registry.npmjs.org/zhi-common@1.5.2
- zhi-env: registry.npmjs.org/zhi-env@1.17.0
- zhi-log: registry.npmjs.org/zhi-log@1.13.0
- dev: false
-
registry.npmjs.org/zip-stream@4.1.0:
resolution: {integrity: sha512-zshzwQW7gG7hjpBlgeQP9RuyPGNxvJdzR8SUM3QhxCnLjWN2E7j3dOvpeDcQoETfHx0urRS7EtmVToql7YpU4A==, registry: https://registry.npmjs.com/, tarball: https://registry.npmjs.org/zip-stream/-/zip-stream-4.1.0.tgz}
name: zip-stream