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!).
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
- <input checked="" disabled="" type="checkbox"> Add tests
- <input checked="" disabled="" type="checkbox"> Add simple README
- <input checked="" disabled="" type="checkbox"> Create self-destruction code
- <input checked="" disabled="" type="checkbox"> Publish to npm
- <input disabled="" type="checkbox"> More documentation