meta files

This commit is contained in:
Erik 2022-11-06 19:36:13 +02:00
parent ebd6e190ec
commit 9595f76a20
Signed by: Navy.gif
GPG Key ID: 811EC0CD80E7E5FB
7 changed files with 1529 additions and 0 deletions

223
.eslintrc.json Normal file
View File

@ -0,0 +1,223 @@
{
"env": {
"es6": true,
"node": true
},
"extends": "eslint:recommended",
"globals": {
"Atomics": "readonly",
"SharedArrayBuffer": "readonly"
},
"parserOptions": {
"ecmaVersion": 2022,
"sourceType": "module"
},
"rules": {
"accessor-pairs": "warn",
"array-callback-return": "warn",
"array-bracket-newline": ["warn", "consistent"],
"array-bracket-spacing": ["warn", "always", { "objectsInArrays": false, "arraysInArrays": false }],
// "arrow-parens": "warn",
"arrow-spacing": "warn",
"block-scoped-var": "warn",
"block-spacing": ["warn", "always"],
"brace-style": ["warn", "1tbs"],
"callback-return": "warn",
"camelcase": "warn",
"comma-dangle": ["warn", "only-multiline"],
"comma-spacing": [
"warn",
{
"after": true,
"before": false
}
],
"comma-style": "warn",
"computed-property-spacing": [
"warn",
"never"
],
"consistent-this": "warn",
"dot-notation": [
"warn",
{
"allowKeywords": true
}
],
"dot-location": [
"error",
"property"
],
"eol-last": [
"warn",
"never"
],
"eqeqeq": "warn",
"func-call-spacing": "warn",
"func-name-matching": "warn",
"func-names": "warn",
"func-style": "warn",
"function-paren-newline": "warn",
"generator-star-spacing": "warn",
"grouped-accessor-pairs": "warn",
"guard-for-in": "warn",
"handle-callback-err": "warn",
"id-blacklist": "warn",
"id-match": "warn",
"implicit-arrow-linebreak": "warn",
"indent": "warn",
"init-declarations": "warn",
"jsx-quotes": ["warn", "prefer-single"],
"key-spacing": ["warn", { "beforeColon": false, "afterColon": true }],
"keyword-spacing": ["warn", { "after": true, "before": true }],
"linebreak-style": [
"error",
"windows"
],
"lines-around-comment": "warn",
"lines-around-directive": "warn",
"lines-between-class-members": [
"warn",
"always"
],
"max-classes-per-file": "warn",
"max-nested-callbacks": "warn",
"new-parens": "warn",
"no-alert": "warn",
"no-array-constructor": "warn",
"no-bitwise": "warn",
"no-buffer-constructor": "warn",
"no-caller": "warn",
"no-console": "warn",
"no-div-regex": "warn",
"no-dupe-else-if": "warn",
"no-duplicate-imports": "warn",
"no-else-return": "warn",
"no-empty-function": "warn",
"no-eq-null": "warn",
"no-eval": "warn",
"no-extend-native": "warn",
"no-extra-bind": "warn",
"no-extra-label": "warn",
"no-extra-parens": "warn",
"no-floating-decimal": "warn",
"no-implicit-coercion": "warn",
"no-implicit-globals": "warn",
"no-implied-eval": "error",
"no-import-assign": "warn",
"no-invalid-this": "warn",
"no-iterator": "warn",
"no-label-var": "warn",
// "no-labels": "warn",
"no-lone-blocks": "warn",
"no-lonely-if": "warn",
"no-loop-func": "warn",
"no-mixed-requires": "warn",
"no-multi-assign": "warn",
"no-multi-spaces": "warn",
"no-multi-str": "warn",
"no-multiple-empty-lines": "warn",
"no-native-reassign": "warn",
"no-negated-in-lhs": "warn",
"no-negated-condition": "error",
"no-nested-ternary": "warn",
"no-new": "warn",
"no-new-func": "warn",
"no-new-object": "warn",
"no-new-require": "warn",
"no-new-wrappers": "warn",
"no-octal-escape": "warn",
"no-path-concat": "warn",
"no-process-exit": "warn",
"no-proto": "warn",
"no-restricted-globals": "warn",
"no-restricted-imports": "warn",
"no-restricted-modules": "warn",
"no-restricted-properties": "warn",
"no-restricted-syntax": "warn",
"no-return-assign": "warn",
"no-return-await": "warn",
"no-script-url": "warn",
"no-self-compare": "warn",
"no-sequences": "warn",
"no-setter-return": "warn",
"no-spaced-func": "warn",
"no-shadow": "error",
"no-tabs": "warn",
"no-template-curly-in-string": "error",
"no-throw-literal": "warn",
"no-undef-init": "error",
"no-undefined": "error",
"no-unmodified-loop-condition": "warn",
"no-unneeded-ternary": "error",
"no-unused-expressions": "warn",
"no-use-before-define": "error",
"no-useless-call": "warn",
"no-useless-computed-key": "warn",
"no-useless-concat": "warn",
"no-useless-constructor": "warn",
"no-useless-rename": "warn",
"no-useless-return": "warn",
"no-var": "warn",
"no-void": "warn",
"no-whitespace-before-property": "error",
"nonblock-statement-body-position": "warn",
"object-curly-spacing": [
"warn",
"always"
],
"object-property-newline": ["warn", { "allowAllPropertiesOnSameLine": true }],
"object-shorthand": "warn",
"one-var-declaration-per-line": "warn",
"operator-assignment": "warn",
"operator-linebreak": ["warn", "before"],
"padding-line-between-statements": "warn",
"padded-blocks": ["warn", { "switches": "never" }, { "allowSingleLineBlocks": true }],
"prefer-arrow-callback": "warn",
"prefer-const": "warn",
"prefer-destructuring": "warn",
"prefer-exponentiation-operator": "warn",
"prefer-numeric-literals": "warn",
"prefer-object-spread": "error",
"prefer-promise-reject-errors": "warn",
"prefer-regex-literals": "warn",
"prefer-rest-params": "warn",
"prefer-spread": "warn",
"require-jsdoc": "warn",
"require-unicode-regexp": "warn",
"rest-spread-spacing": "warn",
"semi": "error",
"semi-spacing": "warn",
"semi-style": [
"warn",
"last"
],
"space-before-blocks": "warn",
"space-before-function-paren":["error", "always"],
"space-in-parens": [
"warn",
"never"
],
"spaced-comment": ["warn", "always"],
"strict": "warn",
"switch-colon-spacing": "warn",
"symbol-description": "warn",
"template-curly-spacing": [
"warn",
"never"
],
"template-tag-spacing": "warn",
"unicode-bom": [
"warn",
"never"
],
"vars-on-top": "warn",
"wrap-iife": "warn",
"wrap-regex": "error",
"yield-star-spacing": "warn",
"yoda": [
"warn",
"never"
]
}
}

