@@ -95,6 +95,29 @@ const greeting = task("hello", "Prints a greeting")
95
95
} )
96
96
. build ( ) ;
97
97
98
+ const pluginExample = {
99
+ id : "community-plugin" ,
100
+ tasks : [
101
+ task ( "plugin-hello" , "Prints a greeting from community-plugin" )
102
+ . addOption ( {
103
+ name : "greeting" ,
104
+ description : "The greeting to print" ,
105
+ defaultValue : "Hello, World from community-plugin!" ,
106
+ } )
107
+ . setAction ( async ( { greeting } , _ ) => {
108
+ console . log ( greeting ) ;
109
+
110
+ if ( greeting === "" ) {
111
+ throw new HardhatPluginError (
112
+ "community-plugin" ,
113
+ "Greeting cannot be empty" ,
114
+ ) ;
115
+ }
116
+ } )
117
+ . build ( ) ,
118
+ ] ,
119
+ } ;
120
+
98
121
export default {
99
122
tasks : [
100
123
exampleTaskOverride ,
@@ -105,29 +128,6 @@ export default {
105
128
exampleEmptySubtask ,
106
129
greeting ,
107
130
] ,
108
- plugins : [
109
- {
110
- id : "plugin-example" ,
111
- tasks : [
112
- task ( "plugin1-hello" , "Prints a greeting from plugin1" )
113
- . addOption ( {
114
- name : "greeting" ,
115
- description : "The greeting to print" ,
116
- defaultValue : "Hello, World from plugin1!" ,
117
- } )
118
- . setAction ( async ( { greeting } , _ ) => {
119
- console . log ( greeting ) ;
120
-
121
- if ( greeting === "" ) {
122
- throw new HardhatPluginError (
123
- "plugin-example" ,
124
- "Greeting cannot be empty" ,
125
- ) ;
126
- }
127
- } )
128
- . build ( ) ,
129
- ] ,
130
- } ,
131
- ] ,
131
+ plugins : [ pluginExample ] ,
132
132
privateKey : configVariable ( "privateKey" ) ,
133
133
} satisfies HardhatUserConfig ;
0 commit comments