{"id":24319534,"url":"https://github.com/ryym/othernpm","last_synced_at":"2025-09-27T04:31:30.781Z","repository":{"id":57316736,"uuid":"52090725","full_name":"ryym/othernpm","owner":"ryym","description":"Run npm commands in other directories","archived":false,"fork":false,"pushed_at":"2017-10-07T08:21:44.000Z","size":168,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-03T03:07:53.083Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ryym.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-02-19T13:51:35.000Z","updated_at":"2021-08-06T06:04:59.000Z","dependencies_parsed_at":"2022-08-25T21:11:03.232Z","dependency_job_id":null,"html_url":"https://github.com/ryym/othernpm","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryym%2Fothernpm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryym%2Fothernpm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryym%2Fothernpm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryym%2Fothernpm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ryym","download_url":"https://codeload.github.com/ryym/othernpm/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234384578,"owners_count":18823699,"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":[],"created_at":"2025-01-17T15:33:40.505Z","updated_at":"2025-09-27T04:31:25.462Z","avatar_url":"https://github.com/ryym.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Othernpm\n\n[![npm version][npm-badge]][npm-version]\n[![Travis Build Status][travis-badge]][travis]\n[![App Veyor Build status][appveyor-badge]][appveyor]\n[![Coverage Status][coveralls-badge]][coveralls]\n[![Dependency Status][david-badge]][david]\n[![devDependency Status][david-dev-badge]][david-dev]\n\n[npm-badge]: https://img.shields.io/npm/v/othernpm.svg\n[npm-version]: https://www.npmjs.org/package/othernpm\n[travis-badge]: https://travis-ci.org/ryym/othernpm.svg?branch=master\n[travis]: https://travis-ci.org/ryym/othernpm\n[appveyor-badge]: https://ci.appveyor.com/api/projects/status/rgc3vn28sc9robt0/branch/master?svg=true\n[appveyor]: https://ci.appveyor.com/project/ryym/othernpm/branch/master\n[coveralls-badge]: https://coveralls.io/repos/github/ryym/othernpm/badge.svg?branch=master\n[coveralls]: https://coveralls.io/github/ryym/othernpm?branch=master\n[david-badge]: https://david-dm.org/ryym/othernpm.svg\n[david]: https://david-dm.org/ryym/othernpm\n[david-dev-badge]: https://david-dm.org/ryym/othernpm/dev-status.svg\n[david-dev]: https://david-dm.org/ryym/othernpm#info=devDependencies\n\nOthernpm provides a way to run npm commands in other directories.\nA typical use of this module would be to run npm scripts of subdirectories\nthat have own `package.json`.\n\n## Usage\n\n### CLI\n\nOthernpm allows you to specify a path where npm commands run.\n\n```sh\n# 'cd ./templates \u0026\u0026 npm install'\n% onpm ./templates install\n```\n\nYou can also define paths in `package.json` and use them to specify\na path.\n\n```json\n{\n  \"name\": \"package name\",\n  ...\n  \"othernpm\": {\n    \"examples\": \"./examples\",\n    \"site\": \"./site\"\n  }\n}\n```\n\n```sh\n# 'cd ./site \u0026\u0026 npm run build'\n% onpm site run build\n\n# 'cd ./examples \u0026\u0026 npm test'\n% onpm examples test\n```\n\nFor example, this repository defines a npm-script named `eg` in its [package.json][root-pkg].\nBy this, we can run any npm command in [test/example] from the root directory like:\n\n[root-pkg]: ./package.json\n[test/example]: ./test/example\n\n```sh\n# Check defined npm-scripts in 'test/example'.\n% npm run eg -- run\n\n# Install Mocha as a dev-dependency of 'test/example'.\n% npm run eg -- install --save-dev mocha\n```\n\n### Node.js API\n\nOthernpm also provides API used in Node.js scripts.\nThe module loads configurations from `package.json` automatically\nso that you can use them as functions.\n\n```javascript\nconst onpm = require('othernpm');\n\n// Run the 'start' script in the examples directory.\nonpm.examples('start');\n\n// Run the 'build' script in the site directory.\nonpm.site('run build');\n\n// Run npm commands in another directory.\nonpm('./templates')('test');\n```\n\nThe othernpm function returns a [spawn] object.\n\n[spawn]: https://nodejs.org/api/child_process.html#child_process_child_process_spawn_command_args_options\n\n```javascript\nconst build = onpm.examples('run build');\nbuild.on('exit', exitCode =\u003e console.log(exitCode));\n```\n\n## Installation\n\n```sh\nnpm install --save-dev othernpm\n```\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fryym%2Fothernpm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fryym%2Fothernpm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fryym%2Fothernpm/lists"}