This repository was archived by the owner on Sep 8, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +40
-0
lines changed Expand file tree Collapse file tree 1 file changed +40
-0
lines changed Original file line number Diff line number Diff line change 1+ const fs = require ( 'fs' ) ;
2+ const path = require ( 'path' ) ;
3+
4+ function getConfigData ( data ) {
5+ return ( data . vue && data . vue . pluginOptions && data . vue . pluginOptions . netlify ) || { } ;
6+ }
7+
8+ module . exports = api => api . describeConfig ( {
9+ id : 'com.netlify.netlify-lambda' ,
10+ name : 'Netlify configuration' ,
11+ description : 'Configure Netlify Functions' ,
12+ link : 'https://github.com/netlify/vue-cli-plugin-netlify-lambda' ,
13+ files : {
14+ vue : {
15+ js : [ 'vue.config.js' ] ,
16+ } ,
17+ } ,
18+ onRead ( { data, cwd } ) {
19+ return {
20+ prompts : [
21+ {
22+ name : 'webpackConfig' ,
23+ type : 'input' ,
24+ default : null ,
25+ value : getConfigData ( data ) . webpackConfig ,
26+ validate : input => fs . existsSync ( path . join ( cwd , input ) ) ,
27+ message : 'Webpack config module' ,
28+ description : 'Additional webpack configuration' ,
29+ } ,
30+ ] ,
31+ } ;
32+ } ,
33+ async onWrite ( { api : writeApi , prompts } ) {
34+ const result = { } ;
35+ for ( const prompt of prompts ) {
36+ result [ `pluginOptions.netlify.${ prompt . id } ` ] = await writeApi . getAnswer ( prompt . id ) ;
37+ }
38+ writeApi . setData ( 'vue' , result ) ;
39+ } ,
40+ } ) ;
You can’t perform that action at this time.
0 commit comments