Skip to content

Commit 7b01166

Browse files
committed
Initial commit
1 parent 6da9613 commit 7b01166

File tree

7 files changed

+293
-0
lines changed

7 files changed

+293
-0
lines changed

.gitignore

+176
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,176 @@
1+
# Based on https://raw.githubusercontent.com/github/gitignore/main/Node.gitignore
2+
3+
# Logs
4+
5+
logs
6+
_.log
7+
npm-debug.log_
8+
yarn-debug.log*
9+
yarn-error.log*
10+
lerna-debug.log*
11+
.pnpm-debug.log*
12+
13+
# Diagnostic reports (https://nodejs.org/api/report.html)
14+
15+
report.[0-9]_.[0-9]_.[0-9]_.[0-9]_.json
16+
17+
# Runtime data
18+
19+
pids
20+
_.pid
21+
_.seed
22+
\*.pid.lock
23+
24+
# Directory for instrumented libs generated by jscoverage/JSCover
25+
26+
lib-cov
27+
28+
# Coverage directory used by tools like istanbul
29+
30+
coverage
31+
\*.lcov
32+
33+
# nyc test coverage
34+
35+
.nyc_output
36+
37+
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
38+
39+
.grunt
40+
41+
# Bower dependency directory (https://bower.io/)
42+
43+
bower_components
44+
45+
# node-waf configuration
46+
47+
.lock-wscript
48+
49+
# Compiled binary addons (https://nodejs.org/api/addons.html)
50+
51+
build/Release
52+
53+
# Dependency directories
54+
55+
node_modules/
56+
jspm_packages/
57+
58+
# Snowpack dependency directory (https://snowpack.dev/)
59+
60+
web_modules/
61+
62+
# TypeScript cache
63+
64+
\*.tsbuildinfo
65+
66+
# Optional npm cache directory
67+
68+
.npm
69+
70+
# Optional eslint cache
71+
72+
.eslintcache
73+
74+
# Optional stylelint cache
75+
76+
.stylelintcache
77+
78+
# Microbundle cache
79+
80+
.rpt2_cache/
81+
.rts2_cache_cjs/
82+
.rts2_cache_es/
83+
.rts2_cache_umd/
84+
85+
# Optional REPL history
86+
87+
.node_repl_history
88+
89+
# Output of 'npm pack'
90+
91+
\*.tgz
92+
93+
# Yarn Integrity file
94+
95+
.yarn-integrity
96+
97+
# dotenv environment variable files
98+
99+
.env
100+
.env.development.local
101+
.env.test.local
102+
.env.production.local
103+
.env.local
104+
105+
# parcel-bundler cache (https://parceljs.org/)
106+
107+
.cache
108+
.parcel-cache
109+
110+
# Next.js build output
111+
112+
.next
113+
out
114+
115+
# Nuxt.js build / generate output
116+
117+
.nuxt
118+
dist
119+
120+
# Gatsby files
121+
122+
.cache/
123+
124+
# Comment in the public line in if your project uses Gatsby and not Next.js
125+
126+
# https://nextjs.org/blog/next-9-1#public-directory-support
127+
128+
# public
129+
130+
# vuepress build output
131+
132+
.vuepress/dist
133+
134+
# vuepress v2.x temp and cache directory
135+
136+
.temp
137+
.cache
138+
139+
# Docusaurus cache and generated files
140+
141+
.docusaurus
142+
143+
# Serverless directories
144+
145+
.serverless/
146+
147+
# FuseBox cache
148+
149+
.fusebox/
150+
151+
# DynamoDB Local files
152+
153+
.dynamodb/
154+
155+
# TernJS port file
156+
157+
.tern-port
158+
159+
# Stores VSCode versions used for testing VSCode extensions
160+
161+
.vscode-test
162+
163+
# yarn v2
164+
165+
.yarn/cache
166+
.yarn/unplugged
167+
.yarn/build-state.yml
168+
.yarn/install-state.gz
169+
.pnp.\*
170+
171+
# IntelliJ based IDEs
172+
.idea
173+
174+
# Finder (MacOS) folder config
175+
.DS_Store
176+

bun.lockb

48.5 KB
Binary file not shown.

