Skip to content
This repository was archived by the owner on Jul 9, 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
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

import { FileInfo } from '@bfc/shared';

import { luImportResolverGenerator, getLUFiles, getQnAFiles } from '../luResolver';
import { FileInfo } from '../src';
import { luImportResolverGenerator, getLUFiles, getQnAFiles } from '../src/luBuildResolver';

const files = [
{
Expand Down
1 change: 1 addition & 0 deletions Composer/packages/lib/shared/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
"@botframework-composer/types": "*",
"format-message": "6.2.3",
"json-schema": "^0.2.5",
"multimatch": "^5.0.0",
"nanoid": "^3.1.3",
"nanoid-dictionary": "^3.0.0"
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

import { FileInfo } from '@bfc/shared';
import { FileInfo } from '@botframework-composer/types';
import multimatch from 'multimatch';

import { Path } from '../../utility/path';
import { Path } from './path';

// eslint-disable-next-line @typescript-eslint/no-var-requires
const luObject = require('@microsoft/bf-lu/lib/parser/lu/lu.js');
Expand Down
35 changes: 35 additions & 0 deletions Composer/packages/lib/shared/src/path.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

import path from 'path';

// handle all the path to unix pattern
class PathHandler {
resolve(...params: string[]) {
const pathToTransform = path.join(...params);
if (path.isAbsolute(pathToTransform)) {
return pathToTransform.replace(/\\/g, '/');
} else {
return path.resolve(...params).replace(/\\/g, '/');
}
}
relative(from: string, to: string) {
return path.relative(from, to).replace(/\\/g, '/');
}
basename(param: string, ext: string | undefined = undefined) {
return path.basename(param, ext).replace(/\\/g, '/');
}
dirname(param: string) {
return path.dirname(param).replace(/\\/g, '/');
}
extname(param: string) {
return path.extname(param).replace(/\\/g, '/');
}
join(...params: string[]) {
return path.join(...params).replace(/\\/g, '/');
}
isAbsolute(param: string) {
return path.isAbsolute(param);
}
}
export const Path = new PathHandler();
1 change: 0 additions & 1 deletion Composer/packages/server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@
"luis-apis": "2.5.1",
"minimatch": "^3.0.4",
"morgan": "^1.9.1",
"multimatch": "^4.0.0",
"passport": "^0.4.1",
"path-to-regexp": "^6.1.0",
"portfinder": "1.0.25",
Expand Down
3 changes: 1 addition & 2 deletions Composer/packages/server/src/models/bot/builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@
import { FileInfo, IConfig } from '@bfc/shared';
import { ComposerReservoirSampler } from '@microsoft/bf-dispatcher/lib/mathematics/sampler/ComposerReservoirSampler';
import { ComposerBootstrapSampler } from '@microsoft/bf-dispatcher/lib/mathematics/sampler/ComposerBootstrapSampler';
import { luImportResolverGenerator, getLUFiles, getQnAFiles } from '@bfc/shared/lib/luBuildResolver';

import { Path } from '../../utility/path';
import { IFileStorage } from '../storage/interface';
import log from '../../logger';

import { luImportResolverGenerator, getLUFiles, getQnAFiles } from './luResolver';

const crossTrainer = require('@microsoft/bf-lu/lib/parser/cross-train/crossTrainer.js');
const luBuild = require('@microsoft/bf-lu/lib/parser/lubuild/builder.js');
const qnaBuild = require('@microsoft/bf-lu/lib/parser/qnabuild/builder.js');
Expand Down
14 changes: 7 additions & 7 deletions Composer/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -890,9 +890,9 @@
js-tokens "^4.0.0"

"@babel/parser@^7.0.0", "@babel/parser@^7.1.0", "@babel/parser@^7.10.4", "@babel/parser@^7.10.5", "@babel/parser@^7.11.3", "@babel/parser@^7.11.5", "@babel/parser@^7.2.2", "@babel/parser@^7.3.4", "@babel/parser@^7.4.0", "@babel/parser@^7.7.0", "@babel/parser@^7.7.4", "@babel/parser@^7.7.5", "@babel/parser@^7.8.6", "@babel/parser@^7.9.0", "@babel/parser@^7.9.6":
version "7.12.3"
resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.12.3.tgz#a305415ebe7a6c7023b40b5122a0662d928334cd"
integrity sha512-kFsOS0IbsuhO5ojF8Hc8z/8vEIOkylVBrjiZUbLTE3XFe0Qi+uu6HjzQixkFaqr0ZPAMZcBVxEwmsnsLPZ2Xsw==
version "7.12.5"
resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.12.5.tgz#b4af32ddd473c0bfa643bd7ff0728b8e71b81ea0"
integrity sha512-FVM6RZQ0mn2KCf1VUED7KepYeUWoVShczewOCfm3nzoBybaih51h+sYVVGthW9M6lPByEPTQf+xm27PBdlpwmQ==

"@babel/plugin-proposal-async-generator-functions@^7.2.0":
version "7.2.0"
Expand Down Expand Up @@ -13971,10 +13971,10 @@ multicast-dns@^6.0.1:
dns-packet "^1.3.1"
thunky "^1.0.2"

multimatch@^4.0.0:
version "4.0.0"
resolved "https://botbuilder.myget.org/F/botframework-cli/npm/multimatch/-/multimatch-4.0.0.tgz#8c3c0f6e3e8449ada0af3dd29efb491a375191b3"
integrity sha1-jDwPbj6ESa2grz3SnvtJGjdRkbM=
multimatch@^5.0.0:
version "5.0.0"
resolved "https://registry.yarnpkg.com/multimatch/-/multimatch-5.0.0.tgz#932b800963cea7a31a033328fa1e0c3a1874dbe6"
integrity sha512-ypMKuglUrZUD99Tk2bUQ+xNQj43lPEfAeX2o9cTteAmShXy2VHDJpuwu1o0xqoKCt9jLVAvwyFKdLTPXKAfJyA==
dependencies:
"@types/minimatch" "^3.0.3"
array-differ "^3.0.0"
Expand Down
8 changes: 5 additions & 3 deletions extensions/azurePublish/src/luisAndQnA.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { ILuisConfig, FileInfo, IQnAConfig } from '@botframework-composer/types'

import { ICrossTrainConfig, createCrossTrainConfig } from './utils/crossTrainUtil';
import { BotProjectDeployLoggerType } from './botProjectLoggerType';
import { luImportResolverGenerator } from '@bfc/shared/lib/luBuildResolver'

const crossTrainer = require('@microsoft/bf-lu/lib/parser/cross-train/crossTrainer.js');
const luBuild = require('@microsoft/bf-lu/lib/parser/lubuild/builder.js');
Expand Down Expand Up @@ -132,16 +133,17 @@ export class LuisAndQnaPublish {
for (const luFile of luFiles) {
luContents.push({
content: fs.readFileSync(luFile, { encoding: 'utf-8' }),
id: luFile.substring(luFile.lastIndexOf('\\') + 1),
name: path.basename(luFile)
});
}
for (const qnaFile of qnaFiles) {
qnaContents.push({
content: fs.readFileSync(qnaFile, { encoding: 'utf-8' }),
id: qnaFile.substring(qnaFile.lastIndexOf('\\') + 1),
name: path.basename(qnaFile)
});
}
const result = await crossTrainer.crossTrain(luContents, qnaContents, this.crossTrainConfig);
const importResolver = luImportResolverGenerator([...qnaContents, ...luContents] as FileInfo[]);
const result = await crossTrainer.crossTrain(luContents, qnaContents, this.crossTrainConfig, importResolver);

await this.writeCrossTrainFiles(result.luResult);
await this.writeCrossTrainFiles(result.qnaResult);
Expand Down
24 changes: 23 additions & 1 deletion extensions/azurePublish/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@
"@botframework-composer/types" "*"
format-message "6.2.3"
json-schema "^0.2.5"
multimatch "^5.0.0"
nanoid "^3.1.3"
nanoid-dictionary "^3.0.0"

Expand Down Expand Up @@ -532,7 +533,7 @@
resolved "https://botbuilder.myget.org/F/botbuilder-v4-js-daily/npm/@types/mime/-/@types/mime-2.0.3.tgz#c893b73721db73699943bfc3653b1deb7faa4a3a"
integrity sha1-yJO3NyHbc2mZQ7/DZTsd63+qSjo=

"@types/minimatch@*":
"@types/minimatch@*", "@types/minimatch@^3.0.3":
version "3.0.3"
resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-3.0.3.tgz#3dca0e3f33b200fc7d1139c0cd96c1268cadfd9d"
integrity sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA==
Expand Down Expand Up @@ -823,11 +824,21 @@ archiver@^5.0.2:
tar-stream "^2.1.4"
zip-stream "^4.0.0"

array-differ@^3.0.0:
version "3.0.0"
resolved "https://botbuilder.myget.org/F/botbuilder-v4-js-daily/npm/array-differ/-/array-differ-3.0.0.tgz#3cbb3d0f316810eafcc47624734237d6aee4ae6b"
integrity sha1-PLs9DzFoEOr8xHYkc0I31q7krms=

array-union@^2.1.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/array-union/-/array-union-2.1.0.tgz#b798420adbeb1de828d84acd8a2e23d3efe85e8d"
integrity sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==

arrify@^2.0.1:
version "2.0.1"
resolved "https://botbuilder.myget.org/F/botbuilder-v4-js-daily/npm/arrify/-/arrify-2.0.1.tgz#c9655e9331e0abcd588d2a7cad7e9956f66701fa"
integrity sha1-yWVekzHgq81YjSp8rX6ZVvZnAfo=

asn1@~0.2.3:
version "0.2.4"
resolved "https://registry.yarnpkg.com/asn1/-/asn1-0.2.4.tgz#8d2475dfab553bb33e77b54e59e880bb8ce23136"
Expand Down Expand Up @@ -2113,6 +2124,17 @@ ms@^2.1.1:
resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009"
integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==

multimatch@^5.0.0:
version "5.0.0"
resolved "https://botbuilder.myget.org/F/botbuilder-v4-js-daily/npm/multimatch/-/multimatch-5.0.0.tgz#932b800963cea7a31a033328fa1e0c3a1874dbe6"
integrity sha1-kyuACWPOp6MaAzMo+h4MOhh02+Y=
dependencies:
"@types/minimatch" "^3.0.3"
array-differ "^3.0.0"
array-union "^2.1.0"
arrify "^2.0.1"
minimatch "^3.0.4"

nanoid-dictionary@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/nanoid-dictionary/-/nanoid-dictionary-3.0.0.tgz#e4ad77e528792095662a7be1855ce31448d0687c"
Expand Down