npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

bone-cli

v0.1.0

Published

commander for bone

Downloads

27

Readme

bone-cli

Bone的命令行工具

###安装 通过npm安装,这是全局模块,安装后可以在命令行中使用bone命令

$ npm install -g bone-cli

:安装到全局需要使用sudo提权

bone-cli会载入你项目目录下的bone模块,并拓展bone对象的方法

###开始

你需要在你的项目的根目录下创建bonefile.js文件,bone-cli会自动载入这个文件

var bone = require('bone');

注意:bonefile.js不需要调用bone.setup()来设置bone根目录,bone-cli会使用bonefile.js所在的文件夹路径初始化bone

通过bone命令查看相应帮助

$ bone --help

###定义任务流

通过bone.task()定义任务流,用来将多个需要执行的命令连成一个任务流

bone.task('release', 'rm -rf ./dist/*', {
	exec: 'name',
	params: '~/dist/*'
});

上面的配置代码定义了一个release任务流,任务流执行的命令不仅限于Bone自身的命令和任务名,也可以是系统的命令

$ bone release

###添加自己的命令

通过bone-cli加载bone,会给bone对象添加bone.cli()函数,参数接受传入一个函数,该函数接受两个参数,一个是command函数,执行后会返回一个commander对象,另一个参数是bone

:commander对象(commander对象是Commander的一个实例),

在bonefile.js文件或者独立的模块里内调用bone.cli()来定义自己的命令

var bone = require('bone');

bone.cli(function(command, bone) {
	var commander = command('custom');
	
	command('custom')
		.version('0.0.1')
		.option('-f, --foo', 'enable some foo')
		.option('-b, --bar', 'enable some bar')
		.option('-B, --baz', 'enable some baz');
});

通过bone custom --help查看自定义命令的帮助

###可用模块