Archived
0
0
Fork 0

feat: Added startup

This commit is contained in:
Daryl Ronningen 2021-06-17 01:03:11 -07:00
parent f4cd25fcef
commit d1cf8a73dd
Signed by: Daryl Ronningen
GPG key ID: FD23F0C934A5EC6B
26 changed files with 1825 additions and 521 deletions

2
.gitignore vendored
View file

@ -672,3 +672,5 @@ DerivedData/
*.rdb *.rdb
# ---> Project
config.json

5
.idea/.gitignore vendored
View file

@ -1,5 +0,0 @@
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/

View file

@ -1,12 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="WEB_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/temp" />
<excludeFolder url="file://$MODULE_DIR$/.tmp" />
<excludeFolder url="file://$MODULE_DIR$/tmp" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

View file

@ -1,106 +0,0 @@
<component name="ProjectCodeStyleConfiguration">
<code_scheme name="Project" version="173">
<option name="OTHER_INDENT_OPTIONS">
<value>
<option name="INDENT_SIZE" value="2" />
<option name="TAB_SIZE" value="2" />
<option name="USE_TAB_CHARACTER" value="true" />
<option name="SMART_TABS" value="true" />
</value>
</option>
<option name="LINE_SEPARATOR" value="&#10;" />
<option name="WRAP_WHEN_TYPING_REACHES_RIGHT_MARGIN" value="true" />
<option name="SOFT_MARGINS" value="80,120" />
<DBN-PSQL>
<case-options enabled="true">
<option name="KEYWORD_CASE" value="lower" />
<option name="FUNCTION_CASE" value="lower" />
<option name="PARAMETER_CASE" value="lower" />
<option name="DATATYPE_CASE" value="lower" />
<option name="OBJECT_CASE" value="preserve" />
</case-options>
<formatting-settings enabled="false" />
</DBN-PSQL>
<DBN-SQL>
<case-options enabled="true">
<option name="KEYWORD_CASE" value="lower" />
<option name="FUNCTION_CASE" value="lower" />
<option name="PARAMETER_CASE" value="lower" />
<option name="DATATYPE_CASE" value="lower" />
<option name="OBJECT_CASE" value="preserve" />
</case-options>
<formatting-settings enabled="false">
<option name="STATEMENT_SPACING" value="one_line" />
<option name="CLAUSE_CHOP_DOWN" value="chop_down_if_statement_long" />
<option name="ITERATION_ELEMENTS_WRAPPING" value="chop_down_if_not_single" />
</formatting-settings>
</DBN-SQL>
<HTMLCodeStyleSettings>
<option name="HTML_SPACE_INSIDE_EMPTY_TAG" value="true" />
</HTMLCodeStyleSettings>
<Markdown>
<option name="MAX_LINES_AROUND_HEADER" value="0" />
<option name="MAX_LINES_AROUND_BLOCK_ELEMENTS" value="0" />
<option name="MAX_LINES_BETWEEN_PARAGRAPHS" value="0" />
</Markdown>
<codeStyleSettings language="CSS">
<indentOptions>
<option name="INDENT_SIZE" value="2" />
<option name="CONTINUATION_INDENT_SIZE" value="2" />
<option name="TAB_SIZE" value="2" />
<option name="USE_TAB_CHARACTER" value="true" />
<option name="SMART_TABS" value="true" />
</indentOptions>
</codeStyleSettings>
<codeStyleSettings language="HTML">
<indentOptions>
<option name="INDENT_SIZE" value="2" />
<option name="CONTINUATION_INDENT_SIZE" value="2" />
<option name="TAB_SIZE" value="2" />
<option name="USE_TAB_CHARACTER" value="true" />
</indentOptions>
</codeStyleSettings>
<codeStyleSettings language="JSON">
<indentOptions>
<option name="CONTINUATION_INDENT_SIZE" value="2" />
<option name="TAB_SIZE" value="2" />
<option name="USE_TAB_CHARACTER" value="true" />
<option name="SMART_TABS" value="true" />
</indentOptions>
</codeStyleSettings>
<codeStyleSettings language="JavaScript">
<indentOptions>
<option name="INDENT_SIZE" value="2" />
<option name="CONTINUATION_INDENT_SIZE" value="2" />
<option name="TAB_SIZE" value="2" />
<option name="USE_TAB_CHARACTER" value="true" />
<option name="SMART_TABS" value="true" />
</indentOptions>
</codeStyleSettings>
<codeStyleSettings language="Markdown">
<indentOptions>
<option name="INDENT_SIZE" value="2" />
<option name="CONTINUATION_INDENT_SIZE" value="4" />
<option name="TAB_SIZE" value="2" />
<option name="USE_TAB_CHARACTER" value="true" />
<option name="SMART_TABS" value="true" />
</indentOptions>
</codeStyleSettings>
<codeStyleSettings language="TypeScript">
<indentOptions>
<option name="INDENT_SIZE" value="2" />
<option name="CONTINUATION_INDENT_SIZE" value="2" />
<option name="TAB_SIZE" value="2" />
<option name="USE_TAB_CHARACTER" value="true" />
<option name="SMART_TABS" value="true" />
</indentOptions>
</codeStyleSettings>
<codeStyleSettings language="Vue">
<indentOptions>
<option name="CONTINUATION_INDENT_SIZE" value="2" />
<option name="USE_TAB_CHARACTER" value="true" />
<option name="SMART_TABS" value="true" />
</indentOptions>
</codeStyleSettings>
</code_scheme>
</component>

