update most packages

This commit is contained in:
2021-08-01 20:45:02 +03:00
committed by Stepan Usatiuk
parent 240804405e
commit a0567f60fa
10 changed files with 4302 additions and 4313 deletions

View File

@@ -72,9 +72,51 @@ jobs:
name: test frontend name: test frontend
command: cd frontend && npm test command: cd frontend && npm test
test-frontend-build:
docker:
- image: circleci/node:14
working_directory: ~/photos/frontend
steps:
- checkout:
- restore_cache:
keys:
- backend-dependencies-{{ checksum "package.json" }}
- run:
name: install backend deps
command: npm i
- save_cache:
paths:
- node_modules
key: backend-dependencies-{{ checksum "package.json" }}
- restore_cache:
keys:
- frontend-dependencies-{{ checksum "package.json" }}
- run:
name: install frontend deps
command: cd frontend && npm i
- save_cache:
paths:
- frontend/node_modules
key: frontend-dependencies-{{ checksum "package.json" }}
- run:
name: test frontend
command: cd frontend && npm run build
workflows: workflows:
version: 2 version: 2
test: test:
jobs: jobs:
- test-backend - test-backend
- test-frontend - test-frontend
- test-frontend-build:
requires:
- test-frontend

View File

@@ -8,7 +8,6 @@
"workspaceFolder": "/workspace", "workspaceFolder": "/workspace",
// Set *default* container specific settings.json values on container create. // Set *default* container specific settings.json values on container create.
"settings": { "settings": {
"terminal.integrated.shell.linux": "/bin/bash"
}, },
// Add the IDs of extensions you want installed when the container is created. // Add the IDs of extensions you want installed when the container is created.
"extensions": [ "extensions": [
@@ -20,7 +19,7 @@
3000 3000
], ],
// Use 'postCreateCommand' to run commands after the container is created. // Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "npm config set unsafe-perm=true && npm i && cd frontend && npm i", // "postCreateCommand": "npm config set unsafe-perm=true && npm i && cd frontend && npm i",
// Uncomment to connect as a non-root user. See https://aka.ms/vscode-remote/containers/non-root. // Uncomment to connect as a non-root user. See https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "node" "remoteUser": "node"
} }

View File

@@ -16,4 +16,5 @@ module.exports = {
"react-spring": "<rootDir>/node_modules/react-spring/web.cjs", "react-spring": "<rootDir>/node_modules/react-spring/web.cjs",
}, },
setupFilesAfterEnv: ["<rootDir>/src/setupTests.ts"], setupFilesAfterEnv: ["<rootDir>/src/setupTests.ts"],
testEnvironment: "jsdom",
}; };

File diff suppressed because it is too large Load Diff

View File

