sort-scripts

1.0.1 • Public • Published

sort-scripts

Sort scripts based on prefix and suffix

Usage

Given an map of script names to behavior (as is found in package.json files for Node projects), sort the scripts in a logical order, considering pre and post prefixes:

const sort = require('sort-scripts');
const scripts = {
  test: "jest",
  pretest: "check-engines",
  postmerge: "lint-staged",
  docs: "markdown-magic",
  postdocs: "echo \"'.md' files updated\""
};
 
sort(scripts);
// [
//   ["docs", "markdown-magic"], 
//   ["postdocs", "echo \"'.md' files updated\"],
//   ["postmerge", "lint-staged"],
//   ["pretest", "check-engines"],
//   ["test", "jest"]
// ]

Dependents (2)

Package Sidebar

Install

npm i sort-scripts

Weekly Downloads

9,628

Version

1.0.1

License

MIT

Unpacked Size

4.41 kB

Total Files

8

Last publish

Collaborators

  • camacho