Merge branch 'develop' into hooks-migration

Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
marcin mikołajczak
2024-09-27 18:35:13 +02:00
11 changed files with 1108 additions and 640 deletions

View File

@ -1,47 +0,0 @@
module.exports = (api) => {
const env = api.env();
const envOptions = {
debug: false,
modules: false,
useBuiltIns: 'usage',
corejs: '3.27',
};
const config = {
presets: [
'@babel/react',
'@babel/typescript',
['@babel/env', envOptions],
],
plugins: [
'formatjs',
'preval',
],
'sourceType': 'unambiguous',
};
switch (env) {
case 'production':
config.plugins.push(...[
'@babel/transform-react-inline-elements',
[
'@babel/transform-runtime',
{
helpers: true,
regenerator: false,
useESModules: true,
},
],
]);
break;
case 'test':
config.plugins.push(...[
'transform-require-context',
]);
envOptions.modules = 'commonjs';
break;
}
return config;
};

View File

@ -39,27 +39,21 @@
"not dead"
],
"dependencies": {
"@akryum/flexsearch-es": "^0.7.32",
"@babel/plugin-transform-react-inline-elements": "^7.22.5",
"@babel/plugin-transform-runtime": "^7.22.15",
"@babel/preset-env": "^7.22.15",
"@babel/preset-react": "^7.22.15",
"@babel/preset-typescript": "^7.22.15",
"@emoji-mart/data": "^1.1.2",
"@floating-ui/react": "^0.26.24",
"@fontsource/inter": "^5.0.0",
"@fontsource/noto-sans-javanese": "^5.0.16",
"@fontsource/roboto-mono": "^5.0.0",
"@fontsource/tajawal": "^5.0.8",
"@lexical/clipboard": "^0.14.5",
"@lexical/code": "^0.14.5",
"@lexical/hashtag": "^0.14.5",
"@lexical/link": "^0.14.5",
"@lexical/list": "^0.14.5",
"@lexical/react": "^0.14.5",
"@lexical/rich-text": "^0.14.5",
"@lexical/selection": "^0.14.5",
"@lexical/utils": "^0.14.5",
"@lexical/clipboard": "^0.18.0",
"@lexical/code": "^0.18.0",
"@lexical/hashtag": "^0.18.0",
"@lexical/link": "^0.18.0",
"@lexical/list": "^0.18.0",
"@lexical/react": "^0.18.0",
"@lexical/rich-text": "^0.18.0",
"@lexical/selection": "^0.18.0",
"@lexical/utils": "^0.18.0",
"@mkljczk/lexical-remark": "^0.4.0",
"@mkljczk/react-hotkeys": "^1.2.2",
"@popperjs/core": "^2.11.5",
@ -71,36 +65,16 @@
"@reduxjs/toolkit": "^2.0.1",
"@sentry/browser": "^7.74.1",
"@sentry/react": "^7.74.1",
"@tabler/icons": "^3.1.0",
"@tabler/icons": "^3.18.0",
"@tailwindcss/aspect-ratio": "^0.4.2",
"@tailwindcss/forms": "^0.5.9",
"@tailwindcss/typography": "^0.5.15",
"@tanstack/react-query": "^5.56.2",
"@tanstack/react-virtual": "^3.10.8",
"@types/escape-html": "^1.0.1",
"@types/http-link-header": "^1.0.3",
"@types/leaflet": "^1.8.0",
"@types/lodash": "^4.14.180",
"@types/object-assign": "^4.0.30",
"@types/path-browserify": "^1.0.0",
"@types/react": "^18.0.26",
"@types/react-color": "^3.0.6",
"@types/react-datepicker": "^4.4.2",
"@types/react-dom": "^18.0.10",
"@types/react-helmet": "^6.1.5",
"@types/react-motion": "^0.0.40",
"@types/react-router-dom": "^5.3.3",
"@types/react-sparklines": "^1.7.2",
"@types/react-swipeable-views": "^0.13.1",
"@types/redux-mock-store": "^1.0.6",
"@types/semver": "^7.3.9",
"@types/uuid": "^9.0.0",
"@uidotdev/usehooks": "^2.4.1",
"@vitejs/plugin-react": "^4.3.1",
"@webbtc/webln-types": "^3.0.0",
"autoprefixer": "^10.4.15",
"babel-plugin-formatjs": "^10.5.6",
"babel-plugin-preval": "^5.1.0",
"blurhash": "^2.0.0",
"bowser": "^2.11.0",
"browserslist": "^4.16.6",
@ -115,6 +89,7 @@
"escape-html": "^1.0.3",
"exifr": "^7.1.3",
"fasttext.wasm.js": "^1.0.0",
"flexsearch": "^0.7.43",
"fuzzysort": "^3.0.0",
"graphemesplit": "^2.4.4",
"html-react-parser": "^5.0.0",
@ -126,7 +101,7 @@
"intl-pluralrules": "^2.0.0",
"isomorphic-dompurify": "^2.3.0",
"leaflet": "^1.8.0",
"lexical": "^0.14.5",
"lexical": "^0.18.0",
"line-awesome": "^1.3.0",
"localforage": "^1.10.0",
"lodash": "^4.7.11",
@ -137,8 +112,8 @@
"postcss": "^8.4.29",
"process": "^0.11.10",
"punycode": "^2.1.1",
"qrcode.react": "^3.1.0",
"query-string": "^9.0.0",
"qrcode.react": "^4.0.1",
"query-string": "^9.1.0",
"react": "^18.0.0",
"react-color": "^2.19.3",
"react-datepicker": "^4.8.0",
@ -165,22 +140,22 @@
"redux-thunk": "^3.1.0",
"reselect": "^5.0.0",
"resize-observer-polyfill": "^1.5.1",
"sass": "^1.69.5",
"semver": "^7.3.8",
"stringz": "^2.0.0",
"sass": "^1.79.3",
"semver": "^7.6.3",
"stringz": "^2.1.0",
"tiny-queue": "^0.2.1",
"tslib": "^2.3.1",
"tslib": "^2.7.0",
"twemoji": "https://github.com/twitter/twemoji#v14.0.2",
"type-fest": "^4.0.0",
"typescript": "^5.6.2",
"util": "^0.12.5",
"uuid": "^9.0.0",
"vite": "^5.4.7",
"uuid": "^10.0.0",
"vite": "^5.4.8",
"vite-plugin-compile-time": "^0.2.1",
"vite-plugin-html": "^3.2.2",
"vite-plugin-require": "^1.2.14",
"vite-plugin-static-copy": "^1.0.6",
"wicg-inert": "^3.1.1",
"wicg-inert": "^3.1.3",
"zod": "^3.23.8",
"zustand": "^5.0.0-rc.2"
},
@ -193,9 +168,26 @@
"@testing-library/react": "^14.0.0",
"@testing-library/react-hooks": "^8.0.1",
"@testing-library/user-event": "^14.5.1",
"@types/escape-html": "^1.0.1",
"@types/http-link-header": "^1.0.3",
"@types/leaflet": "^1.8.0",
"@types/lodash": "^4.14.180",
"@types/object-assign": "^4.0.30",
"@types/path-browserify": "^1.0.0",
"@types/react": "^18.0.26",
"@types/react-color": "^3.0.6",
"@types/react-datepicker": "^4.4.2",
"@types/react-dom": "^18.0.10",
"@types/react-helmet": "^6.1.5",
"@types/react-motion": "^0.0.40",
"@types/react-router-dom": "^5.3.3",
"@types/react-sparklines": "^1.7.2",
"@types/react-swipeable-views": "^0.13.1",
"@types/redux-mock-store": "^1.0.6",
"@types/semver": "^7.3.9",
"@types/uuid": "^9.0.0",
"@typescript-eslint/eslint-plugin": "^8.6.0",
"@typescript-eslint/parser": "^8.6.0",
"babel-plugin-transform-require-context": "^0.1.1",
"eslint": "^8.57.1",
"eslint-import-resolver-typescript": "^3.6.3",
"eslint-plugin-compat": "^6.0.1",
@ -215,6 +207,7 @@
"rollup-plugin-visualizer": "^5.9.2",
"stylelint": "^16.0.2",
"stylelint-config-standard-scss": "^12.0.0",
"tailwind": "^4.0.0",
"tailwindcss": "^3.4.12",
"vite-plugin-checker": "^0.8.0",
"vite-plugin-pwa": "^0.20.5",

