Update readme & contributing guide & language stuff (#2071)

* updates

* keep common errors

* fix selector being empty for english

* sort by label

* update contributing

* update ndk and docs

* Update CONTRIBUTING.md
This commit is contained in:
Utku 2024-02-09 18:42:42 +03:00 committed by GitHub
parent 177b2a23d6
commit 2dc233f1b4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 53 additions and 24 deletions

View file

@ -77,11 +77,11 @@ jobs:
# - name: Cache NDK # - name: Cache NDK
# uses: actions/cache@v3 # uses: actions/cache@v3
# with: # with:
# path: ${{ env.ANDROID_HOME }}/ndk/23.1.7779620 # path: ${{ env.ANDROID_HOME }}/ndk/26.1.10909125
# key: ndk-23.1.7779620 # key: ndk-26.1.10909125
# #
# - name: Install NDK # - name: Install NDK
# run: echo "y" | sudo ${ANDROID_HOME}/cmdline-tools/latest/bin/sdkmanager --install "ndk;23.1.7779620" # run: echo "y" | sudo ${ANDROID_HOME}/cmdline-tools/latest/bin/sdkmanager --install "ndk;26.1.10909125"
# #
# - name: Cache Gradle # - name: Cache Gradle
# uses: gradle/gradle-build-action@v2 # uses: gradle/gradle-build-action@v2
@ -106,7 +106,7 @@ jobs:
# arch: x86_64 # arch: x86_64
# api-level: 30 # api-level: 30
# target: google_apis # target: google_apis
# ndk: 23.1.7779620 # ndk: 26.1.10909125
# ram-size: 4096M # ram-size: 4096M
# emulator-boot-timeout: 12000 # emulator-boot-timeout: 12000
# force-avd-creation: false # force-avd-creation: false
@ -126,7 +126,7 @@ jobs:
# arch: x86_64 # arch: x86_64
# api-level: 30 # api-level: 30
# target: google_apis # target: google_apis
# ndk: 23.1.7779620 # ndk: 26.1.10909125
# ram-size: 4096M # ram-size: 4096M
# emulator-boot-timeout: 12000 # emulator-boot-timeout: 12000
# force-avd-creation: false # force-avd-creation: false

View file

@ -40,12 +40,12 @@ To make changes locally, follow these steps:
1. Clone the repository: `git clone https://github.com/spacedriveapp/spacedrive` 1. Clone the repository: `git clone https://github.com/spacedriveapp/spacedrive`
2. Navigate to the project directory: `cd spacedrive` 2. Navigate to the project directory: `cd spacedrive`
3. Configure your system environment for Spacedrive development 3. Configure your system environment for Spacedrive development
1. For Linux users, run: `./scripts/setup.sh` 1. For Linux users, run: `./scripts/setup.sh`
> This [script](https://github.com/spacedriveapp/spacedrive/blob/main/scripts/setup.sh#L133) will check if Rust and pnpm are installed then proceed to install Clang, NASM, LLVM, libvips, Gstreamer's Plugins, FFmpeg, Perl, [Tauri essentials](https://tauri.app/v1/guides/getting-started/prerequisites/#setting-up-linux) and any other required dependencies for Spacedrive to build. > This [script](https://github.com/spacedriveapp/spacedrive/blob/main/scripts/setup.sh#L133) will check if Rust and pnpm are installed then proceed to install Clang, NASM, LLVM, libvips, Gstreamer's Plugins, FFmpeg, Perl, [Tauri essentials](https://tauri.app/v1/guides/getting-started/prerequisites/#setting-up-linux) and any other required dependencies for Spacedrive to build.
2. For macOS users, run: `./scripts/setup.sh` 2. For macOS users, run: `./scripts/setup.sh`
> This [script](https://github.com/spacedriveapp/spacedrive/blob/main/scripts/setup.sh#L108) will check if Rust, pnpm and Xcode are installed and proceed to use Homebrew to install NASM, [Tauri essentials](https://tauri.app/v1/guides/getting-started/prerequisites/#setting-up-macos) and install any other required dependencies for Spacedrive to build. > This [script](https://github.com/spacedriveapp/spacedrive/blob/main/scripts/setup.sh#L108) will check if Rust, pnpm and Xcode are installed and proceed to use Homebrew to install NASM, [Tauri essentials](https://tauri.app/v1/guides/getting-started/prerequisites/#setting-up-macos) and install any other required dependencies for Spacedrive to build.
3. For Windows users, run in PowerShell: `.\scripts\setup.ps1` 3. For Windows users, run in PowerShell: `.\scripts\setup.ps1`
> This [script](https://github.com/spacedriveapp/spacedrive/blob/main/scripts/setup.ps1#L81) will install pnpm, LLVM, FFmpeg, C++ build tools, NASM, Rust + Cargo, Rust tools, Edge Webview 2, Strawberry Perl, [Tauri essentials](https://tauri.app/v1/guides/getting-started/prerequisites/#setting-up-windows) and any other required dependencies for Spacedrive to build. > This [script](https://github.com/spacedriveapp/spacedrive/blob/main/scripts/setup.ps1#L81) will install pnpm, LLVM, FFmpeg, C++ build tools, NASM, Rust + Cargo, Rust tools, Edge Webview 2, Strawberry Perl, [Tauri essentials](https://tauri.app/v1/guides/getting-started/prerequisites/#setting-up-windows) and any other required dependencies for Spacedrive to build.
4. Install dependencies: `pnpm i` 4. Install dependencies: `pnpm i`
5. Prepare the build: `pnpm prep` (This will run all necessary codegen and build required dependencies) 5. Prepare the build: `pnpm prep` (This will run all necessary codegen and build required dependencies)
@ -89,11 +89,19 @@ To run the mobile app:
- Install [Android Studio](https://developer.android.com/studio) for Android and [Xcode](https://apps.apple.com/au/app/xcode/id497799835) for iOS development. - Install [Android Studio](https://developer.android.com/studio) for Android and [Xcode](https://apps.apple.com/au/app/xcode/id497799835) for iOS development.
- Run `./scripts/setup.sh mobile` - Run `./scripts/setup.sh mobile`
- This will set up most of the dependencies required to build the mobile app. - This will set up most of the dependencies required to build the mobile app.
- Make sure you have [NDK 23.1.7779620 and CMake](https://developer.android.com/studio/projects/install-ndk#default-version) installed in Android Studio. - Make sure you have [NDK 26.1.10909125 and CMake](https://developer.android.com/studio/projects/install-ndk#default-version) installed in Android Studio.
- Run the following commands: - Run the following commands:
- `pnpm android` (runs on Android Emulator) - `pnpm mobile android` (runs on Android Emulator)
- `pnpm ios` (runs on iOS Emulator) - In order to have locations working on Android, you must run the following command once the application has been installed for the first time. Otherwise, locations will not work.
- `pnpm start` (runs the metro bundler) - `adb shell appops set --uid com.spacedrive.app MANAGE_EXTERNAL_STORAGE allow`
- Run the following commands to access the logs from `sd-core`.
- `adb shell`
- Then `run-as com.spacedrive.app` to access the app's directory on device.
- Run `cd files/logs` and then select the logs with the timestamp of when you ran the app. Ex: `sd.log.2023-11-28`.
- You can view the logs using `tail -f [log-name]`. Ex: `tail -f sd.log.2023-11-28`.
- `pnpm mobile ios` (runs on iOS Emulator)
- `xcrun simctl launch --console booted com.spacedrive.app` allows you to view the console output of the iOS app from `tracing`. However, the application must be built in `debug` mode for this.
- `pnpm mobile start` (runs the metro bundler only)
##### AppImage ##### AppImage

View file

@ -90,20 +90,28 @@ This project is using what I'm calling the **"PRRTT"** stack (Prisma, Rust, Reac
- `desktop`: A [Tauri](https://tauri.app) app. - `desktop`: A [Tauri](https://tauri.app) app.
- `mobile`: A [React Native](https://reactnative.dev/) app. - `mobile`: A [React Native](https://reactnative.dev/) app.
- `web`: A [React](https://reactjs.org) webapp. - `web`: A [React](https://reactjs.org) webapp.
- `landing`: A [React](https://reactjs.org) app using Vite SSR & Vite pages. - `landing`: A [React](https://reactjs.org) app using [Next.js](https://nextjs.org).
- `server`: A [Rust](https://www.rust-lang.org) server for the webapp. (planned)
- `cli`: A [Rust](https://www.rust-lang.org) command line interface. (planned)
- `storybook`: A [React](https://reactjs.org) storybook for the UI components.
### Core: ### Core:
- `core`: The [Rust](https://www.rust-lang.org) core, referred to internally as `sdcore`. Contains filesystem, database and networking logic. Can be deployed in a variety of host applications. - `core`: The [Rust](https://www.rust-lang.org) core, referred to internally as `sdcore`. Contains filesystem, database and networking logic. Can be deployed in a variety of host applications.
- `crates`: Shared Rust libraries used by the core and other Rust applications.
### Interface:
- `interface`: The complete user interface in React (used by apps `desktop`, `web`)
### Packages: ### Packages:
- `assets`: Shared assets (images, fonts, etc).
- `client`: A [TypeScript](https://www.typescriptlang.org/) client library to handle dataflow via RPC between UI and the Rust core. - `client`: A [TypeScript](https://www.typescriptlang.org/) client library to handle dataflow via RPC between UI and the Rust core.
- `ui`: A [React](https://reactjs.org) Shared component library.
- `interface`: The complete user interface in React (used by apps `desktop`, `web` and `landing`)
- `config`: `eslint` configurations (includes `eslint-config-next`, `eslint-config-prettier` and all `tsconfig.json` configs used throughout the monorepo). - `config`: `eslint` configurations (includes `eslint-config-next`, `eslint-config-prettier` and all `tsconfig.json` configs used throughout the monorepo).
- `ui`: A [React](https://reactjs.org) Shared component library.
- `macos`: A [Swift](https://developer.apple.com/swift/) Native binary for MacOS system extensions. - `macos`: A [Swift](https://developer.apple.com/swift/) Native binary for MacOS system extensions (planned).
- `ios`: A [Swift](https://developer.apple.com/swift/) Native binary (planned). - `ios`: A [Swift](https://developer.apple.com/swift/) Native binary (planned).
- `windows`: A [C#](https://docs.microsoft.com/en-us/dotnet/csharp/) Native binary (planned). - `windows`: A [C#](https://docs.microsoft.com/en-us/dotnet/csharp/) Native binary (planned).
- `android`: A [Kotlin](https://kotlinlang.org/) Native binary (planned). - `android`: A [Kotlin](https://kotlinlang.org/) Native binary (planned).

View file

@ -60,9 +60,18 @@ To run mobile app
1. Install [Android Studio](https://developer.android.com/studio) for Android and [Xcode](https://apps.apple.com/au/app/xcode/id497799835) for IOS development 1. Install [Android Studio](https://developer.android.com/studio) for Android and [Xcode](https://apps.apple.com/au/app/xcode/id497799835) for IOS development
2. `./scripts/setup.sh mobile` 2. `./scripts/setup.sh mobile`
_The should setup most of the dependencies for the mobile app to build._ _The should setup most of the dependencies for the mobile app to build._
3. You must also ensure you have [NDK 23.1.7779620 and CMake](https://developer.android.com/studio/projects/install-ndk#default-version) in Android Studio 3. You must also ensure you have [NDK 26.1.10909125 and CMake](https://developer.android.com/studio/projects/install-ndk#default-version) in Android Studio
4. `pnpm mobile android` - runs on Android Emulator 4. `pnpm mobile android` (runs on Android Emulator)
5. `pnpm mobile ios` - runs on iOS Emulator - In order to have locations working on Android, you must run the following command once the application has been installed for the first time. Otherwise, locations will not work.
- `adb shell appops set --uid com.spacedrive.app MANAGE_EXTERNAL_STORAGE allow`
- Run the following commands to access the logs from `sd-core`.
- `adb shell`
- Then `run-as com.spacedrive.app` to access the app's directory on device.
- Run `cd files/logs` and then select the logs with the timestamp of when you ran the app. Ex: `sd.log.2023-11-28`.
- You can view the logs using `cat [log-name]`. Ex: `cat sd.log.2023-11-28`.
5. `pnpm mobile ios` (runs on iOS Emulator)
- `xcrun simctl launch --console booted com.spacedrive.app` allows you to view the console output of the iOS app from `tracing`. However, the application must be built in `debug` mode for this.
6. `pnpm mobile start` (runs the metro bundler only)
### Troubleshooting ### Troubleshooting

View file

@ -22,6 +22,8 @@ const NodeSettingLabel = tw.div`mb-1 text-xs font-medium`;
// https://doc.rust-lang.org/std/u16/index.html // https://doc.rust-lang.org/std/u16/index.html
const u16 = z.number().min(0).max(65_535); const u16 = z.number().min(0).max(65_535);
// Unsorted list of languages available in the app.
// Make sure to add new languages to this list and to `project.inlang/settings.json`
const LANGUAGE_OPTIONS = [ const LANGUAGE_OPTIONS = [
{ value: 'en', label: 'English' }, { value: 'en', label: 'English' },
{ value: 'de', label: 'Deutsch' }, { value: 'de', label: 'Deutsch' },
@ -35,6 +37,9 @@ const LANGUAGE_OPTIONS = [
{ value: 'zh-TW', label: '中文(繁體)' } { value: 'zh-TW', label: '中文(繁體)' }
]; ];
// Sort the languages by their label
LANGUAGE_OPTIONS.sort((a, b) => a.label.localeCompare(b.label));
export const Component = () => { export const Component = () => {
const node = useBridgeQuery(['nodeState']); const node = useBridgeQuery(['nodeState']);
const platform = usePlatform(); const platform = usePlatform();
@ -202,7 +207,7 @@ export const Component = () => {
<Setting mini title={t('language')} description={t('language_description')}> <Setting mini title={t('language')} description={t('language_description')}>
<div className="flex h-[30px] gap-2"> <div className="flex h-[30px] gap-2">
<Select <Select
value={i18n.language} value={i18n.resolvedLanguage || i18n.language || 'en'}
onChange={(e) => { onChange={(e) => {
i18n.changeLanguage(e); i18n.changeLanguage(e);
// add "i18nextLng" key to localStorage and set it to the selected language // add "i18nextLng" key to localStorage and set it to the selected language

@ -1 +0,0 @@
Subproject commit 146fbb543fc001bcd8fe5c0d4d59d2bc2948c5f8