mora-scripts
TypeScript icon, indicating that this package has built-in type declarations

1.9.14 • Public • Published

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.

Dependents (26)

Package Sidebar

Install

npm i mora-scripts

Weekly Downloads

203

Version

1.9.14

License

MIT

Unpacked Size

261 kB

Total Files

135

Last publish

Collaborators

  • qiu8310