1- import fs from 'fs' ;
2- import path from 'path' ;
3- import validUrl from 'valid-url' ;
4- import { URL } from 'url' ;
5- import validator from 'validator' ;
6- const { isEmail } = validator ;
1+ import fs from 'fs'
2+ import path from 'path'
3+ import validUrl from 'valid-url'
4+ import { URL } from 'url'
5+ import validator from 'validator'
6+ const { isEmail } = validator
77
88const options = [
9- // {
10- // abbr: 'v',
11- // flag: true,
12- // help: 'Print the logs to console\n'
13- // },
149 {
1510 name : 'root' ,
1611 help : "Root folder to serve (default: './data')" ,
@@ -80,9 +75,7 @@ const options = [
8075 filter : ( value ) => {
8176 if ( value === 'WebID-OpenID Connect' ) return 'oidc'
8277 } ,
83- when : ( answers ) => {
84- return answers . webid
85- }
78+ when : ( answers ) => answers . webid
8679 } ,
8780 {
8881 name : 'use-owner' ,
@@ -150,10 +143,6 @@ const options = [
150143 flag : true ,
151144 default : false
152145 } ,
153- // {
154- // full: 'default-app',
155- // help: 'URI to use as a default app for resources (default: https://linkeddata.github.io/warp/#/list/)'
156- // },
157146 {
158147 name : 'use-cors-proxy' ,
159148 help : 'Do you want to have a CORS proxy endpoint?' ,
@@ -225,11 +214,6 @@ const options = [
225214 return value
226215 }
227216 } ,
228- // {
229- // full: 'no-error-pages',
230- // flag: true,
231- // help: 'Disable custom error pages (use Node.js default pages instead)'
232- // },
233217 {
234218 name : 'error-pages' ,
235219 help : 'Folder from which to look for custom error pages files (files must be named <error-code>.html -- eg. 500.html)' ,
@@ -259,26 +243,20 @@ const options = [
259243 help : 'Host of your email service' ,
260244 prompt : true ,
261245 default : 'smtp.gmail.com' ,
262- when : ( answers ) => {
263- return answers [ 'use-email' ]
264- }
246+ when : ( answers ) => answers [ 'use-email' ]
265247 } ,
266248 {
267249 name : 'email-port' ,
268250 help : 'Port of your email service' ,
269251 prompt : true ,
270252 default : '465' ,
271- when : ( answers ) => {
272- return answers [ 'use-email' ]
273- }
253+ when : ( answers ) => answers [ 'use-email' ]
274254 } ,
275255 {
276256 name : 'email-auth-user' ,
277257 help : 'User of your email service' ,
278258 prompt : true ,
279- when : ( answers ) => {
280- return answers [ 'use-email' ]
281- } ,
259+ when : ( answers ) => answers [ 'use-email' ] ,
282260 validate : ( value ) => {
283261 if ( ! value ) {
284262 return 'You must enter this information'
@@ -291,9 +269,7 @@ const options = [
291269 help : 'Password of your email service' ,
292270 type : 'password' ,
293271 prompt : true ,
294- when : ( answers ) => {
295- return answers [ 'use-email' ]
296- }
272+ when : ( answers ) => answers [ 'use-email' ]
297273 } ,
298274 {
299275 name : 'use-api-apps' ,
@@ -307,42 +283,37 @@ const options = [
307283 help : 'Path to the folder to mount on /api/apps' ,
308284 prompt : true ,
309285 validate : validPath ,
310- when : ( answers ) => {
311- return answers [ 'use-api-apps' ]
312- }
286+ when : ( answers ) => answers [ 'use-api-apps' ]
313287 } ,
314- { // copied from name: 'owner'
288+ {
315289 name : 'redirect-http-from' ,
316- help : 'HTTP port or \',\' -separated ports to redirect to the solid server port (e.g. "80,8080").' ,
290+ help : 'HTTP port or comma -separated ports to redirect to the solid server port (e.g. "80,8080").' ,
317291 prompt : false ,
318292 validate : function ( value ) {
319293 if ( ! value . match ( / ^ [ 0 - 9 ] + ( , [ 0 - 9 ] + ) * $ / ) ) {
320294 return 'direct-port(s) must be a comma-separated list of integers.'
321295 }
322296 const list = value . split ( / , / ) . map ( v => parseInt ( v ) )
323297 const bad = list . find ( v => { return v < 1 || v > 65535 } )
324- if ( bad . length ) {
298+ if ( bad && bad . length ) {
325299 return 'redirect-http-from port(s) ' + bad + ' out of range'
326300 }
327301 return true
328302 }
329303 } ,
330304 {
331- // This property is packaged into an object for the server property in config.json
332- name : 'server-info-name' , // All properties with prefix server-info- will be removed from the config
305+ name : 'server-info-name' ,
333306 help : 'A name for your server (not required, but will be presented on your server\'s frontpage)' ,
334307 prompt : true ,
335308 default : answers => new URL ( answers [ 'server-uri' ] ) . hostname
336309 } ,
337310 {
338- // This property is packaged into an object for the server property in config.json
339- name : 'server-info-description' , // All properties with prefix server-info- will be removed from the config
311+ name : 'server-info-description' ,
340312 help : 'A description of your server (not required)' ,
341313 prompt : true
342314 } ,
343315 {
344- // This property is packaged into an object for the server property in config.json
345- name : 'server-info-logo' , // All properties with prefix server-info- will be removed from the config
316+ name : 'server-info-logo' ,
346317 help : 'A logo that represents you, your brand, or your server (not required)' ,
347318 prompt : true
348319 } ,
@@ -381,28 +352,28 @@ const options = [
381352 } ,
382353 when : answers => answers . multiuser
383354 }
384- ] ;
355+ ]
385356
386- function validPath ( value ) {
357+ function validPath ( value ) {
387358 if ( value === 'default' ) {
388- return Promise . resolve ( true ) ;
359+ return Promise . resolve ( true )
389360 }
390361 if ( ! value ) {
391- return Promise . resolve ( 'You must enter a valid path' ) ;
362+ return Promise . resolve ( 'You must enter a valid path' )
392363 }
393364 return new Promise ( ( resolve ) => {
394365 fs . stat ( value , function ( err ) {
395- if ( err ) return resolve ( 'Nothing found at this path' ) ;
396- return resolve ( true ) ;
397- } ) ;
398- } ) ;
366+ if ( err ) return resolve ( 'Nothing found at this path' )
367+ return resolve ( true )
368+ } )
369+ } )
399370}
400371
401- function validUri ( value ) {
372+ function validUri ( value ) {
402373 if ( ! validUrl . isUri ( value ) ) {
403- return 'Enter a valid uri (with protocol)' ;
374+ return 'Enter a valid uri (with protocol)'
404375 }
405- return true ;
376+ return true
406377}
407378
408- export default options ;
379+ export default options
0 commit comments