Skip to content

Commit

Permalink
chore: adjust prettier config, .gitignore and use taplo to format tom…
Browse files Browse the repository at this point in the history
…l files (tauri-apps#1728)

* chore: adjust prettier config, .gitignore and use taplo to format toml files

This brings the plugins-workspace repository to the same code style of the main tauri repo

* format toml

* ignore examples gen dir

* add .vscode/extensions.json

* remove packageManager field

* fmt

* fix audit

* taplo ignore permissions autogenerated files

* remove create dummy dist

* fix prettier workflow

* install fmt in prettier workflow

---------

Co-authored-by: Lucas Nogueira <[email protected]>
  • Loading branch information
amrbashir and lucasfernog authored Sep 4, 2024
1 parent 72c2ce8 commit cf4d7d4
Show file tree
Hide file tree
Showing 227 changed files with 2,533 additions and 2,504 deletions.
4 changes: 2 additions & 2 deletions .cargo/audit.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ ignore = [
# wry needs kuchiki on Android
"RUSTSEC-2023-0019",
# atty is only used when the `colored` feature is enabled on tauri-plugin-log
"RUSTSEC-2021-0145"
]
"RUSTSEC-2021-0145",
]
16 changes: 8 additions & 8 deletions .github/workflows/audit-javascript.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,23 @@ name: Audit JavaScript
on:
workflow_dispatch:
schedule:
- cron: "0 0 * * *"
- cron: '0 0 * * *'
push:
branches:
- v1
- v2
paths:
- ".github/workflows/audit-javascript.yml"
- "**/pnpm-lock.yaml"
- "**/package.json"
- '.github/workflows/audit-javascript.yml'
- '**/pnpm-lock.yaml'
- '**/package.json'
pull_request:
branches:
- v1
- v2
paths:
- ".github/workflows/audit-javascript.yml"
- "**/pnpm-lock.yaml"
- "**/package.json"
- '.github/workflows/audit-javascript.yml'
- '**/pnpm-lock.yaml'
- '**/package.json'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand All @@ -43,7 +43,7 @@ jobs:
${{ runner.os }}-
- uses: actions/setup-node@v4
with:
node-version: "lts/*"
node-version: 'lts/*'
- uses: pnpm/action-setup@v4
with:
version: 9.x.x
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/audit-rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,23 @@ name: Audit Rust
on:
workflow_dispatch:
schedule:
- cron: "0 0 * * *"
- cron: '0 0 * * *'
push:
branches:
- v1
- v2
paths:
- ".github/workflows/audit-rust.yml"
- "**/Cargo.lock"
- "**/Cargo.toml"
- '.github/workflows/audit-rust.yml'
- '**/Cargo.lock'
- '**/Cargo.toml'
pull_request:
branches:
- v1
- v2
paths:
- ".github/workflows/audit-rust.yml"
- "**/Cargo.lock"
- "**/Cargo.toml"
- '.github/workflows/audit-rust.yml'
- '**/Cargo.lock'
- '**/Cargo.toml'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/check-generated-files.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ name: check generated files
on:
pull_request:
paths:
- ".github/workflows/check-generated-files.yml"
- "**/guest-js/**"
- '.github/workflows/check-generated-files.yml'
- '**/guest-js/**'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand Down Expand Up @@ -136,7 +136,7 @@ jobs:
${{ runner.os }}-
- uses: actions/setup-node@v4
with:
node-version: "lts/*"
node-version: 'lts/*'
- uses: pnpm/action-setup@v4
with:
version: 9.x.x
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/covector-comment-on-fork.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ jobs:
uses: jbolda/covector/packages/action@covector-v0
with:
token: ${{ secrets.GITHUB_TOKEN }}
command: "status"
command: 'status'
4 changes: 2 additions & 2 deletions .github/workflows/covector-status.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ jobs:
uses: jbolda/covector/packages/action@covector-v0
id: covector
with:
command: "status"
command: 'status'
token: ${{ secrets.GITHUB_TOKEN }}
comment: true
comment: true
14 changes: 7 additions & 7 deletions .github/workflows/covector-version-or-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ jobs:

- uses: actions/setup-node@v4
with:
node-version: "lts/*"
registry-url: "https://registry.npmjs.org"
node-version: 'lts/*'
registry-url: 'https://registry.npmjs.org'

- uses: pnpm/action-setup@v4
with:
Expand Down Expand Up @@ -65,7 +65,7 @@ jobs:
NODE_AUTH_TOKEN: ${{ secrets.ORG_NPM_TOKEN }}
with:
token: ${{ secrets.GITHUB_TOKEN }}
command: "version-or-publish"
command: 'version-or-publish'
createRelease: true
recognizeContributors: true

Expand All @@ -78,8 +78,8 @@ jobs:
uses: tauri-apps/create-pull-request@v3
if: steps.covector.outputs.commandRan == 'version'
with:
title: "Publish New Versions (${{ github.ref_name }})"
commit-message: "publish new versions"
labels: "version updates"
branch: "ci/release-${{ github.ref_name }}"
title: 'Publish New Versions (${{ github.ref_name }})'
commit-message: 'publish new versions'
labels: 'version updates'
branch: 'ci/release-${{ github.ref_name }}'
body: ${{ steps.covector.outputs.change }}
59 changes: 59 additions & 0 deletions .github/workflows/fmt.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Copyright 2019-2023 Tauri Programme within The Commons Conservancy
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT

