-
Notifications
You must be signed in to change notification settings - Fork 6
How to install native packages on app installation
pablopi edited this page Oct 13, 2015
·
2 revisions
To install additional packages on when you are installing an app on Netbeast router you can place scripts in the package.json like during npm install.
For example, to run echo "Hello world" on an installation all you need to do is having these lines into the package.json of your application:
"scripts": {
"postinstall": "echo 'Hello world'"
}
Everything you write inside the scripts object is going to be executed:
"scripts": {
"preinstall": "./myInstallationScript.sh",
"postinstall": "echo 'Hello world'",
"whatever": "echo 'This will be executed too'"
}
As result of this code inside src/installer.js:
//exec scripts if any
www.io.emit('stdout', 'Running package.json scripts...');
for (var key in pkgJson.scripts) {
exec(pkgJson.scripts[key], {cwd: appRoot}, function(err, stdout, stderr) {
if (err) throw err;
})
}
Currently all scripts are performed after the app is copied into the apps directory.
# warning: now our docs are being published in our gitbook and available on our website. Visit http://docs.netbeast.co/
- Visit our site https://netbeast.co
- Mail us: staff [at] netbeast.co
- Report a bug or enter discussion at issues
- Other resources: Dashboard, Netbeast API
