Skip to content

Commit 81ec2b8

Browse files
committed
add example
1 parent 6ab0932 commit 81ec2b8

8 files changed

Lines changed: 39 additions & 14 deletions

File tree

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
.DS_Store
22
node_modules
3-
/dist
43

54
# local env files
65
.env.local

dist/index.js

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

dist/测试.js

Whitespace-only changes.

dist/测试1.js

Whitespace-only changes.

example/index.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
const upFtp = require('../index');
2+
3+
class Api {
4+
registerCommand = (type, callback) => {
5+
if ('ftpdeploy' === type) callback();
6+
}
7+
}
8+
class Options {
9+
pluginOptions = {
10+
ftp: {
11+
host: "",
12+
remoteFtpPath: '',
13+
delArr: []
14+
}
15+
}
16+
constructor(host, remoteFtpPath, delArr) {
17+
this.pluginOptions.ftp.host = host;
18+
this.pluginOptions.ftp.remoteFtpPath = remoteFtpPath;
19+
this.pluginOptions.ftp.delArr = delArr
20+
}
21+
}
22+
23+
const api = new Api();
24+
const options = new Options("192.168.1.101", "/newf/", ['测试']);
25+
upFtp(api, options);

index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const Client = require("ftp");
1+
const Client = require("@findsoft/ftp");
22
const fs = require("fs");
33
const ProgressBar = require("./src/progress_bar");
44
module.exports = (api, projectOptions) => {
@@ -55,7 +55,7 @@ module.exports = (api, projectOptions) => {
5555
// if(chineseTest.test(file.name)) {
5656
// console.log('这里面有中文', file.name);
5757
// }
58-
const newName = chineseTest.test(file.name) ? encodeURIComponent(file.name) : file.name
58+
const newName = file.name
5959
const data1 = {
6060
dir,
6161
dirName: `${dir}/${newName}`,

package-lock.json

Lines changed: 10 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"url": "git+https://github.com/phpjavac/vue-cli-plugin-ftp.git"
1414
},
1515
"dependencies": {
16-
"ftp": "^0.3.10",
16+
"@findsoft/ftp": "^0.3.3",
1717
"single-line-log": "^1.1.2"
1818
}
1919
}

0 commit comments

Comments
 (0)