Skip to content

Commit e4523fc

Browse files
authored
fix: read proper version number (#659)
* fix: use the version number in package.json instead of having a VERSION file * Delete VERSION file * feat: remove all references to VERSION file
1 parent 513b969 commit e4523fc

File tree

6 files changed

+5
-16
lines changed

6 files changed

+5
-16
lines changed

β€Ž.eslintignoreβ€Ž

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,3 @@ assets/
22
docs/
33
node_modules/
44
package-lock.json
5-
VERSION

β€Ž.prettierignoreβ€Ž

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,3 @@ assets/
22
docs/
33
node_modules/
44
package-lock.json
5-
VERSION

β€ŽVERSIONβ€Ž

Lines changed: 0 additions & 1 deletion
This file was deleted.

β€Žbin/www.jsβ€Ž

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
const app = require("../app").app;
77
const debug = require("debug")("hackboard:server");
88
const http = require("http");
9-
const fs = require("fs");
9+
const version = require("../services/version.service");
1010

1111
/**
1212
* Get port from environment and store in Express.
@@ -75,12 +75,7 @@ function onListening() {
7575
const bind =
7676
typeof addr === "string" ? "pipe " + addr : "port " + addr.port;
7777
debug("Listening on " + bind);
78-
fs.readFile("VERSION", function(err, data) {
79-
if (err) {
80-
throw err;
81-
}
82-
debug(`VERSION ${data}`);
83-
});
78+
debug(`VERSION ${version.get()}`);
8479
}
8580

8681
/**

β€Ždocs/index.mdβ€Ž

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ Check out [this page](./getting-started).
2323
HackerAPI
2424
β”œβ”€β”€ Dockerfile: controls running of docker image
2525
β”œβ”€β”€ README.md: root of all information
26-
β”œβ”€β”€ VERSION: version number of the application
2726
β”œβ”€β”€ app.js: express app object
2827
β”œβ”€β”€ bin
2928
β”‚Β Β  └── www: entry point to the application
@@ -98,4 +97,4 @@ HackerAPI
9897
β”œβ”€β”€ staff.test.util.js
9998
β”œβ”€β”€ team.test.util.js
10099
└── volunteer.test.util.js
101-
```
100+
```

β€Žservices/version.service.jsβ€Ž

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
"use strict";
2-
const fs = require("fs");
3-
const path = require("path");
2+
const { version } = require("../package.json");
43

54
const get = function() {
6-
const version = fs.readFileSync(path.join(__dirname, "../VERSION"), "utf8");
7-
return version.toString();
5+
return version;
86
};
97

108
module.exports = {

0 commit comments

Comments
Β (0)