1.0.1 • Published 4 years ago

kiwi-bundle-cli v1.0.1

Weekly downloads
1
License
Apache-2.0
Repository
github
Last release
4 years ago

Kiwi Bundle CLI

Getting Started

./package.json (required)

{
  "name": "example",
  "version": "1.0.0",
  "bin": {
    "example": "./dist/index.js"
  },
  "scripts": {
    "start": "kiwi start",
    "test": "kiwi test",
    "build": "kiwi build",
    "cli": "node ./dist/index.js"
  },
  "dependencies": {
    "kiwi-bundle-cli-runtime": "1.0.0"
  },
  "devDependencies": {
    "kiwi-bundle": "3.1.0"
  }
}

./tsconfig.json (required)

{
  "extends": "./node_modules/kiwi-bundle/.models/ts/commonjs.json",
  "compilerOptions": {
    "rootDir": "src",
    "outDir": "dist"
  },
  "include": [
    "./src/**/*"
  ],
  "exclude": [
    "node_modules",
    "src/**/*.test.ts",
    "src/**/*.test.tsx"
  ]
}

./src/commands/say/hello.ts (example)

import { Command } from "kiwi-bundle-cli-runtime"
interface Args {
  "name": string
}
export const SayHelloCommand = new Command<Args>({
  command: "hello <name>",
  description: "Say hello to someone",
  handler: args => {
    console.log("Hello", args.name)
  },
})

./src/commands/say.ts (example)

import { Command } from "kiwi-bundle-cli-runtime"
import { SayHelloCommand } from "./commands/say/hello"
export const SayCommand = new Command({
  command: "say",
  description: "Say something",
  children: [
    SayHelloCommand,
  ],
})

./src/index.ts (example)

#!/usr/bin/env node
import { KiwiBundleCLI } from "kiwi-bundle-cli-runtime"
import { SayCommand } from "./commands/say"
KiwiBundleCLI({
  scriptName: "example",
  version: "1.0.0",
  usage: "Kiwi Bundle CLI example",
  commands: [
    SayCommand,
  ],
})

./.gitignore (recommended)

dist/
node_modules/

./tslint.json (optional)

{
  "extends": "./node_modules/kiwi-bundle/.models/tslint/bf.json"
}