env.ts

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { z } from "zod";
2+
3+
const envSchema = z.object({
4+
NODE_ENV: z
5+
.enum(["development", "test", "production"])
6+
.default("development"),
7+
DISCORD_TOKEN: z.string(),
8+
DISCORD_CLIENT_ID: z.string(),
9+
});
10+
11+
const parsedEnv = envSchema.safeParse(process.env);
12+
13+
if (!parsedEnv.success) {
14+
console.error("❌ Invalid environment variables:", parsedEnv.error.format());
15+
process.exit(1);
16+
}
17+
18+
export const env = parsedEnv.data;

eslint.config.mjs

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
/** @type {import("eslint").Linter.FlatConfig} */
2+
const config = [
3+
{
4+
files: ['src/**/*.ts'],
5+
},
6+
{
7+
rules: {
8+
'arrow-spacing': ['warn', { before: true, after: true }],
9+
'brace-style': ['error', 'stroustrup', { allowSingleLine: true }],
10+
'comma-dangle': ['error', 'always-multiline'],
11+
'comma-spacing': 'error',
12+
'comma-style': 'error',
13+
curly: ['error', 'multi-line', 'consistent'],
14+
'dot-location': ['error', 'property'],
15+
'handle-callback-err': 'off',
16+
indent: ['error', 'tab'],
17+
'keyword-spacing': 'error',
18+
'max-nested-callbacks': ['error', { max: 4 }],
19+
'max-statements-per-line': ['error', { max: 2 }],
20+
'no-console': 'off',
21+
'no-empty-function': 'error',
22+
'no-floating-decimal': 'error',
23+
'no-inline-comments': 'error',
24+
'no-lonely-if': 'error',
25+
'no-multi-spaces': 'error',
26+
'no-multiple-empty-lines': ['error', { max: 2, maxEOF: 1, maxBOF: 0 }],
27+
'no-shadow': ['error', { allow: ['err', 'resolve', 'reject'] }],
28+
'no-trailing-spaces': 'error',
29+
'no-var': 'error',
30+
'object-curly-spacing': ['error', 'always'],
31+
'prefer-const': 'error',
32+
quotes: ['error', 'single'],
33+
semi: ['error', 'always'],
34+
'space-before-blocks': 'error',
35+
'space-before-function-paren': [
36+
'error',
37+
{
38+
anonymous: 'never',
39+
named: 'never',
40+
asyncArrow: 'always',
41+
},
42+
],
43+
'space-in-parens': 'error',
44+
'space-infix-ops': 'error',
45+
'space-unary-ops': 'error',
46+
'spaced-comment': 'error',
47+
yoda: 'error',
48+
},
49+
},
50+
];
51+
52+
export default config;

index.ts

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import "./env";
2+
3+
console.log("Hello World!");

package.json

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"name": "discordjs-v14-typescrypt-bot-template",
3+
"module": "index.ts",
4+
"type": "module",
5+
"scripts": {
6+
"dev": "bun index.ts",
7+
"lint": "bun lint",
8+
"start": "bun start"
9+
},
10+
"devDependencies": {
11+
"babel-eslint": "^10.1.0",
12+
"bun-types": "latest",
13+
"eslint": "^9.9.0",
14+
"typescript": "^5.5.4"
15+
},
16+
"peerDependencies": {
17+
"typescript": "^5.0.0"
18+
},
19+
"dependencies": {
20+
"zod": "^3.23.8"
21+
}
22+
}

tsconfig.json

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"compilerOptions": {
3+
"lib": ["ESNext"],
4+
"module": "esnext",
5+
"target": "esnext",
6+
"moduleResolution": "bundler",
7+
"moduleDetection": "force",
8+
"allowImportingTsExtensions": true,
9+
"noEmit": true,
10+
"composite": true,
11+
"strict": true,
12+
"downlevelIteration": true,
13+
"skipLibCheck": true,
14+
"jsx": "react-jsx",
15+
"allowSyntheticDefaultImports": true,
16+
"forceConsistentCasingInFileNames": true,
17+
"allowJs": true,
18+
"types": [
19+
"bun-types" // add Bun global
20+
]
21+
}
22+
}

0 commit comments

Comments
 (0)