Repository: TheOdinProject/odin-bot-v2
Pull request #703 (2025-03-21 18:40:58)

Chore: Add .env to nodemon watch paths
<!-- Thank you for taking the time to contribute to The Odin Project. In order to get this pull request (PR) merged in a reasonable amount of time, you must complete this entire template. -->

## Because

[By default, nodemon is unable to watch `.env` files](https://github.com/remy/nodemon/blob/master/faq.md#nodemon-doesnt-restart-on-env-change).

## This PR

<!-- A bullet point list of one or more items describing the specific changes. -->
- Makes `dev` npm script watch `.env` changes on top of existing behaviour

## Issue

<!--
If this PR closes an open issue in this repo, replace the XXXXX below with the issue number, e.g. Closes #2013.

If this PR closes an open issue in another TOP repo, replace the #XXXXX with the URL of the issue, e.g. Closes https://github.com/TheOdinProject/curriculum/issues/XXXXX

If this PR does not close, but is related to another issue or PR, you can link it as above without the 'Closes' keyword, e.g. 'Related to #2013'.
-->

N/A

## Additional Information

<!-- Any other information about this PR, such as a link to a Discord discussion. -->
Considered proposing removing nodemon in favour of native `node --watch` but nodemon is still superior for this workflow (watching required and relevant config files as well as `.env`) as `node --watch` only watches the dependency graph, and `node --watch-path` will just watch everything in a dir without further filtering, including `.md` changes).

## Pull Request Requirements

<!-- Replace the whitespace between the square brackets with an 'x', e.g. [x]. After you create the PR, they will become checkboxes that you can click on. -->

- [x] I have thoroughly read and understand [The Odin Project Contributing Guide](https://github.com/TheOdinProject/.github/blob/main/CONTRIBUTING.md)
- [x] The title of this PR follows the `location of change: brief description of change` format, e.g. `Callbacks command: Update verbiage`
- [x] The `Because` section summarizes the reason for this PR
- [x] The `This PR` section has a bullet point list describing the changes in this PR
- [x] If this PR addresses an open issue, it is linked in the `Issue` section
- [x] If this PR adds new features or functionality, I have added new tests
- [x] If applicable, I have ensured all tests related to any command files included in this PR pass, and/or all snapshots are up to date



Patch:
diff --git a/bot-commands/points/award-points.js b/bot-commands/points/award-points.js
index 9999dfa..62e6257 100644
--- a/bot-commands/points/award-points.js
+++ b/bot-commands/points/award-points.js
@@ -1,6 +1,6 @@
 const axios = require('axios');
 const config = require('../../config');
-const club40Gifs = require('../club-40/club_40_gifs.json');
+const club40Gifs = require('./club-40-gifs.json');
 const { isAdmin } = require('../../utils/is-admin');
 
 axios.default.defaults.headers.common.Authorization = `Token ${config.pointsbot.token}`;
diff --git a/package-lock.json b/package-lock.json
index 939fcd0..f16a944 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -10,7 +10,7 @@
       "license": "ISC",
       "dependencies": {
         "@discordjs/rest": "^2.4.3",
-        "axios": "^1.8.2",
+        "axios": "^1.8.4",
         "discord-api-types": "^0.37.119",
         "discord.js": "^14.18.0",
         "dotenv": "^16.4.7",
@@ -2963,9 +2963,9 @@
       }
     },
     "node_modules/axios": {
-      "version": "1.8.2",
-      "resolved": "https://registry.npmjs.org/axios/-/axios-1.8.2.tgz",
-      "integrity": "sha512-ls4GYBm5aig9vWx8AWDSGLpnpDQRtWAfrjU+EuytuODrFBkqesN2RkOQCBzrA1RQNHw1SmRMSDDDSwzNAYQ6Rg==",
+      "version": "1.8.4",
+      "resolved": "https://registry.npmjs.org/axios/-/axios-1.8.4.tgz",
+      "integrity": "sha512-eBSYY4Y68NNlHbHBMdeDmKNtDgXWhQsJcGqzO3iLUM0GraQFSS9cVgPX5I9b3lbdFKyYoAEGAZF1DwhTaljNAw==",
       "license": "MIT",
       "dependencies": {
         "follow-redirects": "^1.15.6",
@@ -10795,9 +10795,9 @@
       }
     },
     "axios": {
-      "version": "1.8.2",
-      "resolved": "https://registry.npmjs.org/axios/-/axios-1.8.2.tgz",
-      "integrity": "sha512-ls4GYBm5aig9vWx8AWDSGLpnpDQRtWAfrjU+EuytuODrFBkqesN2RkOQCBzrA1RQNHw1SmRMSDDDSwzNAYQ6Rg==",
+      "version": "1.8.4",
+      "resolved": "https://registry.npmjs.org/axios/-/axios-1.8.4.tgz",
+      "integrity": "sha512-eBSYY4Y68NNlHbHBMdeDmKNtDgXWhQsJcGqzO3iLUM0GraQFSS9cVgPX5I9b3lbdFKyYoAEGAZF1DwhTaljNAw==",
       "requires": {
         "follow-redirects": "^1.15.6",
         "form-data": "^4.0.0",
diff --git a/package.json b/package.json
index 0209d8a..aec688f 100644
--- a/package.json
+++ b/package.json
@@ -5,7 +5,7 @@
   "main": "index.js",
   "scripts": {
     "start": "node index.js",
-    "dev": "nodemon index.js",
+    "dev": "nodemon --watch . --watch .env index.js",
     "test": "NODE_OPTIONS=--experimental-vm-modules jest",
     "format": "prettier --cache --write",
     "eslint": "eslint '**/*.js'"
@@ -14,7 +14,7 @@
   "license": "ISC",
   "dependencies": {
     "@discordjs/rest": "^2.4.3",
-    "axios": "^1.8.2",
+    "axios": "^1.8.4",
     "discord-api-types": "^0.37.119",
     "discord.js": "^14.18.0",
     "dotenv": "^16.4.7",


Test patch:
diff --git a/bot-commands/club-40/club_40_gifs.json b/bot-commands/points/club-40-gifs.json
similarity index 100%
rename from bot-commands/club-40/club_40_gifs.json
rename to bot-commands/points/club-40-gifs.json
diff --git a/bot-commands/points/points.test.js b/bot-commands/points/points.test.js
index 66ade3e..4c2d027 100644
--- a/bot-commands/points/points.test.js
+++ b/bot-commands/points/points.test.js
@@ -22,7 +22,7 @@ const gifContainer = [
   },
 ];
 
-jest.mock('../club-40/club_40_gifs.json', () => gifContainer);
+jest.mock('./club-40-gifs.json', () => gifContainer);
 
 jest.mock('discord.js', () => ({
   ...jest.requireActual('discord.js'),