Skip to content
This repository was archived by the owner on Jan 15, 2025. It is now read-only.

Commit 8894b21

Browse files
authored
Fix for luis:version:clone and lg docs (#768)
* Fix for luis:version:clone and lg docs * Bump version to RC5
1 parent 3265890 commit 8894b21

File tree

8 files changed

+29
-19
lines changed

8 files changed

+29
-19
lines changed

build/botframework-cli-mac.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ pr:
2828
jobs:
2929
- job: CLI
3030
variables:
31-
buildVersion: '4.9.0-RC4'
31+
buildVersion: '4.9.0-RC5'
3232
_version: ${{coalesce(variables.version, variables.buildVersion)}}
3333

3434
steps:

build/botframework-cli.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ pr:
2828
jobs:
2929
- job: CLI
3030
variables:
31-
buildVersion: '4.9.0-RC4'
31+
buildVersion: '4.9.0-RC5'
3232
_version: ${{coalesce(variables.version, variables.buildVersion)}}
3333

3434
steps:

packages/cli/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ USAGE
390390
OPTIONS
391391
-f, --force If --out flag is provided with the path to an existing file, overwrites that file
392392
-h, --help lg:expand help
393-
-i, --in=in (required) .lg file or folder that contains .lg file.
393+
-i, --in=in (required) Folder that contains .lg file.
394394
-o, --out=out Output file or folder name. If not specified stdout will be used as output
395395
-r, --recurse Consider sub-folders to find .lg file(s)
396396
--all When set, all templates in the .lg file be expanded.
@@ -413,7 +413,7 @@ USAGE
413413
OPTIONS
414414
-f, --force If --out flag is provided with the path to an existing file, overwrites that file
415415
-h, --help lg:translate help
416-
-i, --in=in (required) .lg file or folder that contains .lg file.
416+
-i, --in=in (required) Folder that contains .lg file.
417417
-o, --out=out Output file or folder name. If not specified stdout will be used as output
418418
-r, --recurse Consider sub-folders to find .lg file(s)
419419
--srclang=srclang Source lang code. Auto detect if missing.
@@ -436,7 +436,7 @@ USAGE
436436
OPTIONS
437437
-f, --force If --out flag is provided with the path to an existing file, overwrites that file
438438
-h, --help lg:verify help
439-
-i, --in=in (required) .lg file or folder that contains .lg file.
439+
-i, --in=in (required) Folder that contains .lg file.
440440
-o, --out=out Output file or folder name. If not specified stdout will be used as output
441441
-r, --recurse Considere sub-folders to find .lg file(s)
442442
```

packages/lg/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ USAGE
4343
OPTIONS
4444
-f, --force If --out flag is provided with the path to an existing file, overwrites that file
4545
-h, --help lg:expand help
46-
-i, --in=in (required) .lg file or folder that contains .lg file.
46+
-i, --in=in (required) Folder that contains .lg file.
4747
-o, --out=out Output file or folder name. If not specified stdout will be used as output
4848
-r, --recurse Consider sub-folders to find .lg file(s)
4949
--all When set, all templates in the .lg file be expanded.
@@ -66,7 +66,7 @@ USAGE
6666
OPTIONS
6767
-f, --force If --out flag is provided with the path to an existing file, overwrites that file
6868
-h, --help lg:translate help
69-
-i, --in=in (required) .lg file or folder that contains .lg file.
69+
-i, --in=in (required) Folder that contains .lg file.
7070
-o, --out=out Output file or folder name. If not specified stdout will be used as output
7171
-r, --recurse Consider sub-folders to find .lg file(s)
7272
--srclang=srclang Source lang code. Auto detect if missing.
@@ -89,7 +89,7 @@ USAGE
8989
OPTIONS
9090
-f, --force If --out flag is provided with the path to an existing file, overwrites that file
9191
-h, --help lg:verify help
92-
-i, --in=in (required) .lg file or folder that contains .lg file.
92+
-i, --in=in (required) Folder that contains .lg file.
9393
-o, --out=out Output file or folder name. If not specified stdout will be used as output
9494
-r, --recurse Considere sub-folders to find .lg file(s)
9595
```

packages/lg/src/commands/lg/expand.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export default class ExpandCommand extends Command {
2020
private readonly TempTemplateName = '__temp__'
2121

2222
static flags: flags.Input<any> = {
23-
in: flags.string({char: 'i', description: '.lg file or folder that contains .lg file.', required: true}),
23+
in: flags.string({char: 'i', description: 'Folder that contains .lg file.', required: true}),
2424
recurse: flags.boolean({char: 'r', description: 'Consider sub-folders to find .lg file(s)'}),
2525
out: flags.string({char: 'o', description: 'Output file or folder name. If not specified stdout will be used as output'}),
2626
force: flags.boolean({char: 'f', description: 'If --out flag is provided with the path to an existing file, overwrites that file'}),

packages/lg/src/commands/lg/translate.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export default class TranslateCommand extends Command {
3131
private readonly ExpressionRegex = /(?<!\\)\$\{(('[^'\r\n]*')|("[^"\r\n]*")|(`(\\`|[^`])*`)|([^\r\n{}'"`]))+\}?/g
3232

3333
static flags: flags.Input<any> = {
34-
in: flags.string({char: 'i', description: '.lg file or folder that contains .lg file.', required: true}),
34+
in: flags.string({char: 'i', description: 'Folder that contains .lg file.', required: true}),
3535
tgtlang: flags.string({description: 'Comma separated list of target languages.', required: true}),
3636
translatekey: flags.string({description: 'Machine translation endpoint key.', required: true}),
3737
recurse: flags.boolean({char: 'r', description: 'Consider sub-folders to find .lg file(s)'}),

packages/lg/src/commands/lg/verify.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export default class VerifyCommand extends Command {
1515
static description = 'Verify .lg file(s) and collate them into a single file.'
1616

1717
static flags: flags.Input<any> = {
18-
in: flags.string({char: 'i', description: '.lg file or folder that contains .lg file.', required: true}),
18+
in: flags.string({char: 'i', description: 'Folder that contains .lg file.', required: true}),
1919
recurse: flags.boolean({char: 'r', description: 'Considere sub-folders to find .lg file(s)'}),
2020
out: flags.string({char: 'o', description: 'Output file or folder name. If not specified stdout will be used as output'}),
2121
force: flags.boolean({char: 'f', description: 'If --out flag is provided with the path to an existing file, overwrites that file'}),

packages/luis/src/commands/luis/version/clone.ts

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
*/
55

66
import {CLIError, Command, flags} from '@microsoft/bf-cli-command'
7+
import fetch from 'node-fetch'
78

89
const utils = require('../../../utils/index')
910

@@ -34,16 +35,25 @@ export default class LuisVersionClone extends Command {
3435
const requiredProps = {appId, endpoint, subscriptionKey, versionId, targetVersionId}
3536
utils.validateRequiredProps(requiredProps)
3637

37-
const client = utils.getLUISClient(subscriptionKey, endpoint)
38-
const options = {
39-
versionCloneObject: {
40-
version: targetVersionId
38+
try {
39+
let url = endpoint + '/luis/authoring/v3.0-preview/apps/' + appId + '/versions/' + flags.versionId + '/clone'
40+
const headers = {
41+
'Content-Type': 'application/json',
42+
'Ocp-Apim-Subscription-Key': subscriptionKey
4143
}
42-
}
4344

44-
try {
45-
const latestVersion = await client.versions.clone(appId, versionId, options)
46-
const output = flags.json ? JSON.stringify({Status: 'Success', version: latestVersion}, null, 2) : `App successfully cloned. Latest version is now: ${latestVersion}`
45+
const data = {
46+
version: flags.targetVersionId
47+
}
48+
49+
const response = await fetch(url, {method: 'POST', headers, body: JSON.stringify(data)})
50+
const messageData = await response.json()
51+
52+
if (messageData.error) {
53+
throw new CLIError(messageData.error.message)
54+
}
55+
56+
const output = flags.json ? JSON.stringify({Status: 'Success', version: messageData}, null, 2) : `App successfully cloned. Latest version is now: ${messageData}`
4757
this.log(output)
4858
} catch (err) {
4959
throw new CLIError(`Failed to clone app: ${err}`)

0 commit comments

Comments
 (0)