Skip to content
This repository has been archived by the owner on Oct 1, 2021. It is now read-only.

Commit

Permalink
chore: update dependencies, types
Browse files Browse the repository at this point in the history
  • Loading branch information
VChet committed Aug 24, 2021
1 parent 43596fd commit 35f05d2
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 45 deletions.
4 changes: 2 additions & 2 deletions api/styles.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { Request, Response } from "express";
import type { CallbackError, FilterQuery, PaginateOptions } from "mongoose";
import type { AxiosError } from "axios";
import type { IStyleModel } from "../models/Style";
import type { IStyle } from "../models/Style";

import { Style } from "../models/Style";
import { retrieveRepositoryFiles, retrieveRepositoryData } from "./parser";
Expand Down Expand Up @@ -46,7 +46,7 @@ export function getStyles(req: Request, res: Response) {
const { query, page = "1", limit = "16", sort } = req.query as { [key: string]: string };
const { owner } = req.params;

let filter: FilterQuery<IStyleModel> = {};
let filter: FilterQuery<IStyle> = {};
if (query) {
const queryRegExp = new RegExp(escapeRegex(query), "gi");
filter = {
Expand Down
12 changes: 6 additions & 6 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
},
"dependencies": {
"axios": "^0.21.1",
"core-js": "^3.15.2",
"core-js": "^3.16.2",
"dayjs": "^1.10.6",
"node-emoji": "^1.10.0",
"node-emoji": "^1.11.0",
"normalize.css": "^8.0.1",
"v-click-outside": "^3.1.2",
"vue": "^2.6.14",
Expand All @@ -36,11 +36,11 @@
"@vue/cli-service": "^4.5.13",
"@vue/eslint-config-prettier": "^6.0.0",
"babel-eslint": "^10.1.0",
"eslint": "^7.30.0",
"eslint-plugin-prettier": "^3.4.0",
"eslint-plugin-vue": "^7.13.0",
"eslint": "^7.32.0",
"eslint-plugin-prettier": "^3.4.1",
"eslint-plugin-vue": "^7.16.0",
"prettier": "^2.3.2",
"sass": "^1.35.2",
"sass": "^1.38.1",
"sass-loader": "~10.2.0",
"vue-template-compiler": "^2.6.14"
},
Expand Down
10 changes: 1 addition & 9 deletions middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,7 @@ passport.deserializeUser((id, done) => {
});

// Agenda
const agenda = new Agenda({
db: {
address: config.mongoUrl,
options: {
useNewUrlParser: true,
useUnifiedTopology: true
}
}
});
const agenda = new Agenda({ db: { address: config.mongoUrl } });

if (process.env.NODE_ENV === "production") {
agenda.define("Update all styles", async () => {
Expand Down
7 changes: 3 additions & 4 deletions models/Style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import mongoosePaginate from "mongoose-paginate-v2";
import { customAlphabet } from "nanoid";

import type { Document, PaginateModel } from "mongoose";
import type { BulkWriteResult, UnorderedBulkOperation } from "mongodb";

import { retrieveRepositoryData } from "../api/parser";

Expand Down Expand Up @@ -39,7 +38,7 @@ export interface IStyle extends Document {
}

export interface IStyleModel extends PaginateModel<IStyle> {
updateAllStyles: () => Promise<BulkWriteResult>;
updateAllStyles: () => Promise<any>;
}

const styleIdAlphabet = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
Expand Down Expand Up @@ -94,14 +93,14 @@ StyleSchema.index({
});
StyleSchema.plugin(mongoosePaginate);

StyleSchema.statics.updateAllStyles = async function (): Promise<BulkWriteResult> {
StyleSchema.statics.updateAllStyles = async function (): Promise<any> {
const Style = this;
const styles: Array<IStyle> = await Style.find({}).lean();
const stylesData = await Promise.allSettled(
styles.map(({ url, usercss }) => retrieveRepositoryData(url, { download_url: usercss }))
);

const Bulk: UnorderedBulkOperation = Style.collection.initializeUnorderedBulkOp();
const Bulk = Style.collection.initializeUnorderedBulkOp();
stylesData.forEach((promise) => {
if (promise.status === "fulfilled") {
const styleData = promise.value;
Expand Down
30 changes: 14 additions & 16 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,41 +24,39 @@
"@types/express-rate-limit": "^5.1.3",
"@types/express-session": "^1.17.4",
"@types/memory-cache": "^0.2.1",
"@types/mongodb": "^3.6.20",
"@types/mongoose": "^5.11.97",
"@types/mongoose-paginate-v2": "^1.3.11",
"@types/morgan": "^1.9.3",
"@types/node": "^16.3.1",
"@types/node": "^16.7.1",
"@types/passport-github2": "^1.2.5",
"agenda": "^4.1.3",
"agenda": "^4.2.1",
"axios": "^0.21.1",
"compression": "^1.7.4",
"connect-mongo": "^4.4.1",
"connect-mongo": "^4.5.0",
"express": "^4.17.1",
"express-rate-limit": "^5.3.0",
"express-session": "^1.17.2",
"feed": "^4.2.2",
"helmet": "^4.6.0",
"memory-cache": "^0.2.0",
"mongoose": "^5.13.2",
"mongoose-paginate-v2": "^1.4.1",
"mongoose": "^5.13.8",
"mongoose-paginate-v2": "^1.4.2",
"morgan": "^1.10.0",
"nanoid": "^3.1.23",
"nanoid": "^3.1.25",
"passport": "^0.4.1",
"passport-github2": "^0.1.12",
"repo-images": "^1.0.1",
"ts-node": "^10.1.0",
"ts-node": "^10.2.1",
"typescript": "^4.3.5",
"usercss-meta": "^0.11.0"
"usercss-meta": "^0.12.0"
},
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^4.28.2",
"@typescript-eslint/parser": "^4.28.2",
"eslint": "^7.30.0",
"@typescript-eslint/eslint-plugin": "^4.29.3",
"@typescript-eslint/parser": "^4.29.3",
"eslint": "^7.32.0",
"eslint-config-airbnb-base": "^14.2.1",
"eslint-config-airbnb-typescript": "^12.3.1",
"eslint-plugin-import": "^2.23.4",
"eslint-plugin-sonarjs": "^0.9.1",
"eslint-config-airbnb-typescript": "^14.0.0",
"eslint-plugin-import": "^2.24.1",
"eslint-plugin-sonarjs": "^0.10.0",
"nodemon": "^2.0.12"
},
"engines": {
Expand Down
10 changes: 2 additions & 8 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,12 @@
"@types/express-session",
"@types/express",
"@types/memory-cache",
"@types/mongodb",
"@types/mongoose-paginate-v2",
"@types/mongoose",
"@types/morgan",
"@types/node",
"@types/passport-github2"
]
},
"include": [
"**/*.ts"
],
"exclude": [
"node_modules"
]
"include": ["**/*.ts"],
"exclude": ["node_modules"]
}

0 comments on commit 35f05d2

Please sign in to comment.