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

remembrance

v0.3.1

Published

Keep your source and build/dist files in sync.

Downloads

27

Readme

remembrance

License npm

Keep your source and build/dist files in sync.

Idea

This little tool was born, when I made a release of a JavaScript project. Everything worked perfectly, all bugs fixed, no linting errors, but I forgot to call one build function. The consequence was a new patch release, only to deliver the updated dist packages. Let's face it. These types of errors is something we humans are really good at.

remembrance is a solution to prevent this particular error. It is added to the regular testing routine, and checks whether any dist/build files are not up to date.

If not explicitly disabled, remembrance also checks whether package.json and package-lock.json are in sync (according to the modification date).

How it works

The testing routine walks through all (user defined) source files and stores the most current modification date. All automatically build distribution files (also provided by the user) must have the same modification date or one even more current, if this is not the case - well - we have an error case and the test fails.

Installation

npm install remembrance --save-dev

Usage

Add remembrance to the test script in package.json. Let's imagine the current test runner is ava - the script section may look like this:

"scripts": {
    "test": "remembrance && ava"
}

The next step is to create the json-file .remembrance.json in the projects root folder.

What about tests during development?

It is probably not a goal to get failed tests because of outdated build files while developing. If remembrance sees the NODE_ENV=production environment variable, it will not make the test fail but only warn. However, it can be much more convenient to create different test cases for production and development. For instance (assuming ava as the test runner again):

"scripts": {
    "test": "remembrance && ava",
    "test:dev": "ava",
}

Configuration

All configuration can be made by creating the file .remembrance.json in the projects root folder. This is a mandatory step, as you have to tell remembrance what your source and build/dist files are. The most basic json-file may look like this:

{
    "src": "./index.js",
    "dist": "./dist/**",
}

This configuration takes index.js as the source file. All files found (that match the extension list) in ./dist must have a more current modification date or the test will fail. It is possible to specify one file or multiple files as an array as well as complete directories. Relative paths are getting converted into absolute paths apart from that, you can apply a minimatch pattern or an array of patterns.

List of keys and values for .remembrance.json

| key | default | type | effect | required? | | -------------- |------------------------------------------ |-----------------------| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------- | | debug | false | Boolean/"verbose" | enable debugging information withtrue or "verbose" | no | | dist | null | String/String[] | pass distribution files as a string/minimatch-pattern (also as a list) | yes | | exclude | null | String/String[] | pass source and/or distribution files as a string/minimatch-pattern (also as a list), which should be excluded | no | | extensions | [ "cjs", "js", "map", "mjs", "ts" ] | String[] | only files of the given types are taken into account | no | | includeTests | false | Boolean | usually test folders are completely ignored, but this can be disabled by passing false | no | | packageJSON | true | Boolean / "solo" | if not disabled, it gets tested whether package-lock.json is older than package.json; by passing the string "solo" all other tests get skipped (src and dist are no longer required in this case) | no | | silent | false | Boolean | if outdated files are found, it gets logged to the terminal, disable this by passing true | no | | src | null | String/String[] | pass source files as a string/minimatch-pattern (also as a list) | yes | | tolerance | 5000 | Number | number of tolerance in ms; by default the modification time comparison allows a tolerance of 5000 milliseconds, change it if necessary | no | | warnOnly | false (true if NODE_ENV=production) | Boolean | if set to true the test will only warn for outdated files, but it will not fail | no |

Complete .remembrance.json Example:

{
    "debug": false,
    "dist": "./dist/**",
    "exclude": "./dist/build-0.1.3-legacy.js",
    "extensions": [ "cjs", "js", "map", "mjs", "ts" ],
    "includeTests": false,
    "packageJSON": true,
    "silent": false,
    "src": [
        "**/src/**",
        "./index.ts"
    ],
    "tolerance": 5000,
    "warnOnly": false
}

License

MIT

Copyright (c) 2023, UmamiAppearance