This commit is contained in:
Brendan Allan 2022-04-22 18:21:18 +08:00
parent a0086891de
commit 3f8867fc14
22 changed files with 3329 additions and 233 deletions

119
.github/workflows/_ci.yaml vendored Normal file
View file

@ -0,0 +1,119 @@
name: CI
on:
pull_request:
push:
branches:
- main
- new-ci
paths-ignore:
- "**/.md"
workflow_dispatch:
jobs:
build:
strategy:
fail-fast: false
matrix:
platform: [macos-latest, ubuntu-latest, windows-latest]
env:
FFMPEG_DOWNLOAD_URL: https://www.gyan.dev/ffmpeg/builds/ffmpeg-release-full-shared.7z
RUST_CACHE_VERSION: 0
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v2
# from https://github.com/zmwangx/rust-ffmpeg/blob/master/.github/workflows/build.yml
- name: Install ffmpeg (Windows)
if: matrix.platform == 'windows-latest'
run: |
$VCINSTALLDIR = $(& "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -latest -property installationPath)
Add-Content $env:GITHUB_ENV "LIBCLANG_PATH=${VCINSTALLDIR}\VC\Tools\LLVM\x64\bin`n"
Invoke-WebRequest "${env:FFMPEG_DOWNLOAD_URL}" -OutFile ffmpeg-release-full-shared.7z
7z x ffmpeg-release-full-shared.7z
mkdir ffmpeg
mv ffmpeg-*/* ffmpeg/
Add-Content $env:GITHUB_ENV "FFMPEG_DIR=${pwd}\ffmpeg`n"
Add-Content $env:GITHUB_PATH "${pwd}\ffmpeg\bin`n"
- name: Install CMake (Windows)
uses: lukka/get-cmake@latest
if: matrix.platform == 'windows-latest'
# Optimisation for windows
- name: Rename existing rust toolchain (Windows)
if: matrix.platform == 'windows-latest'
run: Rename-Item C:\Users\runneradmin\.rustup\toolchains\stable-x86_64-pc-windows-msvc C:\Users\runneradmin\.rustup\toolchains\stable-x86_64-pc-windows-msvc.old
- name: Setup Node
uses: actions/setup-node@v1
with:
node-version: 16
- name: Install Rust stable
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
components: rustfmt, rust-src
- name: Cache Rust Dependencies
uses: Swatinem/rust-cache@cb2cf0cc7c5198d3364b9630e2c3d457f160790c
with:
sharedKey: ${{ env.RUST_CACHE_VERSION }}
- name: Cache pnpm dependencies
uses: actions/cache@v2
with:
path: ~/.pnpm-store
key: ${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-
- name: Install pnpm
uses: pnpm/action-setup@v2.2.1
with:
version: 6.32.6
- name: Install dependencies (Ubuntu)
if: matrix.platform == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
libgtk-3-dev \
webkit2gtk-4.0 \
libappindicator3-dev \
librsvg2-dev \
patchelf \
libssl-dev \
libavcodec-dev \
libavdevice-dev \
libavfilter-dev \
libavformat-dev \
libavresample-dev \
libavutil-dev \
libswscale-dev \
libswresample-dev \
pkg-config \
ffmpeg
- name: Install dependencies (macOS)
if: matrix.platform == 'macos-latest'
run: |
brew install ffmpeg
- name: Install pnpm dependencies
run: pnpm i
- name: Build codegen
run: pnpm prep:ci
- name: Build frontend
run: pnpm desktop build:vite
- name: Build Tauri app
uses: tauri-apps/tauri-action@v0
with:
projectPath: apps/desktop
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View file

@ -8,11 +8,7 @@
"vite": "vite",
"dev": "concurrently \"pnpm tauri dev\" \"vite\"",
"tauri": "tauri",
"build:vite": "vite build",
"build": "vite build && tauri build"
},
"resolutions": {
"react-virtualized": "patch:react-virtualized@9.22.3#./path/to/react-virtualized-9.22.3.patch"
"build": "vite build"
},
"dependencies": {
"@sd/client": "workspace:*",
@ -25,12 +21,12 @@
},
"devDependencies": {
"@tauri-apps/cli": "^1.0.0-rc.8",
"@tauri-apps/tauricon": "github:tauri-apps/tauricon",
"@types/babel-core": "^6.25.7",
"@types/byte-size": "^8.1.0",
"@types/react": "^18.0.0",
"@types/react": "^18.0.6",
"@types/react-dom": "^18.0.0",
"@types/react-router-dom": "^5.3.3",
"@types/react-virtualized-auto-sizer": "^1.0.1",
"@types/react-window": "^1.8.5",
"@types/tailwindcss": "^3.0.10",
"@vitejs/plugin-react": "^1.3.1",

View file

@ -1,9 +1,8 @@
import React, { useEffect, useState } from 'react';
import { createRoot } from 'react-dom/client';
// import Spacedrive interface
import SpacedriveInterface, { Platform } from '@sd/interface';
import { emit, listen, Event } from '@tauri-apps/api/event';
import { listen, Event } from '@tauri-apps/api/event';
// import types from Spacedrive core (TODO: re-export from client would be cleaner)
import { ClientCommand, ClientQuery, CoreEvent } from '@sd/core';
// import Spacedrive JS client
@ -11,7 +10,6 @@ import { BaseTransport } from '@sd/client';
// import tauri apis
import { dialog, invoke, os } from '@tauri-apps/api';
import { convertFileSrc } from '@tauri-apps/api/tauri';
import '@sd/ui/style';
// bind state to core via Tauri

View file

@ -16,11 +16,12 @@
"jsx": "react",
"outDir": "dist",
"baseUrl": "./",
"types": ["vite-plugin-svgr/client"],
"paths": {
"@sd/interface": ["../../packages/interface/src/index.ts"],
"@sd/ui": ["../../packages/ui/src/index.ts"],
"@sd/client": ["../../packages/client/src/index.ts"],
"@sd/client": ["../../packages/client/src/index.ts"]
}
},
"include": ["src"],
"include": ["src"]
}

View file

@ -1,8 +1,7 @@
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import { name, version } from './package.json';
import * as path from 'path';
import svg from 'vite-plugin-svgr';
import { name, version } from './package.json';
// https://vitejs.dev/config/
export default defineConfig({

View file

@ -20,7 +20,7 @@
"tsparticles": "^2.0.6"
},
"devDependencies": {
"@types/react": "^18.0.0",
"@types/react": "^18.0.6",
"@types/react-dom": "^18.0.0",
"@vitejs/plugin-react": "^1.3.1",
"autoprefixer": "^10.4.4",

View file

@ -18,7 +18,7 @@
"tsparticles": "^2.0.6"
},
"devDependencies": {
"@types/react": "^18.0.0",
"@types/react": "^18.0.6",
"@types/react-dom": "^18.0.0",
"@vitejs/plugin-react": "^1.3.1",
"autoprefixer": "^10.4.4",

View file

@ -20,9 +20,6 @@ function App() {
{/* <header className="App-header"></header> */}
<SpacedriveInterface
transport={new Transport()}
onCoreEvent={function (event: any): void {
return;
}}
platform={'browser'}
convertFileSrc={function (url: string): string {
return url;

View file

@ -14,6 +14,7 @@
"isolatedModules": true,
"noEmit": true,
"jsx": "react",
"types": ["vite-plugin-svgr/client"],
"baseUrl": "./",
"paths": {
"@sd/interface": ["../../packages/interface/src/index.ts"],

View file

@ -25,7 +25,7 @@
},
"devDependencies": {
"prettier": "^2.6.2",
"turbo": "^1.2.1"
"turbo": "^1.2.4"
},
"turbo": {
"pipeline": {

View file

@ -2,7 +2,6 @@
"compilerOptions": {
"lib": ["esnext"],
"module": "esnext",
"outDir": "./dist",
"rootDir": "src",
"jsx": "react"
},

View file

@ -2,7 +2,7 @@
"$schema": "https://json.schemastore.org/tsconfig",
"display": "Default",
"compilerOptions": {
"composite": false,
"composite": true,
"declaration": true,
"declarationMap": true,
"esModuleInterop": true,
@ -13,7 +13,7 @@
"noUnusedLocals": false,
"noUnusedParameters": false,
"preserveWatchOutput": true,
"skipLibCheck": true,
"skipLibCheck": false,
"strict": true
},
"exclude": ["node_modules"]

View file

@ -6,11 +6,11 @@
"target": "es5",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"skipLibCheck": false,
"strict": false,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"incremental": true,
"incremental": false,
"esModuleInterop": true,
"module": "esnext",
"resolveJsonModule": true,

View file

@ -4,14 +4,14 @@
"license": "MIT",
"private": true,
"main": "src/index.ts",
"exports": {
".": "./src/index.ts",
"./types": "./src/types"
},
"scripts": {
"icons": "ts-node ./scripts/generateSvgImports.mjs"
},
"resolutions": {
"react-virtualized": "patch:react-virtualized@9.22.3#./path/to/react-virtualized-9.22.3.patch"
},
"dependencies": {
"@apollo/client": "^3.5.10",
"@headlessui/react": "^1.5.0",
"@heroicons/react": "^1.0.6",
"@radix-ui/react-dialog": "^0.1.7",
@ -52,14 +52,13 @@
"@trivago/prettier-plugin-sort-imports": "^3.2.0",
"@types/babel-core": "^6.25.7",
"@types/byte-size": "^8.1.0",
"@types/lodash": "^4.14.182",
"@types/node": "^17.0.23",
"@types/pretty-bytes": "^5.2.0",
"@types/react": "^18.0.0",
"@types/react": "^18.0.6",
"@types/react-dom": "^18.0.0",
"@types/react-router-dom": "^5.3.3",
"@types/react-table": "^7.7.10",
"@types/react-virtualized": "^9.21.21",
"@types/react-virtualized-auto-sizer": "^1.0.1",
"@types/react-window": "^1.8.5",
"@types/tailwindcss": "^3.0.10",
"@vitejs/plugin-react": "^1.3.1",

View file

@ -33,6 +33,7 @@ export const AppPropsContext = React.createContext<AppProps | null>(null);
export type Platform = 'browser' | 'macOS' | 'windows' | 'linux';
export interface AppProps {
transport: BaseTransport;
platform: Platform;

View file

@ -1,7 +1,6 @@
import React, { Fragment } from 'react';
import { Menu, Transition } from '@headlessui/react';
import React from 'react';
import { Menu } from '@headlessui/react';
import { ChevronDownIcon } from '@heroicons/react/solid';
import { DefaultOptions } from '@apollo/client';
import clsx from 'clsx';
import { Button, ButtonProps } from '@sd/ui';
@ -11,7 +10,7 @@ type Section = {
selected?: boolean;
}[];
export interface DropdownProps extends DefaultOptions {
export interface DropdownProps {
items: Section[];
buttonText: string;
buttonProps: ButtonProps;

View file

@ -1 +0,0 @@
declare module 'react-spline';

View file

@ -1,7 +0,0 @@
declare module '*.svg' {
import * as React from 'react';
export const ReactComponent: React.FunctionComponent<
React.SVGProps<SVGSVGElement> & { title?: string }
>;
}

View file

@ -16,6 +16,7 @@
"outDir": "dist",
"declaration": true,
"declarationMap": true,
"types": ["vite-plugin-svgr/client"],
"baseUrl": "./",
"paths": {
"@sd/ui": ["../ui/src/index.ts"],

View file

@ -22,7 +22,7 @@
},
"devDependencies": {
"@sd/config": "workspace:*",
"@types/react": "^18.0.0",
"@types/react": "^18.0.6",
"@types/react-dom": "^18.0.0",
"sass": "^1.50.0",
"typescript": "^4.6.3"

File diff suppressed because it is too large Load diff

14
tsconfig.json Normal file
View file

@ -0,0 +1,14 @@
{
"files": [],
"references": [
{
"path": "apps/desktop"
},
{
"path": "apps/web"
},
{
"path": "apps/landing"
}
]
}