Skip to content
This repository was archived by the owner on Jan 15, 2025. It is now read-only.
Merged
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
8 changes: 7 additions & 1 deletion generators/generator-bot-adaptive/baseGenerator.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ module.exports = class extends Generator {
platforms
).join(', ')}`,
type: String,
default: platforms.dotnet,
default: platforms.dotnet.name,
alias: 'p',
});

Expand All @@ -35,6 +35,12 @@ module.exports = class extends Generator {
alias: 'i',
});

this.option('sdkVersion', {
desc: 'The Bot Framework SDK version to use',
type: String,
alias: 's',
});

const { botName, platform, integration } = this.options;
assert(botName, 'botName is required');
assert(typeof botName === 'string', 'botName must be a string');
Expand Down
20 changes: 13 additions & 7 deletions generators/generator-bot-adaptive/generators/app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ const options = rt.Record({
version: rt.String,
})
),
sdkVersion: rt.String,
});

const defaultOptions = {
Expand All @@ -33,6 +34,7 @@ const defaultOptions = {
},
modifyApplicationSettings: undefined,
packageReferences: [],
sdkVersion: undefined,
};

module.exports = class extends BaseGenerator {
Expand Down Expand Up @@ -62,14 +64,16 @@ module.exports = class extends BaseGenerator {
const includeAssets = ['schemas'];

switch (this.options.platform) {
case platforms.dotnet: {
case platforms.dotnet.name: {
this._copyPlatformTemplate({
defaultSettingsDirectory: 'string.Empty',
includeAssets,
templateContext: {
packageReferences: this._formatDotnetPackageReferences(
this.packageReferences
),
sdkVersion:
this.options.sdkVersion || platforms.dotnet.defaultSdkVersion,
},
});

Expand All @@ -82,7 +86,7 @@ module.exports = class extends BaseGenerator {
return;
}

case platforms.js: {
case platforms.js.name: {
this._copyPlatformTemplate({
defaultSettingsDirectory: 'process.cwd()',
includeAssets,
Expand Down Expand Up @@ -187,7 +191,7 @@ module.exports = class extends BaseGenerator {
appSettings.runtime.key = `adaptive-runtime-${platform}-${integration}`;

switch (platform) {
case platforms.dotnet:
case platforms.dotnet.name:
switch (integration) {
case integrations.functions:
appSettings.runtime.command = `func start --script-root ${path.join(
Expand All @@ -200,7 +204,7 @@ module.exports = class extends BaseGenerator {
appSettings.runtime.command = `dotnet run --project ${botName}.csproj`;
}
break;
case platforms.js:
case platforms.js.name:
appSettings.runtime.command = 'npm run dev --';
break;
default:
Expand Down Expand Up @@ -247,9 +251,11 @@ module.exports = class extends BaseGenerator {
}

_writeJsPackageJson() {
const { botName, integration } = this.options;

const sdkVersion = '4.13.4-preview';
const {
botName,
integration,
sdkVersion = platforms.js.defaultSdkVersion,
} = this.options;

const dependencies = {
[integrations.functions]: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="3.1.10" />
<PackageReference Include="Microsoft.AspNetCore.OData" Version="7.5.2" />
<PackageReference Include="Microsoft.Azure.Functions.Extensions" Version="1.1.0" />
<PackageReference Include="Microsoft.Bot.Builder.AI.Luis" Version="4.13.2" />
<PackageReference Include="Microsoft.Bot.Builder.AI.QnA" Version="4.13.2" />
<PackageReference Include="Microsoft.Bot.Builder.Dialogs.Adaptive.Runtime" Version="4.13.2" />
<PackageReference Include="Microsoft.Bot.Builder.AI.Luis" Version="<%= sdkVersion %>" />
<PackageReference Include="Microsoft.Bot.Builder.AI.QnA" Version="<%= sdkVersion %>" />
<PackageReference Include="Microsoft.Bot.Builder.Dialogs.Adaptive.Runtime" Version="<%= sdkVersion %>" />
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="3.1.8" />
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="3.0.7" /><%- packageReferences %>
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="3.1.8" />
<PackageReference Include="Microsoft.Bot.Builder.AI.Luis" Version="4.13.2" />
<PackageReference Include="Microsoft.Bot.Builder.AI.QnA" Version="4.13.2" />
<PackageReference Include="Microsoft.Bot.Builder.Dialogs.Adaptive.Runtime" Version="4.13.2" /><%- packageReferences %>
<PackageReference Include="Microsoft.Bot.Builder.AI.Luis" Version="<%= sdkVersion %>" />
<PackageReference Include="Microsoft.Bot.Builder.AI.QnA" Version="<%= sdkVersion %>" />
<PackageReference Include="Microsoft.Bot.Builder.Dialogs.Adaptive.Runtime" Version="<%= sdkVersion %>" /><%- packageReferences %>
</ItemGroup>
</Project>
11 changes: 9 additions & 2 deletions generators/generator-bot-adaptive/platforms.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

const dotnet = 'dotnet';
const js = 'js';
const dotnet = {
name: 'dotnet',
defaultSdkVersion: '4.13.2',
};

const js = {
name: 'js',
defaultSdkVersion: '4.13.4-preview',
};

module.exports = { dotnet, js };