@seayoo-web/finder 2.0.8 → 2.0.10

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.cjs CHANGED
@@ -6,7 +6,7 @@ const open = require("open");
6
6
  require("colors");
7
7
  const compressing = require("compressing");
8
8
  const os = require("os");
9
- const presetIgnores = ["node_modules/", ".git/", ".vscode/", "__MACOSX/", ".DS_Store"];
9
+ const presetIgnores = ["node_modules/", ".git/", ".vscode/", "__MACOSX/", ".DS_Store", ".gitkeep"];
10
10
  function compressToBuffer(sourceDir, ignoreFiles, debug) {
11
11
  const ignoreFileList = [...presetIgnores, ...ignoreFiles || []];
12
12
  const filesToCompress = getAllFiles(sourceDir, ignoreFileList);
@@ -176,7 +176,7 @@ async function upload(option) {
176
176
  }
177
177
  const filename = path.basename(target);
178
178
  const deployTarget = path.dirname(pure(target));
179
- const { status, message, data } = await request({
179
+ const { status, data } = await request({
180
180
  url: `${getFinderServerFullPath(targetServer)}${FinderApiPaths.upload}?target=${encodeURIComponent(deployTarget)}`,
181
181
  method: "POST",
182
182
  headers: { user, key },
@@ -186,13 +186,10 @@ async function upload(option) {
186
186
  }
187
187
  });
188
188
  if (status !== 200) {
189
- throw `${`上传接口错误(${status})`.bgRed} ${message || ""}.red`;
190
- }
191
- if (!data || typeof data !== "object") {
192
- throw `上传接口响应错误,请自行检查是否上传成功。`.bgRed + JSON.stringify(data).red;
189
+ throw `上传接口错误(status ${status})`.red;
193
190
  }
194
- if ("err" in data || !("data" in data) || typeof data.data !== "string") {
195
- throw `上传接口错误。`.bgRed + JSON.stringify(data).red;
191
+ if (!data || typeof data !== "object" || "err" in data && data.err || !("data" in data) || typeof data.data !== "string") {
192
+ throw `上传接口响应错误。 ${JSON.stringify(data)}`.red;
196
193
  }
197
194
  return { previewUrl: `https://${pure(target)}` };
198
195
  }
package/dist/index.js CHANGED
@@ -4,7 +4,7 @@ import open from "open";
4
4
  import "colors";
5
5
  import { zip } from "compressing";
6
6
  import os from "os";
7
- const presetIgnores = ["node_modules/", ".git/", ".vscode/", "__MACOSX/", ".DS_Store"];
7
+ const presetIgnores = ["node_modules/", ".git/", ".vscode/", "__MACOSX/", ".DS_Store", ".gitkeep"];
8
8
  function compressToBuffer(sourceDir, ignoreFiles, debug) {
9
9
  const ignoreFileList = [...presetIgnores, ...ignoreFiles || []];
10
10
  const filesToCompress = getAllFiles(sourceDir, ignoreFileList);
@@ -174,7 +174,7 @@ async function upload(option) {
174
174
  }
175
175
  const filename = basename(target);
176
176
  const deployTarget = dirname(pure(target));
177
- const { status, message, data } = await request({
177
+ const { status, data } = await request({
178
178
  url: `${getFinderServerFullPath(targetServer)}${FinderApiPaths.upload}?target=${encodeURIComponent(deployTarget)}`,
179
179
  method: "POST",
180
180
  headers: { user, key },
@@ -184,13 +184,10 @@ async function upload(option) {
184
184
  }
185
185
  });
186
186
  if (status !== 200) {
187
- throw `${`上传接口错误(${status})`.bgRed} ${message || ""}.red`;
188
- }
189
- if (!data || typeof data !== "object") {
190
- throw `上传接口响应错误,请自行检查是否上传成功。`.bgRed + JSON.stringify(data).red;
187
+ throw `上传接口错误(status ${status})`.red;
191
188
  }
192
- if ("err" in data || !("data" in data) || typeof data.data !== "string") {
193
- throw `上传接口错误。`.bgRed + JSON.stringify(data).red;
189
+ if (!data || typeof data !== "object" || "err" in data && data.err || !("data" in data) || typeof data.data !== "string") {
190
+ throw `上传接口响应错误。 ${JSON.stringify(data)}`.red;
194
191
  }
195
192
  return { previewUrl: `https://${pure(target)}` };
196
193
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seayoo-web/finder",
3
- "version": "2.0.8",
3
+ "version": "2.0.10",
4
4
  "description": "agent for web finder",
5
5
  "type": "module",
6
6
  "source": "index.ts",