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

gcmm

v1.1.1

Published

Git config manager

Downloads

16

Readme

gcmm

Git config manager that can help you easy and fast set different git configs.

usage

demo@demo:~$ gcmm ls

demo@demo:~$ gcmm add klook yangzhou [email protected]
Add klook: yangzhou [email protected] success!

demo@demo:~$ gcmm add github sishenhei7 [email protected]
Add github: sishenhei7 [email protected] success!

demo@demo:~$ gcmm ls
klook:   yangzhou ---- [email protected]
github:  sishenhei7 -- [email protected]

demo@demo:~$ gcmm use klook
Git config has been set to yangzhou [email protected]

demo@demo:~$ gcmm ls
* klook:   yangzhou ---- [email protected]
  github:  sishenhei7 -- [email protected]

demo@demo:~$ gcmm use github
Git config has been set to sishenhei7 [email protected]

demo@demo:~$ gcmm ls
  klook:   yangzhou ---- [email protected]
* github:  sishenhei7 -- [email protected]

demo@demo:~$ gcmm remove klook
Delete klook success!

demo@demo:~$ gcmm ls
* github:  sishenhei7 -- [email protected]

tips

You can set diefferent git configs locally on different projects to get rid of switching git configs too frequently.

Changelog

Changelog

其它

编写此库的时候学到的东西:

1.关于fs.writefile的原子性。nodejs 的 fs.writeFile 只是一个简单的上层封装,这个方法不是原子的(如果正在写入文件的时候断电了或发生了其它异常,写入会终止,最终写入的文件是一个 broken 文件。)一般这种问题的解决方案是,首先写入一个临时文件,当写入完成之后,把要写入的文件删除,然后把临时文件重命名为要写入的文件,最后删除临时文件。write-file-atomic库就提供了这种原子性的写入文件的方法。另外fs.writefile会覆盖之前的内容,fs.appendFile只是在文件内容后面追加,但是它有两个缺点,第一个是它不是原子的;第二个是每次追加的时候它都会创建一个文件标识符,当同时进行多次追加的时候,会创建很多文件标识符然后报错,这个时候更好的解决方案是使用 nodejs 流来复用文件标识符,进行多次追加。

2.获取 nodejs home 路径的方法:

// old
function getUserHome() {
  return process.env[(process.platform == 'win32') ? 'USERPROFILE' : 'HOME'];
}

// new
const homedir = require('os').homedir()

3.解析 ini 文件的库:ini