🏷️ tsconfig-paths (absolute) instead of relative

This commit is contained in:
Axel Olausson Holtenäs 2022-04-13 18:23:28 +02:00
parent 12b970b23e
commit b44d093919
No known key found for this signature in database
GPG key ID: 9347A5E873995701
8 changed files with 195 additions and 174 deletions

278
.gitignore vendored
View file

@ -1,136 +1,142 @@
json.sqlite
node_modules
.env
config.json
package-lock.json
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
.pnpm-debug.log*
# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
*.lcov
# nyc test coverage
.nyc_output
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Bower dependency directory (https://bower.io/)
bower_components
# node-waf configuration
.lock-wscript
# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release
# Dependency directories
node_modules/
jspm_packages/
# Snowpack dependency directory (https://snowpack.dev/)
web_modules/
# TypeScript cache
*.tsbuildinfo
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Optional stylelint cache
.stylelintcache
# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
*.tgz
# Yarn Integrity file
.yarn-integrity
# dotenv environment variable files
.env
.env.development.local
.env.test.local
.env.production.local
.env.local
# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache
# Next.js build output
.next
out
# Nuxt.js build / generate output
.nuxt
dist
# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public
# vuepress build output
.vuepress/dist
# vuepress v2.x temp and cache directory
.temp
.cache
# Docusaurus cache and generated files
.docusaurus
# Serverless directories
.serverless/
# FuseBox cache
.fusebox/
# DynamoDB Local files
.dynamodb/
# TernJS port file
.tern-port
# Stores VSCode versions used for testing VSCode extensions
.vscode-test
# yarn v2
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*
json.sqlite
node_modules
.env
config.json
package-lock.json
**/config/*.ts
!**/config/index.ts
!**/config/example.*.ts
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
.pnpm-debug.log*
# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
*.lcov
# nyc test coverage
.nyc_output
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Bower dependency directory (https://bower.io/)
bower_components
# node-waf configuration
.lock-wscript
# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release
# Dependency directories
node_modules/
jspm_packages/
# Snowpack dependency directory (https://snowpack.dev/)
web_modules/
# TypeScript cache
*.tsbuildinfo
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Optional stylelint cache
.stylelintcache
# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
*.tgz
# Yarn Integrity file
.yarn-integrity
# dotenv environment variable files
.env
.env.development.local
.env.test.local
.env.production.local
.env.local
# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache
# Next.js build output
.next
out
# Nuxt.js build / generate output
.nuxt
dist
# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public
# vuepress build output
.vuepress/dist
# vuepress v2.x temp and cache directory
.temp
.cache
# Docusaurus cache and generated files
.docusaurus
# Serverless directories
.serverless/
# FuseBox cache
.fusebox/
# DynamoDB Local files
.dynamodb/
# TernJS port file
.tern-port
# Stores VSCode versions used for testing VSCode extensions
.vscode-test
# yarn v2
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*

View file

@ -39,12 +39,14 @@
"discord.js": "^13.6.0",
"dotenv": "^16.0.0",
"i18next": "^21.6.13",
"module-alias": "^2.2.2",
"mongoose": "^6.2.3",
"node-schedule": "^2.1.0",
"pino": "^7.0.0-rc.9",
"pino-pretty": "^7.6.1",
"quick.db": "^7.1.3",
"ts-node": "^10.7.0",
"tsconfig-paths": "^3.14.1",
"typescript": "^4.6.3",
"uuid": "^8.3.2",
"winston-daily-rotate-file": "^4.6.1"

View file

@ -0,0 +1,2 @@
export const url =
"mongodb+srv://username:password@server/database?retryWrites=true&w=majority";

View file

@ -1,11 +1,11 @@
import mongoose from "mongoose";
import { url } from "@config/database";
import { mongodb } from "../../config.json";
import logger from "../logger";
import mongoose from "mongoose";
import logger from "@logger";
export default async () => {
await mongoose
.connect(mongodb?.url)
.connect(url)
?.then(async () => {
logger.info("Successfully connected to MongoDB!");
})

View file

@ -1,10 +1,11 @@
// Dependencies
import { Client, Intents } from "discord.js"; // discord.js
import "tsconfig-paths/register";
// Configurations
import { bot } from "../config.json";
import database from "./database";
import database from "@root/database";
import schedules from "./schedules";
// Handlers

View file

@ -7,22 +7,22 @@ export default {
data: (command: SlashCommandSubcommandBuilder) => {
return command
.setName("view")
.setDescription("View a counter.")
.setDescription("View a counter's count.")
.addChannelOption((option) =>
option
.setName("channel")
.setDescription("The counter channel you want to view")
.setDescription("The counter channel you want to view.")
.setRequired(true)
.addChannelType(ChannelType.GuildText as number)
);
},
execute: async (interaction: CommandInteraction, tools: any) => {
const { options, guild } = interaction;
const { colors, footer } = tools.config;
const { config, schemas } = tools;
const discordChannel = options?.getChannel("channel");
const counter = await tools.schemas.counter?.findOne({
const counter = await schemas?.counter?.findOne({
guildId: guild?.id,
channelId: discordChannel?.id,
});
@ -34,8 +34,11 @@ export default {
.setTitle("[:1234:] Counters (View)")
.setDescription(`${discordChannel} is not a counting channel!`)
.setTimestamp(new Date())
.setColor(colors?.error as ColorResolvable)
.setFooter({ text: footer?.text, iconURL: footer?.icon }),
.setColor(config?.colors?.error as ColorResolvable)
.setFooter({
text: config?.footer?.text,
iconURL: config?.footer?.icon,
}),
],
});
}
@ -48,8 +51,11 @@ export default {
`${discordChannel} is currently at number ${counter?.counter}.`
)
.setTimestamp(new Date())
.setColor(colors?.success as ColorResolvable)
.setFooter({ text: footer?.text, iconURL: footer?.icon }),
.setColor(config?.colors?.success as ColorResolvable)
.setFooter({
text: config?.footer?.text,
iconURL: config?.footer?.icon,
}),
],
});
},

View file

@ -1,4 +1,4 @@
import helpers from "../helpers";
import helpers from "@root/helpers";
import config from "../../config.json";
import schemas from "../database/schemas";

View file

@ -1,24 +1,28 @@
{
"compilerOptions": {
"target": "es2019",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"noFallthroughCasesInSwitch": true,
"module": "commonjs",
"resolveJsonModule": true,
"isolatedModules": true,
// "removeComments": true,
"outDir": "./build",
"paths": {
"@interface/*": ["./src/Interfaces/*"]
},
"typeRoots": ["./src/types/common", "./node_modules/@types"]
},
"exclude": ["./node_modules", "./test"],
"include": ["./src"]
}
{
"compilerOptions": {
"target": "es2019",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"noFallthroughCasesInSwitch": true,
"module": "commonjs",
"resolveJsonModule": true,
"isolatedModules": true,
// "removeComments": true,
"outDir": "./build",
"baseUrl": "./src",
"typeRoots": ["/types/common", "./node_modules/@types"],
"paths": {
"@interface/*": ["Interfaces/*"],
"@root/*": ["*"],
"@config/*": ["config/*"],
"@logger": ["logger"]
}
},
"include": ["./src"],
"exclude": ["./node_modules", "./test"]
}