Skip to content

Commit 69f4755

Browse files
committed
refactor: project
1 parent 176ae30 commit 69f4755

File tree

15 files changed

+1908
-1259
lines changed

15 files changed

+1908
-1259
lines changed

README.md

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
## picgo-plugin-sftp-uploader
22

3-
PicGo SFTP 上传插件,原 `picgo-plugin-ssh-scp-uploader`
3+
PicGo SFTP 上传插件
44

55
## 配置
66

@@ -14,7 +14,7 @@ PicGo SFTP 上传插件,原 `picgo-plugin-ssh-scp-uploader`
1414

1515
| 名称 | 介绍 | 配置示例 |
1616
| -------- | -------------------- | -------------------- |
17-
| 网站标识 | 多个 SFTP 站的标识 | imba97 |
17+
| 网站标识 | 多个 SFTP 站的标识 | site1 |
1818
| 配置文件 | 配置文件的路径或 URL | D:/sftpUploader.json |
1919

2020
**关于配置文件**
@@ -25,16 +25,16 @@ PicGo SFTP 上传插件,原 `picgo-plugin-ssh-scp-uploader`
2525

2626
### 配置文件配置
2727

28-
配置文件是一个`json`文件,你可以在里面配置多个服务器的信息
28+
配置文件是一个 `json` 文件,你可以在里面配置多个服务器的信息
2929

3030
例:
3131

3232
```json
3333
{
34-
"imba97": {
35-
"url": "https://imba97.cn",
36-
"path": "/uploads/{year}/{month}/{fullName}",
37-
"uploadPath": "/www/imba97_cn/uploads/{year}/{month}/{fullName}",
34+
"site1": {
35+
"url": "https://mysite1.com",
36+
"path": "/mysite1.com/{year}/{month}/{fullName}",
37+
"uploadPath": "/Web/mysite1.com/{year}/{month}/{fullName}",
3838
"host": "1.2.3.4",
3939
"port": 22,
4040
"username": "root",
@@ -43,10 +43,10 @@ PicGo SFTP 上传插件,原 `picgo-plugin-ssh-scp-uploader`
4343
"fileUser": "www",
4444
"dirMode": "0755"
4545
},
46-
"btools": {
47-
"url": "https://btools.cc",
48-
"path": "/uploads/{year}/{month}/{fullName}",
49-
"uploadPath": "/www/btools_cc/uploads/{year}/{month}/{fullName}",
46+
"site2": {
47+
"url": "https://mysite2.com",
48+
"path": "/mysite2.com/{year}/{month}/{fullName}",
49+
"uploadPath": "/Web/mysite2.com/{year}/{month}/{fullName}",
5050
"host": "1.2.3.4",
5151
"username": "root",
5252
"password": "ssh_password"
@@ -56,7 +56,7 @@ PicGo SFTP 上传插件,原 `picgo-plugin-ssh-scp-uploader`
5656

5757
| key | 名称 | 介绍 | 配置示例 | 是否必填 |
5858
| ---------- | ------------ | ---------------------------------------------------------------------------------- | --------------------------------------------------- | -------- |
59-
| url | 域名地址 | 图片网站的域名 | https://imba97.cn ||
59+
| url | 域名地址 | 图片网站的域名 | https://mysite.com ||
6060
| path | 网址路径 | 图片在网址中的路径 | /uploads/{year}/{month}/{fullName} ||
6161
| uploadPath | 文件路径 | 图片在服务器的真实路径 | /www/wwwroot/blog/uploads/{year}/{month}/{fullName} ||
6262
| host | SSH 地址 | 一般是服务器 IP | 233.233.233.233 ||
@@ -84,19 +84,19 @@ PicGo SFTP 上传插件,原 `picgo-plugin-ssh-scp-uploader`
8484
| hash32 | 图片 MD5 32 位 | 68559cae1081d6836e09b043aa0b3af1 |
8585
| ext | 图片后缀名 | png |
8686

87-
**注意**:除了`fullName`,其他都需要自行添加后缀名
87+
**注意**:除了 `fullName`,其他都需要自行添加后缀名
8888

8989
## 路径配置示例
9090

91-
**网址路径****文件路径**的配置示例
91+
**网址路径****文件路径** 的配置示例
9292

9393
比如我服务器有这样一个路径:`/www/wwwroot/blog/uploads/`,图片在里面
9494

95-
我的网站根目录是`/www/wwwroot/blog/`
95+
我的网站根目录是 `/www/wwwroot/blog/`
9696

97-
那么我可以把**网址路径**设置为`/uploads/{year}/{month}/{fullName}`
97+
那么我可以把 **网址路径** 设置为 `/uploads/{year}/{month}/{fullName}`
9898

99-
**文件路径**设置为`/www/wwwroot/blog/uploads/{year}/{month}/{fullName}`
99+
**文件路径** 设置为 `/www/wwwroot/blog/uploads/{year}/{month}/{fullName}`
100100

101101
## 用户名|私钥 配置示例
102102

@@ -112,21 +112,21 @@ PicGo SFTP 上传插件,原 `picgo-plugin-ssh-scp-uploader`
112112

113113
2. **用户名 + 私钥 + 私钥密码**
114114

115-
私钥是使用`ssh-keygen`生成的,Windows 系统默认创建位置是`C:\Users\xxx\.ssh\id_rsa`
115+
私钥是使用 `ssh-keygen` 生成的,Windows 系统默认创建位置是 `C:\Users\xxx\.ssh\id_rsa`
116116

117-
生成及配置密钥的过程可参考[《搭建自己的 Git 服务器》](https://imba97.cn/archives/281)中的**创建 SSH**部分
117+
生成及配置密钥的过程可参考[《搭建自己的 Git 服务器》](https://imba97.cn/archives/281)中的 **创建 SSH** 部分
118118

119-
完成后可以登录测试一下,再在**用户名|密钥**配置:
119+
完成后可以登录测试一下,再在 **用户名|密钥** 配置:
120120

121121
```
122122
www|C:\Users\xxx\.ssh\id_rsa
123123
```
124124

125-
`www`是用户名,中间用`|`隔开,后面是保存在本地的私钥文件路径
125+
`www` 是用户名,中间用 `|` 隔开,后面是保存在本地的私钥文件路径
126126

127-
**密码/密钥密码**配置创建密钥时输入的密码,**如果没有私钥密码可留空**
127+
**密码/密钥密码** 配置创建密钥时输入的密码,**如果没有私钥密码可留空**
128128

129-
**注意:**如果是宝塔的`www`用户,还需要修改`/etc/passwd`
129+
**注意:** 如果是宝塔的 `www` 用户,还需要修改 `/etc/passwd`
130130

131131
```bash
132132
# 打开 passwd