View file

@ -1,5 +0,0 @@
<component name="ProjectCodeStyleConfiguration">
<state>
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
</state>
</component>

View file

@ -1,6 +0,0 @@
<component name="CopyrightManager">
<copyright>
<option name="notice" value="ArgonBot&#10;Copyright (C) 2021-Present Daryl Ronningen &amp;amp; Contributors&#10;&#10;This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.&#10;&#10;This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.&#10;&#10;You should have received a copy of the GNU General Public License along with this program. If not, see &lt;https://www.gnu.org/licenses/&gt;." />
<option name="myName" value="GPL" />
</copyright>
</component>

View file

@ -1,6 +0,0 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="Eslint" enabled="true" level="WARNING" enabled_by_default="true" />
</profile>
</component>

View file

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/ArgonBot.iml" filepath="$PROJECT_DIR$/.idea/ArgonBot.iml" />
</modules>
</component>
</project>

View file

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

View file

@ -1,7 +1,7 @@
{ {
"recommendations": [ "recommendations": [
"arcanis.vscode-zipfs", "arcanis.vscode-zipfs",
"dbaeumer.vscode-eslint", "dbaeumer.vscode-eslint",
"doi.fileheadercomment" "doi.fileheadercomment"
] ]
} }

85
.vscode/settings.json vendored
View file

@ -1,40 +1,49 @@
{ {
"search.exclude": { "search.exclude": {
"**/.yarn": true, "**/.yarn": true,
"**/.pnp.*": true "**/.pnp.*": true
}, },
"eslint.nodePath": ".yarn/sdks", "eslint.nodePath": ".yarn/sdks",
"prettier.prettierPath": ".yarn/sdks/prettier/index.js", "prettier.prettierPath": ".yarn/sdks/prettier/index.js",
"typescript.tsdk": ".yarn/sdks/typescript/lib", "editor.formatOnPaste": true,
"typescript.enablePromptUseWorkspaceTsdk": true, "editor.formatOnSave": true,
"fileHeaderComment.parameter": { "editor.formatOnType": true,
"*": { "typescript.tsdk": ".yarn/sdks/typescript/lib",
"author": "Daryl Ronningen", "typescript.enablePromptUseWorkspaceTsdk": true,
"license_gpl-3.0-or-later": [ "fileHeaderComment.parameter": {
"This file is part of ArgonBot", "*": {
"", "author": "Daryl Ronningen",
"ArgonBot is free software: you can redistribute it and/or modify", "license_gpl-3.0-or-later": [
"it under the terms of the GNU General Public License as published by", "This file is part of ArgonBot",
"the Free Software Foundation, either version 3 of the License, or", "",
"(at your option) any later version.", "ArgonBot is free software: you can redistribute it and/or modify",
"", "it under the terms of the GNU General Public License as published by",
"ArgonBot is distributed in the hope that it will be useful,", "the Free Software Foundation, either version 3 of the License, or",
"but WITHOUT ANY WARRANTY; without even the implied warranty of", "(at your option) any later version.",
"MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the", "",
"GNU General Public License for more details.", "ArgonBot is distributed in the hope that it will be useful,",
"", "but WITHOUT ANY WARRANTY; without even the implied warranty of",
"You should have received a copy of the GNU General Public License", "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the",
"along with ArgonBot. If not, see <https: //www.gnu.org/licenses/>." "GNU General Public License for more details.",
] "",
} "You should have received a copy of the GNU General Public License",
}, "along with ArgonBot. If not, see <https: //www.gnu.org/licenses/>."
"fileHeaderComment.template": { ]
"gpl": [ }
"${commentbegin}", },
"${commentprefix} Created on ${datetime24h}", "fileHeaderComment.template": {
"${commentprefix}", "gpl": [
"${commentprefix} ${license_gpl-3.0-or-later}", "${commentbegin}",
"${commentend}" "${commentprefix} Created on ${datetime24h}",
] "${commentprefix}",
} "${commentprefix} ${license_gpl-3.0-or-later}",
"${commentend}"
]
},
"eslint.format.enable": true,
"eslint.lintTask.enable": true,
"eslint.packageManager": "yarn",
"editor.insertSpaces": false,
"editor.tabSize": 2,
"typescript.preferences.quoteStyle": "single"
} }

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -4,7 +4,7 @@ const {existsSync} = require(`fs`);
const {createRequire, createRequireFromPath} = require(`module`); const {createRequire, createRequireFromPath} = require(`module`);
const {resolve} = require(`path`); const {resolve} = require(`path`);
const relPnpApiPath = "../../../../.pnp.js"; const relPnpApiPath = "../../../../.pnp.cjs";
const absPnpApiPath = resolve(__dirname, relPnpApiPath); const absPnpApiPath = resolve(__dirname, relPnpApiPath);
const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath); const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath);

