Skip to content
This repository has been archived by the owner on Jul 11, 2024. It is now read-only.

Commit

Permalink
Merge pull request #283 from Uconnect-Technologies/development
Browse files Browse the repository at this point in the history
V3 Into master
  • Loading branch information
ilyaskarim authored Oct 29, 2021
2 parents 55e5809 + 6ee223d commit 0d558f8
Show file tree
Hide file tree
Showing 76 changed files with 2,400 additions and 410 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ notice.log
info.log
warning.log
.env
storage
/storage
/backups
.DS_STORE
lib
18 changes: 12 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "wertik-js",
"version": "2.0.70",
"version": "3.0.0-beta",
"main": "lib/main.js",
"repository": "https://github.com/Uconnect-Technologies/wertik-js.git",
"keywords": [
Expand All @@ -25,11 +25,16 @@
"license": "MIT",
"scripts": {
"dev": "concurrently -n TS,DevServer \"npm run watch-ts\" \"nodemon lib/devServer.js\" ",
"dev-next": "concurrently -n TS,DevServer \"npm run watch-ts\" \"nodemon lib/next/devServer.js\" ",
"dev-without-nodemon": "concurrently \"npm run watch-ts\" \"node lib/devServer.js\" ",
"build": "yarn tsc",
"production": "node lib/devServer.js",
"watch-ts": "tsc -w"
"watch-ts": "tsc -w",
"prettier": "prettier --write src package.json index.js"
},
"pre-commit": [
"prettier"
],
"dependencies": {
"apollo-server": "^2.8.2",
"apollo-server-express": "^2.9.4",
Expand All @@ -39,7 +44,7 @@
"chalk": "^3.0.0",
"cors": "^2.8.5",
"dropbox": "^8.2.0",
"express": "^4.16.4",
"express": "^4.17.1",
"graphql": "^14.1.1",
"graphql-fields": "^2.0.3",
"graphql-type-json": "^0.3.2",
Expand All @@ -52,16 +57,16 @@
"multer": "^1.4.2",
"mysql2": "^1.6.4",
"mysqldump": "^3.2.0",
"node-cache": "^5.1.2",
"node-cron": "^2.0.3",
"nodemailer": ">=6.4.16",
"pg": "^7.18.2",
"pg-hstore": "^2.3.3",
"request-ip": "^2.1.3",
"sequelize": "^6.3.5",
"shelljs": "^0.8.3",
"socket.io": "^2.3.0",
"winston": "^3.1.0"
"socket.io": "^4.1.3",
"winston": "^3.1.0",
"ws": "^8.0.0"
},
"devDependencies": {
"@types/body-parser": "^1.16.8",
Expand All @@ -79,6 +84,7 @@
"dotenv": "^6.2.0",
"module-alias": "^2.1.0",
"nodemon": "^1.18.9",
"prettier": "^2.3.2",
"sequelize-cli": "^5.4.0",
"tslint": "^5.17.0",
"typescript": "^3.5.1"
Expand Down
8 changes: 5 additions & 3 deletions src/devServer.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
import { connectDatabase, serve } from "./main";
import { IConfiguration } from "./framework/types/configuration";
const defaultConfiguration: IConfiguration = require("./framework/defaults/defaultConfigurations/defaultConfiguration").default;
const postgresConfiguration: IConfiguration = require("./framework/defaults/defaultConfigurations/postgresConfiguration").default;
const defaultConfiguration: IConfiguration =
require("./framework/defaults/defaultConfigurations/defaultConfiguration").default;
const postgresConfiguration: IConfiguration =
require("./framework/defaults/defaultConfigurations/postgresConfiguration").default;

let configuration = defaultConfiguration;

connectDatabase(configuration.database)
.then((databaseInstance) => {
configuration.databaseInstance = databaseInstance;
serve(configuration).then((wertikApp: any) => {
wertikApp.database.sync();
// wertikApp.database.sync();
});
})
.catch((e) => {
Expand Down
10 changes: 5 additions & 5 deletions src/framework/apiDocs/docs/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,20 @@ const app = express();
import { get } from "lodash";
import { successMessage } from "../../logger/consoleMessages";

export default function(options: IDocServerConfiguration, cb: Function) {
export default function (options: IDocServerConfiguration, cb: Function) {
const { configuration } = options;
const port = get(options, "port", 5200);
app.use(express.static("index"));
app.use(express.static(path.join(__dirname, "/content")));
app.use(async function(req, res, next) {
app.use(async function (req, res, next) {
const ip = req.connection.remoteAddress;
next();
});
app.get("/", function(req, res) {
app.get("/", function (req, res) {
res.sendFile("./index.html", { root: __dirname });
});
app.listen(port, function() {
successMessage(`Rest API docs running at`,`http://localhost:${port}/`)
app.listen(port, function () {
successMessage(`Rest API docs running at`, `http://localhost:${port}/`);
cb();
});
}
21 changes: 13 additions & 8 deletions src/framework/apiDocs/index.ts
Original file line number Diff line number Diff line change
@@ -1,31 +1,36 @@
import fs from "fs";
declare var process: any;
import { exists, deleteFile, createEmptyFile, appendToFileSync } from "./../helpers/index";
import {
exists,
deleteFile,
createEmptyFile,
appendToFileSync,
} from "./../helpers/index";
import { IDocServerConfiguration } from "./../types/configuration";

const docFileSource = process.env['generateDocumentationPath'];
const docFileSource = process.env["generateDocumentationPath"];
// const docFileSource = "asd";

export const addContentsToDoc = async function(doc: string) {
export const addContentsToDoc = async function (doc: string) {
setTimeout(() => {
doc = doc.replace("first________", "/**");
doc = doc.replace("last________", "*/");
appendToFileSync(docFileSource, doc);
}, 600);
};

export const resetDocFile = async function() {
deleteDocFile(function() {
createEmptyFile(docFileSource, function() {
export const resetDocFile = async function () {
deleteDocFile(function () {
createEmptyFile(docFileSource, function () {
addContentsToDoc("//empty file");
});
});
};

export const deleteDocFile = async function(cb: Function) {
export const deleteDocFile = async function (cb: Function) {
if (exists(docFileSource)) {
deleteFile(docFileSource, cb);
} else {
cb();
}
};
};
Loading

0 comments on commit 0d558f8

Please sign in to comment.