Skip to content

Commit 1c909ac

Browse files
committed
feat: ✨ upgrade logseq sdk version and replace yarn with pnpm
1 parent 5e62bf7 commit 1c909ac

19 files changed

+5683
-4657
lines changed

.env

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
VITE_LOGSEQ_API_SERVER=http://127.0.0.1:12315
2+
VITE_LOGSEQ_API_TOKEN=123

.env.plugin

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
VITE_MODE=plugin

.env.web

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
VITE_MODE=web

.github/workflows/release.yml

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,34 @@ on:
33
push:
44
branches:
55
- main
6-
pull_request:
7-
branches:
8-
- main
6+
97
jobs:
108
release:
119
name: Release
12-
runs-on: ubuntu-18.04
10+
runs-on: ubuntu-20.04
1311
steps:
1412
- name: Checkout
15-
uses: actions/checkout@v2
13+
uses: actions/checkout@v3
1614
with:
1715
fetch-depth: 0
16+
1817
- name: Setup Node.js
19-
uses: actions/setup-node@v2
18+
uses: actions/setup-node@v3
19+
with:
20+
node-version: 18
21+
22+
- name: Install pnpm
23+
uses: pnpm/action-setup@v2
2024
with:
21-
node-version: 14
25+
version: 8
26+
run_install: false
27+
2228
- name: Install dependencies
23-
run: yarn
29+
run: pnpm install
30+
2431
- name: Build
25-
run: yarn build
32+
run: pnpm build:plugin
33+
2634
- name: Release
2735
env:
2836
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

README.md

Lines changed: 36 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,46 @@
55
[![License](https://img.shields.io/github/license/haydenull/logseq-plugin-react-boilerplate?color=blue)](https://github.com/haydenull/logseq-plugin-react-boilerplate/blob/main/LICENSE)
66

77
## Demo
8-
![demo](./demo.gif)
8+
![demo](./screenshots/demo.gif)
9+
10+
## Pre Requirements
11+
1. [nodejs](https://nodejs.org/)
12+
2. [pnpm](https://pnpm.io/)
913

1014
## Usage
1115
1. Use this template create your own plugin
12-
2. change `package.json` to your own plugin name
16+
2. change `package.json` name to your own plugin name
1317
3. change LICENSE to your own license
14-
4. use `yarn dev` to run your plugin in browser
15-
5. use `yarn build` to build your plugin and load it in logseq
18+
4. change logo.png to your own logo
19+
5. run `pnpm install` to install dependencies
20+
21+
### Browser mode with HMR
22+
23+
1. run `pnpm dev` to start vite server
24+
2. Open HTTP APIs server Feature in logseq settings
25+
![](./screenshots/settings-api-server-feature.png)
26+
3. add [Authorization tokens](https://haydenut.notion.site/English-fd47d1843e654f5485a07ef4935ed365?pvs=25#7a7a57de5a77480a84d30bc610d235c5) in logseq
27+
* API_SERVER=http://127.0.0.1:12315
28+
* API_TOKEN=123
29+
![](./screenshots/api-server.png)
30+
4. open `localhost:5173` in browser
31+
32+
> [!TIP]
33+
> Browser mode cannot access logseq plugin settings, you can add a file `mocks/settings.local.json` to mock.
1634
17-
## Release
35+
36+
### Plugin mode
37+
This mode doesn't support HMR, you need to run `pnpm build` and reload plugin in logseq to see the changes
38+
1. run `pnpm build:plugin` to build plugin
39+
2. Open Plugins feature in logseq settings
40+
![](./screenshots/settings-plugin-feature.png)
41+
3. Click `Load unpacked plugin` and select this project folder
42+
![](./screenshots/load-plugin.png)
43+
44+
## Release new version
1845
1. push to `main` branch
1946
2. github ci will auto create a new release
47+
48+
## Publish to [logseq marketplace](https://github.com/logseq/marketplace)
49+
50+
Create PR to add your plugin message to [logseq/marketplace](https://github.com/logseq/marketplace)

index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<meta charset="UTF-8" />
55
<link rel="icon" type="image/svg+xml" href="/src/favicon.svg" />
66
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
7-
<title>Vite App</title>
7+
<title>Logseq Plugin</title>
88
</head>
99
<body>
1010
<div id="root"></div>

package.json

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,18 @@
77
"icon": "logo.png"
88
},
99
"scripts": {
10-
"dev": "vite",
11-
"build": "tsc && vite build",
10+
"dev": "vite --mode web",
11+
"build:plugin": "tsc && vite build --mode plugin",
12+
"build:web": "tsc && vite build --mode web",
1213
"preview": "vite preview"
1314
},
1415
"dependencies": {
15-
"@logseq/libs": "^0.0.10",
16-
"antd": "^5.0.2",
16+
"@logseq/libs": "^0.0.17",
1717
"react": "^18.2.0",
1818
"react-dom": "^18.2.0"
1919
},
2020
"devDependencies": {
21+
"@haydenull/fabric": "^0.2.6",
2122
"@semantic-release/changelog": "^6.0.1",
2223
"@semantic-release/exec": "^6.0.3",
2324
"@semantic-release/git": "^10.0.1",
@@ -27,10 +28,13 @@
2728
"@types/react-dom": "^18.0.9",
2829
"@vitejs/plugin-react": "^2.2.0",
2930
"autoprefixer": "^10.4.2",
31+
"eslint": "^8.57.0",
32+
"logseq-proxy": "^0.1.2",
3033
"postcss": "^8.4.5",
34+
"semantic-release": "^21.1.2",
3135
"tailwindcss": "^3.2.4",
3236
"typescript": "^4.9.3",
33-
"vite": "^3.2.4",
37+
"vite": "^4.5.3",
3438
"vite-plugin-importer": "^0.2.5"
3539
}
36-
}
40+
}

0 commit comments

Comments
 (0)