vite-plugin-deploy-ftp 0.0.7 → 0.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -56,7 +56,8 @@ function vitePluginDeployFtp(option) {
56
56
  sequential: true,
57
57
  order: "post",
58
58
  async handler() {
59
- if (!host || !port || !user || !password || !uploadPath || !open) {
59
+ if (!open) return;
60
+ if (!host || !port || !user || !password || !uploadPath) {
60
61
  console.log(import_chalk.default.yellow("\u8BF7\u914D\u7F6E\u6B63\u786E\u7684FTP\u4FE1\u606F"));
61
62
  return;
62
63
  }
@@ -84,9 +85,7 @@ function vitePluginDeployFtp(option) {
84
85
  uploadSpinner.color = "blue";
85
86
  uploadSpinner.text = "\u8FDE\u63A5\u6210\u529F";
86
87
  const fileList = await client.list(uploadPath);
87
- uploadSpinner.succeed(
88
- `\u5DF2\u8FDE\u63A5 ${import_chalk.default.green(`\u76EE\u5F55: ==> ${protocol + (0, import_vite.normalizePath)(other + uploadPath)}`)}`
89
- );
88
+ uploadSpinner.succeed(`\u5DF2\u8FDE\u63A5 ${import_chalk.default.green(`\u76EE\u5F55: ==> ${protocol + (0, import_vite.normalizePath)(other + uploadPath)}`)}`);
90
89
  if (fileList.length) {
91
90
  const isBackFiles = await (0, import_prompts.select)({
92
91
  message: "\u662F\u5426\u5907\u4EFD\u8FDC\u7A0B\u6587\u4EF6",
@@ -99,9 +98,7 @@ function vitePluginDeployFtp(option) {
99
98
  }
100
99
  const uploadFileSpinner = (0, import_ora.default)("\u4E0A\u4F20\u4E2D...").start();
101
100
  await client.uploadFromDir(outDir, uploadPath);
102
- uploadFileSpinner.succeed(
103
- "\u4E0A\u4F20\u6210\u529F url:" + import_chalk.default.green(`${protocol + (0, import_vite.normalizePath)(other + uploadPath)}`)
104
- );
101
+ uploadFileSpinner.succeed("\u4E0A\u4F20\u6210\u529F url:" + import_chalk.default.green(`${protocol + (0, import_vite.normalizePath)(other + uploadPath)}`));
105
102
  client.close();
106
103
  }
107
104
  }
@@ -118,9 +115,7 @@ async function createBackupFile(client, dir, protocol, other) {
118
115
  import_node_fs.default.mkdirSync(localDir, { recursive: true });
119
116
  }
120
117
  await client.downloadToDir(localDir, dir);
121
- backupSpinner.text = `\u4E0B\u8F7D\u8FDC\u7A0B\u6587\u4EF6\u6210\u529F ${import_chalk.default.yellow(
122
- `\u76EE\u5F55: ==> ${protocol + (0, import_vite.normalizePath)(other + dir)}`
123
- )}`;
118
+ backupSpinner.text = `\u4E0B\u8F7D\u8FDC\u7A0B\u6587\u4EF6\u6210\u529F ${import_chalk.default.yellow(`\u76EE\u5F55: ==> ${protocol + (0, import_vite.normalizePath)(other + dir)}`)}`;
124
119
  import_node_fs.default.readdirSync(localDir).forEach((i) => {
125
120
  if (i.startsWith("backup_") && i.endsWith(".zip")) {
126
121
  import_node_fs.default.rmSync(import_node_path.default.join(localDir, i));
package/dist/index.mjs CHANGED
@@ -22,7 +22,8 @@ function vitePluginDeployFtp(option) {
22
22
  sequential: true,
23
23
  order: "post",
24
24
  async handler() {
25
- if (!host || !port || !user || !password || !uploadPath || !open) {
25
+ if (!open) return;
26
+ if (!host || !port || !user || !password || !uploadPath) {
26
27
  console.log(chalk.yellow("\u8BF7\u914D\u7F6E\u6B63\u786E\u7684FTP\u4FE1\u606F"));
27
28
  return;
28
29
  }
@@ -50,9 +51,7 @@ function vitePluginDeployFtp(option) {
50
51
  uploadSpinner.color = "blue";
51
52
  uploadSpinner.text = "\u8FDE\u63A5\u6210\u529F";
52
53
  const fileList = await client.list(uploadPath);
53
- uploadSpinner.succeed(
54
- `\u5DF2\u8FDE\u63A5 ${chalk.green(`\u76EE\u5F55: ==> ${protocol + normalizePath(other + uploadPath)}`)}`
55
- );
54
+ uploadSpinner.succeed(`\u5DF2\u8FDE\u63A5 ${chalk.green(`\u76EE\u5F55: ==> ${protocol + normalizePath(other + uploadPath)}`)}`);
56
55
  if (fileList.length) {
57
56
  const isBackFiles = await select({
58
57
  message: "\u662F\u5426\u5907\u4EFD\u8FDC\u7A0B\u6587\u4EF6",
@@ -65,9 +64,7 @@ function vitePluginDeployFtp(option) {
65
64
  }
66
65
  const uploadFileSpinner = ora("\u4E0A\u4F20\u4E2D...").start();
67
66
  await client.uploadFromDir(outDir, uploadPath);
68
- uploadFileSpinner.succeed(
69
- "\u4E0A\u4F20\u6210\u529F url:" + chalk.green(`${protocol + normalizePath(other + uploadPath)}`)
70
- );
67
+ uploadFileSpinner.succeed("\u4E0A\u4F20\u6210\u529F url:" + chalk.green(`${protocol + normalizePath(other + uploadPath)}`));
71
68
  client.close();
72
69
  }
73
70
  }
@@ -84,9 +81,7 @@ async function createBackupFile(client, dir, protocol, other) {
84
81
  fs.mkdirSync(localDir, { recursive: true });
85
82
  }
86
83
  await client.downloadToDir(localDir, dir);
87
- backupSpinner.text = `\u4E0B\u8F7D\u8FDC\u7A0B\u6587\u4EF6\u6210\u529F ${chalk.yellow(
88
- `\u76EE\u5F55: ==> ${protocol + normalizePath(other + dir)}`
89
- )}`;
84
+ backupSpinner.text = `\u4E0B\u8F7D\u8FDC\u7A0B\u6587\u4EF6\u6210\u529F ${chalk.yellow(`\u76EE\u5F55: ==> ${protocol + normalizePath(other + dir)}`)}`;
90
85
  fs.readdirSync(localDir).forEach((i) => {
91
86
  if (i.startsWith("backup_") && i.endsWith(".zip")) {
92
87
  fs.rmSync(path.join(localDir, i));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite-plugin-deploy-ftp",
3
- "version": "0.0.7",
3
+ "version": "0.0.8",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.mjs",
6
6
  "types": "./dist/index.d.ts",