@seayoo-web/finder 2.0.15 → 2.1.0
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 +20 -6
- package/package.json +1 -1
- package/types/src/core.d.ts +6 -2
package/dist/index.js
CHANGED
|
@@ -294,16 +294,30 @@ async function finderDeploy(option) {
|
|
|
294
294
|
})
|
|
295
295
|
);
|
|
296
296
|
const lastDeployResult = results[results.length - 1];
|
|
297
|
-
if (
|
|
298
|
-
|
|
297
|
+
if (lastDeployResult && lastDeployResult.previewUrl) {
|
|
298
|
+
doPreview(lastDeployResult.previewUrl, preview);
|
|
299
299
|
}
|
|
300
|
-
return
|
|
300
|
+
return deployTo.join(",");
|
|
301
301
|
}
|
|
302
302
|
const deployResult = await deploy({ debug, target: deployTo, buffer, user, key, payload });
|
|
303
|
-
if (
|
|
304
|
-
|
|
303
|
+
if (deployResult && deployResult.previewUrl) {
|
|
304
|
+
doPreview(deployResult.previewUrl, preview);
|
|
305
305
|
}
|
|
306
|
-
return
|
|
306
|
+
return deployTo;
|
|
307
|
+
}
|
|
308
|
+
function doPreview(defaultPreviewUrl, option) {
|
|
309
|
+
if (!option) {
|
|
310
|
+
return;
|
|
311
|
+
}
|
|
312
|
+
if (option === true) {
|
|
313
|
+
open(defaultPreviewUrl);
|
|
314
|
+
return;
|
|
315
|
+
}
|
|
316
|
+
const base = defaultPreviewUrl.replace(/index\.html.*$/i, "");
|
|
317
|
+
const files = Array.isArray(option) ? option : [option];
|
|
318
|
+
files.forEach((file) => {
|
|
319
|
+
open(base + file);
|
|
320
|
+
});
|
|
307
321
|
}
|
|
308
322
|
async function finderUpload(option) {
|
|
309
323
|
const { filePath, deployTo, user, key, preview, debug } = option;
|
package/package.json
CHANGED
package/types/src/core.d.ts
CHANGED
|
@@ -17,8 +17,12 @@ export declare function finderDeploy(option: {
|
|
|
17
17
|
key: string;
|
|
18
18
|
/** 是否输出更多调试信息 */
|
|
19
19
|
debug?: boolean;
|
|
20
|
-
/**
|
|
21
|
-
|
|
20
|
+
/**
|
|
21
|
+
* 是否部署完毕后打开目标文件(index.html)
|
|
22
|
+
*
|
|
23
|
+
* 也可以指定不同的目标文件
|
|
24
|
+
*/
|
|
25
|
+
preview?: boolean | string | string[];
|
|
22
26
|
/** 代码的 commit log 信息,换行用 \n */
|
|
23
27
|
commitLogs?: string;
|
|
24
28
|
}): Promise<string>;
|