feat: moved all server deps to root folder

This commit is contained in:
Roberto Tonino 2021-06-14 19:31:21 +02:00
parent d490033d58
commit 368232a843
12 changed files with 4697 additions and 6729 deletions

View File

@ -7,30 +7,63 @@
"license": "GPL-3.0-only", "license": "GPL-3.0-only",
"scripts": { "scripts": {
"start": "electron . --dev", "start": "electron . --dev",
"prebuild": "yarn --cwd ./server build && yarn --cwd ./webui build", "prebuild": "yarn server-build && yarn --cwd ./webui build",
"dist": "electron-builder", "dist": "electron-builder",
"dist:dir": "electron-builder --dir" "dist:dir": "electron-builder --dir",
"server-start": "yarn --cwd server start",
"server-start-build": "yarn --cwd server start-build",
"server-lint": "yarn --cwd server lint",
"server-build": "yarn --cwd server build",
"server-test": "yarn --cwd server test",
"server-test-watch": "yarn --cwd server test-watch"
}, },
"devDependencies": { "devDependencies": {
"electron": "^12.0.9", "electron": "^12.0.9",
"electron-builder": "22.11.4" "electron-builder": "22.11.4",
"@nuxtjs/eslint-config": "6.0.0",
"@types/cookie-parser": "1.4.2",
"@types/debug": "4.1.5",
"@types/express": "4.17.11",
"@types/express-session": "^1.17.3",
"@types/jest": "26.0.22",
"@types/morgan": "1.9.2",
"@types/node": "14.14.37",
"@types/ramda": "0.27.40",
"@types/supertest": "2.0.11",
"@types/uuid": "8.3.0",
"@types/ws": "7.4.1",
"@typescript-eslint/eslint-plugin": "4.21.0",
"@typescript-eslint/parser": "4.21.0",
"@types/yargs": "17.0.0",
"eslint": "7.23.0",
"eslint-config-prettier": "8.1.0",
"eslint-plugin-prettier": "3.3.1",
"jest": "26.6.3",
"nodemon": "2.0.7",
"prettier": "2.2.1",
"supertest": "6.1.3",
"ts-jest": "26.5.4",
"ts-node": "9.1.1",
"ts-node-dev": "1.1.6",
"typescript": "4.2.4"
}, },
"dependencies": { "dependencies": {
"electron-context-menu": "^3.1.0", "electron-context-menu": "^3.1.0",
"electron-window-state-manager": "^0.3.2", "electron-window-state-manager": "^0.3.2",
"cookie-parser": "1.4.5", "cookie-parser": "1.4.5",
"debug": "2.6.9", "debug": "2.6.9",
"deemix": "^0.2.1", "deemix": "0.2.1",
"deezer-js": "^1.0.0", "deezer-js": "1.0.0",
"dotenv": "8.2.0", "dotenv": "8.2.0",
"express": "4.17.1", "express": "4.17.1",
"express-session": "^1.17.1", "express-session": "^1.17.1",
"morgan": "1.10.0", "morgan": "1.10.0",
"ramda": "0.27.1", "ramda": "0.27.1",
"uuid": "8.3.2", "uuid": "8.3.2",
"ws": "7.4.5", "ws": "7.4.5",
"yargs": "17.0.1" "yargs": "17.0.1"
}, },
"build": { "build": {
"appId": "app.deemix.gui", "appId": "app.deemix.gui",

View File

@ -1,30 +0,0 @@
# Not including dev commands as they have issues on Window's Powershell.
# Fixing paths for different platforms
# https://stackoverflow.com/questions/4058840/makefile-that-distincts-between-windows-and-unix-like-systems
ifdef OS
RM = del /Q
FixPath = $(subst /,\,$1)
else
ifeq ($(shell uname), Linux)
RM = rm -f
FixPath = $1
endif
endif
SEP ?= '\'
# Stands for MODULES_BINARIES, abbreviated to pollute less possible the commands
M_B ?= $(call FixPath, ./node_modules/.bin/)
lint:
$(M_B)eslint "./{src, tests}/**" --fix
lint-build:
$(M_B)eslint "./src/**" --fix
test:
$(M_B)jest
build: lint-build test
$(M_B)tsc

View File

@ -1,52 +0,0 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
const utils_1 = require("../../../../tests/utils");
describe('albumSearch requests', () => {
it('should respond 200 to calls with term', () => __awaiter(void 0, void 0, void 0, function* () {
const responseStatusCollector = [];
const batchCalls = [
'/api/album-search/?term=eminem',
'/api/album-search/?term=eminem?start=10',
'/api/album-search/?term=eminem?ack=aa',
'/api/album-search/?term=eminem?ack=aa?start=10',
'/api/album-search/?term=eminem?ack=aa?start=10?nb=34'
];
for (const uri of batchCalls) {
responseStatusCollector.push((yield utils_1.appSendGet(uri)).status);
}
expect(responseStatusCollector).toMatchObject(new Array(batchCalls.length).fill(200));
expect(responseStatusCollector).toMatchObject(new Array(responseStatusCollector.length).fill(200));
}));
it('should respond 400 to calls without term', () => __awaiter(void 0, void 0, void 0, function* () {
const responseStatusCollector = [];
const batchCalls = [
'/api/album-search/',
'/api/album-search/?start=10',
'/api/album-search/?ack=aa',
'/api/album-search/?ack=aa?start=10',
'/api/album-search/?ack=aa?start=10?nb=34'
];
for (const uri of batchCalls) {
responseStatusCollector.push((yield utils_1.appSendGet(uri)).status);
}
expect(responseStatusCollector).toMatchObject(new Array(responseStatusCollector.length).fill(400));
}));
it('should respond the desired search result', () => __awaiter(void 0, void 0, void 0, function* () {
const res = (yield utils_1.appSendGet('/api/album-search/?term=eminem')).body;
expect(res.data.data.length).not.toBe(0);
}));
// TODO Understand whic should be the correct response
it.skip('should respond the desired search result with a start parameter', () => __awaiter(void 0, void 0, void 0, function* () {
const res = (yield utils_1.appSendGet('/api/album-search/?term=eminem?start=10')).body;
expect(res.data.data.length).not.toBe(0);
}));
});

View File

@ -1,41 +0,0 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
const utils_1 = require("../../../../tests/utils");
describe('login-arl requests', () => {
it('should respond 200 to calls with arl', () => __awaiter(void 0, void 0, void 0, function* () {
const responseStatusCollector = [];
const batchCalls = ['/api/login-arl/?arl=abcdef1234'];
for (const uri of batchCalls) {
responseStatusCollector.push((yield utils_1.appSendPost(uri)).status);
}
expect(responseStatusCollector).toMatchObject(new Array(batchCalls.length).fill(200));
expect(responseStatusCollector).toMatchObject(new Array(responseStatusCollector.length).fill(200));
}));
it('should respond 400 to calls without arl', () => __awaiter(void 0, void 0, void 0, function* () {
const responseStatusCollector = [];
const batchCalls = ['/api/login-arl/', '/api/login-arl/?dummy=test', '/api/login-arl/?email=aaa@aa.com'];
for (const uri of batchCalls) {
responseStatusCollector.push((yield utils_1.appSendPost(uri)).status);
}
expect(responseStatusCollector).toMatchObject(new Array(responseStatusCollector.length).fill(400));
}));
it('should login using ARL', () => __awaiter(void 0, void 0, void 0, function* () {
const response = yield utils_1.appSendPost(`/api/login-arl/?arl=${process.env.DEEZER_ARL}`);
expect(response.status).toBe(200);
expect(response.body).toBe(true);
}));
it('should not login using wrong ARL', () => __awaiter(void 0, void 0, void 0, function* () {
const response = yield utils_1.appSendPost(`/api/login-arl/?arl=abcdef1234`);
expect(response.status).toBe(200);
expect(response.body).toBe(false);
}));
});

View File

@ -1 +0,0 @@
"use strict";

View File

@ -1,39 +0,0 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const supertest_1 = __importDefault(require("supertest"));
const app_1 = require("../app");
describe('root path requests', () => {
it('responds 200 to the GET method', () => __awaiter(void 0, void 0, void 0, function* () {
const result = yield supertest_1.default(app_1.app).get('/').send();
expect(result.status).toBe(200);
}));
it('responds 404 to the POST method', () => __awaiter(void 0, void 0, void 0, function* () {
const result = yield supertest_1.default(app_1.app).post('/').send();
expect(result.status).toBe(404);
}));
it('responds 404 to the PATCH method', () => __awaiter(void 0, void 0, void 0, function* () {
const result = yield supertest_1.default(app_1.app).patch('/').send();
expect(result.status).toBe(404);
}));
it('responds 404 to the DELETE method', () => __awaiter(void 0, void 0, void 0, function* () {
const result = yield supertest_1.default(app_1.app).delete('/').send();
expect(result.status).toBe(404);
}));
it('redirects to root when a non existing server route is requested', () => __awaiter(void 0, void 0, void 0, function* () {
const result = yield supertest_1.default(app_1.app).get('/settings').send();
expect(result.header.location).toBe('/');
expect(result.status).toBe(302);
}));
});

View File

@ -1 +0,0 @@
"use strict";

View File

@ -1 +0,0 @@
"use strict";

View File

@ -1 +0,0 @@
"use strict";

View File

@ -1,5 +1,5 @@
{ {
"name": "deemix-gui", "name": "@deemix-gui/server",
"version": "0.1.0", "version": "0.1.0",
"private": true, "private": true,
"scripts": { "scripts": {

File diff suppressed because it is too large Load Diff

4707
yarn.lock

File diff suppressed because it is too large Load Diff