Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate to pnpm #893

Merged
merged 14 commits into from
Feb 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 2 additions & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@

# Make Loucas and Uriel the owners of all GUI stuff
/gui/ @ImUrX
/package-lock.json @ImUrX
/pnpm-lock.yaml @ImUrX
/pnpm-workspace.yaml @ImUrX

# Uriel and Erimel responsible for i18n
/gui/public/i18n/ @ImUrX @Louka3000
Expand Down
18 changes: 10 additions & 8 deletions .github/workflows/build-gui.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,18 @@ jobs:
with:
submodules: recursive

- name: Use Node.js ${{ matrix.node-version }}
- uses: pnpm/action-setup@v2
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version-file: '.node-version'
cache: 'npm'
cache: 'pnpm'

- name: Build
run: |
npm ci
pnpm i
cd gui
npm run lint
pnpm run lint

build:
strategy:
Expand Down Expand Up @@ -71,16 +72,17 @@ jobs:
with:
shared-key: "${{ matrix.os }}"

- name: Use Node.js ${{ matrix.node-version }}
- uses: pnpm/action-setup@v2
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version-file: '.node-version'
cache: 'npm'
cache: 'pnpm'

- name: Build
run: |
npm ci
npm run skipbundler
pnpm i
pnpm run skipbundler

- if: matrix.os == 'windows-latest'
name: Upload a Build Artifact (Windows)
Expand Down
28 changes: 16 additions & 12 deletions .github/workflows/gradle.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -105,16 +105,17 @@ jobs:
- name: Setup Gradle
uses: gradle/gradle-build-action@v2

- uses: pnpm/action-setup@v2
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version-file: '.node-version'
cache: 'npm'
cache: 'pnpm'

- name: Build GUI
run: |
npm ci
cd gui && npm run build
pnpm i
cd gui && pnpm run build

- name: Build with Gradle
run: ./gradlew :server:android:assembleDebug
Expand Down Expand Up @@ -172,16 +173,17 @@ jobs:
with:
shared-key: "ubuntu-22.04"

- uses: pnpm/action-setup@v2
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version-file: '.node-version'
cache: 'npm'
cache: 'pnpm'

- name: Build
run: |
npm ci
npm run tauri build
pnpm i
pnpm run tauri build

- uses: actions/upload-artifact@v3.1.0
with:
Expand Down Expand Up @@ -244,16 +246,17 @@ jobs:
with:
shared-key: "macos-latest"

- uses: pnpm/action-setup@v2
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version-file: '.node-version'
cache: 'npm'
cache: 'pnpm'

- name: Build
run: |
npm ci
npm run tauri build -- "--target universal-apple-darwin"
pnpm i
pnpm run tauri build -- "--target universal-apple-darwin"

- name: Modify Application
run: |
Expand Down Expand Up @@ -309,16 +312,17 @@ jobs:
with:
shared-key: "windows-latest"

- uses: pnpm/action-setup@v2
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version-file: '.node-version'
cache: 'npm'
cache: 'pnpm'

- name: Build
run: |
npm ci
npm run skipbundler
pnpm i
pnpm run skipbundler

- name: Bundle to zips
shell: bash
Expand Down
1 change: 1 addition & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"bradlc.vscode-tailwindcss",
"EditorConfig.EditorConfig",
"macabeus.vscode-fluent",
"redhat.vscode-yaml"
],
// List of extensions recommended by VS Code that should not be recommended for users of this workspace.
"unwantedRecommendations": []
Expand Down
13 changes: 7 additions & 6 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ This document describes essential knowledge required to contribute to the SlimeV

