kiwi-bundle-cli

1.0.1 • Public • Published

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"
}

Readme

Keywords

none

Package Sidebar

Install

npm i kiwi-bundle-cli

Weekly Downloads

0

Version

1.0.1

License

Apache-2.0

Unpacked Size

208 kB

Total Files

12

Last publish

Collaborators

  • n4zim