Have ideas to improve npm?Join in the discussion! »

    kenote-task-helper
    TypeScript icon, indicating that this package has built-in type declarations

    1.1.5 • Public • Published

    task-helper

    Task's Helper.

    NPM Version NPM Downloads Build Status Gratipay

    Installation

    npm install kenote-task-helper
    # Or 
    $ yarn add kenote-task-helper

    Usages

    task.ts

    import { TaskHelper, Connect } from 'kenote-task-helper'
    import initialize from './tasks/initialize'
    import Reset from './tasks/reset'
     
    @Connect({
      title: '操作类型:',
      tasks: [
        { 
          name: '初始化', 
          value: 'initialize',
          script: initialize
        },
        {
          name: '重置',
          value: 'reset',
          script: Reset
        },
        {
          name: '退出',
          value: 'exit',
          script: () => process.exit(0)
        }
      ]
    })
    class Task extends TaskHelper {}
     
    new Task().start()

    task/initialize.ts

    import { TaskSpinner } from 'kenote-task-helper'
     
    export default async function initialize (): Promise<any> {
      await Promise.all([
        ...
      ])
      ...
      return TaskSpinner(Promise.resolve(`Initialize Finished.`))
    }

    Run

    $ ts-node ./task.ts
     
    ? 选择操作类型:
      1) 初始化
      2) 重置
      3) 退出
      Answer: 1

    License

    this repo is released under the MIT License.

    Install

    npm i kenote-task-helper

    DownloadsWeekly Downloads

    1

    Version

    1.1.5

    License

    MIT

    Unpacked Size

    19.8 kB

    Total Files

    15

    Last publish

    Collaborators

    • avatar