Skip to content

Commit

Permalink
⬆️ Upgrade frontend-tooling and docs (#486)
Browse files Browse the repository at this point in the history
* wip: fix tsc errors

* wip: add lerna, pre-start upgrading dev tooling

* wip: upgrade eslint

* wip: fix lints

* wip: so many

* wow

* lots of changes

* wip: more fixes

* fix components tsc checks

* fix lints!

* fix oopsie

* wow

* adjust ci

* ugh

* upgrade docs

* fix redirects, add sdk docs

* bump node version in ci

* fix docs lint

* bump docker node version

* sigh

* ignore transpiled tests

* small doc changes
  • Loading branch information
aaronleopold authored Oct 20, 2024
1 parent cf12bfd commit 95e7da2
Show file tree
Hide file tree
Showing 462 changed files with 6,035 additions and 3,503 deletions.
8 changes: 0 additions & 8 deletions .eslintignore

This file was deleted.

63 changes: 0 additions & 63 deletions .eslintrc.js

This file was deleted.

4 changes: 2 additions & 2 deletions .github/actions/setup-yarn/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ runs:
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: '20.0.0'
node-version: '20.9.0'

- name: Install yarn
shell: bash
Expand All @@ -23,7 +23,7 @@ runs:
if: ${{ inputs.cache-dependencies == 'true' }}
uses: actions/setup-node@v4
with:
node-version: '20.0.0'
node-version: '20.9.0'
cache: 'yarn'

- name: Install dependencies
Expand Down
4 changes: 0 additions & 4 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,5 @@ jobs:
- name: Run TypeScript lints
run: yarn lint

# TODO: Figure out how to run tests in parallel, I don't really want to upgrade to berry which
# means perhaps lerna is the only option? It isn't a big deal now since there is really only one
# package that defines tests, but this will change over time
- name: Run TypeScript tests
run: yarn test
working-directory: ./packages/browser
1 change: 0 additions & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx lint-staged
6 changes: 0 additions & 6 deletions .vscode/.todo

This file was deleted.

3 changes: 1 addition & 2 deletions apps/desktop/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
"description": "",
"license": "MIT",
"scripts": {
"lint": "cargo clippy --package stump_desktop -- -D warnings",
"format": "cargo fmt --package stump_desktop",
"lint": "eslint .",
"tauri": "tauri",
"start": "tauri dev --no-watch",
"start-bundled": "yarn tauri dev --no-watch -- --features bundled-server",
Expand Down
1 change: 0 additions & 1 deletion apps/desktop/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ function App() {
try {
const currentServer = await store.get<SavedServer>('active_server')
if (token && currentServer) {
console.debug('Saving API token for', currentServer.name)
await tauriRPC.setApiToken(currentServer.name, token)
}
} catch (err) {
Expand Down
1 change: 1 addition & 0 deletions apps/expo/src/AppEntry.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ SplashScreen.preventAutoHideAsync()

export function AppEntry() {
const [loaded, error] = useFonts({
// eslint-disable-next-line @typescript-eslint/no-require-imports
SpaceMono: require('../assets/fonts/SpaceMono-Regular.ttf'),
})

Expand Down
2 changes: 0 additions & 2 deletions apps/expo/src/components/reader/UnsupportedReader.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import React from 'react'

import { ScreenRootView, Text } from '../primitives'

export default function UnsupportedReader() {
Expand Down
1 change: 0 additions & 1 deletion apps/expo/src/components/reader/epub/EpubJSFooter.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { useReader } from '@epubjs-react-native/core'
import React from 'react'
import { useSafeAreaInsets } from 'react-native-safe-area-context'

import { Text, View } from '@/components/primitives'
Expand Down
2 changes: 1 addition & 1 deletion apps/expo/src/components/reader/epub/EpubJSReader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { useSDK } from '@stump/client'
import { isAxiosError } from '@stump/sdk'
import { Media } from '@stump/sdk'
import { useColorScheme } from 'nativewind'
import React, { useCallback, useEffect, useState } from 'react'
import { useCallback, useEffect, useState } from 'react'
import { useWindowDimensions } from 'react-native'

import EpubJSReaderContainer from './EpubJSReaderContainer'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { ReaderProvider } from '@epubjs-react-native/core'
import React from 'react'

import { ScreenRootView, View } from '@/components/primitives'

Expand Down
2 changes: 1 addition & 1 deletion apps/expo/src/components/reader/epub/LoadingSpinner.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { LoadingFileProps } from '@epubjs-react-native/core'
import React, { useEffect, useState } from 'react'
import { useEffect, useState } from 'react'

import { Text, View } from '@/components/primitives'

Expand Down
2 changes: 1 addition & 1 deletion apps/expo/src/components/reader/image/ImageBasedReader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { useSDK, useUpdateMediaProgress } from '@stump/client'
import { isAxiosError } from '@stump/sdk'
import { Media } from '@stump/sdk'
import { useColorScheme } from 'nativewind'
import React, { useCallback, useMemo, useState } from 'react'
import { useCallback, useMemo, useState } from 'react'
import { FlatList, TouchableWithoutFeedback, useWindowDimensions } from 'react-native'
import { useSafeAreaInsets } from 'react-native-safe-area-context'

Expand Down
2 changes: 0 additions & 2 deletions apps/expo/src/components/reader/image/ReaderContainer.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import React from 'react'

import { ScreenRootView } from '@/components/primitives'

type Props = {
Expand Down
2 changes: 0 additions & 2 deletions apps/expo/src/constants/colors.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* eslint-disable sort-keys-fix/sort-keys-fix */

export const gray = {
DEFAULT: '#292C30',
50: '#E2E4E6',
Expand Down
6 changes: 4 additions & 2 deletions apps/expo/src/screens/LoginOrClaim.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { zodResolver } from '@hookform/resolvers/zod'
import { useLoginOrRegister } from '@stump/client'
import React, { useCallback } from 'react'
import { useCallback } from 'react'
import { Controller, useForm } from 'react-hook-form'
import { Image, Text, TouchableOpacity, View } from 'react-native'
import { z } from 'zod'
Expand Down Expand Up @@ -41,7 +41,7 @@ export default function LoginOrClaim() {
await registerUser({ password, username })
await loginUser({ password, username })
}
} catch (error) {
} catch {
// TODO: alert error or set error somewhere
}
},
Expand All @@ -53,6 +53,7 @@ export default function LoginOrClaim() {
// just return a view with the icon.png:
return (
<View>
{/* eslint-disable-next-line @typescript-eslint/no-require-imports */}
<Image className="h-32 w-32" source={require('../../assets/images/icon.png')} />
</View>
)
Expand All @@ -63,6 +64,7 @@ export default function LoginOrClaim() {
<Text className="mb-3 text-center text-sm">
Enter a username and password to claim it
</Text>
{/* eslint-disable-next-line @typescript-eslint/no-require-imports */}
<Image className="h-24 w-24" source={require('../../assets/images/icon.png')} />
</View>
)
Expand Down
2 changes: 0 additions & 2 deletions apps/expo/src/screens/ServerNotAccessible.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import React from 'react'

import { ScreenRootView, Text } from '@/components'

// TODO: This component needs to be aware:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { createNativeStackNavigator } from '@react-navigation/native-stack'
import React from 'react'

import { BookStackNavigator } from './book'
import MainTabNavigator from './MainTabNavigator'
Expand Down
1 change: 0 additions & 1 deletion apps/expo/src/screens/authenticated/Home.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { queryClient, useSDK } from '@stump/client'
import React from 'react'
import { Button } from 'react-native'

import { ScreenRootView, Text } from '@/components'
Expand Down
1 change: 0 additions & 1 deletion apps/expo/src/screens/authenticated/MainTabNavigator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import {
Settings as SettingsIcon,
} from 'lucide-react-native'
import { useColorScheme } from 'nativewind'
import React from 'react'

import { gray } from '@/constants/colors'
import { usePreferencesStore } from '@/stores'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { RouteProp, useRoute } from '@react-navigation/native'
import { ARCHIVE_EXTENSION, EBOOK_EXTENSION, PDF_EXTENSION, useMediaByIdQuery } from '@stump/client'
import React from 'react'

import { EpubJSReader, ImageBasedReader, UnsupportedReader } from '@/components/reader'

Expand Down
2 changes: 1 addition & 1 deletion apps/expo/src/screens/authenticated/explore/Explore.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useNavigation } from '@react-navigation/native'
import { useMediaCursorQuery } from '@stump/client'
import React, { useCallback } from 'react'
import { useCallback } from 'react'
import { FlatList } from 'react-native'

import { ScreenRootView, View } from '@/components'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useNavigation } from '@react-navigation/native'
import { useLibraries } from '@stump/client'
import { Library } from '@stump/sdk'
import React, { useCallback } from 'react'
import { useCallback } from 'react'
import { FlatList, TouchableOpacity } from 'react-native'

import { ScreenRootView, Text, View } from '@/components'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { type RouteProp, useNavigation, useRoute } from '@react-navigation/native'
import { useMediaCursorQuery } from '@stump/client'
import React, { useCallback } from 'react'
import { useCallback } from 'react'
import { FlatList } from 'react-native'

import { ScreenRootView, View } from '@/components'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { type RouteProp, useNavigation, useRoute } from '@react-navigation/native'
import { useSeriesCursorQuery } from '@stump/client'
import { Series } from '@stump/sdk'
import React, { useCallback } from 'react'
import { useCallback } from 'react'
import { FlatList, TouchableOpacity } from 'react-native'

import { ScreenRootView, Text, View } from '@/components'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { ChevronRight } from 'lucide-react-native'
import { useColorScheme } from 'nativewind'
import React from 'react'

import { Link, Text, View } from '@/components'
import { gray } from '@/constants/colors'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { NavigationProp } from '@react-navigation/native'
import { createNativeStackNavigator } from '@react-navigation/native-stack'
import React from 'react'

import { AccountSettings, AppearanceSettings } from './app'
import SettingsRoot from './SettingsRoot'
Expand Down
2 changes: 0 additions & 2 deletions apps/expo/src/screens/authenticated/settings/SettingsRoot.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import React from 'react'

import { ScreenRootView, Text, View } from '@/components'

import SettingsListItem from './SettingsListItem'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { useColorScheme } from 'nativewind'
import React from 'react'
import { Switch } from 'react-native'

import { Text, View } from '@/components'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react'
import { Switch } from 'react-native'

import { Text, View } from '@/components'
Expand Down
2 changes: 0 additions & 2 deletions apps/expo/src/screens/offline/Downloads.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import React from 'react'

import { ScreenRootView, Text } from '@/components'

export default function Downloads() {
Expand Down
2 changes: 0 additions & 2 deletions apps/expo/tailwind.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* eslint-disable sort-keys-fix/sort-keys-fix */

/** @type {import('tailwindcss').Config} */
module.exports = {
content: ['./src/**/*.{js,jsx,ts,tsx}'],
Expand Down
15 changes: 0 additions & 15 deletions apps/server/package.json

This file was deleted.

4 changes: 4 additions & 0 deletions apps/web/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
"jsx": "preserve",
"module": "es2022",
"moduleResolution": "Node",
"composite": true,
"declaration": true,
"emitDeclarationOnly": true,
"outDir": "dist",
"paths": {
"@stump/client": ["../../packages/client/src/index.ts"],
"@stump/client/*": ["../../packages/client/src/*"],
Expand Down
16 changes: 0 additions & 16 deletions core/package.json

This file was deleted.

1 change: 0 additions & 1 deletion core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,6 @@ mod tests {

let mut file = File::create(path)?;

file.write_all(b"/* eslint-disable @typescript-eslint/ban-types */\n")?;
file.write_all(b"// DO NOT MODIFY THIS FILE, IT IS AUTOGENERATED\n\n")?;

file.write_all(b"// CORE TYPE GENERATION\n\n")?;
Expand Down
2 changes: 1 addition & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Frontend Build Stage
# ------------------------------------------------------------------------------

FROM node:20.0.0-alpine3.16 AS frontend
FROM node:20.9.0-alpine3.18 AS frontend
ARG TARGETARCH

WORKDIR /app
Expand Down
Loading

0 comments on commit 95e7da2

Please sign in to comment.