Skip to content

Commit

Permalink
Merge pull request #275 from UpendoVentures/tasks/standardize-tokens
Browse files Browse the repository at this point in the history
Tasks/standardize tokens
  • Loading branch information
WillStrohl authored Aug 30, 2023
2 parents fa4e9a4 + 95c6ec3 commit b07c572
Show file tree
Hide file tree
Showing 229 changed files with 1,423 additions and 7,433 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
node_modules
coverage
.vscode/
.vscode/
.vs/
launch.json
2 changes: 1 addition & 1 deletion __tests__/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ describe('generator-dnn:mvc', () => {
name: 'TestMVC',
description: 'Test Build Module',
companyUrl: 'upendoventures.com',
emailAddy: 'solutions@upendoventures.com'
emailAddress: 'solutions@upendoventures.com'
});
});

Expand Down
29 changes: 14 additions & 15 deletions generators/app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,34 +66,33 @@ module.exports = class extends Generator {
message: 'What type of project would you like to scaffold?',
choices: [
solutionChoice,
{ name: 'Module: Webforms', value: 'webforms' },
{ name: 'Authentication Provider', value: 'auth-provider' },
{ name: 'Library', value: 'library' },
{ name: 'Library: Scheduled Job', value: 'library-scheduledjob' },
{ 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: 'Module: Webforms', value: 'webforms' },
{ name: 'Persona Bar', value: 'personabar' },
{ name: 'Skin Object', value: 'skinobject' },
{ name: 'Library', value: 'library' },
{ name: 'Library: Scheduled Job', value: 'library-scheduledjob' },
{ name: 'Authentication Provider', value: 'auth-provider' },
{ name: 'Hotcakes Commerce Extension', value: 'hcc' }
]
},
{
when: !this.options.yourName,
when: !this.options.ownerName,
type: 'input',
name: 'yourName',
name: 'ownerName',
message: 'What\'s your first and last name (surname)?',
store: true,
validate: str => {
return str.length > 0;
}
},
{
when: !this.options.company,
when: !this.options.companyName,
type: 'input',
name: 'company',
message: 'Namespace for your solution (Usually a company name, such as \'Upendo\' if you were Upendo Ventures)?',
name: 'companyName',
message: 'Namespace root for your solution (Usually a company name, such as \'Upendo\' if you were Upendo Ventures)?',
store: true,
validate: str => {
return str.length > 0;
Expand All @@ -110,9 +109,9 @@ module.exports = class extends Generator {
}
},
{
when: !this.options.emailAddy,
when: !this.options.emailAddress,
type: 'input',
name: 'emailAddy',
name: 'emailAddress',
message: 'Your e-mail address:',
store: true,
validate: str => {
Expand All @@ -130,10 +129,10 @@ module.exports = class extends Generator {
composing() {
const options = {
projType: this.props.value,
yourName: this.props.yourName,
company: this.props.company,
ownerName: this.props.ownerName,
companyName: this.props.companyName,
companyUrl: this.props.companyUrl,
emailAddy: this.props.emailAddy
emailAddress: this.props.emailAddress
};

this.composeWith(require.resolve('../' + this.props.projType), options);
Expand Down
101 changes: 50 additions & 51 deletions generators/auth-provider/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,112 +13,111 @@ module.exports = class extends DnnGeneratorBase {
prompting() {
const prompts = [
{
when: !this.options.company,
when: !this.options.companyName,
type: 'input',
name: 'company',
name: 'companyName',
message: 'Namespace for your module (Usually a company name)?',
store: true,
validate: str => {
return str.length > 0;
}
},
{
when: !this.options.objectPrefix,
when: !this.options.friendlyName,
type: 'input',
name: 'objectPrefix',
message: 'What would be a good abbreviation for that (e.g., abc for Awesome Beverages Company)?',
store: true,
name: 'friendlyName',
message: 'What is the name of your authentication provider? ',
default: this.appname, /*to-do: figure out if we want to populate and actually use this later */
validate: str => {
return str.length > 0 && str.length < 6;
return str.length > 0;
}
},
{
when: !this.options.name,
when: !this.options.extensionDescription,
type: 'input',
name: 'name',
message: 'What is the name of your authentication provider? ',
default: this.appname,
name: 'extensionDescription',
message: 'Describe about your authentication provider:',
validate: str => {
return str.length > 0;
}
},
{
when: !this.options.description,
when: !this.options.objectPrefix,
type: 'input',
name: 'description',
message: 'Describe about your authentication provider:',
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;
return str.length > 0 && str.length < 6;
}
},
{
when: !this.options.type,
when: !this.options.authTypeName,
type: 'input',
name: 'type',
message: 'Enter your authentication provider name type (e.g., MyCompany)?',
name: 'authTypeName',
message: 'Enter your authentication provider name with NO SPACES (e.g., MyCompany)?',
validate: str => {
return str.length > 0;
}
}
];

var msBuildVersion = this._getMsBuildVersion();

if (msBuildVersion == "") {
this.log(chalk.red("YIKES! A valid version of MSBuild was not found! This is a critical error... :("));
}

return this.prompt(prompts).then(props => {
// To access props later use this.props.someAnswer;
props.currentDate = new Date();
if (this.options.company.endsWith(" -f")) {
props.namespace = this.options.company.replace(" -f", "");
if (this.options.companyName.endsWith(" -f")) {
props.namespaceRoot = this.options.companyName.replace(" -f", "");
}
else {
props.namespace = this._pascalCaseName(this.options.company);
props.namespaceRoot = this._pascalCaseName(this.options.companyName);
}
if (props.name.endsWith(" -f")) {
props.extensionName = props.name.replace(" -f", "");
if (props.friendlyName.endsWith(" -f")) {
props.friendlyName = props.friendlyName.replace(" -f", "");
}
else {
props.extensionName = this._pascalCaseName(props.name);
props.friendlyName = this._pascalCaseName(props.friendlyName);
}
props.extensionType = "Auth";
props.fullNamespace = props.namespace + "." + props.extensionType + "." + props.extensionName;
props.fullNamespace = props.namespaceRoot + "." + props.extensionType + "." + props.friendlyName;
props.guid = this._generateGuid();
props.openDirective = "%@";
props.closeDirective = "%";
props.msBuildVersion = msBuildVersion;
props.authTypeName = props.authTypeName;

this.props = props;
});
}

writing() {
this.log(chalk.white('Creating Webforms Module.'));
this.log(chalk.white('Creating Authentication Provider.'));

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

let namespace = this.props.namespace;
let extensionName = this.props.extensionName;
let namespaceRoot = this.props.namespaceRoot;
let currentDate = this.props.currentDate;
let fullNamespace = this.props.fullNamespace;
let friendlyName = this.props.friendlyName;

let template = {
yourName: this.options.yourName,
company: this.options.company,
namespace: namespace,
extensionName: extensionName,
moduleFriendlyName: this.props.name,
description: this.props.description,
type: this.props.type,
ownerName: this.options.ownerName,
companyName: this.options.companyName,
currentDate: this.props.currentDate,
namespaceRoot: namespaceRoot,
friendlyName: this.props.friendlyName,
extensionDescription: this.props.extensionDescription,
extensionType: this.props.extensionType,
authTypeName: this.props.authTypeName,
companyUrl: this.options.companyUrl,
emailAddy: this.options.emailAddy,
emailAddress: this.options.emailAddress,
currentYear: currentDate.getFullYear(),
version: '01.00.00',
menuLinkName: this.props.menuLinkName,
parentMenu: this.props.parentMenu,
extensionType: this.props.extensionType,
fullNamespace: this.props.fullNamespace,
guid: this.props.guid,
Expand All @@ -130,67 +129,67 @@ module.exports = class extends DnnGeneratorBase {

this.fs.copyTpl(
this.templatePath('../../common/branding/**'),
this.destinationPath(extensionName + '/'),
this.destinationPath(friendlyName + '/'),
template
);

this.fs.copyTpl(
this.templatePath('../../common/packaging/**'),
this.destinationPath(extensionName + '/'),
this.destinationPath(friendlyName + '/'),
template
);

this.fs.copyTpl(
this.templatePath('../../common/properties/**'),
this.destinationPath(extensionName + '/Properties/'),
this.destinationPath(friendlyName + '/Properties/'),
template
);

this.fs.copyTpl(
this.templatePath('common/**'),
this.destinationPath(extensionName + '/'),
this.destinationPath(friendlyName + '/'),
template
);

this.fs.copyTpl(
this.templatePath('Components/**'),
this.destinationPath(extensionName + '/Components/'),
this.destinationPath(friendlyName + '/Components/'),
template
);

this.fs.copyTpl(
this.templatePath('manifest.dnn'),
this.destinationPath(extensionName + '/' + extensionName + '.dnn'),
this.destinationPath(friendlyName + '/' + friendlyName + '.dnn'),
template
);

this.fs.copyTpl(
this.templatePath('Module.csproj'),
this.destinationPath(extensionName + '/' + fullNamespace + '.csproj'),
this.destinationPath(friendlyName + '/' + fullNamespace + '.csproj'),
template
);

this.fs.copyTpl(
this.templatePath('Module.sln'),
this.destinationPath(extensionName + '/' + fullNamespace + '.sln'),
this.destinationPath(friendlyName + '/' + fullNamespace + '.sln'),
template
);

this.fs.copyTpl(
this.templatePath('symbols.dnn'),
this.destinationPath(extensionName + '/' + extensionName + '_Symbols.dnn'),
this.destinationPath(friendlyName + '/' + friendlyName + '_Symbols.dnn'),
template
);

this.fs.copyTpl(
this.templatePath('package.json'),
this.destinationPath(extensionName + '/package.json'),
this.destinationPath(friendlyName + '/package.json'),
template
);

this.fs.copyTpl(
this.templatePath('../../common/csproj/NuGet.config'),
this.destinationPath(extensionName + '/NuGet.config'),
this.destinationPath(friendlyName + '/NuGet.config'),
template
);

Expand All @@ -211,7 +210,7 @@ module.exports = class extends DnnGeneratorBase {
};

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

install() {
Expand Down
2 changes: 1 addition & 1 deletion generators/auth-provider/templates/Components/Const.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ namespace <%= fullNamespace %>.Components
{
public class Const
{
public const string AUTH_SYSTEM_TYPE = "<%= type %>";
public const string AUTH_SYSTEM_TYPE = "<%= authTypeName %>";
}
}
8 changes: 4 additions & 4 deletions generators/auth-provider/templates/Module.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,10 @@
</Content>
<Content Include="Images\logo.png" />
<Content Include="License.txt" />
<Content Include="<%= extensionName %>.dnn">
<Content Include="<%= friendlyName %>.dnn">
<SubType>Designer</SubType>
</Content>
<Content Include="<%= extensionName %>_Symbols.dnn">
<Content Include="<%= friendlyName %>_Symbols.dnn">
<SubType>Designer</SubType>
</Content>
<Content Include="Module.build">
Expand All @@ -151,11 +151,11 @@
<Content Include="Settings.ascx" />
</ItemGroup>
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''"><%= msBuildVersion %>.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v13.0\WebApplications\Microsoft.WebApplication.targets" Condition="false" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion).0\WebApplications\Microsoft.WebApplication.targets" Condition="false" />
<ProjectExtensions>
<VisualStudio>
<FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@
<value>Login</value>
</data>
<data name="Title.Text" xml:space="preserve">
<value><%= type %></value>
<value><%= authTypeName %></value>
</data>
<data name="InvalidVerificationCode.Text" xml:space="preserve">
<value>Invalid verification code.</value>
Expand Down
4 changes: 2 additions & 2 deletions generators/auth-provider/templates/common/Login.ascx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
/*globals jQuery, window, Sys */
(function ($, Sys) {
const disabledActionClass = "dnnDisabledAction";
const actionLinks = $('a[id^="dnn_ctr<<%= closeDirective %>=ModuleId > Null.NullInteger ? ModuleId.ToString() : ""<%= closeDirective %>>_Login_<%= type %>_Login_<%= type %>"]');
const actionLinks = $('a[id^="dnn_ctr<<%= closeDirective %>=ModuleId > Null.NullInteger ? ModuleId.ToString() : ""<%= closeDirective %>>_Login_<%= authTypeName %>_Login_<%= authTypeName %>"]');
function isActionDisabled($el) {
return $el && $el.hasClass(disabledActionClass);
}
Expand Down Expand Up @@ -78,7 +78,7 @@
$(document).ready(function () {
$(document).on('keydown', '.dnnLoginService', function (e) {
if ($(e.target).is('input:text,input:password,input:checkbox') && e.keyCode === 13) {
var $loginButton = $('#dnn_ctr<<%= closeDirective %>=ModuleId > Null.NullInteger ? ModuleId.ToString() : ""<%= closeDirective %>>_Login_<%= type %>_Login_<%= type %>_cmdLogin');
var $loginButton = $('#dnn_ctr<<%= closeDirective %>=ModuleId > Null.NullInteger ? ModuleId.ToString() : ""<%= closeDirective %>>_Login_<%= authTypeName %>_Login_<%= authTypeName %>_cmdLogin');
if (isActionDisabled($loginButton)) {
return false;
}
Expand Down
4 changes: 2 additions & 2 deletions generators/auth-provider/templates/common/Module.build
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ModulePath><%= extensionName %></ModulePath>
<DNNFileName><%= extensionName %></DNNFileName>
<ModulePath><%= friendlyName %></ModulePath>
<DNNFileName><%= friendlyName %></DNNFileName>
<PackageName><%= fullNamespace %></PackageName>
<Extension>zip</Extension>
<BuildScriptsPath>$(MSBuildProjectDirectory)\..\..\Build</BuildScriptsPath>
Expand Down
Loading

0 comments on commit b07c572

Please sign in to comment.