diff --git a/packages/luis/.editorconfig b/packages/luis/.editorconfig new file mode 100644 index 000000000..beffa3084 --- /dev/null +++ b/packages/luis/.editorconfig @@ -0,0 +1,11 @@ +root = true + +[*] +indent_style = space +indent_size = 2 +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true + +[*.md] +trim_trailing_whitespace = false diff --git a/packages/luis/.gitignore b/packages/luis/.gitignore new file mode 100644 index 000000000..35b0ba96e --- /dev/null +++ b/packages/luis/.gitignore @@ -0,0 +1,8 @@ +*-debug.log +*-error.log +/.nyc_output +/dist +/lib +/tmp +/yarn.lock +node_modules diff --git a/packages/luis/README.md b/packages/luis/README.md new file mode 100644 index 000000000..fa61594ba --- /dev/null +++ b/packages/luis/README.md @@ -0,0 +1,52 @@ +@microsoft/bf-luis-cli +====================== + + + +[![oclif](https://img.shields.io/badge/cli-oclif-brightgreen.svg)](https://oclif.io) +[![Version](https://img.shields.io/npm/v/@microsoft/bf-luis-cli.svg)](https://npmjs.org/package/@microsoft/bf-luis-cli) +[![Downloads/week](https://img.shields.io/npm/dw/@microsoft/bf-luis-cli.svg)](https://npmjs.org/package/@microsoft/bf-luis-cli) +[![License](https://img.shields.io/npm/l/@microsoft/bf-luis-cli.svg)](https://github.com/packages/bf-luis-cli/blob/master/package.json) + + +* [Usage](#usage) +* [Commands](#commands) + +# Usage + +```sh-session +$ npm install -g @microsoft/bf-luis-cli +$ oclif-example COMMAND +running command... +$ oclif-example (-v|--version|version) +@microsoft/bf-luis-cli/0.0.0 win32-x64 node-v10.16.3 +$ oclif-example --help [COMMAND] +USAGE + $ oclif-example COMMAND +... +``` + +# Commands + +* [`oclif-example hello [FILE]`](#oclif-example-hello-file) + +## `oclif-example hello [FILE]` + +describe the command here + +``` +USAGE + $ oclif-example hello [FILE] + +OPTIONS + -f, --force + -h, --help show CLI help + -n, --name=name name to print + +EXAMPLE + $ oclif-example hello + hello world from ./src/hello.ts! +``` + +_See code: [src\commands\hello.ts](https://github.com/packages/bf-luis-cli/blob/v0.0.0/src\commands\hello.ts)_ + diff --git a/packages/luis/bin/run b/packages/luis/bin/run new file mode 100644 index 000000000..3c4ae3ac0 --- /dev/null +++ b/packages/luis/bin/run @@ -0,0 +1,4 @@ +#!/usr/bin/env node + +require('@oclif/command').run() +.catch(require('@oclif/errors/handle')) diff --git a/packages/luis/bin/run.cmd b/packages/luis/bin/run.cmd new file mode 100644 index 000000000..968fc3075 --- /dev/null +++ b/packages/luis/bin/run.cmd @@ -0,0 +1,3 @@ +@echo off + +node "%~dp0\run" %* diff --git a/packages/luis/package.json b/packages/luis/package.json new file mode 100644 index 000000000..5aaccdfd8 --- /dev/null +++ b/packages/luis/package.json @@ -0,0 +1,58 @@ +{ + "name": "@microsoft/bf-luis-cli", + "version": "0.0.0", + "bugs": "https://github.com/packages/bf-luis-cli/issues", + "dependencies": { + "@oclif/command": "^1.5.19", + "@oclif/config": "^1.13.3", + "azure-cognitiveservices-luis-authoring": "2.1.1", + "ms-rest": "2.5.3", + "tslib": "^1.10.0" + }, + "devDependencies": { + "@oclif/dev-cli": "^1.22.2", + "@oclif/plugin-help": "^2.2.1", + "@oclif/test": "^1.2.5", + "@oclif/tslint": "^3.1.1", + "@types/chai": "^4.2.4", + "@types/mocha": "^5.2.7", + "@types/node": "^10.17.4", + "chai": "^4.2.0", + "globby": "^10.0.1", + "mocha": "^5.2.0", + "nyc": "^14.1.1", + "rimraf": "^3.0.0", + "ts-node": "^8.4.1", + "tslint": "^5.20.1", + "typescript": "^3.7.2" + }, + "engines": { + "node": ">=8.0.0" + }, + "files": [ + "/lib", + "/npm-shrinkwrap.json", + "/oclif.manifest.json", + "/yarn.lock" + ], + "homepage": "https://github.com/packages/bf-luis-cli", + "keywords": [ + "oclif-plugin" + ], + "license": "MIT", + "oclif": { + "commands": "./lib/commands", + "bin": "oclif-example", + "devPlugins": [ + "@oclif/plugin-help" + ] + }, + "repository": "packages/bf-luis-cli", + "scripts": { + "postpack": "rimraf oclif.manifest.json", + "posttest": "tslint -p test -t stylish", + "prepack": "rimraf lib && tsc -b && oclif-dev manifest && oclif-dev readme", + "test": "nyc --extension .ts mocha --forbid-only \"test/**/*.test.ts\"", + "version": "oclif-dev readme && git add README.md" + } +} diff --git a/packages/luis/src/commands/hello.ts b/packages/luis/src/commands/hello.ts new file mode 100644 index 000000000..79d01768f --- /dev/null +++ b/packages/luis/src/commands/hello.ts @@ -0,0 +1,31 @@ +import {Command, flags} from '@oclif/command' + +export default class Hello extends Command { + static description = 'describe the command here' + + static examples = [ + `$ oclif-example hello +hello world from ./src/hello.ts! +`, + ] + + static flags = { + help: flags.help({char: 'h'}), + // flag with a value (-n, --name=VALUE) + name: flags.string({char: 'n', description: 'name to print'}), + // flag with no value (-f, --force) + force: flags.boolean({char: 'f'}), + } + + static args = [{name: 'file'}] + + async run() { + const {args, flags} = this.parse(Hello) + + const name = flags.name || 'world' + this.log(`hello ${name} from .\\src\\commands\\hello.ts`) + if (args.file && flags.force) { + this.log(`you input --force and --file: ${args.file}`) + } + } +} diff --git a/packages/luis/src/index.ts b/packages/luis/src/index.ts new file mode 100644 index 000000000..b1c6ea436 --- /dev/null +++ b/packages/luis/src/index.ts @@ -0,0 +1 @@ +export default {} diff --git a/packages/luis/test/commands/hello.test.ts b/packages/luis/test/commands/hello.test.ts new file mode 100644 index 000000000..651a421dc --- /dev/null +++ b/packages/luis/test/commands/hello.test.ts @@ -0,0 +1,17 @@ +import {expect, test} from '@oclif/test' + +describe('hello', () => { + test + .stdout() + .command(['hello']) + .it('runs hello', ctx => { + expect(ctx.stdout).to.contain('hello world') + }) + + test + .stdout() + .command(['hello', '--name', 'jeff']) + .it('runs hello --name jeff', ctx => { + expect(ctx.stdout).to.contain('hello jeff') + }) +}) diff --git a/packages/luis/test/mocha.opts b/packages/luis/test/mocha.opts new file mode 100644 index 000000000..73fb8366a --- /dev/null +++ b/packages/luis/test/mocha.opts @@ -0,0 +1,5 @@ +--require ts-node/register +--watch-extensions ts +--recursive +--reporter spec +--timeout 5000 diff --git a/packages/luis/test/tsconfig.json b/packages/luis/test/tsconfig.json new file mode 100644 index 000000000..95898fced --- /dev/null +++ b/packages/luis/test/tsconfig.json @@ -0,0 +1,9 @@ +{ + "extends": "../tsconfig", + "compilerOptions": { + "noEmit": true + }, + "references": [ + {"path": ".."} + ] +} diff --git a/packages/luis/tsconfig.json b/packages/luis/tsconfig.json new file mode 100644 index 000000000..b4c5d7686 --- /dev/null +++ b/packages/luis/tsconfig.json @@ -0,0 +1,14 @@ +{ + "compilerOptions": { + "declaration": true, + "importHelpers": true, + "module": "commonjs", + "outDir": "lib", + "rootDir": "src", + "strict": true, + "target": "es2017" + }, + "include": [ + "src/**/*" + ] +} diff --git a/packages/luis/tslint.json b/packages/luis/tslint.json new file mode 100644 index 000000000..f5703540c --- /dev/null +++ b/packages/luis/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "@oclif/tslint" +}