Get unlimited public & private packages + team-based management with npm Teams.Learn more »

kenote-task-helper

1.1.3 • 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

2

Version

1.1.3

License

MIT

Unpacked Size

12.4 kB

Total Files

14

Last publish

Collaborators

  • avatar