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:
@@ -29,7 +29,6 @@ import {
|
||||
IsNumeric,
|
||||
IsDate,
|
||||
} from "sequelize-typescript";
|
||||
import MarkdownSerializer from "slate-md-serializer";
|
||||
import isUUID from "validator/lib/isUUID";
|
||||
import type { NavigationNode } from "@shared/types";
|
||||
import getTasks from "@shared/utils/getTasks";
|
||||
@@ -50,8 +49,6 @@ import Fix from "./decorators/Fix";
|
||||
import DocumentHelper from "./helpers/DocumentHelper";
|
||||
import Length from "./validators/Length";
|
||||
|
||||
const serializer = new MarkdownSerializer();
|
||||
|
||||
export const DOCUMENT_VERSION = 2;
|
||||
|
||||
@DefaultScope(() => ({
|
||||
@@ -470,37 +467,6 @@ class Document extends ParanoidModel {
|
||||
|
||||
// instance methods
|
||||
|
||||
migrateVersion = () => {
|
||||
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,
|
||||
});
|
||||
}
|
||||
|
||||
return undefined;
|
||||
};
|
||||
|
||||
get titleWithDefault(): string {
|
||||
return this.title || "Untitled";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user