refactor: use date-fns
This commit is contained in:
parent
7168811283
commit
9ee0db95ac
|
@ -24,7 +24,6 @@
|
||||||
"@types/bcryptjs": "2.4.2",
|
"@types/bcryptjs": "2.4.2",
|
||||||
"@types/bull": "3.15.7",
|
"@types/bull": "3.15.7",
|
||||||
"@types/cbor": "6.0.0",
|
"@types/cbor": "6.0.0",
|
||||||
"@types/dateformat": "5.0.0",
|
|
||||||
"@types/escape-regexp": "0.0.1",
|
"@types/escape-regexp": "0.0.1",
|
||||||
"@types/glob": "7.2.0",
|
"@types/glob": "7.2.0",
|
||||||
"@types/is-url": "1.2.30",
|
"@types/is-url": "1.2.30",
|
||||||
|
@ -87,7 +86,7 @@
|
||||||
"cli-highlight": "2.1.11",
|
"cli-highlight": "2.1.11",
|
||||||
"content-disposition": "0.5.4",
|
"content-disposition": "0.5.4",
|
||||||
"crc-32": "1.2.1",
|
"crc-32": "1.2.1",
|
||||||
"dateformat": "4.5.1",
|
"date-fns": "2.28.0",
|
||||||
"deep-email-validator": "0.1.21",
|
"deep-email-validator": "0.1.21",
|
||||||
"escape-regexp": "0.0.1",
|
"escape-regexp": "0.0.1",
|
||||||
"eslint": "8.8.0",
|
"eslint": "8.8.0",
|
||||||
|
|
|
@ -4,7 +4,7 @@ import * as fs from 'fs';
|
||||||
|
|
||||||
import { queueLogger } from '../../logger';
|
import { queueLogger } from '../../logger';
|
||||||
import { addFile } from '@/services/drive/add-file';
|
import { addFile } from '@/services/drive/add-file';
|
||||||
import * as dateFormat from 'dateformat';
|
import { format as dateFormat } from 'date-fns';
|
||||||
import { getFullApAccount } from '@/misc/convert-host';
|
import { getFullApAccount } from '@/misc/convert-host';
|
||||||
import { Users, Blockings } from '@/models/index';
|
import { Users, Blockings } from '@/models/index';
|
||||||
import { MoreThan } from 'typeorm';
|
import { MoreThan } from 'typeorm';
|
||||||
|
@ -85,7 +85,7 @@ export async function exportBlocking(job: Bull.Job<DbUserJobData>, done: any): P
|
||||||
stream.end();
|
stream.end();
|
||||||
logger.succ(`Exported to: ${path}`);
|
logger.succ(`Exported to: ${path}`);
|
||||||
|
|
||||||
const fileName = 'blocking-' + dateFormat(new Date(), 'yyyy-mm-dd-HH-MM-ss') + '.csv';
|
const fileName = 'blocking-' + dateFormat(new Date(), 'yyyy-MM-dd-HH-mm-ss') + '.csv';
|
||||||
const driveFile = await addFile({ user, path, name: fileName, force: true });
|
const driveFile = await addFile({ user, path, name: fileName, force: true });
|
||||||
|
|
||||||
logger.succ(`Exported to: ${driveFile.id}`);
|
logger.succ(`Exported to: ${driveFile.id}`);
|
||||||
|
|
|
@ -7,7 +7,7 @@ const mime = require('mime-types');
|
||||||
const archiver = require('archiver');
|
const archiver = require('archiver');
|
||||||
import { queueLogger } from '../../logger';
|
import { queueLogger } from '../../logger';
|
||||||
import { addFile } from '@/services/drive/add-file';
|
import { addFile } from '@/services/drive/add-file';
|
||||||
import * as dateFormat from 'dateformat';
|
import { format as dateFormat } from 'date-fns';
|
||||||
import { Users, Emojis } from '@/models/index';
|
import { Users, Emojis } from '@/models/index';
|
||||||
import { } from '@/queue/types';
|
import { } from '@/queue/types';
|
||||||
import { downloadUrl } from '@/misc/download-url';
|
import { downloadUrl } from '@/misc/download-url';
|
||||||
|
@ -110,7 +110,7 @@ export async function exportCustomEmojis(job: Bull.Job, done: () => void): Promi
|
||||||
archiveStream.on('close', async () => {
|
archiveStream.on('close', async () => {
|
||||||
logger.succ(`Exported to: ${archivePath}`);
|
logger.succ(`Exported to: ${archivePath}`);
|
||||||
|
|
||||||
const fileName = 'custom-emojis-' + dateFormat(new Date(), 'yyyy-mm-dd-HH-MM-ss') + '.zip';
|
const fileName = 'custom-emojis-' + dateFormat(new Date(), 'yyyy-MM-dd-HH-mm-ss') + '.zip';
|
||||||
const driveFile = await addFile({ user, path: archivePath, name: fileName, force: true });
|
const driveFile = await addFile({ user, path: archivePath, name: fileName, force: true });
|
||||||
|
|
||||||
logger.succ(`Exported to: ${driveFile.id}`);
|
logger.succ(`Exported to: ${driveFile.id}`);
|
||||||
|
|
|
@ -4,7 +4,7 @@ import * as fs from 'fs';
|
||||||
|
|
||||||
import { queueLogger } from '../../logger';
|
import { queueLogger } from '../../logger';
|
||||||
import { addFile } from '@/services/drive/add-file';
|
import { addFile } from '@/services/drive/add-file';
|
||||||
import * as dateFormat from 'dateformat';
|
import { format as dateFormat } from 'date-fns';
|
||||||
import { getFullApAccount } from '@/misc/convert-host';
|
import { getFullApAccount } from '@/misc/convert-host';
|
||||||
import { Users, Followings, Mutings } from '@/models/index';
|
import { Users, Followings, Mutings } from '@/models/index';
|
||||||
import { In, MoreThan, Not } from 'typeorm';
|
import { In, MoreThan, Not } from 'typeorm';
|
||||||
|
@ -86,7 +86,7 @@ export async function exportFollowing(job: Bull.Job<DbUserJobData>, done: () =>
|
||||||
stream.end();
|
stream.end();
|
||||||
logger.succ(`Exported to: ${path}`);
|
logger.succ(`Exported to: ${path}`);
|
||||||
|
|
||||||
const fileName = 'following-' + dateFormat(new Date(), 'yyyy-mm-dd-HH-MM-ss') + '.csv';
|
const fileName = 'following-' + dateFormat(new Date(), 'yyyy-MM-dd-HH-mm-ss') + '.csv';
|
||||||
const driveFile = await addFile({ user, path, name: fileName, force: true });
|
const driveFile = await addFile({ user, path, name: fileName, force: true });
|
||||||
|
|
||||||
logger.succ(`Exported to: ${driveFile.id}`);
|
logger.succ(`Exported to: ${driveFile.id}`);
|
||||||
|
|
|
@ -4,7 +4,7 @@ import * as fs from 'fs';
|
||||||
|
|
||||||
import { queueLogger } from '../../logger';
|
import { queueLogger } from '../../logger';
|
||||||
import { addFile } from '@/services/drive/add-file';
|
import { addFile } from '@/services/drive/add-file';
|
||||||
import * as dateFormat from 'dateformat';
|
import { format as dateFormat } from 'date-fns';
|
||||||
import { getFullApAccount } from '@/misc/convert-host';
|
import { getFullApAccount } from '@/misc/convert-host';
|
||||||
import { Users, Mutings } from '@/models/index';
|
import { Users, Mutings } from '@/models/index';
|
||||||
import { MoreThan } from 'typeorm';
|
import { MoreThan } from 'typeorm';
|
||||||
|
@ -85,7 +85,7 @@ export async function exportMute(job: Bull.Job<DbUserJobData>, done: any): Promi
|
||||||
stream.end();
|
stream.end();
|
||||||
logger.succ(`Exported to: ${path}`);
|
logger.succ(`Exported to: ${path}`);
|
||||||
|
|
||||||
const fileName = 'mute-' + dateFormat(new Date(), 'yyyy-mm-dd-HH-MM-ss') + '.csv';
|
const fileName = 'mute-' + dateFormat(new Date(), 'yyyy-MM-dd-HH-mm-ss') + '.csv';
|
||||||
const driveFile = await addFile({ user, path, name: fileName, force: true });
|
const driveFile = await addFile({ user, path, name: fileName, force: true });
|
||||||
|
|
||||||
logger.succ(`Exported to: ${driveFile.id}`);
|
logger.succ(`Exported to: ${driveFile.id}`);
|
||||||
|
|
|
@ -4,7 +4,7 @@ import * as fs from 'fs';
|
||||||
|
|
||||||
import { queueLogger } from '../../logger';
|
import { queueLogger } from '../../logger';
|
||||||
import { addFile } from '@/services/drive/add-file';
|
import { addFile } from '@/services/drive/add-file';
|
||||||
import * as dateFormat from 'dateformat';
|
import { format as dateFormat } from 'date-fns';
|
||||||
import { Users, Notes, Polls } from '@/models/index';
|
import { Users, Notes, Polls } from '@/models/index';
|
||||||
import { MoreThan } from 'typeorm';
|
import { MoreThan } from 'typeorm';
|
||||||
import { Note } from '@/models/entities/note';
|
import { Note } from '@/models/entities/note';
|
||||||
|
@ -94,7 +94,7 @@ export async function exportNotes(job: Bull.Job<DbUserJobData>, done: any): Prom
|
||||||
stream.end();
|
stream.end();
|
||||||
logger.succ(`Exported to: ${path}`);
|
logger.succ(`Exported to: ${path}`);
|
||||||
|
|
||||||
const fileName = 'notes-' + dateFormat(new Date(), 'yyyy-mm-dd-HH-MM-ss') + '.json';
|
const fileName = 'notes-' + dateFormat(new Date(), 'yyyy-MM-dd-HH-mm-ss') + '.json';
|
||||||
const driveFile = await addFile({ user, path, name: fileName, force: true });
|
const driveFile = await addFile({ user, path, name: fileName, force: true });
|
||||||
|
|
||||||
logger.succ(`Exported to: ${driveFile.id}`);
|
logger.succ(`Exported to: ${driveFile.id}`);
|
||||||
|
|
|
@ -4,7 +4,7 @@ import * as fs from 'fs';
|
||||||
|
|
||||||
import { queueLogger } from '../../logger';
|
import { queueLogger } from '../../logger';
|
||||||
import { addFile } from '@/services/drive/add-file';
|
import { addFile } from '@/services/drive/add-file';
|
||||||
import * as dateFormat from 'dateformat';
|
import { format as dateFormat } from 'date-fns';
|
||||||
import { getFullApAccount } from '@/misc/convert-host';
|
import { getFullApAccount } from '@/misc/convert-host';
|
||||||
import { Users, UserLists, UserListJoinings } from '@/models/index';
|
import { Users, UserLists, UserListJoinings } from '@/models/index';
|
||||||
import { In } from 'typeorm';
|
import { In } from 'typeorm';
|
||||||
|
@ -62,7 +62,7 @@ export async function exportUserLists(job: Bull.Job<DbUserJobData>, done: any):
|
||||||
stream.end();
|
stream.end();
|
||||||
logger.succ(`Exported to: ${path}`);
|
logger.succ(`Exported to: ${path}`);
|
||||||
|
|
||||||
const fileName = 'user-lists-' + dateFormat(new Date(), 'yyyy-mm-dd-HH-MM-ss') + '.csv';
|
const fileName = 'user-lists-' + dateFormat(new Date(), 'yyyy-MM-dd-HH-mm-ss') + '.csv';
|
||||||
const driveFile = await addFile({ user, path, name: fileName, force: true });
|
const driveFile = await addFile({ user, path, name: fileName, force: true });
|
||||||
|
|
||||||
logger.succ(`Exported to: ${driveFile.id}`);
|
logger.succ(`Exported to: ${driveFile.id}`);
|
||||||
|
|
|
@ -403,11 +403,6 @@
|
||||||
"@types/keygrip" "*"
|
"@types/keygrip" "*"
|
||||||
"@types/node" "*"
|
"@types/node" "*"
|
||||||
|
|
||||||
"@types/dateformat@5.0.0":
|
|
||||||
version "5.0.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/@types/dateformat/-/dateformat-5.0.0.tgz#17ce64b0318f3f36d1c830c58a7a915445f1f93d"
|
|
||||||
integrity sha512-SZg4JdHIWHQGEokbYGZSDvo5wA4TLYPXaqhigs/wH+REDOejcJzgH+qyY+HtEUtWOZxEUkbhbdYPqQDiEgrXeA==
|
|
||||||
|
|
||||||
"@types/disposable-email-domains@^1.0.1":
|
"@types/disposable-email-domains@^1.0.1":
|
||||||
version "1.0.2"
|
version "1.0.2"
|
||||||
resolved "https://registry.yarnpkg.com/@types/disposable-email-domains/-/disposable-email-domains-1.0.2.tgz#0280f6b38fa7f14e54b056a434135ecd254483b1"
|
resolved "https://registry.yarnpkg.com/@types/disposable-email-domains/-/disposable-email-domains-1.0.2.tgz#0280f6b38fa7f14e54b056a434135ecd254483b1"
|
||||||
|
@ -2099,10 +2094,10 @@ data-urls@^3.0.1:
|
||||||
whatwg-mimetype "^3.0.0"
|
whatwg-mimetype "^3.0.0"
|
||||||
whatwg-url "^10.0.0"
|
whatwg-url "^10.0.0"
|
||||||
|
|
||||||
dateformat@4.5.1:
|
date-fns@2.28.0:
|
||||||
version "4.5.1"
|
version "2.28.0"
|
||||||
resolved "https://registry.yarnpkg.com/dateformat/-/dateformat-4.5.1.tgz#c20e7a9ca77d147906b6dc2261a8be0a5bd2173c"
|
resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-2.28.0.tgz#9570d656f5fc13143e50c975a3b6bbeb46cd08b2"
|
||||||
integrity sha512-OD0TZ+B7yP7ZgpJf5K2DIbj3FZvFvxgFUuaqA/V5zTjAtAAXZ1E8bktHxmAGs4x5b7PflqA9LeQ84Og7wYtF7Q==
|
integrity sha512-8d35hViGYx/QH0icHYCeLmsLmMUheMmTyV9Fcm6gvNwdw31yXXH+O85sOBJ+OLnLQMKZowvpKb6FgMIQjcpvQw==
|
||||||
|
|
||||||
debug@2, debug@^2.2.0, debug@^2.5.2, debug@^2.6.9:
|
debug@2, debug@^2.2.0, debug@^2.5.2, debug@^2.6.9:
|
||||||
version "2.6.9"
|
version "2.6.9"
|
||||||
|
|
|
@ -12,7 +12,6 @@
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@discordapp/twemoji": "13.1.0",
|
"@discordapp/twemoji": "13.1.0",
|
||||||
"@syuilo/aiscript": "0.11.1",
|
"@syuilo/aiscript": "0.11.1",
|
||||||
"@types/dateformat": "3.0.1",
|
|
||||||
"@types/escape-regexp": "0.0.1",
|
"@types/escape-regexp": "0.0.1",
|
||||||
"@types/glob": "7.2.0",
|
"@types/glob": "7.2.0",
|
||||||
"@types/gulp": "4.0.9",
|
"@types/gulp": "4.0.9",
|
||||||
|
|
|
@ -266,11 +266,6 @@
|
||||||
resolved "https://registry.yarnpkg.com/@types/color-name/-/color-name-1.1.1.tgz#1c1261bbeaa10a8055bbc5d8ab84b7b2afc846a0"
|
resolved "https://registry.yarnpkg.com/@types/color-name/-/color-name-1.1.1.tgz#1c1261bbeaa10a8055bbc5d8ab84b7b2afc846a0"
|
||||||
integrity sha512-rr+OQyAjxze7GgWrSaJwydHStIhHq2lvY3BOC2Mj7KnzI7XK0Uw1TOOdI9lDoajEbSWLiYgoo4f1R51erQfhPQ==
|
integrity sha512-rr+OQyAjxze7GgWrSaJwydHStIhHq2lvY3BOC2Mj7KnzI7XK0Uw1TOOdI9lDoajEbSWLiYgoo4f1R51erQfhPQ==
|
||||||
|
|
||||||
"@types/dateformat@3.0.1":
|
|
||||||
version "3.0.1"
|
|
||||||
resolved "https://registry.yarnpkg.com/@types/dateformat/-/dateformat-3.0.1.tgz#98d747a2e5e9a56070c6bf14e27bff56204e34cc"
|
|
||||||
integrity sha512-KlPPdikagvL6ELjWsljbyDIPzNCeliYkqRpI+zea99vBBbCIA5JNshZAwQKTON139c87y9qvTFVgkFd14rtS4g==
|
|
||||||
|
|
||||||
"@types/escape-regexp@0.0.1":
|
"@types/escape-regexp@0.0.1":
|
||||||
version "0.0.1"
|
version "0.0.1"
|
||||||
resolved "https://registry.yarnpkg.com/@types/escape-regexp/-/escape-regexp-0.0.1.tgz#f1a977ccdf2ef059e9862bd3af5e92cbbe723e0e"
|
resolved "https://registry.yarnpkg.com/@types/escape-regexp/-/escape-regexp-0.0.1.tgz#f1a977ccdf2ef059e9862bd3af5e92cbbe723e0e"
|
||||||
|
|
Loading…
Reference in New Issue