Skip to content

Commit

Permalink
feat(next.js): rewrite all
Browse files Browse the repository at this point in the history
BREAKING_CHANGE
  • Loading branch information
SARDONYX-sard committed Jul 24, 2024
1 parent 12ffec7 commit 7120ef5
Show file tree
Hide file tree
Showing 229 changed files with 21,482 additions and 4,401 deletions.
5 changes: 3 additions & 2 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[Makefile]
indent_style = tab
[*.rs]
indent_size = 4
26 changes: 8 additions & 18 deletions .github/ISSUE_TEMPLATE/bug-report.yaml
Original file line number Diff line number Diff line change
@@ -1,40 +1,39 @@
---
name: Bug Report
description: File a bug report
title: "[Bug]: "
labels: ["bug"]
title: '[Bug]: '
labels: ['bug']

body:
- type: markdown
attributes:
value: |
Thanks for taking the time to fill out this bug report!
- type: dropdown
- type: input
id: version
attributes:
label: Version
description: What version of our software are you running?
options:
- 0.1.0
- 0.2.0 (Default)
- 0.3.0 (main branch:Next ver.)
placeholder: "Example: 0.1.0"
validations:
required: true

- type: textarea
id: unexpected-behavior
attributes:
label: Unexpected behavior here
description: May I ask you to tell us about the unexpected behavior?
# yamllint disable-line rule:line-length
placeholder: "Example: If '0' is written in settings.toml's duration, the process will go on forever."
placeholder: 'Example: logger is not worked.'
validations:
required: true
- type: textarea
id: expected-behavior
attributes:
label: Expected behavior
description: May I ask you to tell us about the behavior you expect?
placeholder: "Example: Consider falling back to 1 if 0 is set."
# yamllint disable-line rule:line-length
placeholder: 'Example: Reflects the level specification of the logger in the GUI.'
validations:
required: true
- type: textarea
Expand All @@ -44,12 +43,3 @@ body:
# yamllint disable-line rule:line-length
description: Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks.
render: Shell
- type: checkboxes
id: terms
attributes:
label: Code of Conduct
# yamllint disable-line rule:line-length
description: By submitting this issue, you agree to follow our [Code of Conduct](https://github.com/SARDONYX-sard/bluetooth-battery-monitor/CODE_OF_CONDUCT.md)
options:
- label: I agree to follow this project's Code of Conduct
required: true
24 changes: 24 additions & 0 deletions .github/ISSUE_TEMPLATE/feature-request.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
name: Feature Request
description: File a feature request
title: '[Feature]: '
labels: ['enhancement']

body:
- type: markdown
attributes:
value: |
Thanks for taking the time to fill out this feature request.
- type: textarea
id: expected-behavior
attributes:
label: Expected behavior
description: May I ask you to tell us about the behavior you expect?
placeholder: 'Example: Add progress bar in the GUI.'
validations:
required: true
- type: textarea
id: other
attributes:
label: other
description: About everything else.
18 changes: 0 additions & 18 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,5 @@
# New Features

- [ ] Add

-

-

- [ ] Implement to

- [ ] Enable

# Changes and Fixes

- [ ] Change

- [ ] Fix

- [ ] Modify

# Refactors

- [ ] Clean
90 changes: 90 additions & 0 deletions .github/workflows/lint-and-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
name: Cargo Lint & Test

on:
push:
branches: ['main']
pull_request:
branches: '*'
workflow_dispatch: # <- Setting to allow manual execution by button.

env:
CARGO_TERM_COLOR: always

jobs:
build:
strategy:
fail-fast: false
matrix:
platform: [macos-latest, ubuntu-20.04, windows-latest]
runs-on: ${{ matrix.platform }}

steps:
- name: Install dependencies (ubuntu only)
if: matrix.platform == 'ubuntu-20.04'
# You can remove libayatana-appindicator3-dev if you don't use the system tray feature.
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev libayatana-appindicator3-dev librsvg2-dev
- uses: actions/[email protected]
- name: Rust cache
uses: Swatinem/[email protected]
with:
prefix-key: cargo-${{ matrix.platform }}
- name: Install components
run: |
rustup component add clippy
rustup component add rustfmt
- name: Format Check
run: cargo fmt --all -- --check
- name: Lint Check
run: cargo clippy --workspace -- -D warnings
- name: Test(Rust)
run: cargo test --workspace

- name: Sync node version
uses: actions/[email protected]
with:
node-version: 'lts/*'
cache: 'npm'

- name: Node.js cache
uses: actions/[email protected]
with:
path: ${{ github.workspace }}/gui/frontend/.next/cache
# Generate a new cache whenever packages or source files change.
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('dar2oar_gui/frontend/src/**/*.[jt]s', 'dar2oar_gui/frontend/src/**/*.[jt]sx') }}
# If source files changed but packages didn't, rebuild from a prior cache.
restore-keys: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-
- name: Install frontend dependencies
run: npm ci

