Skip to content

Commit d150e3e

Browse files
committed
🔧 Fix development
1 parent b659ce5 commit d150e3e

File tree

4 files changed

+56
-7
lines changed

4 files changed

+56
-7
lines changed

package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
{
22
"name": "discordjs-template-ts",
33
"description": "A template for discord.js with TypeScript",
4-
"version": "14.11.0-0.1.0",
4+
"version": "14.11.0-0.1.1",
55
"license": "ISC",
66
"main": "dist/src/index.js",
77
"scripts": {
8-
"dev": "nodemon",
8+
"dev": "cross-env NODE_ENV=development nodemon",
99
"build": "tsc && tsc-alias",
10-
"start": "node ./dist/src/index.js"
10+
"start": "cross-env NODE_ENV=production node ./dist/src/index.js"
1111
},
1212
"dependencies": {
1313
"chalk": "4.1.2",
@@ -21,6 +21,7 @@
2121
},
2222
"devDependencies": {
2323
"@types/node": "^20.2.5",
24+
"cross-env": "^7.0.3",
2425
"nodemon": "^2.0.22",
2526
"tsc-alias": "^1.8.6",
2627
"typescript": "^5.0.4"

src/index.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
require('module-alias/register');
2-
31
import dotenv from 'dotenv';
2+
// Load .env file
3+
dotenv.config();
4+
5+
import '@/lib/aliases';
46
import { GatewayIntentBits, REST, Routes } from 'discord.js';
57
import { DiscordClient } from '@/lib/client';
68
import { Logger } from '@/lib/logger';
79
import { loadSlashCommands } from '@/loaders/slashCommands';
810
import { handleEvents } from '@/handlers/eventHandler';
911

10-
// Load .env file
11-
dotenv.config();
1212
if (process.env.DISCORD_TOKEN === undefined) {
1313
throw new Error('DISCORD_TOKEN is not defined');
1414
}

src/lib/aliases.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
if (process.env.NODE_ENV === 'production') {
2+
require('module-alias/register');
3+
}

yarn.lock

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,22 @@ [email protected]:
224224
resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b"
225225
integrity sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==
226226

227+
cross-env@^7.0.3:
228+
version "7.0.3"
229+
resolved "https://registry.yarnpkg.com/cross-env/-/cross-env-7.0.3.tgz#865264b29677dc015ba8418918965dd232fc54cf"
230+
integrity sha512-+/HKd6EgcQCJGh2PSjZuUitQBQynKor4wrFbRg4DtAgS1aWO+gU52xpH7M9ScGgXSYmAVS9bIJ8EzuaGw0oNAw==
231+
dependencies:
232+
cross-spawn "^7.0.1"
233+
234+
cross-spawn@^7.0.1:
235+
version "7.0.3"
236+
resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.3.tgz#f73a85b9d5d41d045551c177e2882d4ac85728a6"
237+
integrity sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==
238+
dependencies:
239+
path-key "^3.1.0"
240+
shebang-command "^2.0.0"
241+
which "^2.0.1"
242+
227243
debug@^3.2.7:
228244
version "3.2.7"
229245
resolved "https://registry.yarnpkg.com/debug/-/debug-3.2.7.tgz#72580b7e9145fb39b6676f9c5e5fb100b934179a"
@@ -385,6 +401,11 @@ is-number@^7.0.0:
385401
resolved "https://registry.yarnpkg.com/is-number/-/is-number-7.0.0.tgz#7535345b896734d5f80c4d06c50955527a14f12b"
386402
integrity sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==
387403

404+
isexe@^2.0.0:
405+
version "2.0.0"
406+
resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10"
407+
integrity sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==
408+
388409
lodash.snakecase@^4.1.1:
389410
version "4.1.1"
390411
resolved "https://registry.yarnpkg.com/lodash.snakecase/-/lodash.snakecase-4.1.1.tgz#39d714a35357147837aefd64b5dcbb16becd8f8d"
@@ -458,6 +479,11 @@ normalize-path@^3.0.0, normalize-path@~3.0.0:
458479
resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-3.0.0.tgz#0dcd69ff23a1c9b11fd0978316644a0388216a65"
459480
integrity sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==
460481

482+
path-key@^3.1.0:
483+
version "3.1.1"
484+
resolved "https://registry.yarnpkg.com/path-key/-/path-key-3.1.1.tgz#581f6ade658cbba65a0d3380de7753295054f375"
485+
integrity sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==
486+
461487
path-type@^4.0.0:
462488
version "4.0.0"
463489
resolved "https://registry.yarnpkg.com/path-type/-/path-type-4.0.0.tgz#84ed01c0a7ba380afe09d90a8c180dcd9d03043b"
@@ -545,6 +571,18 @@ semver@~7.0.0:
545571
resolved "https://registry.yarnpkg.com/semver/-/semver-7.0.0.tgz#5f3ca35761e47e05b206c6daff2cf814f0316b8e"
546572
integrity sha512-+GB6zVA9LWh6zovYQLALHwv5rb2PHGlJi3lfiqIHxR0uuwCgefcOJc59v9fv1w8GbStwxuuqqAjI9NMAOOgq1A==
547573

574+
shebang-command@^2.0.0:
575+
version "2.0.0"
576+
resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-2.0.0.tgz#ccd0af4f8835fbdc265b82461aaf0c36663f34ea"
577+
integrity sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==
578+
dependencies:
579+
shebang-regex "^3.0.0"
580+
581+
shebang-regex@^3.0.0:
582+
version "3.0.0"
583+
resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-3.0.0.tgz#ae16f1644d873ecad843b0307b143362d4c42172"
584+
integrity sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==
585+
548586
simple-update-notifier@^1.0.7:
549587
version "1.1.0"
550588
resolved "https://registry.yarnpkg.com/simple-update-notifier/-/simple-update-notifier-1.1.0.tgz#67694c121de354af592b347cdba798463ed49c82"
@@ -657,6 +695,13 @@ util-deprecate@^1.0.1:
657695
resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf"
658696
integrity sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==
659697

698+
which@^2.0.1:
699+
version "2.0.2"
700+
resolved "https://registry.yarnpkg.com/which/-/which-2.0.2.tgz#7c6a8dd0a636a0327e10b59c9286eee93f3f51b1"
701+
integrity sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==
702+
dependencies:
703+
isexe "^2.0.0"
704+
660705
ws@^8.13.0:
661706
version "8.13.0"
662707
resolved "https://registry.yarnpkg.com/ws/-/ws-8.13.0.tgz#9a9fb92f93cf41512a0735c8f4dd09b8a1211cd0"

0 commit comments

Comments
 (0)