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

sls-gm

v1.1.1

Published

sls-git-modeules

Downloads

25

Readme

sls-gm

基于Git仓库作为包的管理工具。

注意:使用之前,请务必先在项目根目录中的.gitignore中忽略目录sls-git-modules

此工具还在开发中,先出使用文档,再进行开发,更有利于使用。

另外,此项目基本功能实现,功能还在内测,git还没有公开,请不要使用。

使用方式

安装

npm install sls-gm -g

初始化

sls-gm init

执行完上面命令,会在当前目录生成sls-git-module.json配置文件,内如如下:

{
    "date": "2017-12-28T01:44:51.175Z",
    "modules": {
        "github": {
            "config": {
                "protocol": "http://",
                "host": "github.com"
            },
            "repos": []
        },
        "gitee": {
            "config": {
                "protocol": "https://",
                "host": "gitee.com"
            },
            "repos": []
        },
        "coding": {
            "config": {
                "protocol": "https://",
                "host": "git.coding.net"
            },
            "repos": []
        },
        "self_git_server_example": {
            "config": {
                "protocol": "https://",
                "host": "git.sailengsi.com"
            },
            "repos": []
        }
    }
}

date属性的值是通过new Date()出来,后续在每次安装Git包的时候也会更新此值。

modules属性是所有的包配置管理,通过生成的默认配置,就可以看出,这是支持多中git服务器配置。下面以github配置为例:

config.protocol // 服务器协议,默认为https://
config.host     // 服务器主机,git服务器地址

之所以支持多种git服务,是为了解决git多平台的兼容问题。

安装Git包的两种方式

默认安装

sls-gm install namespaceName/repoName

默认安装采用的github(后面会增加设置默认安装类型)。

通过指定git类型安装

sls-gm install namespaceName/repoName -t gitServerType

gitServerType这个值必须存在配置文件中modules中key中。

安装完包之后,会把此包写入配置文件sls-git-module.json,格式如下:

{
    "date": "2017-12-28T01:44:51.175Z",
    "modules": {
        "github": {
            "config": {
                "protocol": "http://",
                "host": "github.com"
            },
            "repos": [namespaceName/repoName]
        },
        ......
    }
}

repos 即是安装的所有仓库数组,此值之所以是 namespaceName/repoName 这种形式,是为了兼容在统一git平台中,不同用户下面有同样的仓库并存问题。

同时,会在当前目录创建 sls-git-modules 文件夹,在 sls-git-modules 目录下会安装仓库路径生成对应的目录,格式如下:

|----sls-git-modules
|    |    |----configGitHost
|    |    |    |----namespaceName
|    |    |    |    |----repoName
|    |    |    |    |    |----包中的源码...

之所以以这种格式,也是为了兼容。

全部安装

sls-gm install

更新Git包的两种方式

默认更新

sls-gm update namespaceName/repoName

通过指定git类型更新

sls-gm update namespaceName/repoName -t gitServerType

全部更新

sls-gm update

删除Git包的两种方式

删除包,执行下面的命令之后会先提示是否确认删除,默认Y(是)。

如果选择否,会提示已取消删除。

如果选择是,会接着让你选择是否从配置文件中移除,默认Y(是)。

默认删除

sls-gm delete namespaceName/repoName

通过指定git类型删除

sls-gm delete namespaceName/repoName -t gitServerType

全部删除

sls-gm delete