Skip to content

Commit

Permalink
feat: add CLI question support
Browse files Browse the repository at this point in the history
  • Loading branch information
blackfalcon committed Sep 13, 2020
1 parent 777c30f commit a5f4ee6
Show file tree
Hide file tree
Showing 3 changed files with 775 additions and 786 deletions.
81 changes: 43 additions & 38 deletions bin/generate.js
Original file line number Diff line number Diff line change
Expand Up @@ -299,49 +299,55 @@ const loadingLoop = condition => {
};

const question = async () => {
var questions = [
{
type: 'confirm',
name: 'governance',
message: 'Did you review the Auro Governance Working Agreement?',
},
{
type: 'confirm',
name: 'status',
message: 'Have you reviewed the Auro Components status board?',
when: function (answers) {
return answers.governance;
const params = parseArgs();

if (!params.test) {
const questions = [
{
type: 'confirm',
name: 'governance',
message: 'Did you review the Auro Governance Working Agreement?',
},
},
{
type: 'confirm',
name: 'status',
message: 'Have you reviewed the Auro Components status board?',
when: function (answers) {
return !readDocs('governance')(answers);
{
type: 'confirm',
name: 'status',
message: 'Have you reviewed the Auro Components status board?',
when: function (answers) {
return answers.governance;
},
},
}
];

function readDocs(arg) {
return function (answers) {
return answers[arg];
};
}
{
type: 'confirm',
name: 'status',
message: 'Have you reviewed the Auro Components status board?',
when: function (answers) {
return !readDocs('governance')(answers);
},
}
];

inquirer.prompt(questions).then((answers) => {
if (answers.status === false) {
console.log('Be sure to review https://auro.alaskaair.com/component-status before starting')
function readDocs(arg) {
return function (answers) {
return answers[arg];
};
}

if (answers.governance === false) {
console.log('Be sure to review https://auro.alaskaair.com/getting-started/developers/governance before starting')
}
inquirer.prompt(questions).then((answers) => {
if (answers.status === false) {
console.log('Be sure to review https://auro.alaskaair.com/component-status before starting')
}

if (answers.governance === true && answers.status === true) {
generateFromTemplate();
}
});
if (answers.governance === false) {
console.log('Be sure to review https://auro.alaskaair.com/getting-started/developers/governance before starting')
}

if (answers.governance === true && answers.status === true) {
generateFromTemplate();
}
});
} else {
generateFromTemplate();
}
}

const generateFromTemplate = async () => {
Expand Down Expand Up @@ -475,4 +481,3 @@ Creating a Design System People Love.
};

question();
// generateFromTemplate();
Loading

0 comments on commit a5f4ee6

Please sign in to comment.