{"id":16682606,"url":"https://github.com/jchip/unwrap-npm-cmd","last_synced_at":"2025-04-09T23:13:49.499Z","repository":{"id":57386987,"uuid":"196875793","full_name":"jchip/unwrap-npm-cmd","owner":"jchip","description":"Unwrap npm's node.js bin CMD batch for js files on Windows.","archived":false,"fork":false,"pushed_at":"2019-11-11T05:19:04.000Z","size":14,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-04-09T23:13:44.619Z","etag":null,"topics":["batch","cmd","nodejs","npm","unwrap","windows"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jchip.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":"2019-07-14T19:34:25.000Z","updated_at":"2019-11-11T05:19:00.000Z","dependencies_parsed_at":"2022-09-15T03:02:14.487Z","dependency_job_id":null,"html_url":"https://github.com/jchip/unwrap-npm-cmd","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jchip%2Funwrap-npm-cmd","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jchip%2Funwrap-npm-cmd/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jchip%2Funwrap-npm-cmd/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jchip%2Funwrap-npm-cmd/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jchip","download_url":"https://codeload.github.com/jchip/unwrap-npm-cmd/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248125589,"owners_count":21051770,"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":["batch","cmd","nodejs","npm","unwrap","windows"],"created_at":"2024-10-12T14:08:04.331Z","updated_at":"2025-04-09T23:13:49.482Z","avatar_url":"https://github.com/jchip.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# unwrap-npm-cmd\n\nUnwrap npm's node.js bin CMD batch for js files on Windows.\n\n[Sample](./test/fixtures/sample.js):\n\n```js\nconst unwrapNpmCmd = require(\"unwrap-npm-cmd\");\nconsole.log(unwrapNpmCmd(\"npm test\"));\nconsole.log(unwrapNpmCmd(\"npx mocha\", { relative: true }));\nconsole.log(unwrapNpmCmd(\"mocha test\", { jsOnly: true }));\nconsole.log(unwrapNpmCmd(`find \"name\" package.json`));\nconsole.log(unwrapNpmCmd(\"hello world\", { path: __dirname }));\n```\n\nOutput:\n\n```cmd\n\"C:\\Users\\userid\\nvm\\nodejs\\bin\\node.exe\" \"C:\\Users\\userid\\nvm\\nodejs\\bin\\node_modules\\npm\\bin\\npm-cli.js\" test\n\"C:\\Users\\userid\\nvm\\nodejs\\bin\\node.exe\" \"..\\nvm\\nodejs\\bin\\node_modules\\npm\\bin\\npx-cli.js\" mocha\n\"C:\\Users\\userid\\unwrap-npm-cmd\\node_modules\\mocha\\bin\\mocha\" test\n\"C:\\WINDOWS\\system32\\find.EXE\" \"name\" package.json\n\"C:\\Users\\userid\\unwrap-npm-cmd\\test\\fixtures\\hello.CMD\" world\n```\n\n## Usage\n\n```js\nchild.spawnSync(unwrapNpmCmd(\"mocha test\", { relative: true }));\n```\n\nWould effectivly be doing:\n\n```js\nchild.spawnSync(\n  `\"C:\\\\Users\\\\userid\\\\nvm\\\\nodejs\\\\bin\\\\node.exe\" \".\\\\node_modules\\\\mocha\\\\bin\\\\_mocha\" test`\n);\n```\n\n## API\n\n```js\nunwrapNpmCmd(cmd, options);\n```\n\n`options`:\n\n| name       | description                                                |\n| ---------- | ---------------------------------------------------------- |\n| `path`     | Use instead of the `PATH` environment variable.            |\n| `jsOnly`   | Return only the JS file as command without node exe.       |\n| `relative` | Convert JS file to relative path from CWD.                 |\n| `cwd`      | Use instead of `process.cwd()` to find relative path from. |\n\n# License\n\nLicensed under the [Apache License, Version 2.0](https://www.apache.org/licenses/LICENSE-2.0)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjchip%2Funwrap-npm-cmd","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjchip%2Funwrap-npm-cmd","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjchip%2Funwrap-npm-cmd/lists"}