- [Git](https://git-scm.com/downloads)
- [Java v17+](https://adoptium.net/temurin/releases/)
- [Node.js v16+](https://nodejs.org) (We recommend the use of `nvm` instead of installing Node.js directly)
- [Node.js v16.9+](https://nodejs.org) (We recommend the use of `nvm` instead of installing Node.js directly)
- [Microsoft Edge WebView2](https://developer.microsoft.com/en-us/microsoft-edge/webview2/#download-section) or `webkit2gtk` for Linux
- [Rust](https://rustup.rs)

Expand Down Expand Up @@ -34,9 +34,10 @@ be at `server/build/libs/slimevr.jar` (you can ignore `server.jar`).

### Tauri (gui)

- Run `npm install` in your IDE's terminal to download and install dependencies.
- To launch the GUI in dev mode, run `npm run gui`.
- Finally, to compile for production, run `npm run tauri build`. The result
- Activate corepack (included with Node.JS) via `corepack enable` (might require administrator permissions)
- Run `pnpm i` in your IDE's terminal to download and install dependencies.
- To launch the GUI in dev mode, run `pnpm gui`.
- Finally, to compile for production, run `pnpm run tauri build`. The result
will be at `target/release/slimevr.exe`.

## Code style
Expand Down Expand Up @@ -87,8 +88,8 @@ Eclipse will only do a subset of the checks in `spotless`, so you may still want

We use ESLint and Prettier to format GUI code.
- First, go into the GUI's directory with your terminal by running `cd gui`.
- To check code formatting, run `npm run lint`.
- To fix code formatting, run `npm run lint:fix` and `npm run format`
- To check code formatting, run `pnpm run lint`.
- To fix code formatting, run `pnpm run lint:fix` and `pnpm run format`

Don't forget to run `cd ..` to return to the root directory.

Expand Down
3 changes: 2 additions & 1 deletion gui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"skipbundler": "tauri build -b none",
"tauri": "tauri",
"lint": "tsc --noEmit && eslint --max-warnings=0 \"src/**/*.{js,jsx,ts,tsx,json}\" && prettier --check \"src/**/*.{js,jsx,ts,tsx,css,md,json}\"",
"lint:fix": "tsc --noEmit && eslint --fix --max-warnings=0 \"src/**/*.{js,jsx,ts,tsx,json}\" && npm run format",
"lint:fix": "tsc --noEmit && eslint --fix --max-warnings=0 \"src/**/*.{js,jsx,ts,tsx,json}\" && pnpm run format",
"format": "prettier --write \"src/**/*.{js,jsx,ts,tsx,css,md,json}\"",
"preview-vite": "vite preview",
"javaversion-build": "cd src-tauri/src/ && javac JavaVersion.java && jar cvfe JavaVersion.jar JavaVersion JavaVersion.class"
Expand Down Expand Up @@ -81,6 +81,7 @@
"@types/react-dom": "^18.0.5",
"@types/react-helmet": "^6.1.6",
"@types/react-modal": "3.13.1",
"@types/semver": "^7.5.4",
"@types/three": "^0.155.0",
"@typescript-eslint/eslint-plugin": "^5.60.1",
"@typescript-eslint/parser": "^5.60.1",
Expand Down
4 changes: 2 additions & 2 deletions gui/src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
"build": {
"distDir": "../dist",
"devPath": "http://localhost:5173",
"beforeDevCommand": "npm run start",
"beforeBuildCommand": "npm run build"
"beforeDevCommand": "pnpm run start",
"beforeBuildCommand": "pnpm run build"
},
"plugins": {
"shell": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { Typography } from '@/components/commons/Typography';
import { Button } from '@/components/commons/Button';
import { TryManualFirstModal } from './TryManualFirstModal';
import { useConfig } from '@/hooks/config';
import { useNavigate } from 'react-router';
import { useNavigate } from 'react-router-dom';

export function MountingChoose() {
const { l10n } = useLocalization();
Expand Down
2 changes: 1 addition & 1 deletion gui/src/hooks/countdown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export function useCountdown({
}) {
const [isCounting, setIsCounting] = useState(false);
const [timer, setDisplayTimer] = useState(0);
const countdownTimer = useRef<NodeJS.Timeout>();
const countdownTimer = useRef<ReturnType<typeof setInterval>>();
const counter = useRef(0);

const startCountdown = () => {
Expand Down
Loading
Loading