dogit

1.0.1 • Public • Published

dogit

A tool used to implement the development and release process, with freely configurable commands and plugins.

Downloads License

Read this in other language : English | 简体中文

Install

npm install -g dogit

Init

If you are using DOGIT for the first time in a project, run the following command to initialize.

dogit init

Then you get a configuration file calleddogit.config.js. It looks something like this:

module.exports = {
    "flow": {
        "plugin": "AddTag",
        "option": {
            "envs" : {
                "dev": {
                    "prefix": "xjzmy-dev-v"
                },
                "test": {
                    "prefix": "xjzmy-test-v"
                },
                "prod": {
                    "prefix": "xjzmy-prod-v"
                }
            }
        },
        "hook": {
            "before": [
                {
                    "plugin": "ReplaceFile",
                    "option": {
                    "path": "./build/version.js",
                    "replace": "module.exports = { version: '__$tag__' }"
                    }
                }
            ],
            "after": [
                {
                "command": "npm run changelog:__$env__"
                }
            ]
        }
    }
}

Process

Then you can begin to execute your own process with:

dogit flow

This command will read the configuration file and starts the task. As you can see from the configuration file, flow represents the tasks what we need to execute, and contains two types of flows

  • Shell scripts
  • Plugin

Plugin processes can contain their own hook subprocesses, so they end up in a tree structure.

Shell scripts

I believe everyone is familiar with shell scripts, like this:

{
  "command": "command"
}

Plugin

A plugin is essentially a built-in script that has the following features over a shell

  • Afferent configuration
  • Can execute own hook
  • Accepts the parameters of the upper flow
  • Parameters can be exposed to the subordinate flow

And in a different format than the shell

{
  "plugin": "AddTag", // Name of Plugin required
  "option": {}, // Plugin parameters optional  
  "hook": {}, // Hooks supported by the plugin (subflow) optional 
  "when": params => {} // Prerequisites for executing the plugin optional 
}

The currently supported built-in plugins are

For specific hooks and options supported by the plugin, step into the plugin directory to view the documentation

when parameter indicates the conditions under which the current flow executes

{
    "command": "npm run changelog:__$env__",
    "when": params => {
        return params.env !== 'dev'
    }
}

This means that the Changelog generation task should only be performed without the tag in dev .

i18n

The language of the tool itself can be switched with the following interactive command

dogit set

Readme

Keywords

none

Package Sidebar

Install

npm i dogit

Weekly Downloads

2

Version

1.0.1

License

MIT

Unpacked Size

46.4 kB

Total Files

32

Last publish

Collaborators

  • hxh1246996371