@haetae/cli
@haetae/cli
contains every feature for Haetae's CLI.
If you use Haetae only by programatic api (e.g. other @haetae/*
packages), you probably don't need this package.
peerDependencies
Note: This might not be exhaustive and lists only Haetae's packages.
Dependents
Installation
Are you developing a library(e.g. plugin) for Haetae?
It might be more suitable to specify @haetae/cli
as peerDependencies
than dependencies
.
To automatically install @haetae/cli
and its peerDependencies
You may want to install @haetae/cli
and its peerDependencies
all at once.
install-peerdeps
(opens in a new tab) is a good tool for that.
# As dependencies
npx install-peerdeps @haetae/cli
# As devDependencies
npx install-peerdeps --dev @haetae/cli
To manually handle installation
You might want to manually deal with the installation.
First, install @haetae/cli
itself.
# As dependencies
npm install @haetae/cli
# As devDependencies
npm install --save-dev @haetae/cli
Then, check out peerDependencies
and manually handle them.
(e.g. Install them as dependencies
or set them as peerDependencies
)
# This does not install, but just shows peerDependencies.
npm info @haetae/cli peerDependencies
CLI
For detailed usage and description as CLI, refer to CLI.
API
pkg
Refer to introduction#pkg.
run
A function to run the CLI.
Type
() => Promise<void>
Usage
@haetae/cli
itself is already CLI.
However, if you want to embed the CLI in another package, you can do so by run
.
In fact, this is what haetae
does with @haetae/cli
.
Let's say you want to create a CLI your-command
and yc
(short for your-command
).
src/cli.js of @your/package
Note that you should add shebang (opens in a new tab) for nodejs.
#!/usr/bin/env node
import { run } from '@haetae/cli'
// Or `import { cli: { run } } from 'haetae'`
run()
package.json of @your/package
{
"name": "@your/package",
"files": [
"src"
],
"bin": {
"your-command": "src/cli.js",
"yc": "src/cli.js"
}
}
After installing @your/package
, npx your-command
or npx yc
would execute src/cli.js.
Refer to the official npm docs (opens in a new tab) for more detail.