View File

@ -1,7 +0,0 @@
{
"extends": [
"config:base",
":preserveSemverRanges"
],
"rebaseWhen": "conflicted"
}

View File

@ -1,31 +0,0 @@
import { Gitlab } from '@gitbeaker/node';
import { getChanges } from './lib/changelog';
const {
CI_COMMIT_TAG,
CI_JOB_TOKEN,
CI_PROJECT_ID,
} = process.env;
const api = new Gitlab({
host: 'https://gitlab.com',
jobToken: CI_JOB_TOKEN,
});
const main = async () => {
await api.Releases.create(CI_PROJECT_ID!, {
name: CI_COMMIT_TAG,
tag_name: CI_COMMIT_TAG,
description: '## Changelog\n\n' + getChanges(CI_COMMIT_TAG!),
assets: {
links: [{
name: 'Build',
url: `https://gitlab.com/soapbox-pub/soapbox/-/jobs/artifacts/${CI_COMMIT_TAG}/download?job=build-production`,
link_type: 'package',
}],
},
});
};
main();

View File

@ -1,32 +0,0 @@
import fs from 'fs';
import { join } from 'path';
/** Parse the changelog into an object. */
const parseChangelog = (changelog: string): Record<string, string> => {
const result: Record<string, string> = {};
let currentVersion: string;
changelog.split('\n').forEach(line => {
const match = line.match(/^## \[([\d.]+)\](?: - [\d-]+)?$/);
if (match) {
currentVersion = match[1];
} else if (currentVersion) {
result[currentVersion] = (result[currentVersion] || '') + line + '\n';
}
});
return result;
};
/** Get Markdown changes for a specific version. */
const getChanges = (version: string) => {
version = version.replace('v', '');
const content = fs.readFileSync(join(__dirname, '..', '..', 'CHANGELOG.md'), 'utf8');
const parsed = parseChangelog(content);
return (parsed[version] || '').trim();
};
export {
parseChangelog,
getChanges,
};

View File

@ -15,7 +15,7 @@ const useAccountScrobble = (accountId?: string, opts: UseScrobblesOpts = {}) =>
const { data: scrobble, ...result } = useQuery<Scrobble>({
queryKey: ['scrobbles', accountId!],
queryFn: async () => (await client.accounts.getScrobbles(accountId!, { limit: 1 })).items[0],
queryFn: async () => (await client.accounts.getScrobbles(accountId!, { limit: 1 })).items[0] || null,
placeholderData: undefined,
enabled: enabled && !!accountId && features.scrobbles,
staleTime: 3 * 60 * 1000,

View File

@ -707,7 +707,7 @@ const StatusActionBar: React.FC<IStatusActionBar> = ({
>
<StatusActionButton
title={replyTitle}
icon={require('@tabler/icons/outline/message-circle-2.svg')}
icon={require('@tabler/icons/outline/message-circle.svg')}
onClick={handleReplyClick}
count={replyCount}
text={withLabels ? intl.formatMessage(messages.reply) : undefined}

View File

@ -1,12 +1,11 @@
import Index from '@akryum/flexsearch-es';
import FlexSearch from 'flexsearch';
import data from './data';
import type { Emoji } from './index';
import type { CustomEmoji } from 'pl-api';
// @ts-ignore Wrong default export.
const index: Index.Index = new Index({
const index = new FlexSearch.Index({
tokenize: 'full',
optimize: true,
context: true,

View File

@ -1,11 +1,11 @@
.status {
@apply min-h-[54px] cursor-default opacity-100;
animation: fade 150ms linear;
@keyframes fade {
0% { opacity: 0; }
100% { opacity: 1; }
}
animation: fade 150ms linear;
}
[column-type='filled'] .status__wrapper,

View File

@ -46,13 +46,7 @@ const config = defineConfig(({ command }) => ({
},
},
}),
react({
// Use React plugin in all *.jsx and *.tsx files
include: '**/*.{jsx,tsx}',
babel: {
configFile: './babel.config.cjs',
},
}),
react(),
VitePWA({
injectRegister: null,
strategies: 'injectManifest',

File diff suppressed because it is too large Load Diff