diff --git a/README.md b/README.md index fd6157e9707db1c0db46af2028f0dc906ccf1938..e7709b6ec4191c59c35543049051201325744cd0 100644 --- a/README.md +++ b/README.md @@ -16,8 +16,11 @@ One can also refresh the token for a given slot or simply deactivate it. ## Compiling and Running the Server The camera server is written in typescript, a superset of javascript. That means that is has to be compiled before being able to start. -To compile the code, install the typescript compiler using npm `npm install -g typescript` or apt `apt install node-typescript`. -Navigate into the `camera-server` folder and run `tsc`. This will compile the files into a newly created folder `dist`. +To compile the code, install all dependencies, including the typescript compiler. +This can be done by running `npm install` in the `camera-server` folder. +Then run `npm run build` in the same folder. This will compile the files into a newly created folder `dist`. + +If you want to compile the code into a single file, run `npm run build-single-file` instead. Once the code is compiled, the server can be started with `node server.js` in the `dist` folder. diff --git a/camera-server/package-lock.json b/camera-server/package-lock.json index 252583e7d00971d3407530ada61fb6b7ca54f817..6041ed6799024ed91e72e03edb47941d2522b4a4 100644 --- a/camera-server/package-lock.json +++ b/camera-server/package-lock.json @@ -29,9 +29,9 @@ } }, "@types/node": { - "version": "14.14.12", - "resolved": "https://registry.npmjs.org/@types/node/-/node-14.14.12.tgz", - "integrity": "sha512-ASH8OPHMNlkdjrEdmoILmzFfsJICvhBsFfAum4aKZ/9U4B6M6tTmTPh+f3ttWdD74CEGV5XvXWkbyfSdXaTd7g==" + "version": "14.14.20", + "resolved": "https://registry.npmjs.org/@types/node/-/node-14.14.20.tgz", + "integrity": "sha512-Y93R97Ouif9JEOWPIUyU+eyIdyRqQR0I8Ez1dzku4hDx34NWh4HbtIc3WNzwB1Y9ULvNGeu5B8h8bVL5cAk4/A==" }, "@types/socket.io": { "version": "2.1.12", @@ -180,6 +180,12 @@ "debug": "~4.1.0" } }, + "typescript": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.1.3.tgz", + "integrity": "sha512-B3ZIOf1IKeH2ixgHhj6la6xdwR9QrLC5d1VKeCSY4tvkqhF2eqd9O7txNlS0PO3GrBAFIdr3L1ndNwteUbZLYg==", + "dev": true + }, "vary": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", diff --git a/camera-server/package.json b/camera-server/package.json index 04faac0e99822e2e6d9afbf4dbf2334e9b65378b..3a7a38924d898c2aa0ec1b0bbf8e17beb4a2c94d 100644 --- a/camera-server/package.json +++ b/camera-server/package.json @@ -3,12 +3,15 @@ "version": "1.0.0", "main": "server.js", "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" + "build": "npx tsc", + "build-single-file": "npx tsc -m amd --outfile dist/server.js" }, "dependencies": { "socket.io": "^3.0.4" }, "devDependencies": { - "@types/socket.io": "^2.1.12" + "@types/node": "^14.14.20", + "@types/socket.io": "^2.1.12", + "typescript": "^4.1.3" } }