Skip to content

Commit

Permalink
Merge pull request #47 from UpendoVentures/tasks/adding-mvc-spa-template
Browse files Browse the repository at this point in the history
Tasks/adding mvc spa template
  • Loading branch information
Will Strohl authored Mar 5, 2020
2 parents 8e26ca1 + b5943d8 commit 8afa6b9
Show file tree
Hide file tree
Showing 167 changed files with 82,543 additions and 329 deletions.
59 changes: 40 additions & 19 deletions generators/app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ module.exports = class extends Generator {
this.log(
yosay(
'Welcome to the\n' +
chalk.yellow('Upendo Ventures') +
' ' +
chalk.bold.blue('DNN') +
'\nproject generator! '
chalk.yellow('Upendo Ventures') +
' ' +
chalk.bold.blue('DNN') +
'\nproject generator! '
)
);

Expand All @@ -32,8 +32,8 @@ module.exports = class extends Generator {
);
this.log(
chalk.italic.white('This tool is forked, with love, from the original ') +
chalk.bold.blue('generator-dnn') +
chalk.italic.white(' maintained by the most honorable Matt Rutledge.\n\n')
chalk.bold.blue('generator-dnn') +
chalk.italic.white(' maintained by the most honorable Matt Rutledge.\n\n')
);

// Does the solution already exist? then customize the wizard
Expand All @@ -55,7 +55,7 @@ module.exports = class extends Generator {

//
// TODO: Add logic to look for solution folders (e.g., Modules) and disable the extensions below until the solution is created.
// TODO: Update the primary solution file when projects are added.
// TODO: Update the primary solution file when projects are added.
//

const prompts = [
Expand All @@ -68,6 +68,7 @@ module.exports = class extends Generator {
solutionChoice,
{ name: 'Module: Webforms', value: 'webforms' },
{ name: 'Module: MVC', value: 'mvc' },
{ name: 'Module: MVC+SPA', value: 'mvc-spa' },
{ name: 'Module: MVC, .NET Core', value: 'mvc-core' },
{ name: 'Module: SPA', value: 'spa' },
{ name: 'Persona Bar', value: 'personabar' },
Expand All @@ -78,22 +79,40 @@ module.exports = class extends Generator {
]
},
{
when: !this.options.dnnHost,
when: !this.options.yourName,
type: 'input',
name: 'dnnHost',
message: 'What is the URL to your local DNN site? (currently only used by SPA templates)',
default: 'http://dnndev.me',
name: 'yourName',
message: 'What\'s your first and last name (surname)?',
store: true,
validate: str => {
return str.length > 0;
}
},
{
when: !this.options.dnnRoot,
when: !this.options.company,
type: 'input',
name: 'dnnRoot',
message: 'What is the local path to the root of your DNN site? (currently only used by SPA templates)',
default: process.cwd(),
name: 'company',
message: 'Namespace for your solution (Usually a company name, such as \'Upendo\' if you were Upendo Ventures)?',
store: true,
validate: str => {
return str.length > 0;
}
},
{
when: !this.options.companyUrl,
type: 'input',
name: 'companyUrl',
message: 'Company Website:',
store: true,
validate: str => {
return str.length > 0;
}
},
{
when: !this.options.emailAddy,
type: 'input',
name: 'emailAddy',
message: 'Your e-mail address:',
store: true,
validate: str => {
return str.length > 0;
Expand All @@ -110,14 +129,16 @@ module.exports = class extends Generator {
composing() {
const options = {
projType: this.props.value,
dnnHost: this.props.dnnHost,
dnnRoot: this.props.dnnRoot
yourName: this.props.yourName,
company: this.props.company,
companyUrl: this.props.companyUrl,
emailAddy: this.props.emailAddy
};

this.composeWith(require.resolve('../' + this.props.projType), options);
}

writing() {}
writing() { }

install() {}
install() { }
};
48 changes: 10 additions & 38 deletions generators/hcc/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,6 @@ module.exports = class extends DnnGeneratorBase {
}
]
},
{
when: !this.options.company,
type: 'input',
name: 'company',
message: 'Namespace for your Hotcakes Commerce extension point (Usually a company name)?',
store: true,
validate: str => {
return str.length > 0;
}
},
{
when: !this.options.name,
type: 'input',
Expand All @@ -69,33 +59,13 @@ module.exports = class extends DnnGeneratorBase {
validate: str => {
return str.length > 0;
}
},
{
when: !this.options.companyUrl,
type: 'input',
name: 'companyUrl',
message: 'Company Website:',
store: true,
validate: str => {
return str.length > 0;
}
},
{
when: !this.options.emailAddy,
type: 'input',
name: 'emailAddy',
message: 'Your e-mail address:',
store: true,
validate: str => {
return str.length > 0;
}
}
];

return this.prompt(prompts).then(props => {
// To access props later use this.props.someAnswer;
props.currentDate = new Date();
props.namespace = this._pascalCaseName(props.company);
props.namespace = this._pascalCaseName(this.options.company);
props.extensionName = this._pascalCaseName(props.name);
props.extensionType = "Hotcakes";
props.fullNamespace = props.namespace + "." + props.extensionType + "." + props.extensionName;
Expand All @@ -116,7 +86,7 @@ module.exports = class extends DnnGeneratorBase {
let fullNamespace = this.props.fullNamespace;
let hccType = this.props.hccType;
let guid = this.props.guid;

// mod: this follows the Upendo development/solution pattern
switch (hccType) {
case "workflow":
Expand All @@ -132,12 +102,14 @@ module.exports = class extends DnnGeneratorBase {
}

let template = {
yourName: this.options.yourName,
company: this.options.company,
namespace: namespace,
extensionName: extensionName,
moduleFriendlyName: this.props.name,
description: this.props.description,
companyUrl: this.props.companyUrl,
emailAddy: this.props.emailAddy,
companyUrl: this.options.companyUrl,
emailAddy: this.options.emailAddy,
currentYear: currentDate.getFullYear(),
version: '1.0.0',
menuLinkName: this.props.menuLinkName,
Expand All @@ -159,7 +131,7 @@ module.exports = class extends DnnGeneratorBase {
template
);

if (hccType == "workflow"){
if (hccType == "workflow") {
let task1Guid = this._generateGuid();
let task2Guid = this._generateGuid();

Expand All @@ -179,19 +151,19 @@ module.exports = class extends DnnGeneratorBase {
);
}

if (hccType == "actiondelegate"){
if (hccType == "actiondelegate") {
this.fs.copyTpl(
this.templatePath(hccType + '/MyCartIntegration.cs'),
this.destinationPath(extensionName + '/MyCartIntegration.cs'),
template
);

this.fs.copyTpl(
this.templatePath(hccType + '/MyCheckoutIntegration.cs'),
this.destinationPath(extensionName + '/MyCheckoutIntegration.cs'),
template
);

this.fs.copyTpl(
this.templatePath(hccType + '/MyProductIntegration.cs'),
this.destinationPath(extensionName + '/MyProductIntegration.cs'),
Expand Down
34 changes: 8 additions & 26 deletions generators/library-scheduledjob/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,35 +40,15 @@ module.exports = class extends DnnGeneratorBase {
validate: str => {
return str.length > 0;
}
},
{
when: !this.options.companyUrl,
type: 'input',
name: 'companyUrl',
message: 'Company Website:',
store: true,
validate: str => {
return str.length > 0;
}
},
{
when: !this.options.emailAddy,
type: 'input',
name: 'emailAddy',
message: 'Your e-mail address:',
store: true,
validate: str => {
return str.length > 0;
}
}
];

return this.prompt(prompts).then(props => {
// To access props later use this.props.someAnswer;
props.currentDate = new Date();
props.namespace = this._pascalCaseName(props.company);
props.namespace = this._pascalCaseName(this.options.company);
props.extensionName = this._pascalCaseName(props.name);
props.extensionType = "Libraries";
props.extensionType = "Libraries";
props.fullNamespace = props.namespace + "." + props.extensionType + "." + props.extensionName;
props.guid = this._generateGuid();

Expand All @@ -78,7 +58,7 @@ module.exports = class extends DnnGeneratorBase {

writing() {
this.log(chalk.white('Creating Class Library.'));

// mod: this follows the Upendo development/solution pattern
this.destinationRoot("Libraries/");

Expand All @@ -88,12 +68,14 @@ module.exports = class extends DnnGeneratorBase {
let fullNamespace = this.props.fullNamespace;

let template = {
yourName: this.options.yourName,
company: this.options.company,
namespace: namespace,
extensionName: extensionName,
moduleFriendlyName: this.props.name,
description: this.props.description,
companyUrl: this.props.companyUrl,
emailAddy: this.props.emailAddy,
companyUrl: this.options.companyUrl,
emailAddy: this.options.emailAddy,
currentYear: currentDate.getFullYear(),
version: '1.0.0',
menuLinkName: this.props.menuLinkName,
Expand Down Expand Up @@ -152,7 +134,7 @@ module.exports = class extends DnnGeneratorBase {
);
}

install() { }
install() { }

end() {
process.chdir('../');
Expand Down
6 changes: 3 additions & 3 deletions generators/library-scheduledjob/templates/manifest.dnn
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
<![CDATA[<p><%= description %></p>]]>
</description>
<owner>
<name><%= namespace %></name>
<organization><%= namespace %></organization>
<name><%= yourName %></name>
<organization><%= company %></organization>
<url><![CDATA[<a href="<%= companyUrl %>" target="_blank"><%= companyUrl %></a>]]></url>
<email><![CDATA[<a href="mailto:<%= emailAddy %>" target="_blank"><%= emailAddy %></a>]]></email>
</owner>
Expand All @@ -30,4 +30,4 @@
</components>
</package>
</packages>
</dotnetnuke>
</dotnetnuke>
6 changes: 3 additions & 3 deletions generators/library-scheduledjob/templates/symbols.dnn
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
<friendlyName><%= extensionName %> Library Symbols</friendlyName>
<description><![CDATA[<%= description %>]]></description>
<owner>
<name><%= namespace %></name>
<organization><%= namespace %></organization>
<name><%= yourName %></name>
<organization><%= company %></organization>
<url><%= companyUrl %></url>
<email><%= emailAddy %></email>
</owner>
Expand All @@ -25,4 +25,4 @@
</components>
</package>
</packages>
</dotnetnuke>
</dotnetnuke>
Loading

0 comments on commit 8afa6b9

Please sign in to comment.