Database build script.
This commit is contained in:
1 parent
b905824d50
commit
c3da37c0b0
5 files changed
+57
-26
No files matched your search
@@ -0,0 +1,29 @@
|
||||
const { spawn } = require('child_process');
|
||||
|
||||
function getDatabase() {
|
||||
return process.env.DATABASE_URL.split(':')[0];
|
||||
}
|
||||
|
||||
function runCommand(cmd, args = []) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const child = spawn(cmd, args);
|
||||
|
||||
child.stdout.on('data', data => process.stdout.write(data));
|
||||
|
||||
child.stderr.on('data', data => process.stdout.write(data));
|
||||
|
||||
child.on('error', err => reject(err));
|
||||
|
||||
child.on('exit', (code, signal) => resolve({ code, signal }));
|
||||
});
|
||||
}
|
||||
|
||||
function getNpmCommand() {
|
||||
return /^win/.test(process.platform) ? 'npm.cmd' : 'npm';
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
getDatabase,
|
||||
runCommand,
|
||||
getNpmCommand,
|
||||
};
|
||||
Reference in new issue
Block a user