How to Get a List of All Files in GeoLibre: 3 Methods Explained

Run git ls-files from the repository root to generate a complete, version-controlled inventory of every file in GeoLibre.

GeoLibre is a monorepo containing a web-desktop app, TypeScript packages, a Python side-car, and build scripts. Getting a reliable file list means querying the Git index rather than the filesystem, ensuring you capture exactly what's tracked and ignore build artifacts. This article covers three approaches to list all files in GeoLibre, each suited to different workflows.

Why Use Git to List Files in GeoLibre

GeoLibre's structure spans multiple directories: apps/, packages/, .github/, and configuration files at root. Because the project uses Git for version control, git ls-files returns the authoritative list of tracked files. This method works cross-platform and automatically excludes files listed in .gitignore—critical for a monorepo with generated build outputs.

The git ls-files command is the fastest, most reliable way to get all files in GeoLibre. It reads directly from the Git index.


# From the repository root

git ls-files > all-files.txt

This produces entries such as:

Output stays synchronized with commits because Git manages the index automatically.

Method 2: Node.js Recursive Walk

For JavaScript-based tooling or when you need filesystem-aware behavior, use Node's fs module. This includes untracked files—useful for ad-hoc checks during development.

node -e "require('fs').readdirSync('.', {recursive:true}).forEach(p=>console.log(p))" > all-files.txt

To match Git's view and remove duplicates, pipe through sort | uniq:

node -e "require('fs').readdirSync('.', {recursive:true}).forEach(p=>console.log(p))" | sort | uniq > all-files.txt

Method 3: npm Script

GeoLibre provides a pre-configured npm script that wraps the Git command. Check the scripts section in package.json:

{
  "scripts": {
    "list-files": "git ls-files"
  }
}

Invoke it with:

npm run list-files > all-files.txt

This ensures consistent environment handling when you're already using npm for development tasks.

Converting Output to JSON

For downstream processing in CI pipelines or data tools, convert the plain list to JSON using jq:

git ls-files | jq -R -s 'split("\n")[:-1]' > all-files.json

Key GeoLibre Files to Know

Path Purpose
README.md Project overview and quickstart
package.json Root workspace definition, top-level scripts
packages/core/src/store.ts Central state management (Zustand)
packages/plugins/src/plugins/weather-layer.ts Built-in weather raster plugin
apps/geolibre-desktop/vite.config.ts Desktop app build configuration
.github/workflows/ci.yml Continuous integration pipeline
docker-compose.yml Local development orchestration

These files reveal GeoLibre's architecture: a plugin-based core, desktop and web app variants, and containerized development workflows.

Summary

  • git ls-files – authoritative, version-controlled file list; ignores build artifacts automatically
  • Node.js readdirSync – filesystem walk including untracked files; useful for tooling integration
  • npm run list-files – convenience wrapper matching the Git CLI approach

All three methods answer how to get a list of all files in GeoLibre. Choose based on whether you need Git's accuracy, filesystem awareness, or npm workflow integration.

Frequently Asked Questions

What is the fastest way to list all files in GeoLibre?

git ls-files from the repository root. It executes in milliseconds and requires no dependencies beyond Git, which you already need to clone the repository.

Does git ls-files show untracked files?

No. git ls-files only reports files Git is already tracking. Use the Node.js readdirSync method if you need untracked files, or run git status to see what's uncommitted.

Where is the npm list-files script defined?

In the root package.json under the scripts object. As implemented in opengeos/GeoLibre, it executes git ls-files with no additional filtering.

Can I filter the file list to specific directories?

Yes. Append a pathspec to git ls-files: git ls-files packages/core/ returns only files in that package. For pattern matching, use git ls-files '*.ts' to find all TypeScript files.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →