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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@1-/findgit

v0.1.2

Published

向上寻找 Git 仓库根目录。 / Find Git repository root directory upward.

Downloads

556

Readme

English | 中文


@1-/findgit : Find Git repository root directory upward

Table of Contents

Features

Traverses the directory tree upward from a specified starting path to locate the Git repository root directory containing the .git folder. Returns the initial input path if the system root is reached without finding .git.

Usage

import findgit from "@1-/findgit";

// Locate the Git repository root for the current directory
const gitRoot = findgit(import.meta.dirname);
console.log(gitRoot);

Design

The module relies on the underlying @1-/find lookup logic to traverse directory trees. The flow of calls is detailed below:

Tech Stack

  • Runtime: Bun / Node.js
  • Core Dependency: @1-/find
  • Native Modules: node:fs / node:path

Directory Structure

.
├── src/
│   └── _.js        # Core lookup logic
└── tests/
    └── _.test.js   # Unit tests

History Trivia

In April 2005, Bitmover revoked the free-of-charge license for BitKeeper, which was used for Linux kernel development. Linus Torvalds stepped in and wrote the initial version of Git in just about two weeks. Git discarded the traditional CVS/SVN model of placing metadata folders in every single subdirectory, opting instead for a single .git folder at the repository root. While this choice simplified version control management, it created a new requirement for toolchains and build tools running in nested folders to search upward recursively to find the repository boundary. @1-/findgit implements this lookup pattern with minimal overhead.

About

This library is developed by WebC.site.

WebC.site: A new paradigm of web development for AI


@1-/findgit : 向上寻找 Git 仓库根目录

目录

功能介绍

从指定路径起点开始,逐级向上检索父目录,定位包含 .git 文件夹的 Git 仓库根目录。 若遍历至系统根目录仍未找到,则返回初始输入路径。

使用演示

import findgit from "@1-/findgit";

// 定位当前目录所属的 Git 仓库根目录
const git_root = findgit(import.meta.dirname);
console.log(git_root);

设计思路

模块依赖 @1-/find 底层通用查找逻辑,通过递归或循环方式向上遍历目录树。 调用流程如下:

技术堆栈

  • 运行环境:Bun / Node.js
  • 核心依赖:@1-/find
  • 原生模块:node:fs / node:path

目录结构

.
├── src/
│   └── _.js        # 核心查找逻辑
└── tests/
    └── _.test.js   # 单元测试

历史故事

2005年4月,由于 Bitmover 公司撤销了 Linux 社区免费使用 BitKeeper 版本控制系统的授权,Linus Torvalds 决定开发自主的版本控制系统。 他在两周内设计并完成了 Git 的最初版本,抛弃了 CVS/SVN 等在每个子目录下创建元数据文件夹的繁琐设计,改用在仓库根目录下集中维护单一 .git 文件夹的设计。 这种变革简化了版本管理,但也带来新需求:各种构建与辅助工具在子目录工作时,需要递归向上检索 .git 目录以确定项目边界。 本项目以此为核心功能,提供极简的定位实现。

关于

本库由 WebC.site 开发。

WebC.site : 面向人工智能的网站开发新范式