diff --git a/.editorconfig b/.editorconfig index d0089e19f..ae1c20816 100644 --- a/.editorconfig +++ b/.editorconfig @@ -66,3 +66,8 @@ indent_style = space [*.prisma] indent_size = 4 indent_style = space + +# YAML +# http://yaml.org/spec/1.2/2009-07-21/spec.html#id2576668 +[*.{yaml,yml}] +indent_style = space diff --git a/.eslintignore b/.eslintignore new file mode 120000 index 000000000..656b79624 --- /dev/null +++ b/.eslintignore @@ -0,0 +1 @@ +.prettierignore \ No newline at end of file diff --git a/.github/actions/cache-rust-deps/action.yaml b/.github/actions/cache-rust-deps/action.yaml index 41417f942..bb1a5b1ec 100644 --- a/.github/actions/cache-rust-deps/action.yaml +++ b/.github/actions/cache-rust-deps/action.yaml @@ -4,7 +4,7 @@ inputs: save-cache: description: Whether to save the Rust cache required: false - default: "false" + default: 'false' runs: using: 'composite' steps: diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml index 3997957c6..a9c103183 100644 --- a/.github/actions/setup/action.yml +++ b/.github/actions/setup/action.yml @@ -1,23 +1,44 @@ name: Setup description: Sets up runner, Rust and pnpm inputs: + token: + description: Github token + required: false + default: '' save-cache: description: Whether to save the Rust cache required: false - default: "false" + default: 'false' runs: using: 'composite' steps: - - name: Install Rust stable - uses: actions-rs/toolchain@v1 + - name: Install Rust + id: toolchain + uses: dtolnay/rust-toolchain@stable with: toolchain: stable - profile: minimal + components: clippy, rustfmt - name: Install pnpm - uses: pnpm/action-setup@v2.2.2 + uses: pnpm/action-setup@v2 with: version: 7.x.x + run_install: false + + - name: Cache LLVM and Clang + if: runner.os == 'Windows' + id: cache-llvm + uses: actions/cache@v3 + with: + path: C:/Program Files/LLVM + key: llvm-15 + + - name: Install LLVM and Clang + if: runner.os == 'Windows' + uses: KyleMayes/install-llvm-action@v1 + with: + version: '15' + cached: ${{ steps.cache-llvm.outputs.cache-hit }} - name: Cache Rust deps uses: ./.github/actions/cache-rust-deps @@ -33,6 +54,8 @@ runs: shell: powershell if: runner.os == 'Windows' run: ./.github/scripts/setup-system.ps1 + env: + GITHUB_TOKEN: ${{ inputs.token }} - name: Generate Prisma client uses: ./.github/actions/generate-prisma-client diff --git a/.github/scripts/setup-system.ps1 b/.github/scripts/setup-system.ps1 index 6fc61edf4..4722d82ca 100644 --- a/.github/scripts/setup-system.ps1 +++ b/.github/scripts/setup-system.ps1 @@ -74,6 +74,30 @@ function Add-DirectoryToPath($directory) { Reset-Path } +function Invoke-RestMethodGithub { + [CmdletBinding()] + param ( + [Parameter(Mandatory=$true)] + [string]$Uri, + [string]$Method = 'GET', + [hashtable]$Headers = @{}, + [string]$UserAgent = 'PowerShell' + ) + + if (![string]::IsNullOrEmpty($env:GITHUB_TOKEN)) { + $headers.Add("Authorization", "Bearer $($env:GITHUB_TOKEN)") + } + + $params = @{ + Uri = $Uri + Method = $Method + Headers = $Headers + UserAgent = $UserAgent + } + + Invoke-RestMethod @params +} + # Reset PATH to ensure the script doesn't read any stale entries Reset-Path @@ -151,7 +175,10 @@ https://learn.microsoft.com/windows/package-manager/winget/ Write-Host Write-Host 'Checking for pnpm...' -ForegroundColor Yellow -if ((Get-Command pnpm -ea 0) -and (pnpm --version | Select-Object -First 1) -match "^$pnpm_major\." ) { +if ($env:CI) { + # The CI has pnpm installed already + Write-Host 'Running with CI, skipping pnpm install.' -ForegroundColor Green +}if ((Get-Command pnpm -ea 0) -and (pnpm --version | Select-Object -First 1) -match "^$pnpm_major\." ) { Write-Host "pnpm $pnpm_major is installed." -ForegroundColor Green } else { # Check for pnpm installed with standalone installer @@ -187,12 +214,8 @@ https://pnpm.io/uninstall Write-Host Write-Host 'Checking for LLVM...' -ForegroundColor Yellow if ($env:CI) { - # The CI has LLVM installed already, so we instead just set the env variables. - Write-Host 'Running with Ci, skipping LLVM install.' -ForegroundColor Green - - # TODO: Check if CI LLVM version match our required major version - $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" + # The CI has LLVM installed already + Write-Host 'Running with CI, skipping LLVM install.' -ForegroundColor Green } elseif ( (Get-Command clang -ea 0) -and ( (clang --version | Select-String -Pattern 'version\s+(\d+)' | ForEach-Object { $_.Matches.Groups[1].Value }) -eq "$llvm_major" @@ -206,7 +229,7 @@ if ($env:CI) { $filenamePattern = '*-win64.exe' Write-Host "Downloading LLVM $llvm_major installer..." -ForegroundColor Yellow - $releases = Invoke-RestMethod -Uri $releasesUri + $releases = Invoke-RestMethodGithub -Uri $releasesUri $downloadUri = $releases | ForEach-Object { if ($_.name -like $llvmVersion) { $_.assets | Where-Object { $_.name -like $filenamePattern } | Select-Object -ExpandProperty 'browser_download_url' @@ -249,7 +272,7 @@ if ($protocVersion) { $filenamePattern = '*-win64.zip' Write-Host 'Downloading protobuf compiler...' -ForegroundColor Yellow - $releases = Invoke-RestMethod -Uri $releasesUri + $releases = Invoke-RestMethodGithub -Uri $releasesUri for ($i = 0; $i -lt $releases.Count; $i++) { $release = $releases[$i] foreach ($asset in $release.assets) { @@ -310,7 +333,7 @@ if (($null -ne $env:FFMPEG_DIR) -and ( $filenamePattern = '*-full_build-shared.zip' # Downloads a build of ffmpeg from GitHub compatible with the declared ffmpeg-sys-next version - $releases = Invoke-RestMethod -Uri $releasesUri + $releases = Invoke-RestMethodGithub -Uri $releasesUri $version = $ffmpegVersion while (-not ($filename -and $downloadUri) -and $version) { for ($i = 0; $i -lt $releases.Count; $i++) { diff --git a/.github/workflows/cache-factory.yaml b/.github/workflows/cache-factory.yaml index 38af437fb..54d61e3dc 100644 --- a/.github/workflows/cache-factory.yaml +++ b/.github/workflows/cache-factory.yaml @@ -25,10 +25,10 @@ jobs: - uses: ./.github/actions/setup with: - save-cache: "true" + save-cache: 'true' - name: Compile (debug) run: cargo test --workspace --all-features --no-run - + - name: Compile (release) run: cargo test --workspace --all-features --no-run --release diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index adae85d87..be047594e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -102,6 +102,8 @@ jobs: - name: Setup uses: ./.github/actions/setup + with: + token: ${{ secrets.GITHUB_TOKEN }} - name: Run Clippy uses: actions-rs/clippy-check@v1 diff --git a/.gitignore b/.gitignore index 5f9bc75fa..1a939ad63 100644 --- a/.gitignore +++ b/.gitignore @@ -24,6 +24,7 @@ packages/*/node_modules packages/*/data apps/*/data apps/*/stats.html +apps/releases/.vscode docs/public/*.st docs/public/*.toml dev.db diff --git a/.vscode/settings.json b/.vscode/settings.json index 9951c11b5..f28cb9e02 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -63,5 +63,19 @@ "packages/ui" ], "eslint.packageManager": "pnpm", - "eslint.lintTask.enable": true + "eslint.lintTask.enable": true, + "explorer.fileNesting.enabled": true, + "explorer.fileNesting.patterns": { + "*.ts": "${capture}.js", + "*.js": "${capture}.js.map, ${capture}.min.js, ${capture}.d.ts", + "*.jsx": "${capture}.js", + "*.tsx": "${capture}.ts", + ".npmrc": ".nvmrc, .yarnrc.yml", + ".gitignore": ".eslintignore, .prettierignore", + "README.md": "CONTRIBUTING.md, CODE_OF_CONDUCT.md", + "Cargo.toml": "Cargo.lock", + ".eslintrc.js": ".eslintcache", + "package.json": "package-lock.json, yarn.lock, pnpm-lock.yaml, pnpm-workspace.yaml, .pnp.cjs, .pnp.loader.mjs", + "tsconfig.json": "tsconfig.*.json" + } } diff --git a/apps/releases/next.config.js b/apps/releases/next.config.js index dafb0c88e..0f7a6ac07 100644 --- a/apps/releases/next.config.js +++ b/apps/releases/next.config.js @@ -1,8 +1,8 @@ /** @type {import('next').NextConfig} */ const nextConfig = { - experimental: { - appDir: true, - }, -} + experimental: { + appDir: true + } +}; -module.exports = nextConfig +module.exports = nextConfig; diff --git a/apps/releases/package.json b/apps/releases/package.json index e05fb3662..85375a2b1 100644 --- a/apps/releases/package.json +++ b/apps/releases/package.json @@ -1,24 +1,24 @@ { - "name": "releases", - "version": "0.1.0", - "private": true, - "scripts": { - "dev": "next dev", - "build": "next build", - "start": "next start", - "lint": "next lint" - }, - "dependencies": { - "@types/node": "18.15.11", - "@types/react": "18.0.35", - "@types/react-dom": "18.0.11", - "@vercel/edge-config": "^0.1.7", - "eslint": "^8.38.0", - "eslint-config-next": "13.3.0", - "next": "13.3.0", - "octokit": "^2.0.14", - "react": "18.2.0", - "react-dom": "^18.2.0", - "typescript": "5.0.4" - } + "name": "releases", + "version": "0.1.0", + "private": true, + "scripts": { + "dev": "next dev", + "build": "next build", + "start": "next start", + "lint": "next lint --strict" + }, + "dependencies": { + "@types/node": "18.15.11", + "@types/react": "18.0.35", + "@types/react-dom": "18.0.11", + "@vercel/edge-config": "^0.1.7", + "eslint": "^8.38.0", + "eslint-config-next": "13.3.0", + "next": "13.3.0", + "octokit": "^2.0.14", + "react": "18.2.0", + "react-dom": "^18.2.0", + "typescript": "5.0.4" + } } diff --git a/apps/releases/tsconfig.json b/apps/releases/tsconfig.json index 2ba7bf885..a6c50bacb 100644 --- a/apps/releases/tsconfig.json +++ b/apps/releases/tsconfig.json @@ -1,28 +1,28 @@ { - "compilerOptions": { - "target": "es5", - "lib": ["dom", "dom.iterable", "esnext"], - "allowJs": true, - "skipLibCheck": true, - "strict": true, - "forceConsistentCasingInFileNames": true, - "noEmit": true, - "esModuleInterop": true, - "module": "esnext", - "moduleResolution": "node", - "resolveJsonModule": true, - "isolatedModules": true, - "jsx": "preserve", - "incremental": true, - "plugins": [ - { - "name": "next" - } - ], - "paths": { - "~/*": ["./*"] - } - }, - "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"], - "exclude": ["node_modules"] + "compilerOptions": { + "target": "es5", + "lib": ["dom", "dom.iterable", "esnext"], + "allowJs": true, + "skipLibCheck": true, + "strict": true, + "forceConsistentCasingInFileNames": true, + "noEmit": true, + "esModuleInterop": true, + "module": "esnext", + "moduleResolution": "node", + "resolveJsonModule": true, + "isolatedModules": true, + "jsx": "preserve", + "incremental": true, + "plugins": [ + { + "name": "next" + } + ], + "paths": { + "~/*": ["./*"] + } + }, + "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"], + "exclude": ["node_modules"] } diff --git a/interface/app/$libraryId/Explorer/DismissibleNotice.tsx b/interface/app/$libraryId/Explorer/DismissibleNotice.tsx index 679126a4d..3e5e79661 100644 --- a/interface/app/$libraryId/Explorer/DismissibleNotice.tsx +++ b/interface/app/$libraryId/Explorer/DismissibleNotice.tsx @@ -6,14 +6,14 @@ import { dismissibleNoticeStore } from '~/hooks/useDismissibleNoticeStore'; import { ExplorerLayoutMode, useExplorerStore } from '~/hooks/useExplorerStore'; const MediaViewIcon = () => ( -