/node-self-destruct

self destruct your node module! a practical joke, implemented

Primary LanguageJavaScriptOtherNOASSERTION

Stand With Ukraine

node-self-destruct

Removes your node module from the filesystem if you want it to. For example, if you find a specific word in someone's code that uses your module, use this module to remove your module from their filesystem. Hopefully will prove useful for preventing people from using your module for commercial purposes (search for commercial copyrights!).

Make sure to back your work up as calling this package's destruct mechanism from your script will delete your script's working directory!!

Installation

npm i node-self-destruct

Usage example

const SelfDestruct = require('../self-destruct/destruct.js');

// do something that causes a self destruct.
module.exports = class Fake {
    static init () {
        console.log("Self destructing...");
        SelfDestruct.destroy("You are not allowed to use this module!", {
            changePackageFile: true
        });
    }
}

Options

Required

  • message: The message to display before the module is removed.

Optional

  • changePackageFile: If true, the package.json file will be changed to remove the module. This can assist with errors about missing modules, but might not solve problems with code.

TODO

  • Add tests
  • Add simple README
  • Create self-destruction code
  • Publish to npm
  • More documentation
  • Some sort of plugin system, get user geolocation, etc (Russia/Ukraine issue)
  • Create a deletion depth parameter