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

bf-luis-cli plugin initial commit #336

Merged
merged 1 commit into from
Nov 6, 2019
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
11 changes: 11 additions & 0 deletions packages/luis/.editorconfig
Original file line number Diff line number Diff line change
@@ -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
8 changes: 8 additions & 0 deletions packages/luis/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
*-debug.log
*-error.log
/.nyc_output
/dist
/lib
/tmp
/yarn.lock
node_modules
52 changes: 52 additions & 0 deletions packages/luis/README.md
Original file line number Diff line number Diff line change
@@ -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)

<!-- toc -->
* [Usage](#usage)
* [Commands](#commands)
<!-- tocstop -->
# Usage
<!-- 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
...
```
<!-- usagestop -->
# Commands
<!-- 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)_
<!-- commandsstop -->
4 changes: 4 additions & 0 deletions packages/luis/bin/run
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env node

require('@oclif/command').run()
.catch(require('@oclif/errors/handle'))
3 changes: 3 additions & 0 deletions packages/luis/bin/run.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@echo off

node "%~dp0\run" %*
58 changes: 58 additions & 0 deletions packages/luis/package.json
Original file line number Diff line number Diff line change
@@ -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"
}
}
31 changes: 31 additions & 0 deletions packages/luis/src/commands/hello.ts
Original file line number Diff line number Diff line change
@@ -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}`)
}
}
}
1 change: 1 addition & 0 deletions packages/luis/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export default {}
17 changes: 17 additions & 0 deletions packages/luis/test/commands/hello.test.ts
Original file line number Diff line number Diff line change
@@ -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')
})
})
5 changes: 5 additions & 0 deletions packages/luis/test/mocha.opts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
--require ts-node/register
--watch-extensions ts
--recursive
--reporter spec
--timeout 5000
9 changes: 9 additions & 0 deletions packages/luis/test/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extends": "../tsconfig",
"compilerOptions": {
"noEmit": true
},
"references": [
{"path": ".."}
]
}
14 changes: 14 additions & 0 deletions packages/luis/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"compilerOptions": {
"declaration": true,
"importHelpers": true,
"module": "commonjs",
"outDir": "lib",
"rootDir": "src",
"strict": true,
"target": "es2017"
},
"include": [
"src/**/*"
]
}
3 changes: 3 additions & 0 deletions packages/luis/tslint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "@oclif/tslint"
}