build.config.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ export default defineBuildConfig({
55
'src/index'
66
],
77
rollup: {
8+
emitCJS: true,
89
inlineDependencies: true,
910
json: {
1011
compact: true,
@@ -14,8 +15,16 @@ export default defineBuildConfig({
1415
commonjs: {
1516
requireReturnsDefault: 'auto'
1617
},
18+
esbuild: {
19+
format: 'cjs',
20+
minify: true
21+
},
1722
dts: {
1823
respectExternal: false
24+
},
25+
output: {
26+
format: 'cjs',
27+
exports: 'auto'
1928
}
2029
},
2130
clean: true,

eslint.config.js

Lines changed: 0 additions & 7 deletions
This file was deleted.

eslint.config.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import createConfig from '@imba97/eslint-config'
2+
3+
export default createConfig()

package.json

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22
"name": "picgo-plugin-sftp-uploader",
33
"type": "module",
44
"version": "1.3.0",
5-
"packageManager": "pnpm@9.6.0",
5+
"packageManager": "pnpm@10.10.0",
66
"description": "An uploader for uploadding via SFTP",
77
"author": "imba97",
88
"license": "MIT",
99
"homepage": "https://github.com/imba97/picgo-plugin-sftp-uploader",
1010
"repository": {
1111
"type": "git",
12-
"url": "git+ssh://git@github.com/imba97/picgo-plugin-sftp-uploader"
12+
"url": "git+ssh://git@github.com:imba97/picgo-plugin-sftp-uploader.git"
1313
},
1414
"bugs": {
1515
"url": "https://github.com/imba97/picgo-plugin-sftp-uploader/issues"
@@ -19,12 +19,10 @@
1919
"picgo-gui-plugin",
2020
"picgo-plugin"
2121
],
22-
"main": "dist/index.mjs",
23-
"publishConfig": {
24-
"access": "public"
25-
},
22+
"main": "dist/index.cjs",
2623
"files": [
27-
"dist"
24+
"dist/index.cjs",
25+
"logo.png"
2826
],
2927
"scripts": {
3028
"stub": "unbuild --stub",
@@ -37,15 +35,21 @@
3735
"ssh2": "^1.16.0"
3836
},
3937
"devDependencies": {
40-
"@imba97/eslint-config": "^0.0.5",
41-
"@types/node": "^22.13.5",
42-
"@types/ssh2": "^1.15.4",
43-
"eslint": "^9.21.0",
44-
"lint-staged": "^15.4.3",
45-
"node-fetch": "^3.3.2",
38+
"@imba97/eslint-config": "^0.0.6",
39+
"@types/node": "^22.15.17",
40+
"@types/ssh2": "^1.15.5",
41+
"bumpp": "^10.1.0",
42+
"eslint": "^9.26.0",
43+
"lint-staged": "^16.0.0",
4644
"picgo": "^1.5.8",
47-
"simple-git-hooks": "^2.11.1",
48-
"typescript": "^5.7.3",
49-
"unbuild": "^3.3.1"
45+
"simple-git-hooks": "^2.13.0",
46+
"typescript": "^5.8.3",
47+
"unbuild": "^3.5.0"
48+
},
49+
"simple-git-hooks": {
50+
"pre-commit": "pnpm lint-staged"
51+
},
52+
"lint-staged": {
53+
"*": "eslint --cache --fix"
5054
}
5155
}

0 commit comments

Comments
 (0)