heyoo

1.0.3 • Public • Published

heyoo

heyoo is a command-line tool written in typescript, which supports the expansion of its own or project functions in the form of plugins or packs.

All plugins and packs must be es module, so your node.js version must conform to ^12.20.0 || ^14.13.1 || >=16.0.0.

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

Installation

pnpm add heyoo -g
# or
npm i heyoo -g
# or
yarn add heyoo -g

Usage

Commands

create

Create a new plugins or packs project based on the selected preset template.

hey create
# or
# type is one of "plugins" and "packs"
hey create [type]

link

Link local plugins or packs to heyoo.

hey link
# or
# type is one of "plugins" and "packs"
hey link [type]

For plugins, there can only be one link and install of the plugins, and they will overwrite each other when the link and install commands are executed.

For packs, the priority of the linked package is higher than the package in node_modules.

unlink

Unlink the plugins or packs under the current path, and also can remove the target link of the specified name.

# unlink target by current path
hey unlink
# unlink target by its name
hey unlink [name]

install

Install the plugins. Supports the installation of plugins published to npm registry, GitHub or GitLab.

hey install [options] <plugins>

# npm registry example:
hey install @heyoo/plugins-js-template
# GitHub repo example:
hey install --git hey-yoo/heyoo-template#plugins-js-template

You can check this document to learn more about how to install GitHub or GitLab plugins.

uninstall

Uninstall the installed plugins.

hey uninstall <plugins>

list

Display the local plugins and packs.

hey list

run

If there is a configuration file hey.config in the current path and there is a specified target packs, when the packs can be found then will execute the script(function).

hey run [script]

setting

open the setting file setting.json.

hey setting

Plugins

The plugins expand the function of heyoo by registering new commands on heyoo.

The package.json in its directory must have an exports attribute, and its value must be a string:

{
  "type": "module",
  "exports": "./bin/index.js"
}

The file specified by the exports attribute must export the default command array (export default []). The following is its type definition:

interface command {
  command: string;
  action: (...args: any[]) => void | Promise<void>;
  option?: string[][];
  requiredOption?: string[][];
  argument?: string[][];
  description?: string;
}

export default [] as command[];

You can read this document to learn more about the interface command attribute.

Packs

Packs are used to provide extended functions for specific projects(where the configuration file hey.config exists).

The package.json in its directory must have an exports attribute, and its value must be an object like this:

{
  "type": "module",
  "exports": {
    "./foo": "./bin/foo.js",
    "./bar": "./bin/bar.js"
  }
}

You can read Package entry points to learn more about the exports' property.

The file specified by the exports attribute must export the default function (export default function () {}).

Configuration file

hey.config

The configuration file supports js and json formats. If it is in js format, it must be exported as es module. And there must be a packs attribute, which is used to specify packs, and its value must be consistent with the value of the name attribute in the package.json in the packs.

The run command will first check whether there is a link to the packs locally, otherwise it will search from node_modules under the current path.

export default {
  packs: '@heyoo/plugins-js-template',
};

setting.json

The setting file setting.json will be generated by heyoo when used for the first time:

{
  // packageManager's value is one fo pnpm, npm, yarn
  "packageManager": "",
  "template": {
    "plugins": [],
    "packs": []
  }
}

The value of the template:

{
  // template name
  "title": "",
  // template type (Currently only git is supported, npm will be supported in the future)
  "type": "git",
  // When type is git, you need to specify the git repo
  "repo": ""
}

You can read this document to learn more about template repo attributes.

Currently heyoo has some preset templates, which can be viewed here.

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
1.0.31latest

Version History

VersionDownloads (Last 7 Days)Published
1.0.31
1.0.20
1.0.10
1.0.00

Package Sidebar

Install

npm i heyoo

Weekly Downloads

1

Version

1.0.3

License

MIT

Unpacked Size

39.2 kB

Total Files

4

Last publish

Collaborators

  • aircan