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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@ibiz/cli

v0.2.8

Published

埃必致内部命令行工具

Readme

iBiz命令行工具

目录说明

|-- actions                与命令匹配的对应处理行为
|-- bin                    入口目录
|-- commands               命令声明与命令注册
|-- core                   核心包,基本工具类与接口
|-- tools                  工具包
|   `-- gulp               打包清理gulp插件
|-- LICENSE
|-- README.md
|-- gulpfile.js
|-- package.json
|-- tsconfig.json
`-- yarn.lock

本地开发

// 在项目根目录
yarn

// 启动项目
yarn dev

// 本地全局安装,成功后可在命令行任意目录使用
npm link

扩展

1. 新增命令

  1. 以新增link命令为例

  2. 在commands目录下新建需要新增的命令link/link.ts文件。

  3. link命令类继承CommandBase类

    export class LinkCommand extends CommandBase { }
  4. 实现抽象方法load,用于注册命令

    protected load(program: CommanderStatic): void {
        program
        .command('link')
        .arguments('<source> <target>')
        .description('建立软链接', {
            source: '需要链接的「文件、文件夹」',
            target: '链接至的目标目录',
        })
        .usage('<source> <target>')
        .option('-f, --force', '当指向的目标文件存在时,删除原有[文件 or 文件夹]并建立软链接!')
        .action(async (source: string, target: string, options: Record<string, string | boolean>, _command: Command) => {
            const input: Input = {};
            input.source = { name: 'source', value: source };
            input.target = { name: 'target', value: target };
            const opts: Input = {};
            opts.force = { name: 'force', value: options.force };
            try {
            await this.action.handle(input, opts);
            } catch (err) {
            if (isError(err)) {
                log.error('', err.message);
                process.exit(10);
            } else {
                process.exit(0);
            }
            }
        });
    }
  5. 在commands/loader/loader.ts的load方法中进行命令注册

    public static load(program: CommanderStatic): void {
        new LinkCommand(program);
        new LinkModelCommand(program);
        this.handleInvalidCommand(program);
    }
  6. 实现getAction抽象方法注册行为。

2. 补充命令处理行为

  1. 补充link的处理行为

  2. 在actions目录下新建link/link.ts行为处理文件

  3. link行为处理继承ActionBase

    export class LinkAction extends ActionBase
  4. 实现handle抽象方法,用于处理命令。

    async handle(input: Input, options: Input, _extraFlags?: string[]): Promise<void> {
        const { source, target } = input;
        const { force } = options;
        linkDir(source.value, target.value, force.value);
    }