chore: adjust prettier config, .gitignore and use taplo to format toml files (#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 <lucas@tauri.app>
This commit is contained in:
Amr Bashir
2024-09-04 14:54:23 +03:00
committed by GitHub
parent 72c2ce82c1
commit cf4d7d4e6c
227 changed files with 2534 additions and 2505 deletions
-1
View File
@@ -1 +0,0 @@
/.tauri
+4 -4
View File
@@ -10,12 +10,12 @@ repository = { workspace = true }
links = "tauri-plugin-barcode-scanner"
[package.metadata.docs.rs]
rustc-args = [ "--cfg", "docsrs" ]
rustdoc-args = [ "--cfg", "docsrs" ]
targets = [ "x86_64-linux-android" ]
rustc-args = ["--cfg", "docsrs"]
rustdoc-args = ["--cfg", "docsrs"]
targets = ["x86_64-linux-android"]
[build-dependencies]
tauri-plugin = { workspace = true, features = [ "build" ] }
tauri-plugin = { workspace = true, features = ["build"] }
[dependencies]
serde = { workspace = true }
+2 -2
View File
@@ -60,12 +60,12 @@ fn main() {
Afterwards all the plugin's APIs are available through the JavaScript guest bindings:
```javascript
import { scan } from "@tauri-apps/plugin-barcode-scanner";
import { scan } from '@tauri-apps/plugin-barcode-scanner'
// `windowed: true` actually sets the webview to transparent
// instead of opening a separate view for the camera
// make sure your user interface is ready to show what is underneath with a transparent element
scan({ windowed: true, formats: [""] })
scan({ windowed: true, formats: [''] })
```
## Contributing
-1
View File
@@ -54,7 +54,6 @@ The camera has two modes. The first one is where the user can see the background
The second mode allows the developer to assist the user and add a transparent overlay to the image, providing hints or additional information (like a link preview).
The overlay could be made non-transparent by the application frontend and as long as the app is open (and in some cases) it could read QR codes in range of the camera lense.
#### Out Of Scope
- Exploits in the operating system QR code parsing functionality
+29 -29
View File
@@ -5,37 +5,37 @@
import {
invoke,
requestPermissions as checkPermissions_,
checkPermissions as requestPermissions_,
} from "@tauri-apps/api/core";
checkPermissions as requestPermissions_
} from '@tauri-apps/api/core'
export type { PermissionState } from "@tauri-apps/api/core";
export type { PermissionState } from '@tauri-apps/api/core'
export enum Format {
QRCode = "QR_CODE",
UPC_A = "UPC_A",
UPC_E = "UPC_E",
EAN8 = "EAN_8",
EAN13 = "EAN_13",
Code39 = "CODE_39",
Code93 = "CODE_93",
Code128 = "CODE_128",
Codabar = "CODABAR",
ITF = "ITF",
Aztec = "AZTEC",
DataMatrix = "DATA_MATRIX",
PDF417 = "PDF_417",
QRCode = 'QR_CODE',
UPC_A = 'UPC_A',
UPC_E = 'UPC_E',
EAN8 = 'EAN_8',
EAN13 = 'EAN_13',
Code39 = 'CODE_39',
Code93 = 'CODE_93',
Code128 = 'CODE_128',
Codabar = 'CODABAR',
ITF = 'ITF',
Aztec = 'AZTEC',
DataMatrix = 'DATA_MATRIX',
PDF417 = 'PDF_417'
}
export interface ScanOptions {
cameraDirection?: "back" | "front";
formats?: Format[];
windowed?: boolean;
cameraDirection?: 'back' | 'front'
formats?: Format[]
windowed?: boolean
}
export interface Scanned {
content: string;
format: Format;
bounds: unknown;
content: string
format: Format
bounds: unknown
}
/**
@@ -43,14 +43,14 @@ export interface Scanned {
* @param options
*/
export async function scan(options?: ScanOptions): Promise<Scanned> {
return await invoke("plugin:barcode-scanner|scan", { ...options });
return await invoke('plugin:barcode-scanner|scan', { ...options })
}
/**
* Cancel the current scan process.
*/
export async function cancel(): Promise<void> {
await invoke("plugin:barcode-scanner|cancel");
await invoke('plugin:barcode-scanner|cancel')
}
/**
@@ -58,8 +58,8 @@ export async function cancel(): Promise<void> {
*/
export async function checkPermissions(): Promise<PermissionState> {
return await checkPermissions_<{ camera: PermissionState }>(
"barcode-scanner",
).then((r) => r.camera);
'barcode-scanner'
).then((r) => r.camera)
}
/**
@@ -67,13 +67,13 @@ export async function checkPermissions(): Promise<PermissionState> {
*/
export async function requestPermissions(): Promise<PermissionState> {
return await requestPermissions_<{ camera: PermissionState }>(
"barcode-scanner",
).then((r) => r.camera);
'barcode-scanner'
).then((r) => r.camera)
}
/**
* Open application settings. Useful if permission was denied and the user must manually enable it.
*/
export async function openAppSettings(): Promise<void> {
await invoke("plugin:barcode-scanner|open_app_settings");
await invoke('plugin:barcode-scanner|open_app_settings')
}
+2 -2
View File
@@ -2,6 +2,6 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT
import { createConfig } from "../../shared/rollup.config.js";
import { createConfig } from '../../shared/rollup.config.js'
export default createConfig();
export default createConfig()