npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@devacademy/git-iam

v1.0.3

Published

Git extension for setting name and email config quickly

Downloads

5

Readme

git-iam

This is a Git extension for setting local name and email configuration quickly.

It works by accessing a remote JSON file to get user information. The JSON file contains a list of name and email addresses of GitHub users. This extension configures the name and email config settings for the user provided in the current local repository. For more context, see the Applicability section.

Note about v0.2.0

Starting with version 0.2.0, the script also blanks out the global git config for user.name and user.email. We found some students would forget to run this script before committing and they would follow the git instructions to set the global user settings. Any future devs on that machine who also forgot to run this script before committing would unknowingly get the global settings. This change attempts to mitigate that scenario.

Version 1.0.2 makes a further change so that the behaviour described above only occurs if the --on-campus flag is used during configuration since this behaviour is not ideal for people working from their personal machines.

Installation

yarn global add @devacademy/git-iam
# or
npm i -g @devacademy/git-iam

Create users.json

You need to create a JSON object that contains the students' GitHub information.

The users.json file (or whatever you decide to call it) should have this format:

{
  "jane": {
    "name": "Jane Dev",
    "email": "[email protected]"
  },
  "joe": {
    "name": "Joe Dev",
    "email": "[email protected]"
  }
}

You can use the second part of this script to create the users.json. This script will automatically make a JSON object with the students' GitHub usernames as the object properties. Feel free to edit the property names.

Create Git Gist

  • Open up Git Gist on Github
    • You can either use the toolseda account or one of the teacher's personal account
  • Create a new private Git Gist
  • Copy the contents of your users.json and put it inside your new Git Gist
  • Get the shareable link of your private Git Gist
  • Add /raw/ to the end of the link

It should look like this

https://gist.github.com/{username}/{git-gist-id}/raw/

Configuration

In your terminal, run

# on-campus computer
git-iam --init https://gist.github.com/{username}/{git-gist-id}/raw/ --on-campus

# online student computer
git-iam --init https://gist.github.com/{username}/{git-gist-id}/raw/

Replace the link after the --init with your Git Gist link

Note: --on-campus should be used when setting up on a shared computer (this will clear the global git config when users use git iam <name>)

This command

  • saves the user list URL to the global Git config users.url
  • adds the iam alias to the global Git config alias.iam

Using git-iam

Now you can run this inside of an existing Git repository:

git iam jane

and it will have the same effect as running:

# if initialized with --on-campus only
------
git config --global --unset-all user.name
git config --global --unset-all user.email
------

# always run
git config user.name "Jane Dev"
git config user.email "[email protected]"

You can verify this by running:

git config --list
# or
cat .git/config

Now the next git commit in this repo will list Jane as the dev on the commit.

Applicability

This might not seem like a justifiable effort - to build something that only saves such few keystrokes. And most people, who are the only devs using their computer, rarely run these commands.

But this is the config setting that dictates which developer (and GitHub user) performed the commit. In a classroom setting where students use every machine in the lab, this config is needed before each commit so the appropriate student gets credit for the commit (most importantly for their GitHub profile).

This script hopes to save our students a lot of time, and increase the accuracy of who is performing commits, so students get the credit they deserve.