{"id":16978689,"url":"https://github.com/srph/npm-scripts-info","last_synced_at":"2025-04-09T12:06:40.013Z","repository":{"id":48293687,"uuid":"52149880","full_name":"srph/npm-scripts-info","owner":"srph","description":"Display the description of your npm scripts","archived":false,"fork":false,"pushed_at":"2022-12-29T19:47:03.000Z","size":162,"stargazers_count":93,"open_issues_count":3,"forks_count":10,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-02T03:57:45.697Z","etag":null,"topics":["build-tool","npm"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/srph.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-02-20T11:22:34.000Z","updated_at":"2024-12-16T12:03:38.000Z","dependencies_parsed_at":"2023-01-31T09:46:23.088Z","dependency_job_id":null,"html_url":"https://github.com/srph/npm-scripts-info","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/srph%2Fnpm-scripts-info","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/srph%2Fnpm-scripts-info/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/srph%2Fnpm-scripts-info/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/srph%2Fnpm-scripts-info/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/srph","download_url":"https://codeload.github.com/srph/npm-scripts-info/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248036063,"owners_count":21037092,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["build-tool","npm"],"created_at":"2024-10-14T01:44:01.129Z","updated_at":"2025-04-09T12:06:39.989Z","avatar_url":"https://github.com/srph.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# npm-scripts-info [![NPM version](https://img.shields.io/npm/v/npm-scripts-info.svg?style=flat-square)](https://www.npmjs.com/package/npm-scripts-info) [![Build status for master](https://img.shields.io/travis/srph/npm-scripts-info/master.svg?style=flat-square)](https://travis-ci.org/srph/npm-scripts-info)\n\nDisplay the description of your npm scripts.\n\n## Installation\n\nThis module is installed via npm:\n\n```sh\nnpm install npm-scripts-info --save\n```\n\n## Usage\n\n### Using the `scripts-info` property\n\nAdd the descriptions (`scripts-info`) to your `package.json`. Afterwards, add `npm-scripts-info` to your scripts.\n\n```json\n{\n  \"name\": \"my-project\",\n  \"scripts\": {\n  \t\"info\": \"npm-scripts-info\"\n  },\n  \"scripts-info\": {\n  \t\"info\": \"Displays information about the scripts.\",\n  \t\"watch:build\": \"Compiles the scripts and watches for changes.\",\n  \t\"start\": \"Kickstarts the application.\"\n  }\n}\n```\n\nFinally, run `npm run info`.\n\n### Usings scripts prefixed with `?`\n\nFor modules with dozens of scripts it might be a better option to store the descriptions near the commands. `npm-scripts-info` allows to store the scripts descriptions in the `scripts` property. In order to add a script description, just prefix its name with `?`.\n\n```json\n{\n  \"name\": \"my-project\",\n  \"scripts\": {\n    \"?info\": \"Display information about the scripts.\",\n    \"info\": \"npm-scripts-info\",\n\n    \"?watch:build\": \"Watch codebase, trigger build when source code changes\",\n    \"watch:build\": \"webpack --watch\",\n\n    \"?start\": \"echo Kickstarts the application.\",\n    \"start\": \"node index\"\n  }\n}\n```\n\nHave you noticed the `echo` command in the `start` description? Hence the descriptions are inside the script property, they can be called using `npm run`. By adding the `echo` command to the description properties you can make valid scripts from them. Therefore, running `npm run ?start` will print the description of the `start` script. And the great thing is, `npm-scripts-info` is smart enough to fetch the description from the `echo` command!\n\n**NOTE:** The prefixed commands will be looked up for descriptions only if the `package.json` doesn't have a `scripts-info` property.\n\n## Custom Reporters\n\nYou can customize the output by specifying a reporter.\n\n```bash\nnpm-scripts-info -r=my-reporter\n```\n\nYou can check the [default reporter](lib/reporter.js) to get the gist of how it works. It's very simple.\n\n**Note**: If you're publishing your own reporter, please prefix it with `npm-scripts-info` (e.g., `npm-scripts-info-my-reporter`) for searchability.\n\n## Using the JavaScript API\n\nYou can fetch the scripts descriptions from a `package.json` in JavaScript.\n\n```js\n'use strict';\nvar getScriptsInfo = require('npm-scripts-info');\nvar readPkgUp = require('read-pkg-up');\n\nreadPkgUp()\n  .then(function(result) {\n     var scriptsInfo = getScriptsInfo(result.pkg);\n     console.log(scriptsInfo);\n     //\u003e { md: 'Update the markdown files',\n     //    info: 'Display information about the scripts',\n     //    test: 'Run the tests' }\n  });\n```\n\n## Default Descriptions\n\nSome of the npm scripts are standardized. `npm-scripts-info` provides default descriptions for them, if no custom description specified in `scripts-info`.\n\n- **info** - Display information about the scripts\n- **start** - Kickstart the application\n- **test** - Run the tests\n- **build** - Build the package\n- **watch** - Watch codebase, trigger build when source code changes\n- **cover** - Execute test coverage\n\n## Preview\n\n![preview](preview.png)\n\n## License\n\nISC © [Kier Borromeo](http://srph.github.io)\n\n## \u003ca name=\"dependencies\"\u003eDependencies\u003c/a\u003e [![Dependency status for master](https://img.shields.io/david/srph/npm-scripts-info/master.svg?style=flat-square)](https://david-dm.org/srph/npm-scripts-info/master)\n\n- [chalk](https://github.com/chalk/chalk): Terminal string styling done right. Much color.\n- [meow](https://github.com/sindresorhus/meow): CLI app helper\n- [unquote](https://github.com/lakenen/node-unquote): Remove wrapping quotes from a string.\n\n## \u003ca name=\"dev-dependencies\"\u003eDev Dependencies\u003c/a\u003e [![devDependency status for master](https://img.shields.io/david/dev/srph/npm-scripts-info/master.svg?style=flat-square)](https://david-dm.org/srph/npm-scripts-info/master#info=devDependencies)\n\n- [chai](https://github.com/chaijs/chai): BDD/TDD assertion library for node.js and the browser. Test framework agnostic.\n- [mocha](https://github.com/mochajs/mocha): simple, flexible, fun test framework\n- [mock-fs](https://github.com/tschaub/mock-fs): A configurable mock file system.  You know, for testing.\n- [mos](https://github.com/zkochan/mos): A pluggable module that injects content into your markdown files via hidden JavaScript snippets\n- [read-pkg-up](https://github.com/sindresorhus/read-pkg-up): Read the closest package.json file\n- [rewire](https://github.com/jhnns/rewire): Easy dependency injection for node.js unit testing\n- [sinon](https://github.com/cjohansen/Sinon.JS): JavaScript test spies, stubs and mocks.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsrph%2Fnpm-scripts-info","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsrph%2Fnpm-scripts-info","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsrph%2Fnpm-scripts-info/lists"}