- name: Test(Node.js)
run: npm test
- name: Build Test(GUI)
run: npm run build

- name: Make outputs dir
run: mkdir -p ./build
- name: Compress outputs(Windows)
shell: pwsh
if: runner.os == 'Windows'
run: |
Move-Item -Path ./target/release/bluetooth_battery_monitor.exe -Destination './build'
- name: Compress outputs(MacOS)
shell: bash
if: runner.os == 'macOS'
run: |
mv ./target/release/bluetooth_battery_monitor ./build
- name: Compress outputs(Linux)
shell: bash
if: runner.os == 'Linux'
run: |
mv ./target/release/bluetooth_battery_monitor ./build
- name: Upload a Build Artifact
uses: actions/[email protected]
with:
name: Bluetooth Battery Monitor ${{runner.os}}
path: |
./build/
60 changes: 60 additions & 0 deletions .github/workflows/release-gui.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Release GUI
on:
push:
tags:
- '*'
workflow_dispatch:

jobs:
release:
permissions:
contents: write
strategy:
fail-fast: false
matrix:
platform: [macos-latest, ubuntu-20.04, windows-latest]
runs-on: ${{ matrix.platform }}

steps:
- uses: actions/[email protected]

- name: Install dependencies (ubuntu only)
if: matrix.platform == 'ubuntu-20.04'
# You can remove libayatana-appindicator3-dev if you don't use the system tray feature.
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev libayatana-appindicator3-dev librsvg2-dev
- name: Rust setup
uses: dtolnay/rust-toolchain@stable

- name: Rust cache
uses: Swatinem/[email protected]
with:
prefix-key: cargo-${{ matrix.platform }}

- name: Sync node version and setup cache
uses: actions/[email protected]
with:
node-version: 'lts/*'
cache: 'npm'

- name: Node.js cache
uses: actions/[email protected]
with:
path: ${{ github.workspace }}/dar2oar_gui/frontend/.next/cache
# Generate a new cache whenever packages or source files change.
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('dar2oar_gui/frontend/src/**/*.[jt]s', 'dar2oar_gui/frontend/src/**/*.[jt]sx') }}
restore-keys: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-
- name: Install frontend dependencies
run: npm ci

- name: Build the app
uses: tauri-apps/[email protected]

env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
releaseName: 'Bluetooth Battery Monitor v__VERSION__'
tagName: ${{ github.ref_name }} # This only works if your workflow triggers on new tags.
prerelease: false
46 changes: 0 additions & 46 deletions .github/workflows/release.yaml

This file was deleted.

26 changes: 21 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,22 @@
target
WixTools
dist
**/node_modules/
# dependencies
node_modules/

devices.json
# next.js
.next/
.swc
out/

# production
build

# misc
.DS_Store
*.pem
test/data/*
!test/data/*.md
*.log

# Rust build cache
**/target

secrets/
8 changes: 8 additions & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
//! NOTE: If this file is not in the root directory, VSCode's prettier extension will not reflect this setting.
//! Use prettier because biome is fast but does not yet support yaml formatting.
/** @type {import('prettier').Options} */
module.exports = {
semi: true,
singleQuote: true,
printWidth: 120,
};
8 changes: 7 additions & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
{
"recommendations": [
"bradlc.vscode-tailwindcss"
"biomejs.biome",
"editorconfig.editorconfig",
"jayfong.generate-index",
"lokalise.i18n-ally",
"rust-lang.rust-analyzer",
"tamasfe.even-better-toml",
"vitest.explorer"
]
}
Loading

0 comments on commit 7120ef5

Please sign in to comment.