dimanche 23 juin 2019

Question about hard coding vs. iterating thru a json file

I have a project that provides boilerplates for projects, like yeoman generator. The boilerplate code gets cloned from github. Right now, I have the types of projects hard coded:

inquirer.prompt({
            type: "list",
            name: 'type',
            message: "What type of project would you like to create: ",
            choices: [
                "Web Project",
                "React Project"
            ],
            filter: function(val){
                return val.toLocaleLowerCase()
            }
        })

I want to update this code to pull the names, descriptions, and github repo urls from a json file. What would be the best way to handle this? Whats the best method of downloading an up to date copy of the json file ? Does a github gist allow me to do this? Any advice is appreciated. Thanks

Aucun commentaire:

Enregistrer un commentaire