mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-30 10:23:57 +00:00
deploy WIP
This commit is contained in:
@@ -3,8 +3,11 @@
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"@dbgate/engines": "^0.1.0",
|
||||
"@dbgate/sqltree": "^0.1.0",
|
||||
"axios": "^0.19.0",
|
||||
"body-parser": "^1.19.0",
|
||||
"bufferutil": "^4.0.1",
|
||||
"cors": "^2.8.5",
|
||||
"cross-env": "^6.0.3",
|
||||
"eslint": "^6.8.0",
|
||||
@@ -14,20 +17,24 @@
|
||||
"mssql": "^6.0.1",
|
||||
"mysql": "^2.17.1",
|
||||
"nedb-promises": "^4.0.1",
|
||||
"pg": "^7.17.0",
|
||||
"socket.io": "^2.3.0",
|
||||
"uuid": "^3.4.0",
|
||||
"@dbgate/engines": "^0.1.0",
|
||||
"@dbgate/sqltree": "^0.1.0"
|
||||
"pg": "^7.17.0"
|
||||
},
|
||||
"scripts": {
|
||||
"start": "nodemon src/index.js",
|
||||
"ts": "tsc"
|
||||
"ts": "tsc",
|
||||
"build": "rollup --config",
|
||||
"build2": "webpack"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@dbgate/types": "^0.1.0",
|
||||
"@rollup/plugin-commonjs": "^11.0.2",
|
||||
"@rollup/plugin-json": "^4.0.2",
|
||||
"@rollup/plugin-node-resolve": "^7.1.1",
|
||||
"@types/lodash": "^4.14.149",
|
||||
"nodemon": "^2.0.2",
|
||||
"rollup": "^2.0.6",
|
||||
"typescript": "^3.7.4",
|
||||
"@dbgate/types": "^0.1.0"
|
||||
"webpack": "^4.42.0",
|
||||
"webpack-cli": "^3.3.11"
|
||||
}
|
||||
}
|
||||
|
||||
16
packages/api/rollup.config.js
Normal file
16
packages/api/rollup.config.js
Normal file
@@ -0,0 +1,16 @@
|
||||
import commonjs from '@rollup/plugin-commonjs';
|
||||
import resolve from '@rollup/plugin-node-resolve';
|
||||
import json from '@rollup/plugin-json';
|
||||
|
||||
export default {
|
||||
input: 'src/index.js',
|
||||
output: {
|
||||
file: 'bundle.js',
|
||||
format: 'cjs',
|
||||
},
|
||||
plugins: [
|
||||
resolve(),
|
||||
commonjs(),
|
||||
json()
|
||||
]
|
||||
};
|
||||
3
packages/api/src/deps.js
Normal file
3
packages/api/src/deps.js
Normal file
@@ -0,0 +1,3 @@
|
||||
require('./proc');
|
||||
|
||||
module.exports = {};
|
||||
@@ -3,6 +3,14 @@ const bodyParser = require('body-parser');
|
||||
const http = require('http');
|
||||
const cors = require('cors');
|
||||
const io = require('socket.io');
|
||||
require('./deps');
|
||||
// require('socket.io-client');
|
||||
|
||||
// "socket.io-client": "^2.3.0",
|
||||
// "utf-8-validate": "^5.0.2",
|
||||
// "uuid": "^3.4.0",
|
||||
// "uws": "10.148.1"
|
||||
|
||||
|
||||
const useController = require('./utility/useController');
|
||||
const connections = require('./controllers/connections');
|
||||
|
||||
3
packages/api/src/proc/index.js
Normal file
3
packages/api/src/proc/index.js
Normal file
@@ -0,0 +1,3 @@
|
||||
require('./connectProcess');
|
||||
require('./databaseConnectionProcess');
|
||||
require('./serverConnectionProcess');
|
||||
44
packages/api/webpack.config.js
Normal file
44
packages/api/webpack.config.js
Normal file
@@ -0,0 +1,44 @@
|
||||
var webpack = require('webpack');
|
||||
var path = require('path');
|
||||
|
||||
var config = {
|
||||
context: __dirname + '/src',
|
||||
|
||||
entry: {
|
||||
app: './index.js',
|
||||
},
|
||||
target: 'node',
|
||||
output: {
|
||||
path: path.resolve(__dirname, 'dist'),
|
||||
filename: 'bundle.js'
|
||||
},
|
||||
// module: {
|
||||
// rules: [
|
||||
// {
|
||||
// test: /\.js$/,
|
||||
// exclude: /node_modules/
|
||||
// },
|
||||
// ],
|
||||
// },
|
||||
plugins: [
|
||||
new webpack.IgnorePlugin({
|
||||
checkResource(resource) {
|
||||
const lazyImports = [
|
||||
'pg-native',
|
||||
'uws'
|
||||
];
|
||||
if (!lazyImports.includes(resource)) {
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
require.resolve(resource);
|
||||
} catch (err) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
}),
|
||||
],
|
||||
};
|
||||
|
||||
module.exports = config;
|
||||
@@ -1,27 +0,0 @@
|
||||
{
|
||||
"name": "@dbgate/electron",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
},
|
||||
"build": {
|
||||
"appId": "com.jenasoft.dbgate",
|
||||
"mac": {
|
||||
"category": "database"
|
||||
},
|
||||
"files": ["api", "build", "src"]
|
||||
},
|
||||
"homepage": "./",
|
||||
"scripts": {
|
||||
"start": "cross-env ELECTRON_START_URL=http://localhost:5000 electron .",
|
||||
"dist": "electron-builder",
|
||||
"wait-electron": "node src/electron-wait-react",
|
||||
"postinstall": "electron-builder install-app-deps"
|
||||
},
|
||||
"main": "src/electron.js",
|
||||
"devDependencies": {
|
||||
"electron": "7.1.7",
|
||||
"electron-builder": "21.2.0",
|
||||
"cross-env": "^6.0.3"
|
||||
}
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
const net = require('net');
|
||||
const port = 5000;
|
||||
|
||||
process.env.ELECTRON_START_URL = `http://localhost:${port}`;
|
||||
|
||||
const client = new net.Socket();
|
||||
|
||||
let startedElectron = false;
|
||||
const tryConnection = () => client.connect({port: port}, () => {
|
||||
client.end();
|
||||
if(!startedElectron) {
|
||||
console.log('starting electron');
|
||||
startedElectron = true;
|
||||
const exec = require('child_process').exec;
|
||||
const electron = exec('yarn electron');
|
||||
electron.stdout.on("data", function(data) {
|
||||
console.log("stdout: " + data.toString());
|
||||
});
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
tryConnection();
|
||||
|
||||
client.on('error', (error) => {
|
||||
setTimeout(tryConnection, 1000);
|
||||
});
|
||||
@@ -1,66 +0,0 @@
|
||||
const electron = require('electron');
|
||||
const { fork } = require('child_process');
|
||||
// Module to control application life.
|
||||
const app = electron.app;
|
||||
// Module to create native browser window.
|
||||
const BrowserWindow = electron.BrowserWindow;
|
||||
|
||||
const path = require('path');
|
||||
const url = require('url');
|
||||
|
||||
// Keep a global reference of the window object, if you don't, the window will
|
||||
// be closed automatically when the JavaScript object is garbage collected.
|
||||
let mainWindow;
|
||||
|
||||
function createWindow() {
|
||||
// Create the browser window.
|
||||
mainWindow = new BrowserWindow({width: 800, height: 600});
|
||||
|
||||
const apiProcess = fork(path.join(__dirname, '../api/index.js'));
|
||||
|
||||
const startUrl = process.env.ELECTRON_START_URL || url.format({
|
||||
pathname: path.join(__dirname, '/../build/index.html'),
|
||||
protocol: 'file:',
|
||||
slashes: true
|
||||
});
|
||||
mainWindow.loadURL(startUrl);
|
||||
|
||||
// and load the index.html of the app.
|
||||
// mainWindow.loadURL('http://localhost:3000');
|
||||
|
||||
// Open the DevTools.
|
||||
// mainWindow.webContents.openDevTools();
|
||||
|
||||
// Emitted when the window is closed.
|
||||
mainWindow.on('closed', function () {
|
||||
// Dereference the window object, usually you would store windows
|
||||
// in an array if your app supports multi windows, this is the time
|
||||
// when you should delete the corresponding element.
|
||||
mainWindow = null
|
||||
})
|
||||
}
|
||||
|
||||
// This method will be called when Electron has finished
|
||||
// initialization and is ready to create browser windows.
|
||||
// Some APIs can only be used after this event occurs.
|
||||
app.on('ready', createWindow);
|
||||
|
||||
// Quit when all windows are closed.
|
||||
app.on('window-all-closed', function () {
|
||||
// On OS X it is common for applications and their menu bar
|
||||
// to stay active until the user quits explicitly with Cmd + Q
|
||||
if (process.platform !== 'darwin') {
|
||||
app.quit()
|
||||
}
|
||||
});
|
||||
|
||||
app.on('activate', function () {
|
||||
// On OS X it's common to re-create a window in the app when the
|
||||
// dock icon is clicked and there are no other windows open.
|
||||
if (mainWindow === null) {
|
||||
createWindow()
|
||||
}
|
||||
});
|
||||
|
||||
// In this file you can include the rest of your app's specific main process
|
||||
// code. You can also put them in separate files and require them here.
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user