@@ -13,57 +13,58 @@
} }
}, },
"dependencies": { "dependencies": {
"@blueprintjs/core": "^3.33.0", "@blueprintjs/core": "^3.47.0",
"@typescript-eslint/eslint-plugin": "^4.4.0", "@typescript-eslint/eslint-plugin": "^4.28.5",
"@typescript-eslint/parser": "^4.4.0", "@typescript-eslint/parser": "^4.28.5",
"autoprefixer": "^9.8.6", "autoprefixer": "^9",
"enzyme": "^3.11.0", "enzyme": "^3.11.0",
"enzyme-adapter-react-16": "^1.15.5", "@wojtekmaj/enzyme-adapter-react-17": "^0",
"eslint": "^7.10.0", "eslint": "^7.32.0",
"eslint-config-prettier": "^6.12.0", "eslint-config-prettier": "^8.3.0",
"eslint-import-resolver-typescript": "^2.3.0", "eslint-import-resolver-typescript": "^2.4.0",
"eslint-plugin-html": "^6.1.0", "eslint-plugin-html": "^6.1.2",
"eslint-plugin-import": "^2.22.1", "eslint-plugin-import": "^2.23.4",
"eslint-plugin-jest": "^24.1.0", "eslint-plugin-jest": "^24.4.0",
"eslint-plugin-jsx-a11y": "^6.3.1", "eslint-plugin-jsx-a11y": "^6.4.1",
"eslint-plugin-prettier": "^3.1.4", "eslint-plugin-prettier": "^3.4.0",
"eslint-plugin-react": "^7.21.3", "eslint-plugin-react": "^7.24.0",
"eslint-plugin-react-hooks": "^4.1.2", "eslint-plugin-react-hooks": "^4.2.0",
"jest": "^26.5.2", "jest": "^27.0.6",
"parcel": "^1.12.4", "parcel": "^1.12.4",
"pluralize": "^8.0.0", "pluralize": "^8.0.0",
"postcss": "^8.1.1", "postcss": "^8.3.6",
"prettier": "^2.1.2", "prettier": "^2.3.2",
"prettier-eslint": "^11.0.0", "prettier-eslint": "^13.0.0",
"react": "^16.13.1", "react": "^17.0.2",
"react-dom": "^16.13.1", "react-dom": "^17.0.2",
"react-redux": "^7.2.1", "react-redux": "^7.2.4",
"react-router": "^5.2.0", "react-router": "^5.2.0",
"react-router-dom": "^5.2.0", "react-router-dom": "^5.2.0",
"react-spring": "^8.0.27", "react-spring": "^8",
"redux": "^4.0.5", "redux": "^4.1.0",
"redux-devtools-extension": "^2.13.8", "redux-devtools-extension": "^2.13.9",
"redux-persist": "^6.0.0", "redux-persist": "^6.0.0",
"redux-saga": "^1.1.3", "redux-saga": "^1.1.3",
"sass": "^1.27.0", "sass": "^1.37.0",
"spark-md5": "^3.0.1", "spark-md5": "^3.0.1",
"ts-jest": "^26.4.1", "ts-jest": "^27.0.4",
"typescript": "^4.0.3" "typescript": "^4.3.5",
"flush-promises": "^1.0.2"
}, },
"devDependencies": { "devDependencies": {
"@types/autoprefixer": "^9.7.2", "@types/autoprefixer": "^9.7.2",
"@types/enzyme": "^3.10.7", "@types/enzyme": "^3.10.9",
"@types/enzyme-adapter-react-16": "^1.0.6", "@types/eslint": "^7.28.0",
"@types/eslint": "^7.2.4",
"@types/eslint-plugin-prettier": "^3.1.0", "@types/eslint-plugin-prettier": "^3.1.0",
"@types/jest": "^26.0.24",
"@types/pluralize": "^0.0.29", "@types/pluralize": "^0.0.29",
"@types/prettier": "^2.1.1", "@types/prettier": "^2.3.2",
"@types/react": "^16.9.51", "@types/react": "^17.0.15",
"@types/react-dom": "^16.9.8", "@types/react-dom": "^17.0.9",
"@types/react-redux": "^7.1.9", "@types/react-redux": "^7.1.18",
"@types/react-router": "^5.1.8", "@types/react-router": "^5.1.16",
"@types/react-router-dom": "^5.1.6", "@types/react-router-dom": "^5.1.8",
"@types/sass": "^1.16.0", "@types/sass": "^1.16.1",
"@types/spark-md5": "^3.0.2" "@types/spark-md5": "^3.0.2"
} }
} }

View File

@@ -1,4 +1,4 @@
import * as Enzyme from "enzyme"; import * as Enzyme from "enzyme";
import * as Adapter from "enzyme-adapter-react-16"; import * as Adapter from "@wojtekmaj/enzyme-adapter-react-17";
Enzyme.configure({ adapter: new Adapter() }); Enzyme.configure({ adapter: new Adapter() });

View File

@@ -1,3 +0,0 @@
export function flushPromises(): Promise<unknown> {
return new Promise(setImmediate);
}

