diff --git a/app/README.md b/app/README.md new file mode 100644 index 000000000..f2e9391aa --- /dev/null +++ b/app/README.md @@ -0,0 +1,24 @@ +[![styled with prettier](https://img.shields.io/badge/styled_with-prettier-ff69b4.svg)](https://github.com/prettier/prettier) +[![Donate](https://img.shields.io/badge/donate-paypal-blue.svg)](https://paypal.me/JanProchazkaCz/30eur) +[![NPM version](https://img.shields.io/npm/v/dbgate.svg)](https://www.npmjs.com/package/dbgate) + +# DbGate - database administration tool + +DbGate is fast and easy to use database administration tool for MySQL, PostgreSQL, SQL Server. + +## Install using npm +```sh +npm install -g dbgate +``` + +Then run dbgate from commandline. + +You can also download binary packages from https://dbgate.org + +## Other dbgate packages +You can use some functionality of dbgate from your JavaScript code. See [dbgate-api](https://npmjs.com/dbgate-api) package. + +## Screenshot + +![Screenshot](https://raw.githubusercontent.com/dbshell/dbgate/master/screenshot.png) + diff --git a/app/package.json b/app/package.json index c6d527b97..b456b7050 100644 --- a/app/package.json +++ b/app/package.json @@ -11,7 +11,7 @@ }, "repository": { "type": "git", - "url": "https://github.com/dbshell/dbgate.git" + "url": "https://github.com/dbgate/dbgate.git" }, "build": { "appId": "org.dbgate", @@ -58,12 +58,16 @@ "scripts": { "start": "cross-env ELECTRON_START_URL=http://localhost:5000 electron .", "start:local": "cross-env electron .", + "start:dbgate": "dbgate", "dist": "electron-builder", "build": "cd ../packages/api && yarn build && cd ../web && yarn build:app && cd ../../app && yarn dist", "build:local": "cd ../packages/api && yarn build && cd ../web && yarn build:app && cd ../../app && yarn predist", "postinstall": "electron-builder install-app-deps", "predist": "copyfiles ../packages/api/dist/* packages && copyfiles \"../packages/web/build/*\" packages && copyfiles \"../packages/web/build/**/*\" packages" }, + "bin": { + "dbgate": "./src/dbgate" + }, "main": "src/electron.js", "devDependencies": { "copyfiles": "^2.2.0", diff --git a/app/src/dbgate.js b/app/src/dbgate.js new file mode 100644 index 000000000..cf048c38d --- /dev/null +++ b/app/src/dbgate.js @@ -0,0 +1,25 @@ +#!/usr/bin/env node + +var electron = require('electron'); + +var proc = require('child_process'); + +var child = proc.spawn(electron, ['.'], { stdio: 'inherit', windowsHide: false }); +child.on('close', function (code, signal) { + if (code === null) { + console.error(electron, 'exited with signal', signal); + process.exit(1); + } + process.exit(code); +}); + +const handleTerminationSignal = function (signal) { + process.on(signal, function signalHandler() { + if (!child.killed) { + child.kill(signal); + } + }); +}; + +handleTerminationSignal('SIGINT'); +handleTerminationSignal('SIGTERM');