3
.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
node_modules
logs
.env

12
README.md Normal file
View File

@ -0,0 +1,12 @@
# Navy's webserver framework
A template repository for creating Node.js based webservers with sharding.
## Main components
**Controller:** `/src/controller/Controller.js`
Master process, orchestrates the whole program. Takes care of starting up the shards and communication with them.
**Shard.js:** `/src/controller/Shard.js`
Manages the forked processes. Essentially a wrapper for ChildProcess.
**Server.js:** `/src/server/Server.js`
Main component that runs on the forked processes. Expects a message with a `_start` property with the startup options to be sent.

5
index.js Normal file
View File

@ -0,0 +1,5 @@
const options = require('./options.json');
const { Controller } = require('./src/controller');
const controller = new Controller({ ...options, env: require('dotenv').config() });
controller.init();

9
options.json Normal file
View File

@ -0,0 +1,9 @@
{
"filePath": "./src/server/Server.js",
"shardOptions": {
"respawn": false
},
"serverOptions": {
}
}

23
package.json Normal file
View File

@ -0,0 +1,23 @@
{
"name": "webserver-framework",
"version": "1.0.0",
"description": "Navy's framework for Node.js webservers",
"main": "index.js",
"author": "Navy.gif",
"license": "MIT",
"private": true,
"dependencies": {
"@discordjs/collection": "^1.2.0",
"@navy.gif/logger": "^1.0.0",
"dotenv": "^16.0.3",
"express": "^4.18.2",
"helmet": "^6.0.0"
},
"devDependencies": {
"eslint": "^8.26.0",
"nodemon": "^2.0.20"
},
"scripts": {
"start": "node index.js"
}
}

1254
yarn.lock Normal file

File diff suppressed because it is too large Load Diff