name: check formatting

on:
pull_request:

jobs:
rustfmt:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: install Rust stable and rustfmt
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt

- name: run cargo fmt
run: cargo fmt --all -- --check

prettier:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Cache pnpm modules
uses: actions/cache@v4
with:
path: ~/.pnpm-store
key: ${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-
- uses: actions/setup-node@v4
with:
node-version: 'lts/*'
- uses: pnpm/action-setup@v4
with:
version: 9.x.x
run_install: true
- run: pnpm format:check

taplo:
name: taplo (.toml files)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: install Rust stable
uses: dtolnay/rust-toolchain@stable

- name: install taplo-cli
uses: taiki-e/install-action@v2
with:
tool: taplo-cli

- run: taplo fmt --check --diff
8 changes: 4 additions & 4 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ on:
- v1
- v2
paths:
- ".github/workflows/integration-tests.yml"
- "plugins/updater/src/**"
- '.github/workflows/integration-tests.yml'
- 'plugins/updater/src/**'
pull_request:
branches:
- v1
- v2
paths:
- ".github/workflows/integration-tests.yml"
- "plugins/updater/src/**"
- '.github/workflows/integration-tests.yml'
- 'plugins/updater/src/**'

jobs:
run-integration-tests:
Expand Down
46 changes: 13 additions & 33 deletions .github/workflows/lint-javascript.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,23 @@ on:
- v1
- v2
paths:
- ".github/workflows/lint-javascript.yml"
- "plugins/*/guest-js/**"
- ".eslintignore"
- ".eslintrc.json"
- ".prettierignore"
- "**/package.json"
- '.github/workflows/lint-javascript.yml'
- 'plugins/*/guest-js/**'
- '.eslintignore'
- '.eslintrc.json'
- '.prettierignore'
- '**/package.json'
pull_request:
branches:
- v1
- v2
paths:
- ".github/workflows/lint-javascript.yml"
- "plugins/*/guest-js/**"
- ".eslintignore"
- ".eslintrc.json"
- ".prettierignore"
- "**/package.json"
- '.github/workflows/lint-javascript.yml'
- 'plugins/*/guest-js/**'
- '.eslintignore'
- '.eslintrc.json'
- '.prettierignore'
- '**/package.json'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand All @@ -46,30 +46,10 @@ jobs:
${{ runner.os }}-
- uses: actions/setup-node@v4
with:
node-version: "lts/*"
node-version: 'lts/*'
- uses: pnpm/action-setup@v4
with:
version: 9.x.x
run_install: true
- name: eslint
run: pnpm lint
prettier:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Cache pnpm modules
uses: actions/cache@v4
with:
path: ~/.pnpm-store
key: ${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-
- uses: actions/setup-node@v4
with:
node-version: "lts/*"
- uses: pnpm/action-setup@v4
with:
version: 9.x.x
run_install: true
- name: prettier check
run: pnpm format-check
34 changes: 8 additions & 26 deletions .github/workflows/lint-rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,19 @@ on:
- v1
- v2
paths:
- ".github/workflows/lint-rust.yml"
- "plugins/*/src/**"
- "!plugins/*/src/api-iife.js"
- "**/Cargo.toml"
- '.github/workflows/lint-rust.yml'
- 'plugins/*/src/**'
- '!plugins/*/src/api-iife.js'
- '**/Cargo.toml'
pull_request:
branches:
- v1
- v2
paths:
- ".github/workflows/lint-rust.yml"
- "plugins/*/src/**"
- "!plugins/*/src/api-iife.js"
- "**/Cargo.toml"
- '.github/workflows/lint-rust.yml'
- 'plugins/*/src/**'
- '!plugins/*/src/api-iife.js'
- '**/Cargo.toml'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand Down Expand Up @@ -147,10 +147,6 @@ jobs:

- uses: Swatinem/rust-cache@v2

- name: create dummy dist
working-directory: examples/api
run: mkdir dist

- name: clippy ${{ matrix.package }}
if: matrix.package != 'tauri-plugin-sql'
run: cargo clippy --package ${{ matrix.package }} --all-targets -- -D warnings
Expand All @@ -162,17 +158,3 @@ jobs:
- name: clippy ${{ matrix.package }} postgres
if: matrix.package == 'tauri-plugin-sql'
run: cargo clippy --package ${{ matrix.package }} --all-targets --no-default-features --features postgres -- -D warnings

fmt:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Install rustfmt with nightly toolchain
uses: dtolnay/rust-toolchain@nightly
with:
components: rustfmt

- name: Check formatting
run: cargo fmt --all -- --check
2 changes: 1 addition & 1 deletion .github/workflows/sync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
- uses: actions/setup-node@v4
with:
node-version: "lts/*"
node-version: 'lts/*'

- uses: pnpm/action-setup@v4
with:
Expand Down
Loading

0 comments on commit cf4d7d4

Please sign in to comment.