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:
@@ -1,4 +1,4 @@
|
||||
import { observer } from "mobx-react-lite";
|
||||
import { observer } from "mobx-react";
|
||||
import * as React from "react";
|
||||
import Guide from "~/components/Guide";
|
||||
import Modal from "~/components/Modal";
|
||||
|
||||
30
package.json
30
package.json
@@ -46,11 +46,11 @@
|
||||
"> 0.25%, not dead"
|
||||
],
|
||||
"dependencies": {
|
||||
"@babel/core": "^7.18.6",
|
||||
"@babel/core": "^7.21.0",
|
||||
"@babel/plugin-proposal-decorators": "^7.21.0",
|
||||
"@babel/plugin-transform-destructuring": "^7.20.2",
|
||||
"@babel/plugin-transform-regenerator": "^7.10.4",
|
||||
"@babel/preset-env": "^7.16.0",
|
||||
"@babel/plugin-transform-destructuring": "^7.20.0",
|
||||
"@babel/plugin-transform-regenerator": "^7.20.0",
|
||||
"@babel/preset-env": "^7.20.0",
|
||||
"@babel/preset-react": "^7.18.6",
|
||||
"@benrbray/prosemirror-math": "^0.2.2",
|
||||
"@bull-board/api": "^4.2.2",
|
||||
@@ -84,7 +84,6 @@
|
||||
"class-validator": "^0.14.0",
|
||||
"compressorjs": "^1.1.1",
|
||||
"copy-to-clipboard": "^3.3.3",
|
||||
"core-js": "^3.26.1",
|
||||
"crypto-js": "^4.1.1",
|
||||
"datadog-metrics": "^0.10.2",
|
||||
"date-fns": "^2.25.0",
|
||||
@@ -93,10 +92,8 @@
|
||||
"email-providers": "^1.13.1",
|
||||
"emoji-regex": "^10.0.0",
|
||||
"es6-error": "^4.1.1",
|
||||
"exports-loader": "^1.1.1",
|
||||
"fetch-retry": "^5.0.3",
|
||||
"fetch-with-proxy": "^3.0.1",
|
||||
"file-loader": "^1.1.6",
|
||||
"focus-visible": "^5.2.0",
|
||||
"fractional-index": "^1.0.0",
|
||||
"framer-motion": "^4.1.17",
|
||||
@@ -108,13 +105,11 @@
|
||||
"i18next": "^22.4.8",
|
||||
"i18next-fs-backend": "^2.1.1",
|
||||
"i18next-http-backend": "^2.1.1",
|
||||
"immutable": "^4.2.4",
|
||||
"inline-css": "^4.0.1",
|
||||
"invariant": "^2.2.4",
|
||||
"ioredis": "^5.0.0",
|
||||
"is-printable-key-event": "^1.0.0",
|
||||
"jsdom": "^21.0.0",
|
||||
"json-loader": "0.5.7",
|
||||
"jsonwebtoken": "^9.0.0",
|
||||
"jszip": "^3.10.1",
|
||||
"katex": "^0.16.4",
|
||||
@@ -122,7 +117,6 @@
|
||||
"koa": "^2.13.4",
|
||||
"koa-body": "^4.2.0",
|
||||
"koa-compress": "^5.1.0",
|
||||
"koa-convert": "^2.0.0",
|
||||
"koa-helmet": "^6.1.0",
|
||||
"koa-logger": "^3.2.1",
|
||||
"koa-mount": "^3.0.0",
|
||||
@@ -142,8 +136,7 @@
|
||||
"mobx-utils": "^4.0.1",
|
||||
"natural-sort": "^1.0.0",
|
||||
"node-fetch": "2.6.7",
|
||||
"node-htmldiff": "^0.9.4",
|
||||
"nodemailer": "^6.6.1",
|
||||
"nodemailer": "^6.9.1",
|
||||
"outline-icons": "^1.46.0",
|
||||
"oy-vey": "^0.12.0",
|
||||
"passport": "^0.6.0",
|
||||
@@ -152,7 +145,6 @@
|
||||
"passport-slack-oauth2": "^1.1.1",
|
||||
"patch-package": "^6.5.1",
|
||||
"pg": "^8.8.0",
|
||||
"pg-hstore": "^2.3.4",
|
||||
"pg-tsquery": "^8.4.0",
|
||||
"polished": "^4.2.2",
|
||||
"prosemirror-commands": "1.2.2",
|
||||
@@ -173,7 +165,6 @@
|
||||
"quoted-printable": "^1.0.1",
|
||||
"randomstring": "1.2.3",
|
||||
"rate-limiter-flexible": "^2.4.1",
|
||||
"raw-loader": "^0.5.1",
|
||||
"react": "^17.0.2",
|
||||
"react-avatar-editor": "^13.0.0",
|
||||
"react-color": "^2.17.3",
|
||||
@@ -194,15 +185,12 @@
|
||||
"reakit": "^1.3.11",
|
||||
"reflect-metadata": "^0.1.13",
|
||||
"refractor": "^3.6.0",
|
||||
"regenerator-runtime": "^0.13.7",
|
||||
"request-filtering-agent": "^1.1.2",
|
||||
"semver": "^7.3.7",
|
||||
"sequelize": "^6.20.1",
|
||||
"sequelize-cli": "^6.4.1",
|
||||
"sequelize-encrypted": "^1.0.0",
|
||||
"sequelize-typescript": "^2.1.5",
|
||||
"slate": "0.45.0",
|
||||
"slate-md-serializer": "5.5.4",
|
||||
"slug": "^5.3.0",
|
||||
"slugify": "^1.6.5",
|
||||
"smooth-scroll-into-view-if-needed": "^1.1.32",
|
||||
@@ -235,7 +223,7 @@
|
||||
"@babel/cli": "^7.21.0",
|
||||
"@babel/preset-typescript": "^7.21.0",
|
||||
"@getoutline/jest-runner-serial": "^2.0.0",
|
||||
"@relative-ci/agent": "^3.0.0",
|
||||
"@relative-ci/agent": "^4.1.3",
|
||||
"@types/body-scroll-lock": "^3.1.0",
|
||||
"@types/crypto-js": "^4.1.1",
|
||||
"@types/datadog-metrics": "^0.6.2",
|
||||
@@ -310,15 +298,13 @@
|
||||
"@typescript-eslint/parser": "^5.48.1",
|
||||
"babel-eslint": "^10.1.0",
|
||||
"babel-jest": "^29.4.3",
|
||||
"babel-loader": "^9.1.2",
|
||||
"babel-plugin-transform-inline-environment-variables": "^0.4.4",
|
||||
"babel-plugin-transform-typescript-metadata": "^0.3.2",
|
||||
"babel-plugin-tsconfig-paths-module-resolver": "^1.0.3",
|
||||
"browserslist-to-esbuild": "^1.2.0",
|
||||
"concurrently": "^7.4.0",
|
||||
"css-loader": "5.2.6",
|
||||
"enzyme": "^3.11.0",
|
||||
"enzyme-adapter-react-16": "^1.15.6",
|
||||
"enzyme-adapter-react-16": "^1.15.7",
|
||||
"eslint": "^7.32.0",
|
||||
"eslint-config-prettier": "^8.5.0",
|
||||
"eslint-import-resolver-typescript": "^3.5.2",
|
||||
@@ -342,10 +328,8 @@
|
||||
"react-refresh": "^0.14.0",
|
||||
"rimraf": "^2.5.4",
|
||||
"rollup-plugin-webpack-stats": "^0.2.0",
|
||||
"style-loader": "2.0.0",
|
||||
"terser": "^5.16.3",
|
||||
"typescript": "^4.7.4",
|
||||
"url-loader": "^4.1.1",
|
||||
"vite-plugin-static-copy": "^0.13.0",
|
||||
"yarn-deduplicate": "^6.0.1"
|
||||
},
|
||||
|
||||
@@ -37,131 +37,6 @@ paragraph 2`,
|
||||
});
|
||||
});
|
||||
|
||||
describe("#migrateVersion", () => {
|
||||
test("should maintain empty paragraph under headings", async () => {
|
||||
const document = await buildDocument({
|
||||
version: 1,
|
||||
text: `# Heading
|
||||
|
||||
paragraph`,
|
||||
});
|
||||
await document.migrateVersion();
|
||||
expect(document.text).toBe(`# Heading
|
||||
|
||||
paragraph`);
|
||||
});
|
||||
|
||||
test("should add breaks under headings with extra paragraphs", async () => {
|
||||
const document = await buildDocument({
|
||||
version: 1,
|
||||
text: `# Heading
|
||||
|
||||
|
||||
paragraph`,
|
||||
});
|
||||
await document.migrateVersion();
|
||||
expect(document.text).toBe(`# Heading
|
||||
|
||||
|
||||
\\
|
||||
paragraph`);
|
||||
});
|
||||
|
||||
test("should add breaks between paragraphs", async () => {
|
||||
const document = await buildDocument({
|
||||
version: 1,
|
||||
text: `paragraph
|
||||
|
||||
paragraph`,
|
||||
});
|
||||
await document.migrateVersion();
|
||||
expect(document.text).toBe(`paragraph
|
||||
|
||||
\\
|
||||
paragraph`);
|
||||
});
|
||||
|
||||
test("should add breaks for multiple empty paragraphs", async () => {
|
||||
const document = await buildDocument({
|
||||
version: 1,
|
||||
text: `paragraph
|
||||
|
||||
|
||||
paragraph`,
|
||||
});
|
||||
await document.migrateVersion();
|
||||
expect(document.text).toBe(`paragraph
|
||||
|
||||
\\
|
||||
\\
|
||||
paragraph`);
|
||||
});
|
||||
|
||||
test("should add breaks with non-latin characters", async () => {
|
||||
const document = await buildDocument({
|
||||
version: 1,
|
||||
text: `除。
|
||||
|
||||
通`,
|
||||
});
|
||||
await document.migrateVersion();
|
||||
expect(document.text).toBe(`除。
|
||||
|
||||
\\
|
||||
通`);
|
||||
});
|
||||
|
||||
test("should update task list formatting", async () => {
|
||||
const document = await buildDocument({
|
||||
version: 1,
|
||||
text: `[ ] list item
|
||||
`,
|
||||
});
|
||||
await document.migrateVersion();
|
||||
expect(document.text).toBe(`- [ ] list item
|
||||
`);
|
||||
});
|
||||
|
||||
test("should update task list with multiple items", async () => {
|
||||
const document = await buildDocument({
|
||||
version: 1,
|
||||
text: `[ ] list item
|
||||
[ ] list item 2
|
||||
`,
|
||||
});
|
||||
await document.migrateVersion();
|
||||
expect(document.text).toBe(`- [ ] list item
|
||||
- [ ] list item 2
|
||||
`);
|
||||
});
|
||||
|
||||
test("should update checked task list formatting", async () => {
|
||||
const document = await buildDocument({
|
||||
version: 1,
|
||||
text: `[x] list item
|
||||
`,
|
||||
});
|
||||
await document.migrateVersion();
|
||||
expect(document.text).toBe(`- [x] list item
|
||||
`);
|
||||
});
|
||||
|
||||
test("should update nested task list formatting", async () => {
|
||||
const document = await buildDocument({
|
||||
version: 1,
|
||||
text: `[x] list item
|
||||
[ ] list item
|
||||
[x] list item
|
||||
`,
|
||||
});
|
||||
await document.migrateVersion();
|
||||
expect(document.text).toBe(`- [x] list item
|
||||
- [ ] list item
|
||||
- [x] list item
|
||||
`);
|
||||
});
|
||||
});
|
||||
|
||||
describe("#delete", () => {
|
||||
test("should soft delete and set last modified", async () => {
|
||||
const document = await buildDocument();
|
||||
|
||||
@@ -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";
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -15,7 +15,6 @@ async function presentDocument(
|
||||
isPublic: false,
|
||||
...options,
|
||||
};
|
||||
await document.migrateVersion();
|
||||
const text = options.isPublic
|
||||
? await DocumentHelper.attachmentsToSignedUrls(
|
||||
document.text,
|
||||
|
||||
@@ -3,8 +3,6 @@ import { Revision } from "@server/models";
|
||||
import presentUser from "./user";
|
||||
|
||||
async function presentRevision(revision: Revision, diff?: string) {
|
||||
await revision.migrateVersion();
|
||||
|
||||
return {
|
||||
id: revision.id,
|
||||
documentId: revision.documentId,
|
||||
|
||||
2
server/typings/index.d.ts
vendored
2
server/typings/index.d.ts
vendored
@@ -1,5 +1,3 @@
|
||||
declare module "slate-md-serializer";
|
||||
|
||||
declare module "sequelize-encrypted";
|
||||
|
||||
declare module "styled-components-breakpoint";
|
||||
|
||||
Reference in New Issue
Block a user