From 1d7171a1ec2bf3a1d8a432e9afd0cbf0e5767ee9 Mon Sep 17 00:00:00 2001 From: Amr Bashir Date: Sun, 18 Sep 2022 14:16:35 +0200 Subject: [PATCH] chore: add prettierignore and fmt the repo (#5192) Co-authored-by: Lucas Nogueira --- .prettierignore | 11 ++ .scripts/covector/sync-cli-metadata.js | 24 +-- core/tests/app-updater/tauri.conf.json | 4 +- examples/isolation/isolation-dist/index.html | 14 +- examples/isolation/isolation-dist/index.js | 2 +- examples/multiwindow/index.html | 160 +++++++++---------- examples/navigation/public/secondary.html | 32 ++-- examples/parent-window/index.html | 92 +++++------ examples/resources/package.json | 2 +- examples/sidecar/index.html | 93 ++++++----- examples/sidecar/package.json | 2 +- examples/streaming/index.html | 54 +++---- examples/updater/package.json | 2 +- package.json | 2 +- tooling/api/package.json | 4 +- 15 files changed, 255 insertions(+), 243 deletions(-) create mode 100644 .prettierignore diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 000000000..d677e46da --- /dev/null +++ b/.prettierignore @@ -0,0 +1,11 @@ +/.github +/.husky +/.vscode +/audits +node_modules +target +dist +/core/tauri/scripts +/tooling/cli/templates +/tooling/cli/node +/tooling/cli/schema.json diff --git a/.scripts/covector/sync-cli-metadata.js b/.scripts/covector/sync-cli-metadata.js index f5d735b11..f63cfe56e 100644 --- a/.scripts/covector/sync-cli-metadata.js +++ b/.scripts/covector/sync-cli-metadata.js @@ -1,5 +1,5 @@ #!/usr/bin/env node - // Copyright 2019-2022 Tauri Programme within The Commons Conservancy +// Copyright 2019-2022 Tauri Programme within The Commons Conservancy // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT @@ -10,26 +10,26 @@ we should look to find a more "rusty way" to import / "pin" a version value in o rust binaries. */ -const { - readFileSync, - writeFileSync -} = require('fs') +const { readFileSync, writeFileSync } = require('fs') const packageNickname = process.argv[2] -const filePath = packageNickname === 'cli.js' ? `../../../tooling/cli/metadata.json` : `../../tooling/cli/metadata.json` +const filePath = + packageNickname === 'cli.js' + ? `../../../tooling/cli/metadata.json` + : `../../tooling/cli/metadata.json` const bump = process.argv[3] let index = null switch (bump) { case 'major': - index = 0; - break; + index = 0 + break case 'minor': - index = 1; - break; + index = 1 + break case 'patch': - index = 2; - break; + index = 2 + break default: throw new Error('unexpected bump ' + bump) } diff --git a/core/tests/app-updater/tauri.conf.json b/core/tests/app-updater/tauri.conf.json index 0e21bd844..d45616f89 100644 --- a/core/tests/app-updater/tauri.conf.json +++ b/core/tests/app-updater/tauri.conf.json @@ -30,9 +30,7 @@ "active": true, "dialog": false, "pubkey": "dW50cnVzdGVkIGNvbW1lbnQ6IG1pbmlzaWduIHB1YmxpYyBrZXk6IDE5QzMxNjYwNTM5OEUwNTgKUldSWTRKaFRZQmJER1h4d1ZMYVA3dnluSjdpN2RmMldJR09hUFFlZDY0SlFqckkvRUJhZDJVZXAK", - "endpoints": [ - "http://localhost:3007" - ], + "endpoints": ["http://localhost:3007"], "windows": { "installMode": "quiet" } diff --git a/examples/isolation/isolation-dist/index.html b/examples/isolation/isolation-dist/index.html index 1a12b0bc4..27c8d3f39 100644 --- a/examples/isolation/isolation-dist/index.html +++ b/examples/isolation/isolation-dist/index.html @@ -1,10 +1,10 @@ - - - Isolation Secure Script - - - - + + + Isolation Secure Script + + + + diff --git a/examples/isolation/isolation-dist/index.js b/examples/isolation/isolation-dist/index.js index 2acb850a5..56b9e89b3 100644 --- a/examples/isolation/isolation-dist/index.js +++ b/examples/isolation/isolation-dist/index.js @@ -1,4 +1,4 @@ -window.__TAURI_ISOLATION_HOOK__= (payload) => { +window.__TAURI_ISOLATION_HOOK__ = (payload) => { console.log('hook', payload) return payload } diff --git a/examples/multiwindow/index.html b/examples/multiwindow/index.html index 8ec7c6d6b..4bfe319e1 100644 --- a/examples/multiwindow/index.html +++ b/examples/multiwindow/index.html @@ -1,84 +1,84 @@ - - - - - - -
-
-
- - - + + - \ No newline at end of file + +
+
+
+ + + + diff --git a/examples/navigation/public/secondary.html b/examples/navigation/public/secondary.html index 421ed3cb1..88cb5470f 100644 --- a/examples/navigation/public/secondary.html +++ b/examples/navigation/public/secondary.html @@ -1,21 +1,19 @@ + + + + + Tauri + - - - - - Tauri - - - -

- - - - - + +

+ + + + diff --git a/examples/parent-window/index.html b/examples/parent-window/index.html index bf826e90e..cd5bccac3 100644 --- a/examples/parent-window/index.html +++ b/examples/parent-window/index.html @@ -1,54 +1,54 @@ + + + - - - + +
+
+
- -
-
-
+ - - - \ No newline at end of file + createWindowButton.addEventListener('click', function () { + runCommand('create_child_window', { + id: `child-${windowId}-${windowNumber}` + }) + windowNumber += 1 + createWindowButton.innerHTML = 'Create child window ' + windowNumber + }) + container.appendChild(createWindowButton) + + + diff --git a/examples/resources/package.json b/examples/resources/package.json index 4d9bc4414..81fb8cf72 100644 --- a/examples/resources/package.json +++ b/examples/resources/package.json @@ -4,4 +4,4 @@ "scripts": { "tauri": "node ../../tooling/cli/node/tauri.js" } -} \ No newline at end of file +} diff --git a/examples/sidecar/index.html b/examples/sidecar/index.html index 6fff51829..9362514ee 100644 --- a/examples/sidecar/index.html +++ b/examples/sidecar/index.html @@ -1,49 +1,56 @@ + + + + + Sidecar + + - - - - - Sidecar - - + +
+
+
+
+ - + const backendDiv = document.getElementById('backend') + window.__TAURI__.event.listen('message', (event) => { + addMessage(backendDiv, event.payload) + }) + const frontendDiv = document.getElementById('frontend') + const { Command } = window.__TAURI__.shell + const command = Command.sidecar('binaries/app') + command.on('close', (data) => { + addMessage( + frontendDiv, + `command finished with code ${data.code} and signal ${data.signal}` + ) + }) + command.on('error', (error) => + addMessage(frontendDiv, `command error: "${error}"`) + ) + command.stdout.on('data', (line) => + addMessage(frontendDiv, `command stdout: "${line}"`) + ) + command.stderr.on('data', (line) => + addMessage(frontendDiv, `command stderr: "${line}"`) + ) + command.spawn() + + diff --git a/examples/sidecar/package.json b/examples/sidecar/package.json index b40a20404..034961c39 100644 --- a/examples/sidecar/package.json +++ b/examples/sidecar/package.json @@ -15,4 +15,4 @@ "execa": "5.1.1", "pkg": "5.2.1" } -} \ No newline at end of file +} diff --git a/examples/streaming/index.html b/examples/streaming/index.html index 28fcf708f..03662bfb1 100644 --- a/examples/streaming/index.html +++ b/examples/streaming/index.html @@ -1,31 +1,29 @@ + + + + + + - - - - - - - - - - - - - \ No newline at end of file + + + + + diff --git a/examples/updater/package.json b/examples/updater/package.json index 0e217e086..9c9182bc7 100644 --- a/examples/updater/package.json +++ b/examples/updater/package.json @@ -4,4 +4,4 @@ "scripts": { "tauri": "node ../../tooling/cli/node/tauri.js" } -} \ No newline at end of file +} diff --git a/package.json b/package.json index d77806887..9b24e6286 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ "url": "https://github.com/tauri-apps/tauri.git" }, "scripts": { - "format": "prettier --write --end-of-line=auto \"./**/*.{cjs,js,jsx,ts,tsx,html,css,json}\" --ignore-path .gitignore", + "format": "prettier --write --end-of-line=auto \"./**/*.{cjs,js,jsx,ts,tsx,html,css,json}\" --ignore-path .prettierignore", "postinstall": "husky install" }, "devDependencies": { diff --git a/tooling/api/package.json b/tooling/api/package.json index f63361c97..20747a17f 100644 --- a/tooling/api/package.json +++ b/tooling/api/package.json @@ -16,8 +16,8 @@ "npm-publish": "yarn build && cd ./dist && yarn publish --access public --loglevel silly", "lint": "eslint --ext ts \"./src/**/*.ts\"", "lint-fix": "eslint --fix --ext ts \"./src/**/*.ts\"", - "format": "prettier --write --end-of-line=auto \"./**/*.{cjs,js,jsx,ts,tsx,html,css,json}\" --ignore-path .gitignore", - "format:check": "prettier --check --end-of-line=auto \"./**/*.{cjs,js,jsx,ts,tsx,html,css,json}\" --ignore-path .gitignore", + "format": "prettier --write --end-of-line=auto \"./**/*.{cjs,js,jsx,ts,tsx,html,css,json}\" --ignore-path ../../.prettierignore", + "format:check": "prettier --check --end-of-line=auto \"./**/*.{cjs,js,jsx,ts,tsx,html,css,json}\" --ignore-path ../../.prettierignore", "generate-docs": "typedoc" }, "repository": {