Skip to content

Commit

Permalink
feat: general improvements and tests (#20)
Browse files Browse the repository at this point in the history
- removed unused dependencies
- configured lint and fmt with eslint and prettier
- add a vitest sample test in App.tsx
- fixed format issues
- fixed lint issues
- added lint and fmt checks in ci
  • Loading branch information
hcavarsan committed Dec 17, 2023
1 parent 75d3b00 commit 24d73c2
Show file tree
Hide file tree
Showing 35 changed files with 3,675 additions and 3,815 deletions.
15 changes: 15 additions & 0 deletions .eslintignore
@@ -0,0 +1,15 @@
.DS_Store
node_modules
/build
/package
.env
.env.*
!.env.example

pnpm-lock.yaml
package-lock.json
yarn.lock


dist/
src-tauri/
38 changes: 38 additions & 0 deletions .eslintrc.cjs
@@ -0,0 +1,38 @@
module.exports = {
root: true,
extends: [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:react/recommended",
"prettier",
],
parser: "@typescript-eslint/parser",
plugins: ["@typescript-eslint", "react"],
parserOptions: {
sourceType: "module",
ecmaVersion: 2020,
ecmaFeatures: {
jsx: true,
},
},
env: {
browser: true,
es2017: true,
node: true,
},
settings: {
react: {
version: "detect",
},
},
overrides: [
{
files: ["**/*.tsx", "**/*.jsx"],
rules: {
"react/prop-types": "off",
"react/react-in-jsx-scope": "off",
"@typescript-eslint/no-explicit-any": "off",
},
},
],
}
96 changes: 96 additions & 0 deletions .github/workflows/ci.yaml
@@ -0,0 +1,96 @@
name: Lint and Format

on:
workflow_dispatch:

pull_request:
branches:
- main

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
CARGO_TERM_COLOR: always
CARGO_PROFILE_DEV_DEBUG: 0
RUST_BACKTRACE: 1

jobs:
eslint-format:
name: ESLint
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Install pnpm
uses: pnpm/action-setup@v2.2.2
with:
version: 8.x.x

- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 20
cache: 'pnpm'

- name: Install pnpm dependencies
run: pnpm i --frozen-lockfile

- name: Perform linting
run: pnpm lint

rust-format:
name: rustfmt
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Install dependencies
run: sudo apt-get install -y libgtk-3-dev

- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
components: rustfmt

- name: Run rustfmt
run: cargo fmt --manifest-path ./src-tauri/Cargo.toml --all -- --check

rust-lint:
name: Clippy
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Install dependencies
run: sudo apt-get update && sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev libayatana-appindicator3-dev librsvg2-dev libssl-dev libsoup2.4-dev


- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
components: clippy


- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 20

- name: Install pnpm
uses: pnpm/action-setup@v2.0.1
with:
version: 8
run_install: false


- name: Run Clippy
run: cargo clippy --manifest-path src-tauri/Cargo.toml --all-targets --all-features -- -D warnings
7 changes: 3 additions & 4 deletions .github/workflows/main.yml
Expand Up @@ -57,18 +57,17 @@ jobs:
- name: Rust cache
uses: swatinem/rust-cache@v2
with:
workspaces: './src-tauri -> target'
workspaces: "./src-tauri -> target"

- name: Install dependencies
run: pnpm install


- name: Build Tauri App
uses: tauri-apps/tauri-action@v0
with:
tagName: ${{ github.ref_name }}
releaseName: 'KFtray - v${{ github.ref_name }}'
releaseBody: 'See the assets to download this version and install.'
releaseName: "KFtray - v${{ github.ref_name }}"
releaseBody: "See the assets to download this version and install."
releaseDraft: true
prerelease: false
updaterJsonKeepUniversal: true
Expand Down
2 changes: 2 additions & 0 deletions .prettierignore
@@ -0,0 +1,2 @@
# .prettierignore
src-tauri/
6 changes: 6 additions & 0 deletions README.md
Expand Up @@ -51,7 +51,9 @@ Stay tuned for more features as we continue to enhance `kftray` for an even bett
- Rust for backend development.

## Installation

### Building from Source

To build `kftray` from source, follow these steps:

1. Clone the repository:
Expand All @@ -72,16 +74,20 @@ To build `kftray` from source, follow these steps:
```

## Usage

After building the application, use the following steps to run the application:

1. Navigate to the `src-tauri/target/release/` directory.
2. Execute the binary for your platform (`kftray.exe` on Windows, `./kftray` on macOS and Linux).
3. The application will appear in the system tray.
4. Click the tray icon to open the UI for starting or stopping Kubernetes port forwarding based on your configurations.

## Configuration

The UI allows you to add, remove, and edit port-forwarding settings with ease. Configurations are saved at $HOME/.kftray/configs.db by default.

## Contributing

Contributions are welcome! Feel free to submit pull requests, create issues, or offer suggestions to improve kftray.

## License
Expand Down
Binary file removed dist/assets/logo-086bb510.png
Binary file not shown.
7 changes: 3 additions & 4 deletions dist/index.html
@@ -1,16 +1,15 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Tauri + React + TS</title>
<script type="module" crossorigin src="/assets/index-7068198f.js"></script>
<link rel="stylesheet" href="/assets/index-a485d9f9.css">
<script type="module" crossorigin src="/assets/index-JuZN40LF.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-e3cyFvbq.css">
</head>

<body class="arrow">
<div id="root"></div>

</body>
</html>
2 changes: 1 addition & 1 deletion index.html
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
Expand Down
141 changes: 53 additions & 88 deletions package.json
@@ -1,90 +1,55 @@
{
"name": "kftray",
"version": "0.0.0",
"private": true,
"scripts": {
"build": "tsc && vite build",
"dev": "vite",
"format": "npx prettier --write . --ignore-path .gitignore ",
"preview": "vite preview",
"tauri": "tauri",
"taze": "taze major -I",
"taze:minor": "taze minor -w"
},
"dependencies": {
"@chakra-ui/icons": "^2.1.1",
"@chakra-ui/react": "^2.8.2",
"@emotion/react": "^11.11.1",
"@emotion/styled": "^11.11.0",
"@fortawesome/fontawesome-svg-core": "^6.5.1",
"@fortawesome/free-solid-svg-icons": "^6.5.1",
"@fortawesome/react-fontawesome": "^0.2.0",
"@hookform/resolvers": "^3.1.1",
"@radix-ui/react-accessible-icon": "^1.0.3",
"@radix-ui/react-accordion": "^1.1.2",
"@radix-ui/react-alert-dialog": "^1.0.4",
"@radix-ui/react-aspect-ratio": "^1.0.3",
"@radix-ui/react-avatar": "^1.0.3",
"@radix-ui/react-checkbox": "^1.0.4",
"@radix-ui/react-collapsible": "^1.0.3",
"@radix-ui/react-context-menu": "^2.1.4",
"@radix-ui/react-dialog": "^1.0.4",
"@radix-ui/react-dropdown-menu": "^2.0.5",
"@radix-ui/react-hover-card": "^1.0.6",
"@radix-ui/react-icons": "^1.3.0",
"@radix-ui/react-label": "^2.0.2",
"@radix-ui/react-menubar": "^1.0.3",
"@radix-ui/react-navigation-menu": "^1.1.3",
"@radix-ui/react-popover": "^1.0.6",
"@radix-ui/react-progress": "^1.0.3",
"@radix-ui/react-radio-group": "^1.1.3",
"@radix-ui/react-scroll-area": "^1.0.4",
"@radix-ui/react-select": "^1.2.2",
"@radix-ui/react-separator": "^1.0.3",
"@radix-ui/react-slider": "^1.1.2",
"@radix-ui/react-slot": "^1.0.2",
"@radix-ui/react-switch": "^1.0.3",
"@radix-ui/react-tabs": "^1.0.4",
"@radix-ui/react-toast": "^1.1.4",
"@radix-ui/react-toggle": "^1.0.3",
"@radix-ui/react-toggle-group": "^1.0.4",
"@radix-ui/react-tooltip": "^1.0.6",
"@tauri-apps/api": "^1.5.1",
"@vitejs/plugin-react": "^4.2.1",
"@vitejs/plugin-react-swc": "^3.3.2",
"cmdk": "^0.2.0",
"date-fns": "^2.30.0",
"framer-motion": "^10.16.14",
"lucide-react": "^0.263.1",
"next-themes": "^0.2.1",
"react": "^18.2.0",
"react-day-picker": "^8.8.0",
"react-dom": "^18.2.0",
"react-hook-form": "^7.45.2",
"react-icons": "^4.12.0",
"recharts": "^2.7.2",
"shelljs": "^0.8.5",
"tailwind-scrollbar": "^3.0.4",
"tailwindcss-animate": "^1.0.6",
"tauri-plugin-log-api": "github:tauri-apps/tauri-plugin-log#v1",
"zod": "^3.21.4"
},
"devDependencies": {
"@ianvs/prettier-plugin-sort-imports": "^4.1.0",
"@tauri-apps/cli": "^1.5.1",
"@types/node": "^18.18.13",
"@types/react": "^18.2.18",
"@types/react-dom": "^18.2.7",
"autoprefixer": "^10.4.14",
"class-variance-authority": "^0.7.0",
"clsx": "^2.0.0",
"postcss": "^8.4.27",
"prettier": "^3.0.1",
"prettier-plugin-tailwindcss": "^0.4.1",
"tailwind-merge": "^1.14.0",
"tailwindcss": "^3.3.3",
"taze": "^0.11.2",
"typescript": "^5.1.6",
"vite": "^4.4.8"
}
"name": "kftray",
"version": "0.0.0",
"private": true,
"type": "module",
"scripts": {
"build": "tsc && vite build",
"dev": "vite",
"format": "prettier --write .",
"lint": "eslint . --ext .js,.jsx,.ts,.tsx",
"preview": "vite preview",
"tauri": "tauri",
"taze": "taze major -I",
"taze:minor": "taze minor -w",
"test": "vitest",
"test:ui": "vitest --ui"
},
"dependencies": {
"@chakra-ui/react": "^2.8.2",
"@emotion/react": "^11.11.1",
"@emotion/styled": "^11.11.0",
"@fortawesome/fontawesome-svg-core": "^6.5.1",
"@fortawesome/free-solid-svg-icons": "^6.5.1",
"@fortawesome/react-fontawesome": "^0.2.0",
"@tauri-apps/api": "^1.5.2",
"@vitejs/plugin-react-swc": "^3.5.0",
"framer-motion": "^10.16.16",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-icons": "^4.12.0",
"tauri-plugin-log-api": "github:tauri-apps/tauri-plugin-log#v1"
},
"devDependencies": {
"@ianvs/prettier-plugin-sort-imports": "^4.1.1",
"@tauri-apps/cli": "^1.5.8",
"@testing-library/jest-dom": "^6.1.5",
"@testing-library/react": "^14.1.2",
"@types/node": " ^20.10.4",
"@types/react": "^18.2.45",
"@types/react-dom": "^18.2.18",
"@typescript-eslint/eslint-plugin": "^6.14.0",
"@typescript-eslint/parser": "^6.14.0",
"eslint": "^8.56.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.0.1",
"eslint-plugin-react": "^7.33.2",
"jsdom": "^23.0.1",
"prettier": "^3.1.1",
"taze": "^0.13.0",
"typecheck": "^0.1.2",
"typescript": "^5.3.3",
"vite": "^5.0.10",
"vitest": "^1.0.4"
}
}

0 comments on commit 24d73c2

Please sign in to comment.