Adding new Dialog and Schema plugins
This commit is contained in:
Родитель
8ad246407f
Коммит
80cb77282a
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "root",
|
||||
"scripts": {
|
||||
"build": "lerna bootstrap && lerna run build",
|
||||
"build": "lerna bootstrap && lerna run build && lerna bootstrap",
|
||||
"test": "lerna run test",
|
||||
"coverage": "nyc npm test",
|
||||
"coveralls": "npm run coverage",
|
||||
|
|
|
@ -51,6 +51,9 @@ const getUserConfig = async () => {
|
|||
console.log(chalk.blue('At any time you may enable data collection by changing the configuration using command:'))
|
||||
console.log(chalk.blue('bf config:telemetry:enable'))
|
||||
}
|
||||
|
||||
await fs.mkdirp(pathToConfigJson)
|
||||
|
||||
await fs.writeFile(path.join(pathToConfigJson, 'config.json'), JSON.stringify(userConfig, null, 2))
|
||||
}
|
||||
/* tslint:disable:no-unused */
|
||||
|
|
|
@ -48,6 +48,8 @@ const hook: Hook<'init'> = async function (opts) {
|
|||
this.log(chalk.blue('bf config:telemetry:enable'))
|
||||
}
|
||||
|
||||
await fs.mkdirp(this.config.configDir)
|
||||
|
||||
await fs.writeFileSync(path.join(this.config.configDir, 'config.json'), JSON.stringify(userConfig, null, 2))
|
||||
}
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@
|
|||
"main": "lib/index.js",
|
||||
"repository": "https://github.com/microsoft/botframework-cli",
|
||||
"scripts": {
|
||||
"build": "rm -rf lib && tsc",
|
||||
"build": "rm -rf lib && tsc -b",
|
||||
"posttest": "tsc -p test --noEmit && tslint -p test -t stylish",
|
||||
"prepublishOnly": "rm -rf lib && tsc -b",
|
||||
"test": "nyc --extension .ts mocha --forbid-only \"test/**/*.test.ts\""
|
||||
|
|
|
@ -6,7 +6,7 @@ const pjson = require('../package.json')
|
|||
import Telemetry from './telemetry'
|
||||
|
||||
export {CLIError} from '@oclif/errors'
|
||||
|
||||
export {flags} from '@oclif/command'
|
||||
export abstract class Command extends Base {
|
||||
base = `${pjson.name}@${pjson.version}`
|
||||
telemetryEnabled = false
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
export * from '@oclif/command/lib/flags'
|
|
@ -1,3 +1,3 @@
|
|||
import {CLIError, Command} from './command'
|
||||
export {CLIError, Command}
|
||||
import {CLIError, Command, flags} from './command'
|
||||
export {CLIError, Command, flags}
|
||||
export default Command
|
||||
|
|
|
@ -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
|
|
@ -0,0 +1,8 @@
|
|||
*-debug.log
|
||||
*-error.log
|
||||
/.nyc_output
|
||||
/dist
|
||||
/lib
|
||||
/tmp
|
||||
/yarn.lock
|
||||
node_modules
|
|
@ -0,0 +1,52 @@
|
|||
@microsoft/bf-dialog
|
||||
====================
|
||||
|
||||
|
||||
|
||||
[![oclif](https://img.shields.io/badge/cli-oclif-brightgreen.svg)](https://oclif.io)
|
||||
[![Version](https://img.shields.io/npm/v/@microsoft/bf-dialog.svg)](https://npmjs.org/package/@microsoft/bf-dialog)
|
||||
[![Downloads/week](https://img.shields.io/npm/dw/@microsoft/bf-dialog.svg)](https://npmjs.org/package/@microsoft/bf-dialog)
|
||||
[![License](https://img.shields.io/npm/l/@microsoft/bf-dialog.svg)](https://github.com/microsoft/botframework-cli/blob/master/package.json)
|
||||
|
||||
<!-- toc -->
|
||||
* [Usage](#usage)
|
||||
* [Commands](#commands)
|
||||
<!-- tocstop -->
|
||||
# Usage
|
||||
<!-- usage -->
|
||||
```sh-session
|
||||
$ npm install -g @microsoft/bf-dialog
|
||||
$ oclif-example COMMAND
|
||||
running command...
|
||||
$ oclif-example (-v|--version|version)
|
||||
@microsoft/bf-dialog/0.0.0 darwin-x64 node-v12.1.0
|
||||
$ 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/microsoft/botframework-cli/blob/v0.0.0/src/commands/hello.ts)_
|
||||
<!-- commandsstop -->
|
|
@ -0,0 +1,4 @@
|
|||
#!/usr/bin/env node
|
||||
|
||||
require('@oclif/command').run()
|
||||
.catch(require('@oclif/errors/handle'))
|
|
@ -0,0 +1,3 @@
|
|||
@echo off
|
||||
|
||||
node "%~dp0\run" %*
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -0,0 +1,56 @@
|
|||
{
|
||||
"name": "@microsoft/bf-dialog",
|
||||
"version": "0.0.0",
|
||||
"author": "Microsoft",
|
||||
"bugs": "https://github.com/microsoft/botframework-cli/issues",
|
||||
"dependencies": {
|
||||
"@oclif/command": "~1.5.13",
|
||||
"@oclif/config": "~1.13.0",
|
||||
"@microsoft/bf-cli-command": "1.0.0",
|
||||
"tslib": "^1.10.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@oclif/dev-cli": "^1.22.2",
|
||||
"@oclif/plugin-help": "^2.2.0",
|
||||
"@oclif/test": "^1.2.5",
|
||||
"@oclif/tslint": "^3.1.1",
|
||||
"@types/chai": "^4.1.7",
|
||||
"@types/mocha": "^5.2.7",
|
||||
"@types/node": "^10.14.14",
|
||||
"chai": "^4.2.0",
|
||||
"globby": "^10.0.1",
|
||||
"mocha": "^5.2.0",
|
||||
"nyc": "^13.3.0",
|
||||
"ts-node": "^8.3.0",
|
||||
"tslint": "^5.18.0",
|
||||
"typescript": "^3.5.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8.0.0"
|
||||
},
|
||||
"files": [
|
||||
"/lib",
|
||||
"/npm-shrinkwrap.json",
|
||||
"/oclif.manifest.json"
|
||||
],
|
||||
"homepage": "https://github.com/microsoft/botframework-cli",
|
||||
"keywords": [
|
||||
"oclif-plugin"
|
||||
],
|
||||
"license": "MIT",
|
||||
"oclif": {
|
||||
"commands": "./lib/commands",
|
||||
"bin": "oclif-example",
|
||||
"devPlugins": [
|
||||
"@oclif/plugin-help"
|
||||
]
|
||||
},
|
||||
"repository": "microsoft/botframework-cli",
|
||||
"scripts": {
|
||||
"postpack": "rm -f oclif.manifest.json",
|
||||
"posttest": "tslint -p test -t stylish",
|
||||
"prepack": "rm -rf 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"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
import {Command, flags} from '@microsoft/bf-cli-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: flags.Input<any> = {
|
||||
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}`)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
export default {}
|
|
@ -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')
|
||||
})
|
||||
})
|
|
@ -0,0 +1,5 @@
|
|||
--require ts-node/register
|
||||
--watch-extensions ts
|
||||
--recursive
|
||||
--reporter spec
|
||||
--timeout 5000
|
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"extends": "../tsconfig",
|
||||
"compilerOptions": {
|
||||
"noEmit": true
|
||||
},
|
||||
"references": [
|
||||
{"path": ".."}
|
||||
]
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"declaration": true,
|
||||
"importHelpers": true,
|
||||
"module": "commonjs",
|
||||
"outDir": "lib",
|
||||
"rootDir": "src",
|
||||
"strict": true,
|
||||
"target": "es2017"
|
||||
},
|
||||
"include": [
|
||||
"src/**/*"
|
||||
]
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"extends": "@oclif/tslint"
|
||||
}
|
|
@ -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
|
|
@ -0,0 +1,8 @@
|
|||
*-debug.log
|
||||
*-error.log
|
||||
/.nyc_output
|
||||
/dist
|
||||
/lib
|
||||
/tmp
|
||||
/yarn.lock
|
||||
node_modules
|
|
@ -0,0 +1,52 @@
|
|||
@microsoft/bf-schema
|
||||
====================
|
||||
|
||||
|
||||
|
||||
[![oclif](https://img.shields.io/badge/cli-oclif-brightgreen.svg)](https://oclif.io)
|
||||
[![Version](https://img.shields.io/npm/v/@microsoft/bf-schema.svg)](https://npmjs.org/package/@microsoft/bf-schema)
|
||||
[![Downloads/week](https://img.shields.io/npm/dw/@microsoft/bf-schema.svg)](https://npmjs.org/package/@microsoft/bf-schema)
|
||||
[![License](https://img.shields.io/npm/l/@microsoft/bf-schema.svg)](https://github.com/microsoft/botframework-cli/blob/master/package.json)
|
||||
|
||||
<!-- toc -->
|
||||
* [Usage](#usage)
|
||||
* [Commands](#commands)
|
||||
<!-- tocstop -->
|
||||
# Usage
|
||||
<!-- usage -->
|
||||
```sh-session
|
||||
$ npm install -g @microsoft/bf-schema
|
||||
$ oclif-example COMMAND
|
||||
running command...
|
||||
$ oclif-example (-v|--version|version)
|
||||
@microsoft/bf-schema/0.0.0 darwin-x64 node-v12.1.0
|
||||
$ 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/microsoft/botframework-cli/blob/v0.0.0/src/commands/hello.ts)_
|
||||
<!-- commandsstop -->
|
|
@ -0,0 +1,4 @@
|
|||
#!/usr/bin/env node
|
||||
|
||||
require('@oclif/command').run()
|
||||
.catch(require('@oclif/errors/handle'))
|
|
@ -0,0 +1,3 @@
|
|||
@echo off
|
||||
|
||||
node "%~dp0\run" %*
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -0,0 +1,56 @@
|
|||
{
|
||||
"name": "@microsoft/bf-schema",
|
||||
"version": "0.0.0",
|
||||
"author": "Microsoft",
|
||||
"bugs": "https://github.com/microsoft/botframework-cli/issues",
|
||||
"dependencies": {
|
||||
"@oclif/command": "~1.5.13",
|
||||
"@oclif/config": "~1.13.0",
|
||||
"@microsoft/bf-cli-command": "1.0.0",
|
||||
"tslib": "^1.10.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@oclif/dev-cli": "^1.22.2",
|
||||
"@oclif/plugin-help": "^2.2.0",
|
||||
"@oclif/test": "^1.2.5",
|
||||
"@oclif/tslint": "^3.1.1",
|
||||
"@types/chai": "^4.1.7",
|
||||
"@types/mocha": "^5.2.7",
|
||||
"@types/node": "^10.14.14",
|
||||
"chai": "^4.2.0",
|
||||
"globby": "^10.0.1",
|
||||
"mocha": "^5.2.0",
|
||||
"nyc": "^13.3.0",
|
||||
"ts-node": "^8.3.0",
|
||||
"tslint": "^5.18.0",
|
||||
"typescript": "^3.5.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8.0.0"
|
||||
},
|
||||
"files": [
|
||||
"/lib",
|
||||
"/npm-shrinkwrap.json",
|
||||
"/oclif.manifest.json"
|
||||
],
|
||||
"homepage": "https://github.com/microsoft/botframework-cli",
|
||||
"keywords": [
|
||||
"oclif-plugin"
|
||||
],
|
||||
"license": "MIT",
|
||||
"oclif": {
|
||||
"commands": "./lib/commands",
|
||||
"bin": "oclif-example",
|
||||
"devPlugins": [
|
||||
"@oclif/plugin-help"
|
||||
]
|
||||
},
|
||||
"repository": "microsoft/botframework-cli",
|
||||
"scripts": {
|
||||
"postpack": "rm -f oclif.manifest.json",
|
||||
"posttest": "tslint -p test -t stylish",
|
||||
"prepack": "rm -rf 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"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
import {Command, flags} from '@microsoft/bf-cli-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: flags.Input<any> = {
|
||||
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}`)
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
export default {}
|
|
@ -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')
|
||||
})
|
||||
})
|
|
@ -0,0 +1,5 @@
|
|||
--require ts-node/register
|
||||
--watch-extensions ts
|
||||
--recursive
|
||||
--reporter spec
|
||||
--timeout 5000
|
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"extends": "../tsconfig",
|
||||
"compilerOptions": {
|
||||
"noEmit": true
|
||||
},
|
||||
"references": [
|
||||
{"path": ".."}
|
||||
]
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"declaration": true,
|
||||
"importHelpers": true,
|
||||
"module": "commonjs",
|
||||
"outDir": "lib",
|
||||
"rootDir": "src",
|
||||
"strict": true,
|
||||
"target": "es2017"
|
||||
},
|
||||
"include": [
|
||||
"src/**/*"
|
||||
]
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"extends": "@oclif/tslint"
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
# Contribution guide
|
||||
|
||||
## Steps to create a new plugin
|
||||
1.- Clone the repo by running 'git clone https://github.com/microsoft/botframework-cli.git'
|
||||
2.- Inside the project folder run 'npm run build'
|
||||
3.- If you want to create a new plugin, inside the packages folder run 'npx oclif plugin <plugin-name>'
|
||||
|
||||
## Steps to create a new command
|
||||
1.- To add a command, inside the plugin folder run 'npx oclif command <command-name>'. If you want to add a subcommand just name it colon separated as <command-name:subcommand-name>
|
||||
2.- Replace the import 'import {Command, flags} from '@oclif/command' line inside the newly created command with 'import {Command, flags} from '@microsoft/bf-cli-command'
|
||||
3.- Add the type to the flags property like this: static flags: flags.Input<any> = {}
|
||||
4.- Implement the run method
|
Загрузка…
Ссылка в новой задаче