update deps, move to atlas configs

This commit is contained in:
Sylver 2024-01-07 12:19:16 +08:00
parent aec85d03a6
commit 40cbaaca8b
16 changed files with 3869 additions and 4661 deletions

31
.syncpackrc Normal file
View File

@ -0,0 +1,31 @@
{
"indent": " ",
"sortFirst": [
"name",
"version",
"license",
"repository",
"author",
"type",
"main",
"private",
"types",
"module",
"exports",
"source",
"publishConfig",
"contributors",
"keywords",
"files",
"workspaces",
"engines",
"scripts",
"contributors",
"dependencies",
"devDependencies",
"peerDependencies",
"keywords",
"mikro-orm",
"jest"
]
}

View File

@ -1,6 +0,0 @@
module.exports = {
extends: ["@commitlint/config-conventional"],
rules: {
"subject-case": [0],
},
};

View File

@ -1,22 +1,24 @@
{
"name": "micro",
"version": "1.0.0",
"license": "GPL-3.0",
"repository": "https://github.com/sylv/micro.git",
"author": "Ryan <ryan@sylver.me>",
"license": "GPL-3.0",
"private": true,
"packageManager": "pnpm@7.0.0",
"engines": {
"node": ">=16",
"pnpm": ">=7"
},
"scripts": {
"lint": "turbo run lint",
"build": "turbo run build",
"test": "turbo run test",
"clean": "rm -rf ./packages/*/{tsconfig.tsbuildinfo,lib,dist,yarn-error.log,.next}"
"clean": "rm -rf ./packages/*/{tsconfig.tsbuildinfo,lib,dist,yarn-error.log,.next}",
"lint": "turbo run lint",
"sync": "syncpack format && syncpack fix-mismatches",
"test": "turbo run test"
},
"devDependencies": {
"turbo": "1.10.13"
}
"syncpack": "^12.3.0",
"turbo": "1.11.3"
},
"packageManager": "pnpm@7.0.0"
}

View File

@ -1,11 +1,9 @@
module.exports = {
extends: require.resolve('@sylo-digital/scripts/eslint/base'),
overrides: [
{
files: ['**/*.{entity,embeddable,resolver}.ts'],
rules: {
'@typescript-eslint/no-inferrable-types': 'off',
},
},
],
extends: require.resolve('@atlasbot/configs/eslint/node'),
parserOptions: {
project: './tsconfig.json',
},
rules: {
'unicorn/no-abusive-eslint-disable': 'off',
},
};

View File

