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

gru

v0.0.2

Published

A git wrapper that facilitates the management of a project's files and directories across multiple repositories.

Downloads

2

Readme

What is gru?

Gru (Git Repo Unifier) is a tool that offers a flexible solution to having a project's codebase distributed across multiple git repositories. It allows you to clone one repo and have the contents of another repo automatically merged in, but excluded from the first repo's index of tracked files. This in turn allows a project's entire codebase to be pulled in from different repos and set up for development while constricting git to only see files/directories from one repo at a time. Gru can be used as a drop-in replacement for all git commands, since all parameters passed to gru are proxied through to git itself — it does all its work by adding side effects to some of the common git commands. This behavior is controlled in the gru.yml config file, which gru will look for and parse in each repo it handles.

The relationship between repos is defined by saying that the derived repo inherits content from one or more base repos; this concept of inheritance is borrowed from object-oriented programming. By including a gru.yml config file at the root of the repo, you can define one or more repos whose files you want to essentially treat as part of the project on your local copy. Within the config file, gru expects the property derives-from to be an array of the sources the repo will inherit from.

The command gru clone <repo> will first run git clone to do the respective clone, and then it will look for the gru.yml file and recursively clone each referenced repo, and then copy its file structure to the derived repo. Each file that is copied to the derived repo is also added to its .git/info/exclude file which behaves like .gitignore but is kept on the local repo only.

Why not simply use submodules?

Git's submodules allow a project to reference other git repositories as sources to be included in the current repository, and similarly can recursively clone all dependent submodules into the project.

Submodules are the appropriate tool to use when the other repository you're referencing is a library or another dependency that can be embedded as a subdirectory, but not when it contains the main project root that you want your current repository to extend from. Gru permits the final arrangement of files and directories for the combined repos to be completely independent from the origin of the files.

What are some practical use cases for gru?

  • Cases where you want two portions of the same project to remain completely separate from each other, but allow them to overlap the same directory hierarchy (i.e. separating additional private files that may be scattered throughout a public directory tree).
  • Applying complex access control to projects down to the file level, where file permissions are determined by those of the repo that contains them.
  • Aggregating scattered repositories of config or data files to facilitate editing and testing.

Installation

Make sure you have NPM installed, then run:

npm install -g gru

Usage

gru clone <repo>

More commands/options to follow...

Note that this project is still in the early stages of development and should not be used to blindly deploy code to production.

####TODO####

  • Add tests
  • Support gru init
  • Allow base repos to be selected for modification, swapping out .git directories and updating excludes accordingly.
  • Show security notifications and confirmations for "risky" operations:
    • On commit or status, optionally notify when changes are made to untracked files (belonging to other repos not currently selected for modification)
    • Add option to force user confirmation of any change made to any base repo, to prevent accidentally committing sensitive information to the wrong repo.