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

ras

v0.1.1

Published

A regex & glob based batch renaming utility

Downloads

11

Readme

RAS

A regex & glob based batch renaming utility

Installation

npm -g install ras yarn global add ras

Usage

CLI help

Usage: ras <pattern> <output> [options]

Options:
	-h, --help        Print out this text
	--version         Print out the ras version
	-v, --verbose     Print out info about what's happening
	-p, --preview     Log out the changes that would happen but don't execute them
	-o, --omit        Omit files from the cwd that aren't in a glob matched directory
	--cwd=<root>      The directory to run in, if not the current one
	--ext=<extension> A comma seperated list of extensions to filter by
	--find=<glob>     Specify the glob path that will match folders to search in

Arguments

  • pattern: A regular expression that will match against the file name of any discovered files
  • output: A lineup template that will be used to generate the output file name based on the regex match from pattern. e.g myfile-%1%.png will replace the %1% with the first regex capture group

Options

  • verbose: Prints out the path of each file that will be moved, and the filename that it will be moved to
  • preview: As per verbose, but wont actually commit the movements. Good for seeing exactly what will happen. Can safely be specified alongside verbose, they wont clash
  • omit: Normal execution checks for files in the working directory, this flag stops that. Usually specified alongside a search glob, otherwise nothing will get renamed
  • cwd: Specify the working directory of the command, relative to the current working directory
  • ext: Currently not implemented A comma seperated list of file extensions to limit to. Useful to avoid needing to anchor patterns that contain a string that could be mistaken for a file extension
  • find: A glob expression that will match subfolders of the working directory, which will then be searched for pattern. Only exact glob matches will be found, intermediary folders wont be picked up

Example

This script searches a series of asset folders to rename files containing a dpi identifier to a standardised format to be used as android icons, where the folders are of the format whitelabel/assets/[company name]/android/icon and the files have varying names, but all have a -{size}dpi identifier in them

	ras "-(.*dpi).*?\.png$" \
		"ic_launcher-%1%.png" \
		-o \
		--find="assets/**/android/icon" \
		--cwd="$HOME/projects/MyApp/whitelabel"