Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
b841679
chore: Initial vite migration
null2264 Sep 23, 2023
cfedf96
lint: Fix vite eslint
null2264 Sep 23, 2023
8cbf871
chore: Migrate HtmlWebpackPlugin
null2264 Sep 23, 2023
4cf5953
chore: Migrate CopyPlugin
null2264 Sep 23, 2023
38438fa
chore: Replace webpack script with vite
null2264 Sep 23, 2023
3e7d677
ci: Trigger for refactor/ branches
null2264 Sep 23, 2023
ef3dbcc
fix: Snippets
null2264 Sep 23, 2023
38db319
chore: Rename index.ejs -> index.html
null2264 Sep 23, 2023
a72a96c
ci: `static/` -> `dist/`
null2264 Sep 23, 2023
1802157
chore: Migrate ServiceWorker to Vite
null2264 Sep 23, 2023
87d496b
chore: Import locales at compile time
null2264 Sep 23, 2023
bda45b2
chore: Exported locales should contain `data` property
null2264 Sep 23, 2023
8540959
chore: Register SW
null2264 Sep 23, 2023
a138eb5
ci: Keep it `static/`
null2264 Sep 23, 2023
a0e3e35
refactor: Set output dir from vite config
null2264 Sep 24, 2023
0f356dc
chore: Add `require(...)` support back
null2264 Sep 24, 2023
b30d3f0
feat: Resolve and stuff
null2264 Sep 24, 2023
a9b0415
fix: Move index.html
null2264 Sep 24, 2023
03c8a03
fix: Resolve ambigous import
null2264 Sep 24, 2023
0384a15
fix: Browserify path
null2264 Sep 24, 2023
159e3f8
chore: Remove crypto related stuff
null2264 Sep 24, 2023
fc04db3
fix: Use `@akryum/flexsearch-es`
null2264 Sep 24, 2023
f84bb41
fix: webpack -> vite-ignore
null2264 Sep 24, 2023
27de7aa
fix: Vite env
null2264 Sep 24, 2023
1d562aa
chore: Ignore some vite temp files
null2264 Sep 24, 2023
9cefc95
revert: Vite env
null2264 Sep 24, 2023
b78c207
revert: Vite env
null2264 Sep 24, 2023
9106877
chore: More vite env stuff
null2264 Sep 25, 2023
bb87115
fix: CSP
null2264 Sep 25, 2023
bd2259c
fix: Entrypoint shouldn't be a relative path
null2264 Sep 25, 2023
4270d9c
fix: Adjust initial nonce
null2264 Sep 25, 2023
ba553c3
chore: TS Checker
null2264 Sep 25, 2023
d47521a
fix: Adjust eslintignore
null2264 Sep 25, 2023
a46872c
lint: Adjust eslintignore
null2264 Sep 25, 2023
79891dd
fix: Adjust lint command
null2264 Sep 25, 2023
ce34cc0
chore: Disable eslint checker for now
null2264 Sep 25, 2023
fbeb263
chore: It's actually ts checker that keep checking node_modules
null2264 Sep 25, 2023
9a4993e
fix: lint command
null2264 Sep 25, 2023
ade6b80
chore: Disable stylelint
null2264 Sep 25, 2023
459741a
fix: Yarn can't be used for lint command
null2264 Sep 25, 2023
2e961a0
chore: Temporarily disable eslint
null2264 Sep 25, 2023
edcd2c2
fix: CSP in dev mode
null2264 Sep 25, 2023
705cca6
chore: CSP adjustment
null2264 Sep 25, 2023
6b1bf36
fix: Slight adjustment
null2264 Sep 25, 2023
86ba5ee
fix: CSP forr vite-plugin-checker
null2264 Sep 25, 2023
79c5aaa
fix: Resolve warnings
null2264 Sep 25, 2023
f7574fb
fix: More warning fixing
null2264 Sep 25, 2023
dae2351
fix: Yet another warning fixes
null2264 Sep 25, 2023
fc1e446
fix: SW typing
null2264 Sep 25, 2023
baf545c
fix: It's webworker not dom
null2264 Sep 25, 2023
0bcd0f9
chore: Remove webpack
null2264 Sep 25, 2023
c92b3a3
chore: Disable eslint and stylelint
null2264 Sep 25, 2023
269a279
fix: Hopefully one last error fix
null2264 Sep 25, 2023
657b319
chore: Merge branch 'develop' into refactor/vite
null2264 Sep 25, 2023
53f4f27
chore: Update immer to v10
null2264 Sep 25, 2023
d465110
fix: Regex
null2264 Sep 25, 2023
7420d60
chore: Update more deps
null2264 Sep 25, 2023
de496e5
chore: Downgrade toast to v2.4.0
null2264 Sep 25, 2023
4e14abf
chore: Remove dangerfile
null2264 Sep 25, 2023
14bac9e
fix: Dynamic locale import
null2264 Sep 25, 2023
913b114
fix: Try use __webpack_nonce__ just in case
null2264 Sep 25, 2023
7c4e15f
fix: vite-plugin-require
null2264 Sep 25, 2023
7fd4d6b
revert: Revert "fix: vite-plugin-require"
null2264 Sep 26, 2023
beba57a
chore: Remove keymap temporarily
null2264 Sep 27, 2023
5f5502e
fix: Goober
null2264 Sep 27, 2023
5e529b9
fix: nonce
null2264 Sep 27, 2023
0e9f477
chore: Temporarily disable hotkey
null2264 Sep 27, 2023
8b7a558
fix: Properly null check textarea
null2264 Sep 27, 2023
cea6dab
fix: NODE_ENV
null2264 Sep 27, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
NODE_ENV=development
# NODE_ENV=development
# BACKEND_URL="https://example.com"
# PROXY_HTTPS_INSECURE=false
2 changes: 1 addition & 1 deletion .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,6 @@ module.exports = {
alphabetize: { order: 'asc' },
},
],
'@typescript-eslint/no-duplicate-imports': 'error',
'@typescript-eslint/member-delimiter-style': [
'error',
{
Expand All @@ -285,6 +284,7 @@ module.exports = {
},
],
'tailwindcss/migration-from-tailwind-2': 'error',
'tailwindcss/no-custom-classname': 'warn',
},
overrides: [
{
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
- develop
- feat/**
- fix/**
- refactor/**
release:
types: [ published ]

Expand All @@ -27,7 +28,7 @@ jobs:
yarn install --ignore-scripts
yarn patch-package
env NODE_ENV=production yarn build
zip -r static.zip static
zip -r static.zip static/
# -- For artifact
mkdir __build/
cp -r static/ __build/
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
/.vs/
yarn-error.log*
/junit.xml
*.timestamp-*
*.bundled_*

/static/
/static-test/
Expand Down
2 changes: 1 addition & 1 deletion app/soapbox/actions/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { createSelector } from 'reselect';
import { v4 as uuid } from 'uuid';

import { patchMe } from 'soapbox/actions/me';
import messages from 'soapbox/locales/messages';
import messages from 'soapbox/messages';
import toast from 'soapbox/toast';
import { isLoggedIn } from 'soapbox/utils/auth';

Expand Down
2 changes: 1 addition & 1 deletion app/soapbox/actions/streaming.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { getLocale, getSettings } from 'soapbox/actions/settings';
import { importEntities } from 'soapbox/entity-store/actions';
import { Entities } from 'soapbox/entity-store/entities';
import { selectEntity } from 'soapbox/entity-store/selectors';
import messages from 'soapbox/locales/messages';
import messages from 'soapbox/messages';
import { ChatKeys, IChat, isLastMessage } from 'soapbox/queries/chats';
import { queryClient } from 'soapbox/queries/client';
import { getUnreadChatsCount, updateChatListItem, updateChatMessage } from 'soapbox/utils/chats';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,43 +4,41 @@
* @module soapbox/build-config
*/

const trim = require('lodash/trim');
const trimEnd = require('lodash/trimEnd');
// eslint-disable-next-line import/extensions
import trim from 'lodash/trim.js';
// eslint-disable-next-line import/extensions
import trimEnd from 'lodash/trimEnd.js';

const {
NODE_ENV,
BACKEND_URL,
FE_SUBDIRECTORY,
FE_BUILD_DIR,
FE_INSTANCE_SOURCE_DIR,
SENTRY_DSN,
} = process.env;
} = process.env || {};

const sanitizeURL = url => {
const sanitizeURL = (url: string | undefined = '') => {
try {
return trimEnd(new URL(url).toString(), '/');
} catch {
return '';
}
};

const sanitizeBasename = path => {
const sanitizeBasename = (path: string | undefined = '') => {
return `/${trim(path, '/')}`;
};

const sanitizePath = path => {
return trim(path, '/');
};

// JSON.parse/stringify is to emulate what @preval is doing and avoid any
// inconsistent behavior in dev mode
const sanitize = obj => JSON.parse(JSON.stringify(obj));

module.exports = sanitize({
const env = {
NODE_ENV: NODE_ENV || 'development',
BACKEND_URL: sanitizeURL(BACKEND_URL),
FE_SUBDIRECTORY: sanitizeBasename(FE_SUBDIRECTORY),
FE_BUILD_DIR: sanitizePath(FE_BUILD_DIR) || 'static',
FE_INSTANCE_SOURCE_DIR: FE_INSTANCE_SOURCE_DIR || 'instance',
SENTRY_DSN,
};

export type BuildConfig = typeof env;

export default () => ({
data: env,
});
9 changes: 9 additions & 0 deletions app/soapbox/build-config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import type { BuildConfig } from './build-config-compiletime';

export const {
NODE_ENV,
BACKEND_URL,
FE_SUBDIRECTORY,
FE_INSTANCE_SOURCE_DIR,
SENTRY_DSN,
} = import.meta.compileTime<BuildConfig>('./build-config-compiletime.ts');
11 changes: 10 additions & 1 deletion app/soapbox/components/autosuggest-textarea.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { install, uninstall } from '@github/hotkey';
import clsx from 'clsx';
import React from 'react';
import ImmutablePureComponent from 'react-immutable-pure-component';
Expand Down Expand Up @@ -30,12 +31,14 @@ interface IAutosuggesteTextarea {
onFocus: () => void
onBlur?: () => void
condensed?: boolean
keymap?: string
children: React.ReactNode
}

class AutosuggestTextarea extends ImmutablePureComponent<IAutosuggesteTextarea> {

textarea: HTMLTextAreaElement | null = null;
keymap?: string = undefined;

static defaultProps = {
autoFocus: true,
Expand Down Expand Up @@ -171,8 +174,13 @@ class AutosuggestTextarea extends ImmutablePureComponent<IAutosuggesteTextarea>

setTextarea: React.Ref<HTMLTextAreaElement> = (c) => {
this.textarea = c;
if (this.textarea && this.keymap) install(this.textarea, this.keymap);
};

componentWillUnmount(): void {
if (this.textarea && this.keymap) uninstall(this.textarea);
}

onPaste: React.ClipboardEventHandler<HTMLTextAreaElement> = (e) => {
if (e.clipboardData && e.clipboardData.files.length === 1) {
this.props.onPaste(e.clipboardData.files);
Expand Down Expand Up @@ -227,7 +235,8 @@ class AutosuggestTextarea extends ImmutablePureComponent<IAutosuggesteTextarea>
}

render() {
const { value, suggestions, disabled, placeholder, onKeyUp, autoFocus, children, condensed, id } = this.props;
const { value, suggestions, disabled, placeholder, onKeyUp, autoFocus, children, condensed, id, keymap } = this.props;
if (keymap) this.keymap = keymap;
const { suggestionsHidden } = this.state;
const style = { direction: 'ltr', minRows: 10 };

Expand Down
Loading