File tree Expand file tree Collapse file tree 3 files changed +10
-2
lines changed
packages/@vue/cli-ui/apollo-server/api Expand file tree Collapse file tree 3 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -350,6 +350,14 @@ api.describeTask({
350
350
})
351
351
```
352
352
353
+ You can also use a function for ` match ` :
354
+
355
+ ``` js
356
+ api .describeTask ({
357
+ match : (command ) => / vue-cli-service serve/ .test (command),
358
+ })
359
+ ```
360
+
353
361
### Task icon
354
362
355
363
It can be either a [ Material icon] ( https://material.io/tools/icons ) code or a custom image (see [ Public static files] ( #public-static-files ) ):
Original file line number Diff line number Diff line change @@ -191,7 +191,7 @@ class PluginApi {
191
191
*/
192
192
getDescribedTask ( command ) {
193
193
return this . describedTasks . find (
194
- options => options . match . test ( command )
194
+ options => typeof options . match === 'function' ? options . match ( command ) : options . match . test ( command )
195
195
)
196
196
}
197
197
Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ const schema = joi => ({
18
18
} )
19
19
20
20
const describeSchema = createSchema ( joi => ( {
21
- match : joi . object ( ) . type ( RegExp ) . required ( ) . description ( 'Match a npm script command' ) ,
21
+ match : joi . alternatives ( ) . try ( joi . object ( ) . type ( RegExp ) , joi . func ( ) ) . required ( ) . description ( 'Match a npm script command' ) ,
22
22
...schema ( joi )
23
23
} ) )
24
24
You can’t perform that action at this time.
0 commit comments