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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@mrmtech/splice-action-indexes

v0.0.19

Published

MRM Tech Splice Action Indexes Scripts.

Downloads

450

Readme

Splice Action Indexes

splice-action-indexes is for managing MongoDB indexes and Atlas Search indexes in your project. It provides a set of scripts to download, inspect, and write index configurations, along with the ability to post comments on GitHub pull requests regarding any changes to your indexes. It reads index specifications from .json files stored in the actions/action-indexes/indexes/{DATABASE_NAME}/ directory in your project. Each subdirectory within .../indexes/{DATABASE_NAME}/ represents a collection in your MongoDB database, and the files within those subdirectories define indexes for those collections. File names are used as index names. Files meant for Atlas Search indexes include .search in their filename (e.g., index_name.search.json) and contain an object with the search index definition.

Features

  • Automatic Index Creation: Automatically creates or updates indexes based on the .json files found in the .../indexes/{DATABASE_NAME}/ directory.
  • Support for Atlas Search Indexes: Distinguishes between standard indexes and Atlas Search indexes, allowing for the creation of both types from the specified files.
  • Collection-Specific Indexing: Organizes index files by MongoDB collection names, allowing for clear and manageable index specifications.

How It Works

  1. File Structure:

    • The actions/action-indexes/indexes/{DATABASE_NAME}/ directory contains subdirectories named after your MongoDB collections.
    • Each subdirectory contains .json files, where each file defines an index for that collection.
    • Standard index files are named <indexName>.json and contain the field specification and index metadata as an array.
    • Atlas Search index files are named <indexName>.search.json and contain the search index definition as an object.
  2. Index File Format:

    • Standard Index Files: Contain an array with the field specification and index metadata.

      [
        {
          "fieldName": 1
        },
        {
          "v": 2,
          "name": "index_name"
        }
      ]
    • Atlas Search Index Files: Contain an object with the search index definition.

      {
        "name": "index_name",
        "mappings": {
          "dynamic": true,
          ...
        },
      }
  3. Usage:

    You can import and use the scripts as follows:

    • Downloading Indexes

      To download indexes, including Atlas Search configurations, use:

      import { download } from '@mrmtech/splice-action-indexes';
      
      await download({ scriptUrl: import.meta.url, indexFolder: '{DATABASE_NAME}' });
    • Inspecting Indexes

      To inspect the MongoDB indexes (both standard and Atlas Search), use:

      import { inspect } from '@mrmtech/splice-action-indexes';
      
      await inspect();
    • Writing Indexes

      To write or update indexes in your MongoDB, including Atlas Search indexes, use:

      import { write } from '@mrmtech/splice-action-indexes';
      
      await write();
    • Commenting on Pull Requests

      To post a comment on a GitHub pull request regarding index changes, use:

      import { comment } from '@mrmtech/splice-action-indexes';
      
      await comment();
    • Package Scripts

      The following scripts are defined in the package.json file, making it easy to run the various functions:

      {
        "scripts": {
          "splice-action-indexes:link": "pnpm link ../../../splice/actions/splice-action-indexes",
          "splice-action-indexes:unlink": "pnpm unlink ../../../splice/actions/splice-action-indexes",
          "comment": "node comment.js",
          "inspect": "node inspect.js --mongodb_uri=$MONGODB_URI --index_folder={DATABASE_NAME}",
          "write": "node write.js --mongodb_uri=$MONGODB_URI --index_folder={DATABASE_NAME}",
          "download": "infisical run --env=dev --path=/ -- node download.js",
          "inspect-local": "infisical run --env=dev --path=/ -- node inspect.js --index_folder={DATABASE_NAME}",
          "write-local": "infisical run --env=dev --path=/ -- node write.js --index_folder={DATABASE_NAME}"
        }
      }