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({
350350})
351351```
352352
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+
353361### Task icon
354362
355363It 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 {
191191 */
192192 getDescribedTask ( command ) {
193193 return this . describedTasks . find (
194- options => options . match . test ( command )
194+ options => typeof options . match === 'function' ? options . match ( command ) : options . match . test ( command )
195195 )
196196 }
197197
Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ const schema = joi => ({
1818} )
1919
2020const 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' ) ,
2222 ...schema ( joi )
2323} ) )
2424
You can’t perform that action at this time.
0 commit comments