View file

@ -4,7 +4,7 @@ const {existsSync} = require(`fs`);
const {createRequire, createRequireFromPath} = require(`module`); const {createRequire, createRequireFromPath} = require(`module`);
const {resolve} = require(`path`); const {resolve} = require(`path`);
const relPnpApiPath = "../../../../.pnp.js"; const relPnpApiPath = "../../../../.pnp.cjs";
const absPnpApiPath = resolve(__dirname, relPnpApiPath); const absPnpApiPath = resolve(__dirname, relPnpApiPath);
const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath); const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath);

View file

@ -4,7 +4,7 @@ const {existsSync} = require(`fs`);
const {createRequire, createRequireFromPath} = require(`module`); const {createRequire, createRequireFromPath} = require(`module`);
const {resolve} = require(`path`); const {resolve} = require(`path`);
const relPnpApiPath = "../../../../.pnp.js"; const relPnpApiPath = "../../../../.pnp.cjs";
const absPnpApiPath = resolve(__dirname, relPnpApiPath); const absPnpApiPath = resolve(__dirname, relPnpApiPath);
const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath); const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath);

View file

@ -4,7 +4,7 @@ const {existsSync} = require(`fs`);
const {createRequire, createRequireFromPath} = require(`module`); const {createRequire, createRequireFromPath} = require(`module`);
const {resolve} = require(`path`); const {resolve} = require(`path`);
const relPnpApiPath = "../../../../.pnp.js"; const relPnpApiPath = "../../../../.pnp.cjs";
const absPnpApiPath = resolve(__dirname, relPnpApiPath); const absPnpApiPath = resolve(__dirname, relPnpApiPath);
const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath); const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath);

View file

@ -1,6 +1,6 @@
{ {
"name": "typescript", "name": "typescript",
"version": "4.3.2-pnpify", "version": "4.3.3-pnpify",
"main": "./lib/typescript.js", "main": "./lib/typescript.js",
"type": "commonjs" "type": "commonjs"
} }

4
config.json.example Normal file
View file

@ -0,0 +1,4 @@
{
"token": "",
"loglevel": ""
}

View file

