generator-portals-clientside
Version:
Generates a SharePoint clientside project skeleton. Brought to you by Skyline's Portals & Collaboration Team.
75 lines (72 loc) • 1.86 kB
JavaScript
var prompts = {
projectName: {
type: "input",
name: "projectName",
message: "Your project name (lowercase, no spaces): ",
},
createFolder: {
name: "createFolder",
message: "Create a new folder for this project?",
type: "confirm",
default: true
},
namespace: {
type: "input",
name: "namespace",
message: "Your namespace (this will prefix all your deployed files): "
},
sharepointUrl: {
type: "input",
name: "sharepointUrl",
message: "Your SharePoint site url: "
},
version: {
type: "list",
name: "version",
choices: [ 'Online', '2016', '2013' ],
message: "You SharePoint version ('Online', '2016', '2013'): ",
default: "Online"
},
hasGit: {
type: "confirm",
name: "hasGit",
default: false,
message: "Is there an existing GIT repository?"
},
gitUrl: {
type: "input",
name: "gitUrl",
message: "Git Repo Url: "
},
};
var promptUser = function(generator, key) {
return generator.prompt(prompts[key]).then(function(answers) {
generator.params = Object.assign({}, generator.params, answers);
});
};
module.exports = {
prompt1: function() {
return promptUser(this, "projectName");
},
prompt2: function() {
return promptUser(this, "createFolder" )
},
prompt3: function() {
return promptUser(this, "namespace");
},
prompt4: function() {
return promptUser(this, "sharepointUrl");
},
prompt5: function() {
return promptUser(this, "version");
},
prompt6: function() {
return this.prompt(prompts.hasGit)
.then(answers => this.params.hasGit = answers.hasGit)
.then(hasGit => {
if (hasGit) {
return promptUser(this, "gitUrl");
} else false;
})
}
};