1.0.2 • Published 7 years ago
update-on-start v1.0.2
Node Update on Start
This module updates it's parent and all of it's parent's modules on start up. It spawns git pull
using the repository url found in package.json to and then spawns npm update --save
.
Usage
Don't store copies of npm repositories in your project's repository, use npm the way it was meant to be used! Make sure to run update-on-start
at the very start of your program before requiring any dependencies. Put your project's main contents in another file so you never have to update index.js
and don't have to restart for changes to take effect! In your repository's .gitignore
file, exclude all of your node_modules and use !
to make an exception for update-on-start
.
Example index.js
#!/usr/bin/env node
// true if the program is run independently as a CLI
if (require.main == module) {
const selfUpdate = require('update-on-start');
selfUpdate(() => {
require('./src/main.js')();
});
} else {
module.exports = require('./src/main.js');
}
Example .gitignore
/node_modules/**
!/node_modules/update-on-start/**