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

find-git-repositories

v0.2.2

Published

Finds Git Repos asynchronously

Downloads

14,614

Readme

find-git-repositories

Actions Status

Find Git repositories in a directory and it's subfolders and return an array of paths to the found repositories.

Usage

findGitRepos(pathToSearch, progressCallback, options): Promise<string[]>

Arguments

  • pathToSearch: path to search for repositories in.
  • progressCallback: function to be called with an array of found repositories.
    • Definition: progressCallback(repositories: string[]): boolean.
    • As optional, we could return true from the progress callback to cancel the search.
  • options: optional object with the following properties:
    • throttleTimeoutMS: optional number of milliseconds to wait before calling the progress callback.
    • maxSubfolderDeep: optional maximum number of subfolders to search in.

Basic example

const findGitRepos = require('find-git-repositories');
findGitRepos('some/path', repos => console.log('progress:', repos))
  .then(allFoundRepositories => console.log('all the repositories found in this search:', allFoundRepositories));

Example with options

const findGitRepos = require('find-git-repositories');
findGitRepos(
  'some/path',
  repos => {
    console.log('progress:', repos);
    return shouldCancelSearch(); // Return true to cancel the search
  ),
  {
    throttleTimeoutMS: 100, // Only call the progress callback every 100ms
    maxSubfolderDeep: 2 // Only search in the first 2 subfolders
  }
).then(
  allFoundRepositories => console.log('all the repositories found in this search:', allFoundRepositories)
);

How to build

Run yarn or yarn install to install dependencies and build the native addon in release mode.

How to run tests

Run yarn test.

How to debug (in VS Code and MacOS)

  1. Install CodeLLBD addon for VS Code.
  2. Modify the main property in the package.json file to point to debug instead of release: "main": "build/Debug/findGitRepos.node",.
  3. Create a .vscode/launch.json file with the following content:
{
  "version": "0.2.0",
  "configurations": [
    {
      "type": "lldb",
      "request": "attach",
      "name": "Attach",
      "pid": "${command:pickMyProcess}" // use ${command:pickProcess} to pick other users' processes
    }
  ]
}
  1. Create a .vscode/c_cpp_properties.json file with a similar content:
{
   "configurations": [
      {
        "name": "Mac",
        "includePath": [
            "${workspaceFolder}/**",
            "/Users/MY_USER/.nvm/versions/node/v20.14.0/include/node/**" // enter your node path here
        ],
        "defines": [],
        "macFrameworkPath": [
            "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks"
        ],
        "compilerPath": "/usr/bin/clang",
        "cStandard": "c17",
        "cppStandard": "c++17",
        "intelliSenseMode": "macos-clang-x64"
      }
    ],
    "version": 4
}
  1. Create a .vscode/settings.json file with the following content:
{
  "files.associations": {
    "__bit_reference": "cpp",
    "__bits": "cpp",
    "__config": "cpp",
    "__debug": "cpp",
    "__errc": "cpp",
    "__functional_base": "cpp",
    "__hash_table": "cpp",
    "__locale": "cpp",
    "__mutex_base": "cpp",
    "__node_handle": "cpp",
    "__nullptr": "cpp",
    "__split_buffer": "cpp",
    "__string": "cpp",
    "__threading_support": "cpp",
    "__tuple": "cpp",
    "algorithm": "cpp",
    "array": "cpp",
    "atomic": "cpp",
    "bit": "cpp",
    "bitset": "cpp",
    "cctype": "cpp",
    "chrono": "cpp",
    "clocale": "cpp",
    "cmath": "cpp",
    "complex": "cpp",
    "cstdarg": "cpp",
    "cstddef": "cpp",
    "cstdint": "cpp",
    "cstdio": "cpp",
    "cstdlib": "cpp",
    "cstring": "cpp",
    "ctime": "cpp",
    "cwchar": "cpp",
    "cwctype": "cpp",
    "exception": "cpp",
    "functional": "cpp",
    "initializer_list": "cpp",
    "ios": "cpp",
    "iosfwd": "cpp",
    "istream": "cpp",
    "iterator": "cpp",
    "limits": "cpp",
    "list": "cpp",
    "locale": "cpp",
    "memory": "cpp",
    "mutex": "cpp",
    "new": "cpp",
    "optional": "cpp",
    "ostream": "cpp",
    "ratio": "cpp",
    "sstream": "cpp",
    "stdexcept": "cpp",
    "streambuf": "cpp",
    "string": "cpp",
    "string_view": "cpp",
    "system_error": "cpp",
    "tuple": "cpp",
    "type_traits": "cpp",
    "typeinfo": "cpp",
    "unordered_map": "cpp",
    "utility": "cpp",
    "vector": "cpp"
  }
}
  1. Run npx node-gyp rebuild --debug to install dependencies and build the native addon in debug mode.
  2. Run your app with the debugger attached in VSCode and add a breakpoint.
  3. When it stops at the breakpoint, run in the console: process.pid and copy the process number to use in the next step.
  4. In the find-git-repositories VSCode project, click on the Attach button in the debug toolbar and enter the process number from the previous step.
  5. Add breakpoints where ever you want to start debugging.