{"id":17004652,"url":"https://github.com/dinoboff/git-spawned-promise","last_synced_at":"2026-04-11T03:34:07.768Z","repository":{"id":57251106,"uuid":"81264146","full_name":"dinoboff/git-spawned-promise","owner":"dinoboff","description":"Promisify a git child process, settling once the process exits and its stdio streams and transformers close.","archived":false,"fork":false,"pushed_at":"2017-02-09T01:23:55.000Z","size":25,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-03-14T15:49:46.050Z","etag":null,"topics":["git","nodejs","promise"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/git-spawned-promise","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/dinoboff.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-02-07T23:08:34.000Z","updated_at":"2017-11-10T16:34:14.000Z","dependencies_parsed_at":"2022-08-24T16:52:00.538Z","dependency_job_id":null,"html_url":"https://github.com/dinoboff/git-spawned-promise","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/dinoboff/git-spawned-promise","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dinoboff%2Fgit-spawned-promise","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dinoboff%2Fgit-spawned-promise/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dinoboff%2Fgit-spawned-promise/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dinoboff%2Fgit-spawned-promise/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dinoboff","download_url":"https://codeload.github.com/dinoboff/git-spawned-promise/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dinoboff%2Fgit-spawned-promise/sbom","scorecard":{"id":343778,"data":{"date":"2025-08-11","repo":{"name":"github.com/dinoboff/git-spawned-promise","commit":"fe7e803a3c9c28c7e43354484e12f67e01aaeb60"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Code-Review","score":0,"reason":"Found 0/21 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE.md:0","Info: FSF or OSI recognized license: MIT License: LICENSE.md:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 5 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-18T06:36:20.316Z","repository_id":57251106,"created_at":"2025-08-18T06:36:20.316Z","updated_at":"2025-08-18T06:36:20.316Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31668049,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-10T17:19:37.612Z","status":"online","status_checked_at":"2026-04-11T02:00:05.776Z","response_time":54,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["git","nodejs","promise"],"created_at":"2024-10-14T04:44:07.089Z","updated_at":"2026-04-11T03:34:07.737Z","avatar_url":"https://github.com/dinoboff.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# git-spawned-promise\n\n[![Build Status][ci-badge]][travis]\n[![Build Status (win)][ci-badge-win]][appveyor]\n[![Coverage][codecov-badge]][codecov]\n[![bitHound Overall Score][bithound-badge]][bithound]\n\nPromisify a [git][git] [child process], settling once the process exit and its [stdio] streams and [transformers][transformer] close.\n\n\n## Usage\n\nOperations can ignore `stdout` (`run(...cmd)` method), can return it (`get(...cmd)`method) or can split it while transforming each element (`array(...cmd, {sep, map})`).\n\nIn any case, they capture `stderr` and reject errors when the exit codes are not zero, which will including `sdterr` in their messages and as a property:\n\n```js\nconst gitSpawnedPromise = require('../');\n\nasync function init(path = '.') {\n  const git = gitPromise();\n\n  // `run()`` ignores stdout.\n  await git.run('init', path);\n  await git.run('commit', '--allow-empty', '--message', 'chore: first commit');\n  await git.run('commit', '--allow-empty', '--message', 'feat: first feature');\n  await git.run('commit', '--allow-empty', '--message', 'fix: first fix');\n  await git.run('commit', '--allow-empty', '--message', 'feat: second feature');\n\n  const log = ['log', '--format=\"%s\"', '--no-merges', '--grep', 'feat', 'HEAD'];\n  const map = msg =\u003e msg.slice(5).trim();\n\n  const [hash, feats] = await Promise.all([\n    // `get()` resolves with stdout\n    git.get('parse-rev', 'HEAD'),\n\n    // `array` splits stdout stream and pipe transform stream.\n    git.array(...log, {map, sep: '\\n'})\n  ]);\n\n  console.log(`Status up to ${hash.slice(0, 7)}...`);\n  console.log(feats.map(title =\u003e `  ${title}`).join('\\n'));\n}\n\n// stderr available (when the error is a git error).\ninit(repo)\n  .catch(err =\u003e console.log(`${err.stderr} (${err.code})`));\n```\n\n\n## API\n\n- `gitSpawnedPromise`: `function({gitDir: ?string}): GitClient`\n\n  Bound a `GitClient` to a local repository.\n\n- `GitClient`: `function(cmd: string[], ?options: ClientOption): Promise\u003cany,Error\u003e`\n\n  Run the git command and settle once the git child process exit and the stdout/stderr pipe closes, or when either fail.\n\n- `ClientOption`: `{ignore: ?boolean, sep: ?string, map: mapper[]}`\n\n  * `ignore`: ignore stdout when set to `true` (`false` by default).\n  * `sep`: separator to split the stream (default to `\\n` if a mapper is provided).\n  * `map`: when splitting a stream, apply each element and replace the returned value. If the value is a promise it will resolve it.\n\n  if `sep` or `map` are set, the `gitCLient` `Promise` will resolve to an `Array`.\n\n- `Mapper`: function(item: any): any\n\n  A handler for a `stream.Transformer` for `stdout`. Unlike regular handler async values are passed via a `Promise` instead of a callback function, and returning `null` (or `Promise\u003cnull\u003e)` does not close the stream; the Transformer would just skip the value.\n\n  If the mapper throws or reject, the `GitClient` returned `Promise` will reject with that error.\n\n- `GitClient.run`: `function(...cmd: string[]): Promise\u003cvoid,GitError\u003e`\n\n  `gitClient.run(...cmd)` is equivalent to `gitClient(cmd, {capture: true})`.\n\n- `GitClient.get`: `function(...cmd: string[]): Promise\u003cstring,GitError\u003e`\n\n  `gitClient.get(...cmd)` is equivalent to `gitClient(cmd)`.\n\n- `GitClient.array`: `function(...cmd: string[], ?options: ClientOption): Promise\u003cany[],Error\u003e`\n\n  `gitClient.array(...cmd)` is equivalent to `gitClient(cmd, {sep: '\\n', map: someMapperOrMappperArray})`.\n\n\n\n## Installation\n\nusing npm:\n\n```shell\nnpm install git-spawned-promise\n```\n\n\n## License\n\nMIT License\n\nCopyright (c) 2017 Damien Lebrun\n\n[git]: https://git-scm.com/\n[child process]: https://nodejs.org/api/child_process.html#child_process_class_childprocess\n[stdio]: https://nodejs.org/api/child_process.html#child_process_options_stdio\n[transformer]: https://nodejs.org/api/stream.html#stream_duplex_and_transform_streams\n[travis]: https://travis-ci.org/dinoboff/git-spawned-promise\n[ci-badge]: https://travis-ci.org/dinoboff/git-spawned-promise.svg?branch=master\n[appveyor]: https://ci.appveyor.com/project/dinoboff/git-spawned-promise/branch/master\n[ci-badge-win]: https://ci.appveyor.com/api/projects/status/sgjrh23qgd1g5bd9/branch/master?svg=true\n[bithound]: https://www.bithound.io/github/dinoboff/git-spawned-promise\n[bithound-badge]: https://www.bithound.io/github/dinoboff/git-spawned-promise/badges/score.svg\n[codecov]: https://codecov.io/gh/dinoboff/git-spawned-promise\n[codecov-badge]: https://codecov.io/gh/dinoboff/git-spawned-promise/branch/master/graph/badge.svg\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdinoboff%2Fgit-spawned-promise","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdinoboff%2Fgit-spawned-promise","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdinoboff%2Fgit-spawned-promise/lists"}