{"id":21474935,"url":"https://github.com/wayfair/git-parse","last_synced_at":"2025-04-07T07:06:30.255Z","repository":{"id":37926320,"uuid":"130100738","full_name":"wayfair/git-parse","owner":"wayfair","description":"JavaScript library that generates an array of JavaScript objects, representing the current branch of a local git repository's commit history","archived":false,"fork":false,"pushed_at":"2024-09-16T15:54:35.000Z","size":4667,"stargazers_count":41,"open_issues_count":8,"forks_count":18,"subscribers_count":9,"default_branch":"main","last_synced_at":"2024-09-16T19:15:58.045Z","etag":null,"topics":["git","javascript","node","nodejs"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/git-parse","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wayfair.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-04-18T17:47:46.000Z","updated_at":"2024-08-13T16:34:07.000Z","dependencies_parsed_at":"2023-10-12T01:58:14.327Z","dependency_job_id":"33a75da0-7887-43ef-9442-eecf864d6dd1","html_url":"https://github.com/wayfair/git-parse","commit_stats":{"total_commits":55,"total_committers":18,"mean_commits":"3.0555555555555554","dds":0.7090909090909091,"last_synced_commit":"b88100fc4a3ee7abf83bd7218bb414839a891f2e"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wayfair%2Fgit-parse","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wayfair%2Fgit-parse/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wayfair%2Fgit-parse/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wayfair%2Fgit-parse/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wayfair","download_url":"https://codeload.github.com/wayfair/git-parse/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247608151,"owners_count":20965952,"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":["git","javascript","node","nodejs"],"created_at":"2024-11-23T10:35:18.134Z","updated_at":"2025-04-07T07:06:30.233Z","avatar_url":"https://github.com/wayfair.png","language":"TypeScript","readme":"Git-Parse\n=========\n\n[![NPM version](https://img.shields.io/npm/v/git-parse.svg)](https://www.npmjs.com/package/git-parse)\n[![NPM Downloads](https://img.shields.io/npm/dm/git-parse.svg?style=flat)](https://www.npmjs.org/package/git-parse)\n[![Bundlephobia](https://badgen.net/bundlephobia/minzip/git-parse)](https://bundlephobia.com/result?p=git-parse)\n\n\u003e `git-parse` is a utility which generates an array of javascript objects representing the current branch of a local git repository's commit history.\n\n### Details\n\n- Support NodeJS \u003e= 14\n\n### Installation\n\n```bash\nnpm install git-parse\n```\n\n### Usage\n\n```js\nconst { gitToJs } = require('git-parse');\n\nconst commitsPromise = gitToJs('path/to/repo/');\n\ncommitsPromise.then(commits =\u003e console.log(JSON.stringify(commits, null, 2)));\n```\n\n\u003cdetails\u003e\n  \u003csummary\u003e\u003cb\u003eConsole output:\u003c/b\u003e\u003c/summary\u003e\n\n  ```json\n  [\n    {\n      \"hash\": \"7cedc121ee163d859dfdb9911e627d4b5933cc6d\",\n      \"authorName\": \"mpackard@wayfair.com\",\n      \"authorEmail\": \"mpackard@wayfair.com\",\n      \"date\": \"Wed, 10 Jan 2018 16:44:52 -0500\",\n      \"message\": \"initial setup\",\n      \"filesAdded\":[\n          { \"path\": \"packages/raspberry-popsicle/index.js\" },\n          { \"path\": \"packages/raspberry-popsicle/package-lock.json\" },\n          { \"path\": \"packages/raspberry-popsicle/package.json\" }\n      ],\n      \"filesDeleted\": [],\n      \"filesModified\": [],\n      \"filesRenamed\": []\n    },\n    {\n      \"hash\": \"226f032eb87ac1eb18b7212eeaf1356980a9ae03\",\n      \"authorName\": \"mpackard@wayfair.com\",\n      \"authorEmail\": \"mpackard@wayfair.com\",\n      \"date\": \"Wed, 10 Jan 2018 15:25:16 -0500\",\n      \"message\": \"add README\",\n      \"filesAdded\": [\n        { \"path\": \"README.md\" }\n      ],\n      \"filesDeleted\": [],\n      \"filesModified\": [],\n      \"filesRenamed\": []\n    }\n  ]\n  ```\n\u003c/details\u003e\n\n## API\n\n### .gitToJs(pathToRepo, [options])\n\nReturns a promise which resolves with a list of objects describing git commits on the current branch. `pathToRepo` is a string. `options` is an optional object with one property, `sinceCommit`, which is a commit hash. If `sinceCommit` is present, gitToJs will return logs for commits _after_ the commit specified.\n\n```js\nconst { gitToJs } = require('git-parse');\n\nconst commitsPromise = gitToJs('path/to/repo/');\n\ncommitsPromise.then(commits =\u003e console.log(JSON.stringify(commits, null, 2)));\n```\n\n### .checkOutCommit(pathToRepo, commitHash, [options])\n\nChecks a repository out to a given commit. `hash` is the commit hash. Options is an optional object with one property, `force`. `force` adds `--force` to the [underlying git checkout](https://git-scm.com/docs/git-checkout#git-checkout--f). Returns a promise.\n\n### .gitPull(pathToRepo)\n\nRuns 'git pull' on the repository at the given path. Returns a promise.\n\n### .gitDiff(pathToRepo, commitHash1, [commitHash2], [file])\n\nReturns a git diff given a path to the repo, a commit, an optional second commit, and an optional file path.\n\nReturns a promise resolving with the diff as a string.\n\n## Development\n\n### Build\n\nTo generate a local distribution for the git-parse library run the following command:\n```sh\nyarn build\n```\n\nTo build the library in the background on file changes, use:\n```sh\nyarn build:watch\n```\n\n### Code Formatting\n\nTo automatically format the code using [Prettier](https://prettier.io/) run:\n```sh\nyarn format\n```\nor\n```sh\nyarn format:check\n```\n\n### Linting\n\nTo lint the project using [ESLint](https://eslint.org/) run:\n```sh\nyarn lint\n```\n\n### Tests\n\nTo run the project tests using the [Jest](https://jestjs.io/) framework run:\n```sh\nyarn test\n```\n\n### Type Checking\n\nTo check the project for type errors using [Typescript](https://www.typescriptlang.org/) run:\n```sh\nyarn tsc\n```\n\nUse `--watch` to run the type checker in the background:\n```sh\nyarn tsc --watch\n```\n\n## License\n\nThis project is licensed under the BSD-2-Clause license.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwayfair%2Fgit-parse","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwayfair%2Fgit-parse","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwayfair%2Fgit-parse/lists"}