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
+15 -15
View File
@@ -2,26 +2,26 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT
import http from "http";
import fs from "fs";
import http from 'http'
import fs from 'fs'
const hostname = "localhost";
const port = 8080;
const hostname = 'localhost'
const port = 8080
const server = http.createServer(function (req, res) {
console.log(req.url);
if (req.url == "/.well-known/apple-app-site-association") {
console.log(req.url)
if (req.url == '/.well-known/apple-app-site-association') {
const association = fs.readFileSync(
".well-known/apple-app-site-association",
);
res.writeHead(200, { "Content-Type": "application/json" });
res.end(association);
'.well-known/apple-app-site-association'
)
res.writeHead(200, { 'Content-Type': 'application/json' })
res.end(association)
} else {
res.writeHead(404);
res.end("404 NOT FOUND");
res.writeHead(404)
res.end('404 NOT FOUND')
}
});
})
server.listen(port, hostname, () => {
console.log("Server started on port", port);
});
console.log('Server started on port', port)
})
+3 -3
View File
@@ -10,15 +10,15 @@ repository = { workspace = true }
links = "tauri-plugin-deep-link"
[package.metadata.docs.rs]
rustc-args = [ "--cfg", "docsrs" ]
rustdoc-args = [ "--cfg", "docsrs" ]
rustc-args = ["--cfg", "docsrs"]
rustdoc-args = ["--cfg", "docsrs"]
targets = ["x86_64-linux-android"]
[build-dependencies]
serde = { workspace = true }
serde_json = { workspace = true }
tauri-utils = { workspace = true }
tauri-plugin = { workspace = true, features = [ "build" ] }
tauri-plugin = { workspace = true, features = ["build"] }
[dependencies]
serde = { workspace = true }
+3 -3
View File
@@ -139,10 +139,10 @@ fn main() {
Afterwards all the plugin's APIs are available through the JavaScript guest bindings:
```javascript
import { onOpenUrl } from "@tauri-apps/plugin-deep-link";
import { onOpenUrl } from '@tauri-apps/plugin-deep-link'
await onOpenUrl((urls) => {
console.log("deep link:", urls);
});
console.log('deep link:', urls)
})
```
Note that the Plugin will only emit events on macOS, iOS and Android. On Windows and Linux the OS will spawn a new instance of your app with the URL as a CLI argument. If you want your app to behave on Windows & Linux similar to the other platforms you can use the [single-instance](../single-instance/) plugin.
+1 -1
View File
@@ -20,4 +20,4 @@ We prefer to receive reports in English.
Please disclose a vulnerability or security relevant issue here: [https://github.com/tauri-apps/plugins-workspace/security/advisories/new](https://github.com/tauri-apps/plugins-workspace/security/advisories/new).
Alternatively, you can also contact us by email via [security@tauri.app](mailto:security@tauri.app).
Alternatively, you can also contact us by email via [security@tauri.app](mailto:security@tauri.app).
@@ -68,7 +68,7 @@ targets:
base:
ENABLE_BITCODE: false
ARCHS: [arm64, arm64-sim]
VALID_ARCHS: arm64 arm64-sim
VALID_ARCHS: arm64 arm64-sim
LIBRARY_SEARCH_PATHS[arch=x86_64]: $(inherited) $(PROJECT_DIR)/Externals/x86_64/$(CONFIGURATION) $(SDKROOT)/usr/lib/swift $(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME) $(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)
LIBRARY_SEARCH_PATHS[arch=arm64]: $(inherited) $(PROJECT_DIR)/Externals/arm64/$(CONFIGURATION) $(SDKROOT)/usr/lib/swift $(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME) $(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)
LIBRARY_SEARCH_PATHS[arch=arm64-sim]: $(inherited) $(PROJECT_DIR)/Externals/arm64-sim/$(CONFIGURATION) $(SDKROOT)/usr/lib/swift $(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME) $(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)
@@ -93,4 +93,4 @@ targets:
outputFiles:
- $(SRCROOT)/Externals/x86_64/${CONFIGURATION}/libapp.a
- $(SRCROOT)/Externals/arm64/${CONFIGURATION}/libapp.a
- $(SRCROOT)/Externals/arm64-sim/${CONFIGURATION}/libapp.a
- $(SRCROOT)/Externals/arm64-sim/${CONFIGURATION}/libapp.a
@@ -2,30 +2,30 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT
import http from "http";
import fs from "fs";
import path from "path";
import * as url from "url";
const __dirname = url.fileURLToPath(new URL(".", import.meta.url));
import http from 'http'
import fs from 'fs'
import path from 'path'
import * as url from 'url'
const __dirname = url.fileURLToPath(new URL('.', import.meta.url))
const port = 8125;
const port = 8125
http
.createServer(function (request, response) {
if (request.url === "/.well-known/apple-app-site-association") {
if (request.url === '/.well-known/apple-app-site-association') {
// eslint-disable-next-line
fs.readFile(
path.resolve(__dirname, "apple-app-site-association"),
path.resolve(__dirname, 'apple-app-site-association'),
function (_error, content) {
response.writeHead(200);
response.end(content, "utf-8");
},
);
response.writeHead(200)
response.end(content, 'utf-8')
}
)
} else {
response.writeHead(404);
response.end();
response.writeHead(404)
response.end()
}
})
.listen(port);
.listen(port)
console.log(`Server running at http://127.0.0.1:${port}/`);
console.log(`Server running at http://127.0.0.1:${port}/`)
+17 -17
View File
@@ -4,35 +4,35 @@
import {
onOpenUrl,
getCurrent as getCurrentDeepLinkUrls,
} from "@tauri-apps/plugin-deep-link";
getCurrent as getCurrentDeepLinkUrls
} from '@tauri-apps/plugin-deep-link'
function handler(urls: string[]) {
console.log(urls);
console.log(urls)
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const updateIntentEl = document.querySelector("#event-intent")!;
updateIntentEl.textContent = JSON.stringify(urls);
const updateIntentEl = document.querySelector('#event-intent')!
updateIntentEl.textContent = JSON.stringify(urls)
}
window.addEventListener("DOMContentLoaded", () => {
onOpenUrl(handler);
window.addEventListener('DOMContentLoaded', () => {
onOpenUrl(handler)
document.querySelector("#intent-form")?.addEventListener("submit", (e) => {
e.preventDefault();
document.querySelector('#intent-form')?.addEventListener('submit', (e) => {
e.preventDefault()
getCurrentDeepLinkUrls()
.then((res) => {
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const updateIntentEl = document.querySelector("#update-intent")!;
updateIntentEl.textContent = res ? JSON.stringify(res) : "none";
const updateIntentEl = document.querySelector('#update-intent')!
updateIntentEl.textContent = res ? JSON.stringify(res) : 'none'
})
.catch(console.error);
});
.catch(console.error)
})
getCurrentDeepLinkUrls()
.then((res) => {
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const initialIntentEl = document.querySelector("#initial-intent")!;
initialIntentEl.textContent = res ? JSON.stringify(res) : "none";
const initialIntentEl = document.querySelector('#initial-intent')!
initialIntentEl.textContent = res ? JSON.stringify(res) : 'none'
})
.catch(console.error);
});
.catch(console.error)
})
+11 -11
View File
@@ -2,9 +2,9 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT
import { defineConfig } from "vite";
import { defineConfig } from 'vite'
const host = process.env.TAURI_DEV_HOST;
const host = process.env.TAURI_DEV_HOST
// https://vitejs.dev/config/
export default defineConfig({
@@ -17,22 +17,22 @@ export default defineConfig({
port: 1420,
hmr: host
? {
protocol: "ws",
protocol: 'ws',
host,
port: 1421,
port: 1421
}
: undefined,
strictPort: true,
strictPort: true
},
// to make use of `TAURI_DEBUG` and other env variables
// https://tauri.studio/v1/api/config#buildconfig.beforedevcommand
envPrefix: ["VITE_", "TAURI_"],
envPrefix: ['VITE_', 'TAURI_'],
build: {
// Tauri supports es2021
target: process.env.TAURI_PLATFORM == "windows" ? "chrome105" : "safari13",
target: process.env.TAURI_PLATFORM == 'windows' ? 'chrome105' : 'safari13',
// don't minify for debug builds
minify: !process.env.TAURI_DEBUG ? "esbuild" : false,
minify: !process.env.TAURI_DEBUG ? 'esbuild' : false,
// produce sourcemaps for debug builds
sourcemap: !!process.env.TAURI_DEBUG,
},
});
sourcemap: !!process.env.TAURI_DEBUG
}
})
+12 -12
View File
@@ -2,8 +2,8 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT
import { invoke } from "@tauri-apps/api/core";
import { type UnlistenFn, listen } from "@tauri-apps/api/event";
import { invoke } from '@tauri-apps/api/core'
import { type UnlistenFn, listen } from '@tauri-apps/api/event'
/**
* Get the current URLs that triggered the deep link. Use this on app load to check whether your app was started via a deep link.
@@ -19,7 +19,7 @@ import { type UnlistenFn, listen } from "@tauri-apps/api/event";
* @since 2.0.0
*/
export async function getCurrent(): Promise<string[] | null> {
return await invoke("plugin:deep-link|get_current");
return await invoke('plugin:deep-link|get_current')
}
/**
@@ -38,7 +38,7 @@ export async function getCurrent(): Promise<string[] | null> {
* @since 2.0.0
*/
export async function register(protocol: string): Promise<null> {
return await invoke("plugin:deep-link|register", { protocol });
return await invoke('plugin:deep-link|register', { protocol })
}
/**
@@ -57,7 +57,7 @@ export async function register(protocol: string): Promise<null> {
* @since 2.0.0
*/
export async function unregister(protocol: string): Promise<null> {
return await invoke("plugin:deep-link|unregister", { protocol });
return await invoke('plugin:deep-link|unregister', { protocol })
}
/**
@@ -76,7 +76,7 @@ export async function unregister(protocol: string): Promise<null> {
* @since 2.0.0
*/
export async function isRegistered(protocol: string): Promise<boolean> {
return await invoke("plugin:deep-link|is_registered", { protocol });
return await invoke('plugin:deep-link|is_registered', { protocol })
}
/**
@@ -95,14 +95,14 @@ export async function isRegistered(protocol: string): Promise<boolean> {
* @since 2.0.0
*/
export async function onOpenUrl(
handler: (urls: string[]) => void,
handler: (urls: string[]) => void
): Promise<UnlistenFn> {
const current = await getCurrent();
const current = await getCurrent()
if (current) {
handler(current);
handler(current)
}
return await listen<string[]>("deep-link://new-url", (event) => {
handler(event.payload);
});
return await listen<string[]>('deep-link://new-url', (event) => {
handler(event.payload)
})
}
+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()