
Research
Malicious npm Packages Impersonate Flashbots SDKs, Targeting Ethereum Wallet Credentials
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Snippet Tidy: A tool to automatically remove unused methods, classes, and code elements from TypeScript projects.
Snipdy (short for “Snippet Tidy”) is a powerful and efficient command-line tool designed to automatically analyze and remove unused methods, classes, and code elements from your TypeScript projects. With a focus on a specified entry point or method, Snipdy intelligently prunes away unnecessary code, streamlining your codebase while ensuring that only relevant pieces remain.
import
and require
statements.To install Snipdy via npm, run the following command:
npm install -g snipdy
This will install Snipdy globally on your system, making it accessible as a CLI tool.
Once installed, Snipdy can be used via the command line by invoking the snipdy
command. Here’s the basic syntax:
snipdy [command] [options]
snipdy focus <file> <method-name> [options]
Suppose you have a file example.ts
with the following content:
import fs from 'fs';
import { createHmac } from 'crypto';
class VisitsController {
getVisits() {
this.fetchCoupons();
console.log('crypto', createHmac);
}
fetchCoupons() {
this.showReceipt();
}
showReceipt() {
console.log("Showing receipt...");
}
createVisit() {
console.log("Creating visit...");
}
}
class OrdersController {
placeOrder() {
console.log("Placing order...");
}
}
You want to clean up the file, keeping only the methods related to getVisits
. You can run:
snipdy focus path/to/example.ts getVisits --override --debug
This will:
example.ts
file.getVisits
method.createVisit
method and the entire OrdersController
class since they are not called or related to getVisits
.fs
if not used anywhere else.If you only want to clean up unused imports and require statements, Snipdy can help as well. For example, in this file:
import { readFileSync } from 'fs';
import { spawn } from 'child_process';
const path = require('path');
const { randomBytes } = require('crypto');
console.log(randomBytes(16));
You want to clean up unused imports (readFileSync
and spawn
are not used). Run the following command:
snipdy focus path/to/example.ts randomBytes --override
The result will remove the unused imports and keep only the necessary code:
const { randomBytes } = require('crypto');
console.log(randomBytes(16));
If you want to see detailed logs of which methods, classes, or imports are being removed, enable the --debug
flag:
snipdy focus path/to/example.ts getVisits --debug
This will print out which methods or imports are removed, making it easier to understand the decisions Snipdy is making during the cleanup.
If you want to analyze a file and see the result without overwriting the original file, simply omit the --override
option. The cleaned code will be printed to the console instead:
snipdy focus path/to/example.ts getVisits
This will allow you to inspect the cleaned version of the file without making any permanent changes.
Contributions are welcome! If you'd like to contribute to Snipdy, feel free to fork the repository, create a feature branch, and submit a pull request with a detailed description of your changes.
This project is licensed under the MIT License.
This version of the README.md
includes more descriptive examples of how users can use Snipdy and should make it easier for them to get started and explore different use cases.
FAQs
Snippet Tidy: A tool to automatically remove unused methods, classes, and code elements from TypeScript projects.
The npm package snipdy receives a total of 0 weekly downloads. As such, snipdy popularity was classified as not popular.
We found that snipdy demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.