Skip to content

Commit e1d8d02

Browse files
FranciscoPonceGomezTom Laird-McConnell
authored and
Tom Laird-McConnell
committed
v-frgome generators (#4554)
* Initial commit * Changes after review * Initial commit * cleanup * Fix memory storage warning * Fixed Bot storage warning in .ts sample * deleted not used samples. Renamed package * Included .bot file * Added .bot file * Refactoring * Reverted name * missing bits * bump version to 3.x.x * Updated links and email * After cleanup
1 parent 187c32a commit e1d8d02

File tree

12 files changed

+66
-25
lines changed

12 files changed

+66
-25
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"name": "$safeprojectname$",
3+
"secretKey": "",
4+
"services": [
5+
{
6+
"appId": "",
7+
"id": "http://localhost:3978/api/messages",
8+
"type": "endpoint",
9+
"appPassword": "",
10+
"endpoint": "http://localhost:3978/api/messages",
11+
"name": "$safeprojectname$"
12+
}
13+
]
14+
}

CSharp/Generator/BotApplication/BotApplication.csproj

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@
161161
<Reference Include="System.Xml" />
162162
</ItemGroup>
163163
<ItemGroup>
164+
<Content Include="%24safeprojectname%24.bot" />
164165
<None Include="App_Start\WebApiConfig.cs" />
165166
<None Include="Controllers\MessagesController.cs" />
166167
<None Include="Dialogs\RootDialog.cs" />
@@ -174,10 +175,11 @@
174175
<None Include="packages.config">
175176
<SubType>Designer</SubType>
176177
</None>
177-
<None Include="ProjectTemplate.csproj" />
178+
<None Include="ProjectTemplate.csproj">
179+
<SubType>Designer</SubType>
180+
</None>
178181
<Content Include="default.htm" />
179182
<Content Include="Web.config" />
180-
<Content Include="TestBot.bot" />
181183
<None Include="Web.Debug.config">
182184
<DependentUpon>Web.config</DependentUpon>
183185
</None>

CSharp/Generator/BotApplication/BotApplication.vstemplate

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
<ProjectItem ReplaceParameters="true" TargetFileName="Global.asax.cs">Global.asax.cs</ProjectItem>
2929
<ProjectItem ReplaceParameters="true" TargetFileName="packages.config">packages.config</ProjectItem>
3030
<ProjectItem ReplaceParameters="true" TargetFileName="ProjectTemplate.csproj">ProjectTemplate.csproj</ProjectItem>
31-
<ProjectItem ReplaceParameters="true" TargetFileName="TestBot.bot">TestBot.bot</ProjectItem>
31+
<ProjectItem ReplaceParameters="true" TargetFileName="$safeprojectname$.bot">$safeprojectname$.bot</ProjectItem>
3232
<ProjectItem ReplaceParameters="true" TargetFileName="BotApplication.vstemplate">BotApplication.vstemplate</ProjectItem>
3333
<Folder Name="Properties" TargetFolderName="Properties">
3434
<ProjectItem ReplaceParameters="true" TargetFileName="AssemblyInfo.cs">AssemblyInfo.cs</ProjectItem>

CSharp/Generator/BotApplication/Global.asax.cs

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
using Microsoft.Bot.Builder.Dialogs.Internals;
55
using Autofac;
66
using Microsoft.Bot.Connector;
7+
using System.Reflection;
78

