From bc9b296c7b2725cdd5f08345557d32af71d1faf6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20D=C3=B6ring?= <simon.doering@stud.hs-bochum.de> Date: Tue, 5 Jan 2021 21:34:03 +0100 Subject: [PATCH] Add typescript compiler to dependencies --- README.md | 7 +++++-- camera-server/package-lock.json | 12 +++++++++--- camera-server/package.json | 7 +++++-- 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index fd6157e..e7709b6 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 252583e..6041ed6 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 04faac0..3a7a389 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" } } -- GitLab