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

fecom

v1.5.0

Published

A magic component management tool

Downloads

9

Readme

fecom

A magic component management tool

Build Status Build status Coverage Status Dependency Status


简介

fecom是依托于Gitlab的组件管理工具,只需要满足下面条件,就可以通过fecom管理组件:

  • fecom进行正确配置
  • 组件中包含component.json配置文件
  • 组件中有与版本相对应的tag

组件示例可以参考:https://gitlab.com/u/icefox0801/projects

安装

npm install -g fecom

配置

首次执行fecom命令,会提示输入用户名邮箱Gitlab Token

icefox@icefoxmac:~ $ fecom
11:55:51 INFO  用户配置文件未找到,初始化"~/.fecomrc"
? 请输入您的用户名: icefox0801
? 请输入您的邮箱: [email protected]
? 请输入您的Gitlab token: ********************
11:56:06 INFO  完成初始化用户配置文件

输入以上信息后,用户信息会被保存到~/.fecomrc文件中,以后每次执行fecom会读取~/.fecomrc中的用户配置

除此之外,还需要配置GitlabAPI地址和默认组件所属的用户/组。例如,Gitlab的地址为https://gitlab.exaplem.com,默认组件的仓库都放下fe-group下,那么还需执行:

icefox@icefoxmac:~ $ fecom p -d "domain=https://gitlab.example.com&owner=fe-group"

用法

Usage: fecom [options]

Commands:

init [options]                         初始化组件
install|i [options] [component...]     安装组件
uninstall|un [options] <component...>  卸载组件
list|ls [options] [component...]       列出组件版本
info <component>                       显示组件的详细信息
link [component]                       链接组件
search|s [options] <pattern>           搜索组件
profile|p [options] [query]            管理用户配置
tree|t [options] [component...]        打印组件依赖树
version|v [options] [releaseType]      组件版本更新
update|u [component...]                更新组件

A magic component management tool

Options:

-h, --help  output usage information

component.json

component.json配置文件可能存在于项目或者组件中,在不同的应用场景,并非所有的配置项都有用,请酌情进行配置!

  • name: 名称,请和Gitlab项目名称保持一致
  • description: 描述,请用简洁的语言描述项目或者组件
  • version: 版本号,仅适用于组件
  • dependencies: 依赖的组件
  • dir: 组件安装的目录,仅适用于项目
  • author: 组件作者信息
  • main: 入口文件,仅适用于组件
  • exclude: 安装时排除的文件和目录,仅适用于组件,配置规则可以参考node-glob

fecom的默认配置项:

  • name: 执行fecom命令的目录
  • dir: components
  • owner: fecom-fe
  • domain: http://gitlab.58corp.com

综上所述:

  • 项目应该配置的项有namedescriptiondirdependenciesauthor
  • 组件应该配置的项有namedescriptionversionmainauthordependenciesexclude

常用命令介绍

  • fecom init: 初始化组件的目录结构,如果指定-S参数则跳过所有问题直接通过默认配置生成组件目录结构
  • fecom install: 安装component.jsondependencies项所指定的所有组件
  • fecom install compA: 安装compA组件以及它的依赖,并保存到component.json
  • fecom link: 将当前目前的组件注册为全局的链接,以便进行本地开发
  • fecom link compA: 软链接components/compA到全局注册的compA组件目录
  • fecom uninstall compA: 卸载compA组件以及它的依赖
  • fecom update compA: 更新compA到最新版本,只更新compA本身
  • fecom info compA: 显示compA的详细信息以及版本更新历史
  • fecom list: 列出本地安装的所有组件,如果指定-U参数则检查是否有更新
  • fecom list compA: 列出本地安装的compA组件,如果指定-U参数则检查是否有更新
  • fecom search compA: 按照compA搜索Gitlab中的组件,如果指定-O参数则按用户/组搜索
  • fecom profile: 列出用户配置
  • fecom profile "username=icefox0801": 以query形式设置用户配置项
  • fecom profile -D "domain=https://gitlab.example.com": 以query形式设置fecom默认配置项
  • fecom tree: 以依赖树的形式列出本地安装的所有组件
  • fecom tree compA: 以依赖树的形式列出本地安装的compA组件,如果指定-R参数,则列出远程compA组件的依赖树
  • fecom version: 提示选择并更新组件的版本号,会更新component.json中的version和自动添加tag,注意还需执行git push --follow-tags来推送到远程仓库
  • fecom version patch: 以patch类型更新组件版本号,类型也可以为major或者minor

组件安装格式

组件名称格式 [source:][owner/]name[@version][?args],以group/compA为例

  • fecom install compA
  • fecom install group/compA
  • fecom install group/[email protected]
  • fecom install npm:group/[email protected](目前未实现,后续根据需要实现扩展npm包)