89
namespace $safeprojectname$
910
{
@@ -16,18 +17,22 @@ protected void Application_Start()
1617
Conversation.UpdateContainer(
1718
builder =>
1819
{
20+
builder.RegisterModule(new AzureModule(Assembly.GetExecutingAssembly()));
21+
22+
// Bot Storage: Here we register the state storage for your bot.
23+
// Default store: volatile in-memory store - Only for prototyping!
24+
// We provide adapters for Azure Table, CosmosDb, SQL Azure, or you can implement your own!
25+
// For samples and documentation, see: [https://github.com/Microsoft/BotBuilder-Azure](https://github.com/Microsoft/BotBuilder-Azure)
1926
var store = new InMemoryDataStore();
20-
builder.Register(c => store)
21-
.Keyed<IBotDataStore<BotData>>(AzureModule.Key_DataStore)
22-
.AsSelf()
23-
.SingleInstance();
24-
builder.Register(c => new CachingBotDataStore(store,
25-
CachingBotDataStoreConsistencyPolicy
26-
.ETagBasedConsistency))
27-
.As<IBotDataStore<BotData>>()
28-
.AsSelf()
29-
.InstancePerLifetimeScope();
3027

28+
// Other storage options
29+
// var store = new TableBotDataStore("...DataStorageConnectionString..."); // requires Microsoft.BotBuilder.Azure Nuget package
30+
// var store = new DocumentDbBotDataStore("cosmos db uri", "cosmos db key"); // requires Microsoft.BotBuilder.Azure Nuget package
31+
32+
builder.Register(c => store)
33+
.Keyed<IBotDataStore<BotData>>(AzureModule.Key_DataStore)
34+
.AsSelf()
35+
.SingleInstance();
3136
});
3237
}
3338
}

CSharp/Generator/BotApplication/ProjectTemplate.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@
146146
<ItemGroup>
147147
<Content Include="default.htm" />
148148
<Content Include="Global.asax" />
149-
<Content Include="TestBot.bot" />
149+
<Content Include="$safeprojectname$.bot" />
150150
<Content Include="Web.config">
151151
<SubType>Designer</SubType>
152152
</Content>

Node/Generator/LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2017 Microsoft
3+
Copyright (c) 2018 Microsoft
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

Node/Generator/debug.log

Lines changed: 0 additions & 2 deletions
This file was deleted.

Node/Generator/generators/app/index.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ module.exports = class extends Generator {
2121
}
2222
writing() {
2323
const directoryName = _.kebabCase(this.props.botName);
24+
const botName = this.props.botName;
2425
const extension = this.props.language === 'JavaScript' ? 'js' : 'ts';
2526
const launchSteps = extension === 'js' ? `node app.js` : `tsc\nnode app.js`;
2627
const defaultDialog = this.props.dialog.split(' ')[0].toLowerCase();
@@ -35,7 +36,11 @@ module.exports = class extends Generator {
3536
this.fs.copyTpl(this.templatePath('package.json'), this.destinationPath('package.json'), { botName: directoryName });
3637
this.fs.copy(this.templatePath('_gitignore'), this.destinationPath('.gitignore'));
3738
this.fs.copy(this.templatePath('_env'), this.destinationPath('.env'));
38-
39+
this.fs.copy(this.templatePath(`botName.bot`), this.destinationPath(`${this.props.botName}.bot`), {
40+
process: function(content) {
41+
var pattern = new RegExp('<%= botName %>','g');
42+
return content.toString().replace(pattern, botName.toString());
43+
}});
3944

4045
this.fs.copy(this.templatePath(`app.${extension}`), this.destinationPath(`app.${extension}`));
4146
this.fs.copyTpl(this.templatePath(`bot.${extension}`), this.destinationPath(`bot.${extension}`), {
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"name": "<%= botName %>",
3+
"secretKey": "",
4+
"services": [
5+
{
6+
"appId": "",
7+
"id": "http://localhost:3978/api/messages",
8+
"type": "endpoint",
9+
"appPassword": "",
10+
"endpoint": "http://localhost:3978/api/messages",
11+
"name": "<%= botName %>"
12+
}
13+
]
14+
}

Node/Generator/package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Node/Generator/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
{
2-
"name": "generator-botbuilder-v3",
3-
"version": "1.0.0",
2+
"name": "generator-botbuilder",
3+
"version": "3.0.0",
44
"description": "A yeoman generator for creating bots using Microsoft Bot Framework",
5-
"homepage": "",
5+
"homepage": "https://github.com/Microsoft/BotBuilder",
66
"author": {
77
"name": "Microsoft",
8-
"email": "",
9-
"url": ""
8+
"email": "[email protected]",
9+
"url": "http://dev.botframework.com"
1010
},
1111
"files": [
1212
"generators"

package-lock.json

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)