Skip to content

Commit

Permalink
Merge pull request #386 from terwer/dev
Browse files Browse the repository at this point in the history
docs: update deps
  • Loading branch information
terwer authored Jun 11, 2023
2 parents 64c868b + b90fdf1 commit 6b162c5
Show file tree
Hide file tree
Showing 39 changed files with 1,938 additions and 21 deletions.
2 changes: 1 addition & 1 deletion .changeset/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"fixed": [],
"linked": [],
"access": "restricted",
"baseBranch": "main",
"baseBranch": "dev",
"updateInternalDependencies": "patch",
"ignore": []
}
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
- [ ] [zhi-yuque-api](https://github.com/terwer/zhi/tree/main/libs/zhi-yuque-api)
- [ ] [zhi-liandi-api](https://github.com/terwer/zhi/tree/main/libs/zhi-liandi-api)
- [ ] [zhi-kms-api](https://github.com/terwer/zhi/tree/main/libs/zhi-kms-api)
- [ ] [zhi-siyuan-api](https://github.com/terwer/zhi/tree/main/libs/zhi-siyuan-api)
- [X] [zhi-siyuan-api](https://github.com/terwer/zhi/tree/main/libs/zhi-siyuan-api)
- [ ] [zhi-wechat-api](https://github.com/terwer/zhi/tree/main/libs/zhi-wechat-api)
- [ ] [zhi-http-api](https://github.com/terwer/zhi/tree/main/libs/zhi-http-api)
- [ ] [zhi-zhihu-api](https://github.com/terwer/zhi/tree/main/libs/zhi-zhihu-api)
Expand Down Expand Up @@ -66,4 +66,5 @@
- [siyuan-plugin-custom-slug](https://github.com/terwer/siyuan-plugin-custom-slug) - Document alias, a new alias index for document titles, convenient for quick search <sup>Available</sup>
- [siyuan-plugin-code-block](https://github.com/terwer/siyuan-plugin-code-block) - Code block beautification, imitating Mac style code block style <sup>Available</sup>
- [siyuan-plugin-2md](https://github.com/terwer/siyuan-plugin-2md) - Markdown batch conversion, batch conversion of documents of Siyuan notes into Markdown files, support conversion properties for Hexo, HUGO, Vitepress, Obsidian and other platforms corresponding to FrontFormatter <sup>In progress</sup>
- [siyuan-plugin-random-doc](https://github.com/terwer/siyuan-plugin-random-doc) - Random Doc <sup>In progress</sup>
- [siyuan-plugin-random-doc](https://github.com/terwer/siyuan-plugin-random-doc) - Random Doc <sup>In progress</sup>
- [siyuan-plugin-picgo](https://github.com/terwer/siyuan-plugin-picgo) - PocGo <sup>In progress</sup>
3 changes: 2 additions & 1 deletion README_zh_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
- [ ] [zhi-yuque-api](https://github.com/terwer/zhi/tree/main/libs/zhi-yuque-api)
- [ ] [zhi-liandi-api](https://github.com/terwer/zhi/tree/main/libs/zhi-liandi-api)
- [ ] [zhi-kms-api](https://github.com/terwer/zhi/tree/main/libs/zhi-kms-api)
- [ ] [zhi-siyuan-api](https://github.com/terwer/zhi/tree/main/libs/zhi-siyuan-api)
- [X] [zhi-siyuan-api](https://github.com/terwer/zhi/tree/main/libs/zhi-siyuan-api)
- [ ] [zhi-wechat-api](https://github.com/terwer/zhi/tree/main/libs/zhi-wechat-api)
- [ ] [zhi-http-api](https://github.com/terwer/zhi/tree/main/libs/zhi-http-api)
- [ ] [zhi-zhihu-api](https://github.com/terwer/zhi/tree/main/libs/zhi-zhihu-api)
Expand Down Expand Up @@ -67,3 +67,4 @@
- [siyuan-plugin-code-block](https://github.com/terwer/siyuan-plugin-code-block) - 代码块美化,模仿Mac风格的代码块风格 <sup>已上架</sup>
- [siyuan-plugin-2md](https://github.com/terwer/siyuan-plugin-2md) - Markdown批量转换,将思源笔记的文档批量转换为Markdown文件,支持转换属性为Hexo、HUGO、Vitepress、Obsidian等平台对应的FrontFormatter <sup>进行中</sup>
- [siyuan-plugin-random-doc](https://github.com/terwer/siyuan-plugin-random-doc) - 文档漫游 <sup>进行中</sup>
- [siyuan-plugin-picgo](https://github.com/terwer/siyuan-plugin-picgo) - PocGo图床 <sup>进行中</sup>
6 changes: 6 additions & 0 deletions apps/zhi-cli/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# zhi-cli

## 1.5.8

### Patch Changes

- zhi-log@1.14.8

## 1.5.7

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion apps/zhi-cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "zhi-cli",
"version": "1.5.7",
"version": "1.5.8",
"description": "a tool for generating zhi framework related projects",
"type": "module",
"bin": {
Expand Down
6 changes: 6 additions & 0 deletions libs/zhi-device/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# zhi-device

## 2.1.0

### Minor Changes

- fix hashcquery

## 2.0.0

### Major Changes
Expand Down
2 changes: 1 addition & 1 deletion libs/zhi-device/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "zhi-device",
"version": "2.0.0",
"version": "2.1.0",
"type": "module",
"main": "./dist/index.js",
"typings": "./dist/index.d.ts",
Expand Down
3 changes: 2 additions & 1 deletion libs/zhi-device/src/lib/browserUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ class BrowserUtil {
* @since 0.0.1
*/
public static getQueryParam = (key: string) => {
if (BrowserUtil.isInBrowser) {
// check env
if (!BrowserUtil.isInBrowser) {
return ""
}

Expand Down
7 changes: 7 additions & 0 deletions libs/zhi-fetch-middleware/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# zhi-fetch-middleware

## 0.1.8

### Patch Changes

- Updated dependencies
- zhi-device@2.1.0

## 0.1.7

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion libs/zhi-fetch-middleware/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "zhi-fetch-middleware",
"version": "0.1.7",
"version": "0.1.8",
"type": "module",
"description": "an intermediate tier prepared for fetch requests",
"main": "./dist/index.js",
Expand Down
7 changes: 7 additions & 0 deletions libs/zhi-log/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# zhi-log

## 1.14.8

### Patch Changes

- Updated dependencies
- zhi-device@2.1.0

## 1.14.7

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion libs/zhi-log/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "zhi-log",
"version": "1.14.7",
"version": "1.14.8",
"type": "module",
"main": "./dist/index.js",
"typings": "./dist/index.d.ts",
Expand Down
1 change: 1 addition & 0 deletions libs/zhi-siyuan-api/.env.development.local.example
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
VITE_DEBUG_MODE=true
4 changes: 4 additions & 0 deletions libs/zhi-siyuan-api/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module.exports = {
root: true,
extends: ["./node_modules/@terwer/eslint-config-custom/typescript/index.cjs"],
}
3 changes: 3 additions & 0 deletions libs/zhi-siyuan-api/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.idea
.DS_Store
testdata
19 changes: 19 additions & 0 deletions libs/zhi-siyuan-api/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# zhi-siyuan-api

## 1.9.1

### Patch Changes

- add get image blocks

## 1.9.0

### Minor Changes

- remove unused appinstance

## 1.8.0

### Minor Changes

- new kernel api
89 changes: 89 additions & 0 deletions libs/zhi-siyuan-api/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
# zhi-siyuan-api

a siyuan-note api including both kernel and client

## Usage

```ts
import { SiyuanKernelApi } from "zhi-siyuan-api"
import { ZhiUtil } from "zhi-common"

// appInstance
const appInstance: any = {}
appInstance.zhiCommon = {
ZhiUtil: ZhiUtil
}
console.log(appInstance)

// kernelApi
const siyuanConfig = new SiyuanConfig("http://127.0.0.1:6806", "")
const kernelApi = new SiyuanKernelApi(appInstance, siyuanConfig)
const result = await kernelApi.lsNotebooks()
console.log("result=>", result)
```

dynamic invoke

```ts
import { SiyuanKernelApi } from "zhi-siyuan-api"

// appInstance也可以动态加载,减小打包体积
const appInstance: any = {}

// polyfills
const moduleBase = ""
console.log("moduleBase=>", moduleBase)
// https://github.com/terwer/siyuan-plugin-publisher/blob/main/public/polyfills/fs.js
appInstance.fs = (await import(`${moduleBase}/polyfills/fs.js`))["default"]
// https://github.com/terwer/siyuan-plugin-publisher/blob/main/public/polyfills/path.js
appInstance.path = (await import(`${moduleBase}/polyfills/path.js`))["default"]
appInstance.importDep = async (moduleName) => {
return await import(appInstance.path.join(moduleBase, moduleName))
}

const zhiCommon = (await appInstance.importDep("./libs/zhi-common/index.js")) as any
appInstance.zhiCommon = {
ZhiUtil: zhiCommon["ZhiUtil"],
}
console.log(appInstance)

// kernelApi
const siyuanConfig = new SiyuanConfig("http://127.0.0.1:6806", "")
const kernelApi = new SiyuanKernelApi(appInstance, siyuanConfig)
const result = await kernelApi.lsNotebooks()
console.log("result=>", result)
```

## Deps

```
├── zhi-common - [dynaminc dependency]
├── zhi-blog-api
├── zhi-lib-base
```

## Dev

```bash
pnpm dev -F zhi-siyuan-api
```

## Build

```bash
pnpm build -F zhi-siyuan-api
```

## Test

Execute the unit tests via [vitest](https://vitest.dev)

```bash
pnpm test -F zhi-siyuan-api
```

## Publish

```bash
pnpm publish -F zhi-siyuan-api --tag latest
```
12 changes: 12 additions & 0 deletions libs/zhi-siyuan-api/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite + Vue + TS</title>
</head>
<body>
This file is for lib hot-load test only, see <a href="/src/index.ts">/src/index.ts</a>
<script type="module" src="/src/index.ts"></script>
</body>
</html>
45 changes: 45 additions & 0 deletions libs/zhi-siyuan-api/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"name": "zhi-siyuan-api",
"version": "1.9.1",
"type": "module",
"description": "a siyuan-note api including both kernel and client",
"main": "./dist/index.js",
"typings": "./dist/index.d.ts",
"repository": "terwer/zhi",
"homepage": "https://github.com/terwer/zhi/tree/main/libs/zhi-siyuan-api",
"author": "terwer",
"license": "GPL",
"files": [
"dist",
"README.md"
],
"keywords": [
"zhi",
"lib",
"siyuan",
"note",
"api"
],
"scripts": {
"serve": "vite",
"dev": "vite build --watch",
"build": "vite build",
"start": "vite preview",
"test": "vitest --watch"
},
"devDependencies": {
"@terwer/eslint-config-custom": "workspace:*",
"@terwer/tsconfig": "workspace:*",
"@terwer/vite-config-custom": "workspace:*",
"form-data": "^4.0.0"
},
"dependencies": {
"cross-fetch": "^3.1.6",
"zhi-blog-api": "workspace:*",
"zhi-common": "workspace:*",
"zhi-lib-base": "workspace:*"
},
"publishConfig": {
"access": "public"
}
}
32 changes: 32 additions & 0 deletions libs/zhi-siyuan-api/src/index.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* 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 { describe, it } from "vitest"

describe("zhi-siyuan-api", () => {
it("index", () => {
console.log("hello world")
})
})
10 changes: 10 additions & 0 deletions libs/zhi-siyuan-api/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import SiyuanApi from "./lib/zhi-siyuan-api"
import SiyuanKernelApi from "./lib/kernel/siyuanKernelApi"
import type { SiyuanData } from "./lib/kernel/ISiyuanKernelApi"
import SiyuanConfig from "./lib/config/siyuanConfig"
import SiYuanApiAdaptor from "./lib/adaptor/siYuanApiAdaptor"
import SiyuanConstants from "./lib/siyuanConstants"

export { SiyuanApi }
export { SiyuanData, SiyuanKernelApi }
export { SiyuanConstants, SiyuanConfig, SiYuanApiAdaptor }
Loading

0 comments on commit 6b162c5

Please sign in to comment.