@ -1,86 +1,86 @@
{
"name": "@ryanke/micro-api",
"version": "1.0.0",
"license": "GPL-3.0",
"repository": "https://github.com/sylv/micro.git",
"author": "Ryan <ryan@sylver.me>",
"license": "GPL-3.0",
"type": "module",
"private": true,
"engine": {
"node": ">=18"
"engines": {
"node": ">=20"
},
"scripts": {
"watch": "tsup --watch --onSuccess \"node dist/main.js --inspect --inspect-brk\"",
"build": "tsup",
"build": "tsc --noEmit && tsup",
"lint": "eslint src --fix --cache",
"test": "vitest run"
"test": "vitest run",
"watch": "tsup --watch --onSuccess \"node dist/main.js --inspect --inspect-brk\""
},
"dependencies": {
"@fastify/cookie": "^9.0.4",
"@fastify/helmet": "^11.0.0",
"@fastify/multipart": "^7.7.3",
"@fastify/cookie": "^9.2.0",
"@fastify/helmet": "^11.1.1",
"@fastify/multipart": "^8.1.0",
"@jenyus-org/graphql-utils": "^1.5.0",
"@mercuriusjs/gateway": "^1.2.0",
"@mikro-orm/core": "^5.7.14",
"@mikro-orm/migrations": "^5.7.14",
"@mikro-orm/nestjs": "^5.2.1",
"@mikro-orm/postgresql": "^5.7.14",
"@nestjs/common": "^10.2.2",
"@nestjs/core": "^10.2.2",
"@nestjs/graphql": "^12.0.8",
"@nestjs/jwt": "^10.1.0",
"@nestjs/mercurius": "^12.0.4",
"@nestjs/passport": "^10.0.1",
"@nestjs/platform-fastify": "^10.2.2",
"@nestjs/schedule": "^3.0.3",
"@mercuriusjs/gateway": "^2.2.0",
"@mikro-orm/core": "^5.9.7",
"@mikro-orm/migrations": "^5.9.7",
"@mikro-orm/nestjs": "^5.2.3",
"@mikro-orm/postgresql": "^5.9.7",
"@nestjs/common": "^10.3.0",
"@nestjs/core": "^10.3.0",
"@nestjs/graphql": "^12.0.11",
"@nestjs/jwt": "^10.2.0",
"@nestjs/mercurius": "^12.0.11",
"@nestjs/passport": "^10.0.3",
"@nestjs/platform-fastify": "^10.3.0",
"@nestjs/schedule": "^4.0.0",
"@ryanke/venera": "^1.0.5",
"rxjs": "^7.8.1",
"bcryptjs": "^2.4.3",
"class-transformer": "^0.5.1",
"class-validator": "^0.14.0",
"fastify": "^4.22.0",
"fastify": "^4.25.2",
"fluent-ffmpeg": "^2.1.2",
"graphql": "^16.8.0",
"mercurius": "^13.1.0",
"graphql": "^16.8.1",
"mercurius": "^13.3.3",
"mime-types": "^2.1.35",
"nodemailer": "^6.9.4",
"nodemailer": "^6.9.8",
"otplib": "^12.0.1",
"passport": "^0.6.0",
"passport": "^0.7.0",
"passport-jwt": "^4.0.1",
"sharp": "^0.32.5",
"rxjs": "^7.8.1",
"sharp": "^0.33.1",
"stream-size": "^0.0.6"
},
"devDependencies": {
"@mikro-orm/cli": "^5.7.14",
"@swc/core": "^1.3.80",
"@sylo-digital/scripts": "^1.0.12",
"@types/bcryptjs": "^2.4.3",
"@types/bytes": "^3.1.1",
"@types/dedent": "^0.7.0",
"@types/fluent-ffmpeg": "^2.1.21",
"@types/luxon": "^3.3.1",
"@types/mime-types": "^2.1.1",
"@types/ms": "^0.7.31",
"@types/node": "^18.15.11",
"@types/nodemailer": "^6.4.9",
"@types/passport-jwt": "^3.0.9",
"@atlasbot/configs": "^10.5.14",
"@mikro-orm/cli": "^5.9.7",
"@swc/core": "^1.3.102",
"@types/bcryptjs": "^2.4.6",
"@types/bytes": "^3.1.4",
"@types/dedent": "^0.7.2",
"@types/fluent-ffmpeg": "^2.1.24",
"@types/luxon": "^3.4.0",
"@types/mime-types": "^2.1.4",
"@types/ms": "^0.7.34",
"@types/node": "^20.10.6",
"@types/nodemailer": "^6.4.14",
"@types/passport-jwt": "^4.0.0",
"bytes": "^3.1.2",
"content-range": "^2.0.2",
"dedent": "^1.5.1",
"escape-string-regexp": "^5.0.0",
"file-type": "^18.5.0",
"file-type": "^18.7.0",
"handlebars": "^4.7.8",
"istextorbinary": "^6.0.0",
"luxon": "^3.4.2",
"istextorbinary": "^9.5.0",
"luxon": "^3.4.4",
"ms": "^3.0.0-canary.1",
"nanoid": "^4.0.2",
"nanoid": "^5.0.4",
"normalize-url": "^8.0.0",
"pretty-bytes": "^6.1.1",
"reflect-metadata": "^0.1.13",
"ts-node": "^10.9.1",
"tsup": "^7.2.0",
"typescript": "^5.2.2",
"vitest": "^0.34.3"
"reflect-metadata": "^0.2.1",
"ts-node": "^10.9.2",
"tsup": "^8.0.1",
"typescript": "^5.3.3",
"vitest": "^1.1.3"
},
"mikro-orm": {
"useTsNode": true,

View File

@ -16,7 +16,7 @@ export class ExifTransformer extends Transform {
private static readonly maxMarkerLength = Math.max(
ExifTransformer.exifMarker.length,
ExifTransformer.xmpMarker.length,
ExifTransformer.flirMarker.length
ExifTransformer.flirMarker.length,
);
private remainingBytes?: number;

View File

@ -1,5 +1,5 @@
import { customAlphabet } from 'nanoid';
import blocklist from '../blocklist.json' assert { type: 'json' };
import blocklist from '../blocklist.json';
const contentIdLength = 6;
const paranoidIdLength = 12;

View File

@ -2,8 +2,6 @@ import { fileTypeFromBuffer } from 'file-type';
import * as mimeType from 'mime-types';
import path from 'path';
import type { PassThrough } from 'stream';
// @ts-expect-error see tsconfig.json/paths
import { isBinary } from 'istextorbinary';
const DEFAULT_TYPE = 'application/octet-stream';

View File

@ -1,6 +1,6 @@
import { Field, InputType } from '@nestjs/graphql';
import { IsEmail, IsLowercase, IsNotIn, IsOptional, IsString, MaxLength, MinLength } from 'class-validator';
import blocklist from '../../../blocklist.json' assert { type: 'json' };
import blocklist from '../../../blocklist.json';
@InputType()
export class CreateUserDto {

View File

@ -1,38 +1,13 @@
{
"include": ["src", "types"],
"extends": "@atlasbot/configs/tsconfig/esm.json",
"include": ["src"],
"compilerOptions": {
// https://www.npmjs.com/package/@tsconfig/node18
// https://github.com/sindresorhus/tsconfig/blob/main/tsconfig.json
"moduleDetection": "force",
"allowSyntheticDefaultImports": true,
"resolveJsonModule": true,
"lib": ["es2022"],
// "module": "CommonJS",
// "moduleResolution": "node",
"module": "NodeNext",
"moduleResolution": "nodenext",
"target": "es2022",
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"declaration": true,
"pretty": true,
"newLine": "lf",
"stripInternal": true,
"noImplicitOverride": false,
"noUnusedLocals": true,
"noFallthroughCasesInSwitch": true,
"outDir": "dist",
"noUncheckedIndexedAccess": false,
"strictPropertyInitialization": false,
"noImplicitOverride": false,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"baseUrl": ".",
"paths": {
// https://github.com/bevry/istextorbinary/issues/270
// voids the bad types or else ncc fails
"istextorbinary": ["*.sink.d.ts"]
}
"lib": ["es2021", "dom"]
}
}

View File

@ -1,12 +1,7 @@
module.exports = {
extends: require.resolve('@sylo-digital/scripts/eslint/react'),
ignorePatterns: ['**/generated/**'],
rules: {
'@typescript-eslint/consistent-type-assertions': 'off',
'storybook/no-title-property-in-meta': 'off',
'jsx-a11y/media-has-caption': 'off',
'@typescript-eslint/no-confusing-void-expression': 'off',
'@typescript-eslint/no-unnecessary-type-assertion': 'off',
'@typescript-eslint/no-misused-promises': 'off',
extends: require.resolve('@atlasbot/configs/eslint/next'),
parserOptions: {
project: './tsconfig.json',
},
rules: {},
};

View File

@ -1,59 +1,59 @@
{
"name": "@ryanke/micro-web",
"version": "1.0.0",
"license": "GPL-3.0",
"repository": "https://github.com/sylv/micro.git",
"author": "Ryan <ryan@sylver.me>",
"license": "GPL-3.0",
"private": true,
"engine": {
"node": ">=16"
"engines": {
"node": ">=20"
},
"scripts": {
"watch": "NODE_ENV=development concurrently \"next dev\" \"pnpm generate --watch\"",
"build": "NODE_ENV=production next build",
"generate": "graphql-codegen --config codegen.yml",
"lint": "NODE_ENV=production next lint",
"generate": "graphql-codegen --config codegen.yml"
"watch": "NODE_ENV=development concurrently \"next dev\" \"pnpm generate --watch\""
},
"dependencies": {
"@apollo/client": "^3.8.1",
"@apollo/client": "^3.8.8",
"@headlessui/react": "^1.7.17",
"@ryanke/pandora": "^0.0.9",
"@tailwindcss/typography": "^0.5.9",
"autoprefixer": "^10.4.15",
"clsx": "^2.0.0",
"concurrently": "^8.2.1",
"@tailwindcss/typography": "^0.5.10",
"autoprefixer": "^10.4.16",
"clsx": "^2.1.0",
"concurrently": "^8.2.2",
"copy-to-clipboard": "^3.3.3",
"dayjs": "^1.11.9",
"dayjs": "^1.11.10",
"deepmerge": "^4.3.1",
"formik": "^2.4.3",
"formik": "^2.4.5",
"generate-avatar": "1.4.10",
"graphql": "^16.8.0",
"http-status-codes": "^2.2.0",
"graphql": "^16.8.1",
"http-status-codes": "^2.3.0",
"lodash": "^4.17.21",
"nanoid": "^4.0.2",
"next": "13.4.19",
"postcss": "^8.4.29",
"prism-react-renderer": "^2.0.6",
"next": "14.0.4",
"postcss": "^8.4.33",
"prism-react-renderer": "^2.3.1",
"qrcode.react": "^3.1.0",
"react": "18.2.0",
"react-dom": "^18.1.0",
"react-feather": "^2.0.9",
"react-markdown": "^8.0.7",
"remark-gfm": "^3.0.1",
"swr": "^2.2.2",
"tailwindcss": "^3.3.3",
"yup": "^1.2.0"
"react-markdown": "^9.0.1",
"remark-gfm": "^4.0.0",
"swr": "^2.2.4",
"tailwindcss": "^3.4.1",
"yup": "^1.3.3"
},
"devDependencies": {
"@atlasbot/configs": "^10.5.14",
"@graphql-codegen/cli": "^5.0.0",
"@graphql-codegen/typescript": "4.0.1",
"@graphql-codegen/typescript-operations": "4.0.1",
"@graphql-codegen/typescript-react-apollo": "3.3.7",
"@sylo-digital/scripts": "^1.0.12",
"@types/lodash": "^4.14.197",
"@types/node": "^18.15.11",
"@types/react": "^18.2.21",
"prettier": "^3.0.3",
"typescript": "^5.2.2"
"@graphql-codegen/typescript-react-apollo": "4.1.0",
"@parcel/watcher": "^2.3.0",
"@types/lodash": "^4.14.202",
"@types/node": "^20.10.6",
"@types/react": "^18.2.47",
"prettier": "^3.1.1",
"typescript": "^5.3.3"
}
}

View File

@ -1,6 +1,6 @@
import clsx from 'clsx';
import type { Language } from 'prism-react-renderer';
import { Fragment, memo } from 'react';
import { Children, Fragment, memo } from 'react';
import ReactMarkdown from 'react-markdown';
import remarkGfm from 'remark-gfm';
import { SyntaxHighlighter } from './syntax-highlighter/syntax-highlighter';
@ -18,7 +18,7 @@ export const Markdown = memo<{ children: string; className?: string }>(({ childr
'prose-blockquote:font-normal prose-blockquote:not-italic',
// make inline `code` blocks purple
'prose-code:text-primary',
className
className,
);
return (
@ -32,10 +32,15 @@ export const Markdown = memo<{ children: string; className?: string }>(({ childr
// prism syntax highlighter. so this just doesnt render the pre tag.
return <Fragment>{children}</Fragment>;
},
code({ inline, className, children, ...rest }) {
const languageMatch = !inline && className && LANGUAGE_REGEX.exec(className);
const text = languageMatch ? children.filter((child) => typeof child === 'string').join(' ') : null;
if (inline || !languageMatch || !text) {
code({ className, children, ...rest }) {
const languageMatch = className && LANGUAGE_REGEX.exec(className);
const text = languageMatch
? Children.toArray(children)
.filter((child) => typeof child === 'string')
.join(' ')
: null;
if (!languageMatch || !text) {
return (
<code className={className} {...rest}>
{children}
@ -45,7 +50,7 @@ export const Markdown = memo<{ children: string; className?: string }>(({ childr
const language = languageMatch.groups!.language as Language;
return (
<SyntaxHighlighter language={language} className={className} {...rest}>
<SyntaxHighlighter language={language} className={className} {...(rest as any)}>
{text}
</SyntaxHighlighter>
);

View File

@ -24,7 +24,7 @@ export const SyntaxHighlighter = memo<SyntaxHighlighterProps>(
const containerClasses = clsx(
'text-left overflow-x-auto h-full relative',
highlighterClasses,
additionalClasses
additionalClasses,
);
return (
@ -43,5 +43,5 @@ export const SyntaxHighlighter = memo<SyntaxHighlighterProps>(
}}
</Highlight>
);
}
},
);

View File

@ -678,8 +678,15 @@ export function useGetFilesLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions<G
const options = { ...defaultOptions, ...baseOptions };
return Apollo.useLazyQuery<GetFilesQuery, GetFilesQueryVariables>(GetFilesDocument, options);
}
export function useGetFilesSuspenseQuery(
baseOptions?: Apollo.SuspenseQueryHookOptions<GetFilesQuery, GetFilesQueryVariables>,
) {
const options = { ...defaultOptions, ...baseOptions };
return Apollo.useSuspenseQuery<GetFilesQuery, GetFilesQueryVariables>(GetFilesDocument, options);
}
export type GetFilesQueryHookResult = ReturnType<typeof useGetFilesQuery>;
export type GetFilesLazyQueryHookResult = ReturnType<typeof useGetFilesLazyQuery>;
export type GetFilesSuspenseQueryHookResult = ReturnType<typeof useGetFilesSuspenseQuery>;
export type GetFilesQueryResult = Apollo.QueryResult<GetFilesQuery, GetFilesQueryVariables>;
export const GetPastesDocument = gql`
query GetPastes($first: Float, $after: String) {
@ -727,8 +734,15 @@ export function useGetPastesLazyQuery(
const options = { ...defaultOptions, ...baseOptions };
return Apollo.useLazyQuery<GetPastesQuery, GetPastesQueryVariables>(GetPastesDocument, options);
}
export function useGetPastesSuspenseQuery(
baseOptions?: Apollo.SuspenseQueryHookOptions<GetPastesQuery, GetPastesQueryVariables>,
) {
const options = { ...defaultOptions, ...baseOptions };
return Apollo.useSuspenseQuery<GetPastesQuery, GetPastesQueryVariables>(GetPastesDocument, options);
}
export type GetPastesQueryHookResult = ReturnType<typeof useGetPastesQuery>;
export type GetPastesLazyQueryHookResult = ReturnType<typeof useGetPastesLazyQuery>;
export type GetPastesSuspenseQueryHookResult = ReturnType<typeof useGetPastesSuspenseQuery>;
export type GetPastesQueryResult = Apollo.QueryResult<GetPastesQuery, GetPastesQueryVariables>;
export const ConfigDocument = gql`
query Config {
@ -775,8 +789,15 @@ export function useConfigLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions<Con
const options = { ...defaultOptions, ...baseOptions };
return Apollo.useLazyQuery<ConfigQuery, ConfigQueryVariables>(ConfigDocument, options);
}
export function useConfigSuspenseQuery(
baseOptions?: Apollo.SuspenseQueryHookOptions<ConfigQuery, ConfigQueryVariables>,
) {
const options = { ...defaultOptions, ...baseOptions };
return Apollo.useSuspenseQuery<ConfigQuery, ConfigQueryVariables>(ConfigDocument, options);
}
export type ConfigQueryHookResult = ReturnType<typeof useConfigQuery>;
export type ConfigLazyQueryHookResult = ReturnType<typeof useConfigLazyQuery>;
export type ConfigSuspenseQueryHookResult = ReturnType<typeof useConfigSuspenseQuery>;
export type ConfigQueryResult = Apollo.QueryResult<ConfigQuery, ConfigQueryVariables>;
export const GetUserDocument = gql`
query GetUser {
@ -811,8 +832,15 @@ export function useGetUserLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions<Ge
const options = { ...defaultOptions, ...baseOptions };
return Apollo.useLazyQuery<GetUserQuery, GetUserQueryVariables>(GetUserDocument, options);
}
export function useGetUserSuspenseQuery(
baseOptions?: Apollo.SuspenseQueryHookOptions<GetUserQuery, GetUserQueryVariables>,
) {
const options = { ...defaultOptions, ...baseOptions };
return Apollo.useSuspenseQuery<GetUserQuery, GetUserQueryVariables>(GetUserDocument, options);
}
export type GetUserQueryHookResult = ReturnType<typeof useGetUserQuery>;
export type GetUserLazyQueryHookResult = ReturnType<typeof useGetUserLazyQuery>;
export type GetUserSuspenseQueryHookResult = ReturnType<typeof useGetUserSuspenseQuery>;
export type GetUserQueryResult = Apollo.QueryResult<GetUserQuery, GetUserQueryVariables>;
export const LoginDocument = gql`
mutation Login($username: String!, $password: String!, $otp: String) {
@ -1069,8 +1097,15 @@ export function useGetFileLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions<Ge
const options = { ...defaultOptions, ...baseOptions };
return Apollo.useLazyQuery<GetFileQuery, GetFileQueryVariables>(GetFileDocument, options);
}
export function useGetFileSuspenseQuery(
baseOptions?: Apollo.SuspenseQueryHookOptions<GetFileQuery, GetFileQueryVariables>,
) {
const options = { ...defaultOptions, ...baseOptions };
return Apollo.useSuspenseQuery<GetFileQuery, GetFileQueryVariables>(GetFileDocument, options);
}
export type GetFileQueryHookResult = ReturnType<typeof useGetFileQuery>;
export type GetFileLazyQueryHookResult = ReturnType<typeof useGetFileLazyQuery>;
export type GetFileSuspenseQueryHookResult = ReturnType<typeof useGetFileSuspenseQuery>;
export type GetFileQueryResult = Apollo.QueryResult<GetFileQuery, GetFileQueryVariables>;
export const DeleteFileDocument = gql`
mutation DeleteFile($fileId: ID!, $deleteKey: String) {
@ -1141,8 +1176,15 @@ export function useGetInviteLazyQuery(
const options = { ...defaultOptions, ...baseOptions };
return Apollo.useLazyQuery<GetInviteQuery, GetInviteQueryVariables>(GetInviteDocument, options);
}
export function useGetInviteSuspenseQuery(
baseOptions?: Apollo.SuspenseQueryHookOptions<GetInviteQuery, GetInviteQueryVariables>,
) {
const options = { ...defaultOptions, ...baseOptions };
return Apollo.useSuspenseQuery<GetInviteQuery, GetInviteQueryVariables>(GetInviteDocument, options);
}
export type GetInviteQueryHookResult = ReturnType<typeof useGetInviteQuery>;
export type GetInviteLazyQueryHookResult = ReturnType<typeof useGetInviteLazyQuery>;
export type GetInviteSuspenseQueryHookResult = ReturnType<typeof useGetInviteSuspenseQuery>;
export type GetInviteQueryResult = Apollo.QueryResult<GetInviteQuery, GetInviteQueryVariables>;
export const CreateUserDocument = gql`
mutation CreateUser($user: CreateUserDto!) {
@ -1261,8 +1303,15 @@ export function useGetPasteLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions<G
const options = { ...defaultOptions, ...baseOptions };
return Apollo.useLazyQuery<GetPasteQuery, GetPasteQueryVariables>(GetPasteDocument, options);
}
export function useGetPasteSuspenseQuery(
baseOptions?: Apollo.SuspenseQueryHookOptions<GetPasteQuery, GetPasteQueryVariables>,
) {
const options = { ...defaultOptions, ...baseOptions };
return Apollo.useSuspenseQuery<GetPasteQuery, GetPasteQueryVariables>(GetPasteDocument, options);
}
export type GetPasteQueryHookResult = ReturnType<typeof useGetPasteQuery>;
export type GetPasteLazyQueryHookResult = ReturnType<typeof useGetPasteLazyQuery>;
export type GetPasteSuspenseQueryHookResult = ReturnType<typeof useGetPasteSuspenseQuery>;
export type GetPasteQueryResult = Apollo.QueryResult<GetPasteQuery, GetPasteQueryVariables>;
export const ShortenDocument = gql`
mutation Shorten($link: String!, $host: String) {

File diff suppressed because it is too large Load Diff