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

mora-scripts

v1.9.14

Published

Some collection scripts by myself

Downloads

129

Readme

mora-scripts

Greenkeeper badge js-standard-style Build Status Build status Coverage Status

TODO

  • 生成单独的 package,以 ms- 开头,如 ms-fs-exists
  • 统一 new Error 中的字符串参数首字母要大写,且最后不要带标点符号

cli

run

pkg. 开头的变量会递归的循环解析成对应的 package.json 中的值

run 后面使用 --prefix=xxx 可以修改默认的 pkg 前缀

//...
"scripts": {
  "build": "run NODE_ENV=development webpack -p",
  "release": "run --prefix % git commit -am 'release %.version' && run git tag %.version"
}
//...

主要参考了下面这些组件的功能

puts

用于在命令行上输出颜色,如

# "Are you ok" will output in red color
puts '%cAre you ok' 'red'   

更多详情参考文件 libs/color.js

另外还要三个用于输出颜色的命令没有放在 cli 目录下,也没放到 package.json 中的 bin 中,

主要是因为在命令行上使用只是它们的次要功能

hooks

  • post-merge 可以在每次从远端拉取代码时自动根据 package.json 文件是否有更新而执行 npm install
  • commit-msg 检查提交的信息是否符合规范,规范:<type>(<scope>): <subject>
  • pre-push 提交前检查脚本中是否有 lint 和 test 命令,有的话便执行它

主要参考了下面这些组件的功能

install

npm install mora-scripts --save-dev

config

package.json

...
"config": {
  "hooks": {
    "post-merge": "node ~/mora-scripts/hooks/post-merge.js"
  }
}
...

or

"config": {
  "hooks": {
    "commit-msg": true,
    "post-merge": true
  }
}

or

"config": {
  "hooks": {
    "commit-msg": {
      "command": "node ~/mora-scripts/hooks/commit-msg.js",
      "warnOnFail": false,
      "showHelp": true,
      "maxSubjectLength": 100,
      "subjectPattern": ".+",
      "types": ["feat", "fix", "docs", "style", "refactor", "perf", "test", "chore", "revert"]
    }
  }
}

js

promise-extra

Add Promise.prototype.finally and Promise.try functions.