@@ -111,6 +111,12 @@ module.exports = (api, options, rootOptions) => {
111
111
api . onCreateComplete ( async ( ) => {
112
112
const execa = require ( 'execa' )
113
113
114
+ function run ( program , args ) {
115
+ return execa ( program , args , {
116
+ preferLocal : true ,
117
+ } )
118
+ }
119
+
114
120
if ( options . addExamples ) {
115
121
const appPath = api . resolve ( 'src/App.vue' )
116
122
if ( fs . existsSync ( appPath ) ) {
@@ -139,7 +145,7 @@ module.exports = (api, options, rootOptions) => {
139
145
}
140
146
}
141
147
142
- await execa ( 'vue-cli-service' , [
148
+ await run ( 'vue-cli-service' , [
143
149
'apollo:schema:generate' ,
144
150
] )
145
151
}
@@ -184,47 +190,9 @@ module.exports = (api, options, rootOptions) => {
184
190
}
185
191
}
186
192
187
- // Linting
188
- if ( api . hasPlugin ( 'eslint' ) ) {
189
- // ESlint ignore
190
- if ( options . addServer ) {
191
- const filePath = api . resolve ( '.eslintignore' )
192
- let content
193
-
194
- if ( fs . existsSync ( filePath ) ) {
195
- content = fs . readFileSync ( filePath , { encoding : 'utf8' } )
196
- } else {
197
- content = ''
198
- }
199
-
200
- if ( content . indexOf ( 'schema.graphql' ) === - 1 ) {
201
- content += '\nschema.graphql\n'
202
-
203
- fs . writeFileSync ( filePath , content , { encoding : 'utf8' } )
204
- }
205
- }
206
-
207
- // Lint generated/modified files
208
- try {
209
- const files = [ '*.js' , '.*.js' , 'src' ]
210
- if ( api . hasPlugin ( 'apollo' ) ) {
211
- files . push ( 'apollo-server' )
212
- }
213
- execa . sync ( 'vue-cli-service lint' , [
214
- '--silent' ,
215
- ...files ,
216
- ] , {
217
- cleanup : true ,
218
- shell : true ,
219
- } )
220
- } catch ( e ) {
221
- // No ESLint vue-cli plugin
222
- }
223
- }
224
-
225
193
// Schema publish
226
194
if ( options . publishSchema ) {
227
- await execa ( 'vue-cli-service' , [
195
+ await run ( 'vue-cli-service' , [
228
196
'apollo:schema:publish' ,
229
197
] )
230
198
}
0 commit comments