chore: Remove 16+ unused dependencies (#4910)

* chore: Remove no-longer used webpack loaders

* chore: Remove migration of markdown from Slate documents (2y old)

* chore: Remove more unused deps

* chore: Remove explicit core-js dep

* Remove more unused dependencies

* test
This commit is contained in:
Tom Moor
2023-02-21 11:43:28 -05:00
committed by GitHub
parent 0887219be6
commit eb42f8006d
9 changed files with 156 additions and 658 deletions

View File

@@ -9,7 +9,6 @@ import {
IsNumeric,
Length as SimpleLength,
} from "sequelize-typescript";
import MarkdownSerializer from "slate-md-serializer";
import { DocumentValidation } from "@shared/validations";
import Document from "./Document";
import User from "./User";
@@ -17,8 +16,6 @@ import IdModel from "./base/IdModel";
import Fix from "./decorators/Fix";
import Length from "./validators/Length";
const serializer = new MarkdownSerializer();
@DefaultScope(() => ({
include: [
{
@@ -110,35 +107,6 @@ class Revision extends IdModel {
order: [["createdAt", "DESC"]],
});
}
migrateVersion = function () {
let migrated = false;
// migrate from document version 0 -> 1
if (!this.version) {
// removing the title from the document text attribute
this.text = this.text.replace(/^#\s(.*)\n/, "");
this.version = 1;
migrated = true;
}
// migrate from document version 1 -> 2
if (this.version === 1) {
const nodes = serializer.deserialize(this.text);
this.text = serializer.serialize(nodes, {
version: 2,
});
this.version = 2;
migrated = true;
}
if (migrated) {
return this.save({
silent: true,
hooks: false,
});
}
};
}
export default Revision;