@ -1,147 +1,176 @@
{ {
"name": "argon-bot", "name": "argon-bot",
"version": "0.0.1-alpha.0", "version": "0.0.1-alpha.0",
"description": "A free and open source Discord Bot under GPL-3.0-or-later", "description": "A free and open source Discord Bot under GPL-3.0-or-later",
"main": "dist/index.js", "main": "dist/index.js",
"repository": "https://code.relms.dev/Relms/ArgonBot", "repository": "https://code.relms.dev/Relms/ArgonBot",
"bugs": "https://code.relms.dev/Relms/ArgonBot/issues", "bugs": "https://code.relms.dev/Relms/ArgonBot/issues",
"homepage": "https://code.relms.dev/Relms/ArgonBot/src/branch/master/README.md", "homepage": "https://code.relms.dev/Relms/ArgonBot/src/branch/master/README.md",
"author": "Daryl Ronningen <relms@relms.dev>", "author": "Daryl Ronningen <relms@relms.dev>",
"maintainers": [], "maintainers": [
"contributors": [], "Daryl Ronningen <relms@relms.dev>"
"license": "GPL-3.0-or-later", ],
"private": true, "contributors": [],
"scripts": { "license": "GPL-3.0-or-later",
"compile:dev": "tsc", "private": true,
"compile:final": "rollup -c --compact", "scripts": {
"commit": "commit", "clean": "rimraf dist",
"lint": "eslint --format=pretty src/**/*.ts", "compile:dev": "tsc",
"lint:save": "eslint --format=pretty --save src/**/*.ts", "compile:prod": "rollup -c --compact",
"release:alpha": "standard-version --prelease alpha -s", "commit": "commit",
"release:beta": "standard-version --prelease beta -s", "lint": "eslint --format=pretty src/**/*.ts",
"release:full": "standard-version -s", "lint:save": "eslint --format=pretty --save src/**/*.ts",
"run:dev": "node dist/src/index.js", "release:alpha": "standard-version --prelease alpha -s",
"run:prod": "node dist/index.js", "release:beta": "standard-version --prelease beta -s",
"watch": "tsc --watch" "release:full": "standard-version -s",
}, "run:dev": "node dist/src/index.js --dev",
"dependencies": { "run:prod": "node dist/index.js",
"@discordjs/opus": "^0.5.3", "watch:bot": "nodemon dist/src/index.js --dev",
"@discordjs/voice": "^0.3.1", "watch:rollup": "tsc --watch",
"bufferutil": "^4.0.3", "watch:tsc": "tsc --watch"
"discord.js": "dev", },
"erlpack": "^0.1.3", "dependencies": {
"ffmpeg-static": "^4.3.0", "@discordjs/opus": "^0.5.3",
"node-gyp": "^8.1.0", "@discordjs/voice": "^0.5.0",
"sodium": "^3.0.2", "bufferutil": "^4.0.3",
"tslib": "^2.3.0", "chalk": "^4.1.1",
"utf-8-validate": "^5.0.5", "color-convert": "^2.0.1",
"zlib-sync": "^0.1.7" "discord.js": "^13.0.0-dev.a3cbcca13da1af416c219bd64a0a6e84bb87a057",
}, "erlpack": "^0.1.3",
"devDependencies": { "ffmpeg-static": "^4.3.0",
"@commitlint/cli": "^12.1.4", "figlet": "^1.5.0",
"@commitlint/config-angular": "^12.1.4", "gradient-string": "^1.2.0",
"@commitlint/config-conventional": "^12.1.4", "jsonschema": "^1.4.0",
"@commitlint/prompt-cli": "^12.1.4", "luxon": "^1.27.0",
"@rollup/plugin-json": "^4.1.0", "node-gyp": "^8.1.0",
"@rollup/plugin-typescript": "^8.2.1", "sodium": "^3.0.2",
"@types/eslint": "^7.2.13", "supports-color": "^9.0.1",
"@typescript-eslint/eslint-plugin": "^4.26.1", "terminal-link": "^3.0.0",
"@typescript-eslint/parser": "^4.26.1", "tslib": "^2.3.0",
"@typescript-eslint/typescript-estree": "^4.26.1", "utf-8-validate": "^5.0.5",
"@yarnpkg/pnpify": "^3.0.0-rc.6", "yargs": "^17.0.1",
"eslint": "^7.28.0", "zlib-sync": "^0.1.7"
"eslint-formatter-pretty": "^4.1.0", },
"eslint-plugin-import": "^2.23.4", "devDependencies": {
"husky": "^6.0.0", "@commitlint/cli": "^12.1.4",
"mocha": "^9.0.0", "@commitlint/config-angular": "^12.1.4",
"nyc": "^15.1.0", "@commitlint/config-conventional": "^12.1.4",
"rollup": "^2.51.2", "@commitlint/prompt-cli": "^12.1.4",
"standard-version": "^9.3.0", "@rollup/plugin-json": "^4.1.0",
"typescript": "^4.3.2", "@rollup/plugin-typescript": "^8.2.1",
"typescript-eslint-language-service": "^4.1.4" "@types/color-convert": "^2",
}, "@types/eslint": "^7.2.13",
"eslintConfig": { "@types/figlet": "^1.5.1",
"root": true, "@types/gradient-string": "^1",
"env": { "@types/luxon": "^1",
"es2021": true, "@types/node": "^15.12.2",
"node": true, "@types/rimraf": "^3",
"commonjs": true "@types/yargs": "^17",
}, "@typescript-eslint/eslint-plugin": "^4.27.0",
"extends": [ "@typescript-eslint/parser": "^4.27.0",
"eslint:recommended", "@typescript-eslint/typescript-estree": "^4.27.0",
"plugin:import/recommended", "@yarnpkg/pnpify": "^3.0.0-rc.6",
"plugin:@typescript-eslint/eslint-recommended", "eslint": "^7.28.0",
"plugin:@typescript-eslint/recommended" "eslint-formatter-pretty": "^4.1.0",
], "eslint-plugin-import": "^2.23.4",
"parser": "@typescript-eslint/parser", "husky": "^6.0.0",
"parserOptions": { "lint-staged": "^11.0.0",
"ecmaVersion": 2021, "mocha": "^9.0.0",
"sourceType": "module" "nodemon": "^2.0.7",
}, "nyc": "^15.1.0",
"plugins": [ "rimraf": "^3.0.2",
"@typescript-eslint" "rollup": "^2.52.0",
], "rollup-plugin-terser": "^7.0.2",
"rules": { "standard-version": "^9.3.0",
"indent": [ "typescript": "^4.3.3",
"error", "typescript-eslint-language-service": "^4.1.4"
"tab", },
{ "eslintConfig": {
"SwitchCase": 1, "root": true,
"CallExpression": { "env": {
"arguments": 1 "es2021": true,
} "node": true,
} "commonjs": true
], },
"linebreak-style": [ "extends": [
"error", "eslint:recommended",
"unix" "plugin:import/recommended",
], "plugin:@typescript-eslint/eslint-recommended",
"quotes": [ "plugin:@typescript-eslint/recommended"
"error", ],
"single" "parser": "@typescript-eslint/parser",
], "parserOptions": {
"semi": [ "ecmaVersion": 2021,
"error", "sourceType": "module"
"always" },
], "plugins": [
"eol-last": [ "@typescript-eslint"
"error", ],
"always" "rules": {
], "indent": [
"object-curly-spacing": [ "error",
"error", "tab",
"always" {
], "SwitchCase": 1,
"default-case": "error", "CallExpression": {
"comma-dangle": [ "arguments": 1
"error", }
"always-multiline" }
], ],
"no-case-declarations": "off", "linebreak-style": [
"@typescript-eslint/no-non-null-assertion": "off" "error",
}, "unix"
"reportUnusedDisableDirectives": true ],
}, "quotes": [
"husky": { "error",
"hooks": { "single"
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS" ],
} "semi": [
}, "error",
"commitlint": { "always"
"extends": [ ],
"@commitlint/config-conventional" "eol-last": [
] "error",
}, "always"
"standard-version": { ],
"types": [ "object-curly-spacing": [
{ "error",
"type": "feat", "always"
"section": "Features" ],
}, "default-case": "error",
{ "comma-dangle": [
"type": "fix", "error",
"section": "Bug Fixes" "always-multiline"
} ],
] "no-case-declarations": "off",
} "@typescript-eslint/no-non-null-assertion": "off"
},
"reportUnusedDisableDirectives": true
},
"husky": {
"hooks": {
"pre-commit": "lint-staged",
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
}
},
"lint-staged": {
"src/**/*.ts": ["yarn lint"]
},
"commitlint": {
"extends": [
"@commitlint/config-conventional"
]
},
"standard-version": {
"types": [
{
"type": "feat",
"section": "Features"
},
{
"type": "fix",
"section": "Bug Fixes"
}
]
}
} }

View file

@ -1,11 +1,15 @@
import typescript from '@rollup/plugin-typescript'; import typescript from '@rollup/plugin-typescript';
import json from '@rollup/plugin-json'; import json from '@rollup/plugin-json';
import { terser } from 'rollup-plugin-terser';
export default { export default {
input: 'src/index.ts', input: 'src/index.ts',
output: { output: {
dir: 'dist', dir: 'dist',
format: 'cjs' format: 'cjs',
}, },
plugins: [typescript({ module: 'ESNext' }), json( {compact: true, preferConst: true })], plugins: [
typescript({ module: 'ESNext', include: ['src/**/*.ts', '*.json'] }),
json({ compact: true, preferConst: true }),
terser(),
],
}; };

View file

@ -17,6 +17,25 @@
* along with ArgonBot. If not, see <https: //www.gnu.org/licenses/>. * along with ArgonBot. If not, see <https: //www.gnu.org/licenses/>.
*/ */
import discord from "discord.js"; import { Client } from 'discord.js';
import figlet from 'figlet';
import gradient from 'gradient-string';
const client = new discord.Client(); import { token } from '../config.json';
import { info } from './utils/logger';
figlet('Argon Bot', (err, data) => {
if (err) return;
info(gradient.rainbow.multiline(`\n${data}`));
});
const client = new Client({
intents: ['GUILDS', 'GUILD_MESSAGES'],
});
client.on('ready', () => {
info('Startup!');
});
client.login(token);

82
src/utils/logger.ts Normal file
View file

@ -0,0 +1,82 @@
import chalk from 'chalk';
import { DateTime } from 'luxon';
import { loglevel } from '../../config.json';
const logger = new chalk.Instance({ level: 3 });
const date = DateTime.now().toLocal().setLocale(Intl.DateTimeFormat().resolvedOptions().locale).toFormat('yyyy-LL-dd HH:mm:ss');
let verboseLevel = false;
let debugLevel = false;
let infoLevel = false;
let warnLevel = false;
let errorLevel = false;
let fatalLevel = false;
switch (loglevel.toLowerCase()) {
case 'verbose':
verboseLevel = true;
debugLevel = true;
infoLevel = true;
warnLevel = true;
errorLevel = true;
fatalLevel = true;
break;
case 'debug':
debugLevel = true;
infoLevel = true;
warnLevel = true;
errorLevel = true;
fatalLevel = true;
break;
case 'info':
infoLevel = true;
warnLevel = true;
errorLevel = true;
fatalLevel = true;
break;
case 'warn':
warnLevel = true;
errorLevel = true;
fatalLevel = true;
break;
case 'error':
errorLevel = true;
fatalLevel = true;
break;
case 'fatal':
fatalLevel = true;
break;
default:
break;
}
export function verbose(message: string): void {
if(verboseLevel)
console.log(logger`{grey (${date})} {white.bold [VERBOSE]}: ${message}`);
}
export function debug(message: string): void {
if(debugLevel)
console.log(logger`{grey (${date})} {blue.bold [DEBUG]}: ${message}`);
}
export function info(message: string): void {
if(infoLevel)
console.log(logger`{grey (${date})} {green.bold [INFO]}: ${message}`);
}
export function warn(message: string): void {
if(warnLevel)
console.log(logger`{grey (${date})} {yellow.bold.underline [WARN]}: ${message}`);
}
export function error(message: string): void {
if(errorLevel)
console.log(logger`{grey (${date})} {orange.bold.underline [ERROR]}: ${message}`);
}
export function fatal(message: string): void {
if(fatalLevel)
console.log(logger`{grey (${date})} {red.bold.underline [FATAL]}: ${message}`);
}

View file

@ -4,7 +4,10 @@
"downlevelIteration": true, "downlevelIteration": true,
"importHelpers": true, "importHelpers": true,
"incremental": true, "incremental": true,
"lib": ["ESNext", "DOM"], "lib": [
"ESNext",
"DOM"
],
"module": "CommonJS", "module": "CommonJS",
"outDir": "dist", "outDir": "dist",
"tsBuildInfoFile": "dist/.tsbuildinfo", "tsBuildInfoFile": "dist/.tsbuildinfo",
@ -44,18 +47,24 @@
"preserveConstEnums": true, "preserveConstEnums": true,
"resolveJsonModule": true, "resolveJsonModule": true,
"traceResolution": false, "traceResolution": false,
"plugins": [{ "plugins": [
"name": "typescript-eslint-language-service" {
}] "name": "typescript-eslint-language-service"
}
]
}, },
"watchOptions": { "watchOptions": {
"watchFile": "useFsEvents", "watchFile": "useFsEvents",
"watchDirectory": "useFsEvents", "watchDirectory": "useFsEvents",
"fallbackPolling": "dynamicpriority", "fallbackPolling": "dynamicpriority",
"synchronousWatchDirectory": true, "synchronousWatchDirectory": true,
"excludeDirectories": ["node_modules", "dist"] "excludeDirectories": [
"node_modules",
"dist"
]
}, },
"include": [ "include": [
"src/**/*.ts" "src/**/*.ts",
"*.json"
] ]
} }

1210
yarn.lock

File diff suppressed because it is too large Load diff