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

persempre

v1.0.4

Published

๐Ÿ‘“ Monitor file changes and restart your NodeJS server inside a Docker container

Downloads

30

Readme

downloads


Persempre

The app name Persempre means Forever in Italian and was create to replace Nodemon in a docker environment.

Why you say?

I personally love Docker, and run everything through it, but the big issue is that Docker won't bobble the events related to a file change if your run a VM machine on your host, and inside the VM a Docker environment while mounting a folder with your code from the originally host environment inside the VM and then mount that folder inside a Docker container. As you can see there are lots of nesting.

This situation makes it so that a file change event won't reach Docker, and if you use Nodemon you'll need to use the legacy mode. Which is nothing more then a infinite while loop that constantly goes over each file in your project and thus uses a lot of CPU time - to the point that my VM is sign a constant 110% of the CPU and my MacBook Ari gets very hot.

The solution!

Because of this poorly designed legacy mode I decided to write my own solution that is more mindful of the CPU, and tries to minimize the CPU time used to check when a file was changed.

How it works?

My app uses one timer that runs every 4 sec and goes over each file in the project while checking the time a file was change. This approach is way more efficient because it uses the CPU only every 4 sec and in between the brakes the system has the time to perform other operation.

When should this project be used?

Only if you work with a Docker container or if you need to use the legacy mode of Nodemon. If that is the case fell free to use this project instead.

How to use this package?

Just install this package globally with the following command

$ npm install persempre -g

Then you can just type:

$ persempre FILE_TO_RUN

Is this an ideal solution?

Far from it. But this is the best solution for the problem. Ideally you would want to let the operating system tell you when a file was change, but since a Docker container is unable to provide this information as of now.

Please don't use this module if you run your NodeJS project directly on your machine.

The End

If you've enjoyed this article/project, please consider giving it a ๐ŸŒŸ or donate.

  • Donate
  • Star on GitHub
  • Watch on GitHub

Also check out my GitHub account, where I have other articles and apps that you might find interesting.

Where to follow

You can follow me on social media ๐Ÿ™๐Ÿ˜‡, at the following locations:

More about me

I donโ€™t only live on GitHub, I try to do many things not to get bored ๐Ÿ™ƒ. To learn more about me, you can visit the following links: