Skip to content

Commit 96ab5d5

Browse files
committed
feat: build hook add shelljs
1 parent e73bfc4 commit 96ab5d5

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,11 +108,11 @@ Execution timeout.
108108
If it is `rsync`, it is the timeout period for executing the command. If it is `oss-upload-tool`, it is the single file upload timeout period.
109109

110110
### `onUploadStart`
111-
Type: `(stats: Stats) => void | Promise<void>`
111+
Type: `(stats: Stats, shelljs) => void | Promise<void>`
112112
Before upload event.
113113

114114
### `onUploadFinish`
115-
Type: `(stats: Stats) => void | Promise<void>`
115+
Type: `(stats: Stats, shelljs) => void | Promise<void>`
116116
Upload complete event.
117117

118118
### `execUploadStartScripts`

src/index.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,16 @@ export type TargetItem = {
5858
/**
5959
* before upload callback
6060
*/
61-
onUploadStart?: (stats: Stats) => void | Promise<void>;
61+
onUploadStart?: (stats: Stats, shelljs: typeof shell) => void | Promise<void>;
6262
/**
6363
* Upload finish callback
6464
*/
65-
onUploadFinish?: (stats: Stats) => void | Promise<void>;
65+
onUploadFinish?: (
66+
stats: Stats,
67+
shelljs: typeof shell
68+
) => void | Promise<void>;
6669
/**
67-
* @link {import("shelljs").ExecOptions}
70+
* @link {require("shelljs").ExecOptions}
6871
*/
6972
execOptions?: ExecOptions;
7073
};
@@ -151,7 +154,7 @@ class WebpackDeployPlugin {
151154
return;
152155
}
153156

154-
onUploadStart?.(stats);
157+
onUploadStart?.(stats, shell);
155158
execScripts(execUploadStartScripts, {
156159
...execOptions,
157160
cwd: context,
@@ -182,7 +185,7 @@ class WebpackDeployPlugin {
182185
return;
183186
}
184187

185-
await onUploadFinish?.(stats);
188+
await onUploadFinish?.(stats, shell);
186189
execScripts(execUploadFinishScripts, {
187190
...execOptions,
188191
cwd: context,

0 commit comments

Comments
 (0)