3246
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -23,66 +23,66 @@
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@koa/cors": "^3.1.0", "@koa/cors": "^3.1.0",
"@koa/router": "^10.0.0", "@koa/router": "^10.1.0",
"@typescript-eslint/eslint-plugin": "^4.9.1", "@typescript-eslint/eslint-plugin": "^4.28.5",
"@typescript-eslint/parser": "^4.9.1", "@typescript-eslint/parser": "^4.28.5",
"bcrypt": "^5.0.0", "bcrypt": "^5.0.1",
"chai": "^4.2.0", "chai": "^4.3.4",
"class-validator": "^0.12.2", "class-validator": "^0.13.1",
"concurrently": "^5.3.0", "concurrently": "^6.2.0",
"cross-env": "^7.0.3", "cross-env": "^7.0.3",
"deasync": "^0.1.21", "deasync": "^0.1.21",
"eslint": "^7.15.0", "eslint": "^7.32.0",
"eslint-config-prettier": "^7.0.0", "eslint-config-prettier": "^8.3.0",
"eslint-import-resolver-typescript": "^2.3.0", "eslint-import-resolver-typescript": "^2.4.0",
"eslint-plugin-import": "^2.22.1", "eslint-plugin-import": "^2.23.4",
"eslint-plugin-mocha": "^8.0.0", "eslint-plugin-mocha": "^9.0.0",
"eslint-plugin-prettier": "^3.2.0", "eslint-plugin-prettier": "^3.4.0",
"exifreader": "^3.12.6", "exifreader": "^3.16.0",
"hasha": "^5.2.2", "hasha": "^5.2.2",
"husky": "^4.3.5", "husky": "^7.0.1",
"jsonwebtoken": "^8.5.1", "jsonwebtoken": "^8.5.1",
"koa": "^2.13.0", "koa": "^2.13.1",
"koa-body": "^4.2.0", "koa-body": "^4.2.0",
"koa-jwt": "^4.0.0", "koa-jwt": "^4.0.1",
"koa-logger": "^3.2.1", "koa-logger": "^3.2.1",
"koa-send": "^5.0.1", "koa-send": "^5.0.1",
"koa-sslify": "^4.0.3", "koa-sslify": "^5.0.0",
"koa-static": "^5.0.0", "koa-static": "^5.0.0",
"mime-types": "^2.1.27", "mime-types": "^2.1.32",
"mocha": "^8.2.1", "mocha": "^9.0.3",
"mysql": "^2.18.1", "mysql": "^2.18.1",
"prettier": "^2.2.1", "prettier": "^2.3.2",
"prettier-eslint": "^12.0.0", "prettier-eslint": "^13.0.0",
"sharp": "^0.26.3", "sharp": "^0.28.3",
"supertest": "^6.0.1", "supertest": "^6.1.4",
"ts-node": "^9.1.1", "ts-node": "^10.1.0",
"ts-node-dev": "^1.1.1", "ts-node-dev": "^1.1.8",
"tsconfig-paths": "^3.9.0", "tsconfig-paths": "^3.10.1",
"typeorm": "^0.2.29", "typeorm": "^0.2.36",
"typescript": "^4.1.3" "typescript": "^4.3.5"
}, },
"devDependencies": { "devDependencies": {
"@types/bcrypt": "^3.0.0", "@types/bcrypt": "^5.0.0",
"@types/chai": "^4.2.14", "@types/chai": "^4.2.21",
"@types/concurrently": "^5.2.1", "@types/concurrently": "^6.2.1",
"@types/deasync": "^0.1.1", "@types/deasync": "^0.1.1",
"@types/eslint": "^7.2.6", "@types/eslint": "^7.28.0",
"@types/eslint-plugin-prettier": "^3.1.0", "@types/eslint-plugin-prettier": "^3.1.0",
"@types/jsonwebtoken": "^8.5.0", "@types/jsonwebtoken": "^8.5.4",
"@types/koa": "^2.11.6", "@types/koa": "^2.13.4",
"@types/koa-logger": "^3.1.1", "@types/koa-logger": "^3.1.1",
"@types/koa-send": "^4.1.2", "@types/koa-send": "^4.1.3",
"@types/koa-sslify": "^4.0.1", "@types/koa-sslify": "^4.0.2",
"@types/koa-static": "^4.0.1", "@types/koa-static": "^4.0.2",
"@types/koa__cors": "^3.0.2", "@types/koa__cors": "^3.0.3",
"@types/koa__router": "^8.0.3", "@types/koa__router": "^8.0.7",
"@types/mime-types": "^2.1.0", "@types/mime-types": "^2.1.0",
"@types/mocha": "^8.2.0", "@types/mocha": "^9.0.0",
"@types/mysql": "^2.15.16", "@types/mysql": "^2.15.19",
"@types/prettier": "^2.1.5", "@types/prettier": "^2.3.2",
"@types/sharp": "^0.26.1", "@types/sharp": "^0.28.5",
"@types/supertest": "^2.0.10" "@types/supertest": "^2.0.11"
}, },
"husky": { "husky": {
"hooks": { "hooks": {

View File

@@ -73,7 +73,7 @@ photosRouter.post("/photos/upload/:id", async (ctx) => {
} }
const { id } = ctx.params as { const { id } = ctx.params as {
id: number | undefined; id: string | undefined;
}; };
if (!id) { if (!id) {
@@ -82,7 +82,7 @@ photosRouter.post("/photos/upload/:id", async (ctx) => {
} }
const { user } = ctx.state; const { user } = ctx.state;
const photo = await Photo.findOne({ id, user }); const photo = await Photo.findOne({ id: parseInt(id), user });
if (!photo) { if (!photo) {
ctx.throw(404); ctx.throw(404);
return; return;
@@ -221,16 +221,17 @@ photosRouter.get("/photos/byID/:id", async (ctx) => {
} }
const { id } = ctx.params as { const { id } = ctx.params as {
id: number | undefined; id: string | undefined;
}; };
if (!id) { if (!id) {
ctx.throw(400); ctx.throw(400);
return;
} }
const { user } = ctx.state; const { user } = ctx.state;
const photo = await Photo.findOne({ id, user }); const photo = await Photo.findOne({ id: parseInt(id), user });
if (!photo) { if (!photo) {
ctx.throw(404); ctx.throw(404);
@@ -245,7 +246,7 @@ photosRouter.get("/photos/byID/:id", async (ctx) => {
photosRouter.get("/photos/showByID/:id/:token", async (ctx) => { photosRouter.get("/photos/showByID/:id/:token", async (ctx) => {
const { id, token } = ctx.params as { const { id, token } = ctx.params as {
id: number | undefined; id: string | undefined;
token: string | undefined; token: string | undefined;
}; };
@@ -264,7 +265,7 @@ photosRouter.get("/photos/showByID/:id/:token", async (ctx) => {
const { user } = photoReqJSON; const { user } = photoReqJSON;
const photo = await Photo.findOne({ const photo = await Photo.findOne({
id, id: parseInt(id),
user: { id: user }, user: { id: user },
}); });
@@ -273,7 +274,7 @@ photosRouter.get("/photos/showByID/:id/:token", async (ctx) => {
return; return;
} }
if (ctx.request.query["size"]) { if (ctx.request.query["size"] && typeof ctx.request.query["size"] == "string") {
const size = parseInt(ctx.request.query["size"]); const size = parseInt(ctx.request.query["size"]);
await send(ctx, await photo.getReadyThumbnailPath(size)); await send(ctx, await photo.getReadyThumbnailPath(size));
return; return;
@@ -288,23 +289,24 @@ photosRouter.get("/photos/showByID/:id", async (ctx) => {
} }
const { id } = ctx.params as { const { id } = ctx.params as {
id: number | undefined; id: string | undefined;
}; };
if (!id) { if (!id) {
ctx.throw(400); ctx.throw(400);
return;
} }
const { user } = ctx.state; const { user } = ctx.state;
const photo = await Photo.findOne({ id, user }); const photo = await Photo.findOne({ id: parseInt(id), user });
if (!photo || !(await photo.fileExists())) { if (!photo || !(await photo.fileExists())) {
ctx.throw(404); ctx.throw(404);
return; return;
} }
if (ctx.request.query["size"]) { if (ctx.request.query["size"] && typeof ctx.request.query["size"] == "string") {
const size = parseInt(ctx.request.query["size"]); const size = parseInt(ctx.request.query["size"]);
await send(ctx, await photo.getReadyThumbnailPath(size)); await send(ctx, await photo.getReadyThumbnailPath(size));
return; return;
@@ -321,16 +323,17 @@ photosRouter.get("/photos/getShowByIDToken/:id", async (ctx) => {
} }
const { id } = ctx.params as { const { id } = ctx.params as {
id: number | undefined; id: string | undefined;
}; };
if (!id) { if (!id) {
ctx.throw(400); ctx.throw(400);
return;
} }
const { user } = ctx.state; const { user } = ctx.state;
const photo = await Photo.findOne({ id, user }); const photo = await Photo.findOne({ id: parseInt(id), user });
if (!photo || !(await photo.fileExists())) { if (!photo || !(await photo.fileExists())) {
ctx.throw(404); ctx.throw(404);
return; return;
@@ -348,16 +351,17 @@ photosRouter.delete("/photos/byID/:id", async (ctx) => {
} }
const { id } = ctx.params as { const { id } = ctx.params as {
id: number | undefined; id: string | undefined;
}; };
if (!id) { if (!id) {
ctx.throw(400); ctx.throw(400);
return;
} }
const { user } = ctx.state; const { user } = ctx.state;
const photo = await Photo.findOne({ id, user }); const photo = await Photo.findOne({ id: parseInt(id), user });
if (!photo) { if (!photo) {
ctx.throw(404); ctx.throw(404);