Skip to content

Commit

Permalink
Reordered prompts
Browse files Browse the repository at this point in the history
related to #273
  • Loading branch information
WillStrohl committed Aug 30, 2023
1 parent f111aaa commit 465fd60
Show file tree
Hide file tree
Showing 6 changed files with 64 additions and 62 deletions.
25 changes: 13 additions & 12 deletions generators/auth-provider/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,6 @@ module.exports = class extends DnnGeneratorBase {
return str.length > 0;
}
},
{
when: !this.options.objectPrefix,
type: 'input',
name: 'objectPrefix',
message: 'What would be a good abbreviation for that (e.g., abc for Awesome Beverages Company)?',
store: true,
validate: str => {
return str.length > 0 && str.length < 6;
}
},
{
when: !this.options.friendlyName,
type: 'input',
Expand All @@ -51,6 +41,16 @@ module.exports = class extends DnnGeneratorBase {
return str.length > 0;
}
},
{
when: !this.options.objectPrefix,
type: 'input',
name: 'objectPrefix',
message: 'What would be a good abbreviation for that (e.g., abc for Awesome Beverages Company)?',
store: true,
validate: str => {
return str.length > 0 && str.length < 6;
}
},
{
when: !this.options.authTypeName,
type: 'input',
Expand All @@ -63,7 +63,6 @@ module.exports = class extends DnnGeneratorBase {
];

var msBuildVersion = this._getMsBuildVersion();

if (msBuildVersion == "") {
this.log(chalk.red("YIKES! A valid version of MSBuild was not found! This is a critical error... :("));
}
Expand All @@ -77,7 +76,7 @@ module.exports = class extends DnnGeneratorBase {
else {
props.namespaceRoot = this._pascalCaseName(this.options.companyName);
}
if (props.name.endsWith(" -f")) {
if (props.friendlyName.endsWith(" -f")) {
props.friendlyName = props.friendlyName.replace(" -f", "");
}
else {
Expand All @@ -89,6 +88,7 @@ module.exports = class extends DnnGeneratorBase {
props.openDirective = "%@";
props.closeDirective = "%";
props.msBuildVersion = msBuildVersion;
props.authTypeName = props.authTypeName;

this.props = props;
});
Expand All @@ -103,6 +103,7 @@ module.exports = class extends DnnGeneratorBase {
let namespaceRoot = this.props.namespaceRoot;
let currentDate = this.props.currentDate;
let fullNamespace = this.props.fullNamespace;
let friendlyName = this.props.friendlyName;

let template = {
ownerName: this.options.ownerName,
Expand Down
4 changes: 2 additions & 2 deletions generators/hcc/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ module.exports = class extends DnnGeneratorBase {
name: 'hccType',
message: 'Which Hotcakes Commerce extension point do you want to build?',
choices: [
{ name: 'Order Workflow', value: 'workflow' },
{ name: 'Action Delegate Integration', value: 'actiondelegate' },
{ name: 'Credit Card Gateway', value: 'creditcardgateway' },
{ name: 'Gift Card Gateway', value: 'giftcardgateway' },
{ name: 'Order Workflow', value: 'workflow' },
{ name: 'Payment Method', value: 'paymentmethod' },
{ name: 'Tax Provider', value: 'taxprovider' },
{ name: 'Viewset', value: 'viewset' },
Expand Down Expand Up @@ -51,7 +51,7 @@ module.exports = class extends DnnGeneratorBase {
else {
props.namespaceRoot = this._pascalCaseName(this.options.companyName);
}
if (props.name.endsWith(" -f")) {
if (props.friendlyName.endsWith(" -f")) {
props.friendlyName = props.friendlyName.replace(" -f", "");
}
else {
Expand Down
22 changes: 11 additions & 11 deletions generators/mvc-spa/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,6 @@ module.exports = class extends DnnGeneratorBase {

prompting() {
const prompts = [
{
when: !this.options.objectPrefix,
type: 'input',
name: 'objectPrefix',
message: 'What would be a good abbreviation for that (e.g., abc for Awesome Beverages Company)?',
store: true,
validate: str => {
return str.length > 0 && str.length < 6;
}
},
{
when: !this.options.friendlyName,
type: 'input',
Expand All @@ -40,6 +30,16 @@ module.exports = class extends DnnGeneratorBase {
validate: str => {
return str.length > 0;
}
},
{
when: !this.options.objectPrefix,
type: 'input',
name: 'objectPrefix',
message: 'What would be a good abbreviation for that (e.g., abc for Awesome Beverages Company)?',
store: true,
validate: str => {
return str.length > 0 && str.length < 6;
}
}
];

Expand All @@ -58,7 +58,7 @@ module.exports = class extends DnnGeneratorBase {
else {
props.namespaceRoot = this._pascalCaseName(this.options.companyName);
}
if (props.name.endsWith(" -f")) {
if (props.friendlyName.endsWith(" -f")) {
props.friendlyName = props.friendlyName.replace(" -f", "");
}
else {
Expand Down
22 changes: 11 additions & 11 deletions generators/mvc/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,6 @@ module.exports = class extends DnnGeneratorBase {
return str.length > 0;
}
},
{
when: !this.options.objectPrefix,
type: 'input',
name: 'objectPrefix',
message: 'What would be a good abbreviation for that (e.g., abc for Awesome Beverages Company)?',
store: true,
validate: str => {
return str.length > 0 && str.length < 6;
}
},
{
when: !this.options.friendlyName,
type: 'input',
Expand All @@ -50,6 +40,16 @@ module.exports = class extends DnnGeneratorBase {
validate: str => {
return str.length > 0;
}
},
{
when: !this.options.objectPrefix,
type: 'input',
name: 'objectPrefix',
message: 'What would be a good abbreviation for that (e.g., abc for Awesome Beverages Company)?',
store: true,
validate: str => {
return str.length > 0 && str.length < 6;
}
}
];

Expand All @@ -68,7 +68,7 @@ module.exports = class extends DnnGeneratorBase {
else {
props.namespaceRoot = this._pascalCaseName(this.options.companyName);
}
if (props.name.endsWith(" -f")) {
if (props.friendlyName.endsWith(" -f")) {
props.friendlyName = props.friendlyName.replace(" -f", "");
}
else {
Expand Down
28 changes: 14 additions & 14 deletions generators/spa/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ module.exports = class extends DnnGeneratorBase {
name: 'spaType',
message: 'What language do you want your SPA Module to use?',
choices: [
{ name: 'Angular', value: 'Angular' },
{ name: 'ReactJS', value: 'ReactJS' },
{ name: 'VueJS', value: 'VueJS' },
{ name: 'Angular', value: 'Angular' }
{ name: 'VueJS', value: 'VueJS' }
]
},
{
Expand All @@ -25,20 +25,10 @@ module.exports = class extends DnnGeneratorBase {
name: 'langType',
message: 'What Script Language do you want to use?',
choices: [
{ name: 'TypeScript (tsx)', value: 'tsx' },
{ name: 'ECMAScript (jsx)', value: 'jsx' }
{ name: 'ECMAScript (jsx)', value: 'jsx' },
{ name: 'TypeScript (tsx)', value: 'tsx' }
]
},
{
when: !this.options.companyName,
type: 'input',
name: 'companyName',
message: 'Namespace root for your SPA module (Usually a company name)?',
store: true,
validate: str => {
return str.length > 0;
}
},
{
when: !this.options.friendlyName,
type: 'input',
Expand All @@ -57,6 +47,16 @@ module.exports = class extends DnnGeneratorBase {
validate: str => {
return str.length > 0;
}
},
{
when: !this.options.companyName,
type: 'input',
name: 'companyName',
message: 'Namespace root for your SPA module (Usually a company name)?',
store: true,
validate: str => {
return str.length > 0;
}
}
];

Expand Down
25 changes: 13 additions & 12 deletions generators/webforms/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,7 @@ module.exports = class extends DnnGeneratorBase {
validate: str => {
return str.length > 0;
}
},
{
when: !this.options.objectPrefix,
type: 'input',
name: 'objectPrefix',
message: 'What would be a good abbreviation for that (e.g., abc for Awesome Beverages Company)?',
store: true,
validate: str => {
return str.length > 0 && str.length < 6;
}
},
}
{
when: !this.options.friendlyName,
type: 'input',
Expand All @@ -50,11 +40,20 @@ module.exports = class extends DnnGeneratorBase {
validate: str => {
return str.length > 0;
}
},
{
when: !this.options.objectPrefix,
type: 'input',
name: 'objectPrefix',
message: 'What would be a good abbreviation for that (e.g., abc for Awesome Beverages Company)?',
store: true,
validate: str => {
return str.length > 0 && str.length < 6;
}
}
];

var msBuildVersion = this._getMsBuildVersion();

if (msBuildVersion == "") {
this.log(chalk.red("YIKES! A valid version of MSBuild was not found! This is a critical error... :("));
}
Expand Down Expand Up @@ -219,6 +218,8 @@ module.exports = class extends DnnGeneratorBase {

// Extend package.json file in destination path
this.fs.extendJSON(this.destinationPath(friendlyName + '/package.json'), pkgJson);

this.log(chalk.white('Done writing Webforms module files.'));
}

install() {
Expand Down

0 comments on commit 465fd60

Please sign in to comment.