Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added option to create configs with projectname, not storing it as part of foldername #129

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion generators/add/Templates/_project.unicorn.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
<Reference Include="System.EnterpriseServices" />
</ItemGroup>
<ItemGroup>
<Content Include="App_Config\Include\<%= layerprefixedprojectname %>\Serialization.config" />
<Content Include="App_Config\Include\<%= configlayername %>\<%= confignameprefix %>Serialization.config" />
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
Expand Down
36 changes: 34 additions & 2 deletions generators/add/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,35 @@ module.exports = class extends yeoman {
});
}

askForFolderStructure() {
const done = this.async();
const questions = [{
type: 'list',
name: 'configConvention',
message: 'What folder structure do you want to be applied on config files?',
choices: [
{
name: 'App_Config/Include/Layer/ProjectName.ConfigName.config?',
value: true
}, {
name: 'App_Config/Include/Layer.ProjectName/ConfigName.config?',
value: false
},
],
}];

this.prompt(questions).then((answers) => {
if(answers.configConvention){
this.configLayerName = this.layer;
this.configNamePrefix = this.settings.ProjectName + '.';
}else{
this.configLayerName = this.layer + '.' + this.settings.ProjectName;
this.configNamePrefix = '';
}
done();
});
}

askTargetFrameworkVersion() {
const done = this.async();
const questions = [{
Expand All @@ -130,6 +159,9 @@ module.exports = class extends yeoman {
this.templatedata.layer = this.layer;
this.templatedata.lowercasedlayer = this.layer.toLowerCase();
this.templatedata.target = this.target;
this.templatedata.configlayername = this.configLayerName;
this.templatedata.confignameprefix = this.configNamePrefix;

}

_copyProjectItems() {
Expand Down Expand Up @@ -204,8 +236,8 @@ module.exports = class extends yeoman {
const serializationDestinationFile = path.join(
this.settings.ProjectPath,
'App_Config/Include',
this.settings.LayerPrefixedProjectName,
'serialization.config'
this.configLayerName,
this.configNamePrefix + 'Serialization.config'
);
this.fs.copyTpl(this.templatePath('_serialization.config'), this.destinationPath(serializationDestinationFile), this.templatedata);
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "generator-helix",
"version": "1.3.4",
"version": "1.3.5",
"description": "yeoman generator for Helix style Sitecore projects",
"main": "index.js",
"scripts": {
Expand Down
2 changes: 2 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ You can inject all the variables that the generator defines into your files usin
* `layer`
* `target`
* `vendorprefix`
* `configlayername`
* `confignameprefix`

***Note***

Expand Down