GithubHelp home page GithubHelp logo

wayfair / git-parse Goto Github PK

View Code? Open in Web Editor NEW
41.0 41.0 18.0 4.55 MB

JavaScript library that generates an array of JavaScript objects, representing the current branch of a local git repository's commit history

Home Page: https://www.npmjs.com/package/git-parse

License: BSD 2-Clause "Simplified" License

TypeScript 99.04% Shell 0.96%
git javascript node nodejs

git-parse's People

Contributors

artemruts avatar c-tanner avatar cooperbuilt avatar crashmax-dev avatar dependabot[bot] avatar draco2003 avatar erj826 avatar finn-orsini avatar garypwhite avatar jashparekh avatar kurt-r2c avatar kv979w avatar letlm avatar morganpackard avatar peterthehan avatar raphaelts3 avatar rchl avatar renovate[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

git-parse's Issues

Convert from Flow to TypeScript

Description

Per the discussion in #52, we have decided to move from Flow types to TypeScript to follow industry best practices.

What's the benefit of this feature?

  1. Moves us in line with current industry standards in Open Source repositories. Flow usage is waning as TS usage is waxing
  2. Better integration with text editors than Flow
    • this repo works in large part with objects, and having enhanced editor support for working with those objects (auto-filling properties for example) is a win
  3. Helps auto-document code
  4. Many other TS benefits...

Possible Implementation (optional)

This can happen in a few parts. Here are the general broad strokes:

  • rename .js files to .ts
  • uninstall flow-bin
  • install typescript as a dev dep and initialize typescript
  • convert flow types to typescript types (consider looking at our definitelytyped entry for inspiration)
    - Could also try using this conversion project
  • Add TS documentation to the readme and any convenience scripts to the package json
  • stretch goal: add TS checking to our CI

Investigate Use of Current Dependencies

Description

A significant portion of maintenance effort of this repo is updating dependencies. After a quick search, we recently found that we had an unused dependency (#33). We should vet our other dependnencies to make sure they are currently used, and their use is unique enough that it warrants an external library.

What's the benefit of this feature?

The less external deps we have, the less overall maintenance will be required to keep git-parse up to date. Also, less external dependencies can help make a library more durable (less moving parts)

Acceptance Criteria

  1. Look at each current dependency and note it's usage.
    • If a dependency has no usages, create a ticket to remove it
    • If a dependency has a usage that could be easily internalized (think: https://www.npmjs.com/package/is-odd), make a ticket to replace it with an internal utility

Add/Improve Repo Documentation

Description

Add a contributing guide and scrub the current readme and code of conduct to ensure it aligns with the Wayfair OSPO best practices guides here

What's the benefit of this feature?

Best OS practices dictate a strong contributor guide. In addition, our other documentation hasn't been scrubbed for quality/detail since it was written.

Acceptance Criteria

  1. Repo has a contributor guide added
  2. Readme and Code of Conduct align with the OSPO best practices

HOT TAKE ALERT: Should we remove/replace Flow?

❗ Disclaimer - this is meant to illicit some conversation. Please weigh in with your thoughts!

Question

This repository uses Flow types to type check javascript. While Flow is a perfectly fine type checking system, there are some drawbacks. First, flow-bin is losing steam and Typrescript continues to gain widespread support.

stats_per_year_image

While this isn't inherently a bad thing, I think we should consider how it may impact the ease-to-contribution for our repo here.

Also, Flow doesn't have a clear and public roadmap (note, we still haven't seen a v1). For comparisons sake, Typescript does have a clear roadmap and a stable v1

Context

Given the focused nature of this package, I'm of the mind we should keep it as simple and easy to contribute to as possible. I don't personally see the benefit of Flow for avoiding type-related bugs and it could deter future contributor-ship given it's lack of widespread adoption.

Comments

I think we should remove flow. If someone has a strong opinion on type checking, we could convert to TS. Looking for thoughts!

❓Should We Automate Changelog and Package Version Changes?

Question

Manually upgrading the package.json version and adding a changelog entry are possible automation / validation targets. One example of this would be semantic commits powering automatic changelog updates and a required version bump / changelog check for PRs to be merged. Does anyone have strong thoughts / opinions on if we should do this and if so, what it would look like?

Context

We recently had a PR that made a major version change and didn't include a package json update, and also had a pr that didn't include a changelog update. These seem like good DX opportunities to automate away the need to think about this and in doing so, potentially increase the quality of the repo.

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Warning

These dependencies are deprecated:

Datasource Name Replacement PR?
npm @babel/plugin-proposal-class-properties Unavailable
npm @babel/plugin-proposal-object-rest-spread Unavailable

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Ignored or Blocked

These are blocked by an existing closed PR and will not be recreated unless you click a checkbox below.

Detected dependencies

github-actions
.github/workflows/no-response.yml
  • lee-dohm/no-response v0.5.0
.github/workflows/pr-checks.yml
  • actions/checkout v3
  • wagoid/commitlint-github-action v5
  • actions/checkout v3
  • actions/setup-node v3
  • actions/checkout v3
  • actions/setup-node v3
  • actions/checkout v3
  • actions/setup-node v3
  • actions/checkout v3
  • actions/setup-node v3
  • actions/checkout v3
  • actions/setup-node v3
.github/workflows/release.yml
  • actions/checkout v3
  • actions/setup-node v3
  • JS-DevTools/npm-publish v1
.github/workflows/stale.yml
  • actions/stale v7
npm
package.json
  • byline 5.0.0
  • util.promisify 1.1.1
  • @babel/cli ^7.19.3
  • @babel/core ^7.19.3
  • @babel/plugin-proposal-class-properties ^7.18.6
  • @babel/plugin-proposal-object-rest-spread ^7.19.4
  • @babel/preset-env ^7.19.4
  • @babel/preset-typescript ^7.18.6
  • @commitlint/cli ^17.1.2
  • @commitlint/config-conventional ^17.1.0
  • @types/byline ^4.2.33
  • @types/jest ^29.0.0
  • @types/util.promisify ^1.0.4
  • @typescript-eslint/eslint-plugin ^5.40.0
  • @typescript-eslint/parser ^5.40.0
  • eslint 8.31.0
  • husky ^8.0.1
  • jest ^29.0.0
  • pinst ^3.0.0
  • prettier ^2.7.1
  • typescript ^4.8.4
  • node >=14
  • minimist ^1.2.6
  • json-schema ^0.4.0
  • node-fetch ^3.0.0
  • yarn 3.3.1

  • Check this box to trigger a request for Renovate to run again on this repository

Add Release Scheduling Docs

Description

This repo currently has no documentation on how often we plan on releasing the library, or how to do so. We currently plan on releasing at least once a quarter, but more if necessary.

Acceptance Criteria

  • Release scheduling documentation has been added to the README
  • Instructions to release have been added to the contributing guide, which reference the required Changelog updates

Create .npmrc to avoid Wayfair-specific package resolution

Description

We should specify an .npmrc for this repo that resolves packages to the public npm package registry, instead of any company-specific registry that Wayfairians would have configured on their machines

What's the benefit of this feature?

avoid committing any company-specific endpoints in a package.lock

Possible Implementation (optional)

write .npmrc that points to public registry.

Add the No Response workflow

Description

Add a "No Response" workflow to ensure our issues remain fresh and relevant to the project

What's the benefit of this feature?

We always believe our contributors will provide detailed bug / feature reports with enough information to be actionable. Let's automate the process of ensuring that continues to happen!

With a No Response workflow, If you tag an issue more-information-needed and the issue reporter doesn’t follow up within a specified period of time, No Response will automatically close the issue out.

Possible Implementation (optional)

  1. Add a more-information-needed label
  2. Follow the https://github.com/lee-dohm/no-response repo to add a workflow for closing no response issues

Create Changelog

Description

This repo & library are missing a Changelog to document the changes in each version.

Acceptance Criteria

  • Add a changelog, based on Keep a Changelog
  • Add note to contributing & release guides for updating said changelog
  • Add note in changelog for anything pre 1.0.5 we do not have the details

If the file name contains spaces, the value of filesAdded.path is not expected

What happens?

If the file name contains spaces, the value of filesAdded.path is not expected.It only shows part of file name.

What were you expecting to happen?

If I have file a b.md,filesAdded.path should be a b.md,not a

Reproducing the Bug

First,init a new git repo:

git init

then,create a new file t t.mdand run git add:

git add "t t.md" 

then commit:

git commit -m 1

then run JS file:

const { gitToJs } = require('git-parse');

const commitsPromise = gitToJs(process.cwd());

commitsPromise.then((commits) => console.log(JSON.stringify(commits, null, 2)));

I got :

[                                                                   
  {                                                                 
    "hash": "afb09d58e3bf0b99789ef9a368f4e9c4e80ef479",             
    "authorName": "shadowfish07",                                   
    "authorEmail": "[email protected]",
    "date": "Fri, 6 May 2022 21:18:34 +0800",                       
    "message": "1",                                                 
    "filesAdded": [                                                 
      {                                                             
        "path": "t"                                                 
      }
    ],
    "filesDeleted": [],
    "filesModified": [],
    "filesRenamed": []
  }
]

Environment

Windows 10

Version bump

Hey, could you please release a new version for the actual babel-polyfill / core-js 2 drop? :) Thanks

Refactor git-log-stream

Description

During the Jest upgrade, I noticed gitLogStream method has an api that returns an object of stream, addErrorHandler, and does not easily allow for mocking out the actual git command executions.

I'd like to explore if we can update this module in a few ways:

  • Return a promise, to chain .then() and .catch() handlers
  • Move the git command execution to a "git api" module which can be mocked out in specs

This would be a breaking change to the public api, so anyone who picks this up should be aware not to merge until we're ready to cut a new major version as we will likely want to combine this with other breaking changes.

What's the benefit of this feature?

  • Improved testability (is that a word?)
  • Simpler API for consumers (no custom methods like .addErrorHandler(), can simply use .catch())

Testing Requirements

Per #32 (comment), be sure to test this functionality on a large repo (think Apollo or something of similar size) and ensure there are no performance / memory degradations

Investigate adopting yarn

Question

How do we feel about continuing to use npm as the package manager here?

Context

One of my favorite features of yarn includes running yarn why to tell us why a certain dependency is being pulled in. This can be super useful when tracking down vulnerabilities (and is what I used to find the root of the problem for the jest upgrade ).

Related issues

None

Comments

This is a minor dev experience change and is my personal preference, interested in how the other maintainers feel about this.

Set Up GitHub Checks

Description

This repo is missing automation to verify / validate suggested changes.

To help folks contribute to the repo, and increase our confidence in reviewing PRs, checks should be automated and reported on PRs.

Acceptance Criteria

  • GitHub checks/actions run on PRs
  • Checks include:
    • Running jest tests
    • Running lints
    • Validating formatting (check prettier run)
  • Checks are added as a branch protection rule (i.e. block merging to main if failed)

Increase verbosity in `npm ci` for GitHub Action Checks

Description

Better verbosity and logging for output of npm install / npm ci in our PR checks

What's the benefit of this feature?

Investigation of any issues or possible improvements to be made to npm install are nearly impossible with the current verbosity -- we missed an important issue on that output, we would like to not do that again.

Possible Implementation (optional)

Remove the Nock dependency

Description

As mentioned in #38, it looks like nock is an unused dependency. Furthermore, we don't want to encourage it's usage by having it available as we prefer mock service modules vs use nock.

What's the benefit of this feature?

Removes another dependency that is unnecessary, resulting in less overall maintenance over time.

Possible Implementation (optional)

  1. npm uninstall nock
  2. Check that everything works 👍

OSSF Scorecard

Description

I'd like to use OSSF's scorecards for git-parse to give an idea outwardly of our vulnerabilities, and how we do in keeping up the project over time.

We can set this up in a bespoke part of the GitHub scanning suite, see link provided for details.

What's the benefit of this feature?

Widely available and adopted scoring of our project in how it's security vulnerabilities are addressed will make this project more attractive and reliable for our downstream consumers.

Possible Implementation (optional)

Installation instructions here, happy to do it myself if nobody picks this up, or should be an easy contribution!

Investigate & Upgrade Supported Node Version

Description

The node version specified in the README is overly permissive and allows for an unsupported version of node, node 8.

Suggested Fix

  • Test package when using node LTS (14.x)
  • Add engines config to alert users of change
  • Update README to reflect change

Remove Lodash dependency

Description

Remove the lodash dev-dependency

What's the benefit of this feature?

Lodash is not used in this repo, however we have it as a dev dependency. This will cause non-zero dependabot inbounds to upgrade versions in the future which is a waste of time if the library is unused.

Possible Implementation (optional)

yarn remove lodash

Open Question (Edit: Answered in the comments below)

If we remove a dev dep that is unused, what would be the proper semver change there? @finn-orsini I'd love your thoughts here.

Add Prettier

Description

Repo does not contain a Prettier configuration. This can lead to formatting inconsistencies.

Suggested Fix

  • Add a prettier config & prettier ignore. Can use the defaults for now.
  • Run prettier on all files

Rename paths with spaces not recognized correctly

What happens?

In case of a PR renaming a file with spaces in the path, the old and new path of the change entry will be broken. Maybe similar to #63

What were you expecting to happen?

Should recognize them correctly

Reproducing the Bug

Check out https://github.com/vuejs/docs
Try to parse commit bb9f97a9ca0acc7408e0c59750e712d94360f499

The diff via git show in the terminal:

diff --git a/src/.vuepress/public/images/sponsors/primevue copy.png b/src/public/images/sponsors/primevue copy.png
similarity index 100%
rename from src/.vuepress/public/images/sponsors/primevue copy.png
rename to src/public/images/sponsors/primevue copy.png

The diff entry via git-parse:

{
      "oldPath": "src/.vuepress/public/images/sponsors/primevue copy.png\tsrc/public/images/sponsors/primevue",
      "newPath": "copy.png"
    }

Environment

3.0.0 on MacOs

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.