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

amplify-disable-unused-ops

v0.2.0

Published

A CLI tool that automatically detects and disables unused GraphQL operations in AWS Amplify Gen2 projects.

Readme

amplify-disable-unused-ops

A CLI tool that automatically detects and disables unused GraphQL operations in AWS Amplify Gen2 projects.

Overview

This tool scans TypeScript projects to identify actually used Amplify DataClient operations (query/mutation/subscription) and disables unused operations using disableOperations(), preventing the generation of unnecessary API endpoints.

Key Features

  • Usage Scanning: Analyzes TypeScript files in your project to detect which models and operations are actually being used
  • Automatic Disabling: Automatically disables unused operations with disableOperations()
  • Backup: Automatically creates backups of resource files before making changes (optional)
  • Dry Run: Preview changes before actually applying them

Installation

npm add -D amplify-disable-unused-ops

Usage

1. Scan Usage

Scan TypeScript files in your project to detect which Amplify operations are being used.

amplify-disable-unused-ops scan --project tsconfig.json --out usage.json

Options:

  • --project: Path to the TypeScript project configuration file (tsconfig.json)
  • --out: Path to the JSON file where usage information will be written

Example output (usage.json):

{
  "Todo": ["create", "list"],
  "User": ["get", "update"]
}

2. Disable Unused Operations

Update the Amplify resource file to disable unused operations based on the scan results.

amplify-disable-unused-ops apply --resource amplify/data/resource.ts --usage usage.json

Options:

  • --resource: Path to the Amplify resource definition file (resource.ts)
  • --usage: Path to the usage JSON file generated by the scan command
  • --dry-run: Preview changes without actually modifying files
  • --no-backup: Skip creating a backup file (backup is created by default)

Dry run example:

amplify-disable-unused-ops apply --resource amplify/data/resource.ts --usage usage.json --dry-run

Operation Types

This tool detects and manages the following operation types:

Query Operations

  • get: Retrieve a single record
  • list: Retrieve multiple records

Mutation Operations

  • create: Create a record
  • update: Update a record
  • delete: Delete a record

Subscription Operations

  • onCreate: Real-time notification on record creation
  • onUpdate: Real-time notification on record update
  • onDelete: Real-time notification on record deletion
  • observeQuery: Real-time monitoring of query results

How It Works

  1. Scan Phase: Uses ts-morph to parse the TypeScript AST and track client instances generated by generateClient()
  2. Analysis Phase: Detects operations called in the form client.models.ModelName.operation()
  3. Apply Phase: Disables unused operation groups (queries/mutations/subscriptions) using disableOperations() based on detected usage

Tech Stack

  • TypeScript: Type-safe development
  • ts-morph: TypeScript AST parsing and manipulation
  • Node.js: Runtime environment

Development

Build

npm run build

Run

npm start

License

MIT