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

new-order

v1.0.0

Published

Help you manage an ordered list of filenames.

Downloads

7

Readme

New Order

Help you manage an ordered list of filenames, by splicing it.

npm i new-order -g

Usage

In the directory where you need to work :

new-order --move fileToMove --before otherFile

new-order --move fileToMove --after otherFile

fileToMove and otherFile can be directories.

Currently no relative or absolute file paths supported, just plain filenames.

Example

Let's say you want to write a book about rainbows to cheer you up during a sad Blue Monday. Each chapter will be about a specific color and will have its own markdown file.

Here's the initial content of your book directory, files are for now sorted alphabetically :

.
..
blue.md
green.md
red.md

Your story is a journey along the light spectrum, from infrared to ultraviolet. So you need to reorder your chapters. Doing it by hand (with the mv command for example), you'll get :

.
..
1 red.md
2 green.md
3 blue.md

Now you need to write the orange chapter. It should fit in 2nd position, between red and green. But if you simply call it 2 orange.md it won't work. You need to rename all the files coming after :

.
.
..
1 red.md
2 orange.md
3 green.md
4 blue.md

As you've guessed, this task can be very tedious and error-prone for large amounts of files.

Let's see how can new-order help you doing this chore. 'Time to write down yellow.md, your next episode following the newly created orange's one.

.
..
1 red.md
2 orange.md
3 green.md
4 blue.md
yellow.md

You can handle this in several ways with the same result :

new-order --move yellow.md --after 2\ orange.md

or

new-order --move yellow.md --before 3\ green.md

.
..
1 red.md
2 orange.md
3 yellow.md
4 green.md
5 blue.md

What happens if you have more than 9 files?

.
..
1 red.md
2 orange.md
3 yellow.md
4 lime.md
5 green.md
6 cyan
7 blue.md
8 indigo.md
9 violet.md
jade.md

new-order --move jade.md --after 5\ green.md

.
..
01 red.md
02 orange.md
03 yellow.md
04 lime.md
05 green.md
06 jade.md
07 cyan
08 blue.md
09 indigo.md
10 violet.md

new-order will automatically adjust to a 2 digits naming scheme.

License MIT