Skip to content

Commit

Permalink
chore: add prettierignore and fmt the repo (tauri-apps#5192)
Browse files Browse the repository at this point in the history
Co-authored-by: Lucas Nogueira <[email protected]>
  • Loading branch information
amrbashir and lucasfernog authored Sep 18, 2022
1 parent ecb489a commit 1d7171a
Show file tree
Hide file tree
Showing 15 changed files with 245 additions and 233 deletions.
11 changes: 11 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -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
24 changes: 12 additions & 12 deletions .scripts/covector/sync-cli-metadata.js
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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)
}
Expand Down
4 changes: 1 addition & 3 deletions core/tests/app-updater/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,7 @@
"active": true,
"dialog": false,
"pubkey": "dW50cnVzdGVkIGNvbW1lbnQ6IG1pbmlzaWduIHB1YmxpYyBrZXk6IDE5QzMxNjYwNTM5OEUwNTgKUldSWTRKaFRZQmJER1h4d1ZMYVA3dnluSjdpN2RmMldJR09hUFFlZDY0SlFqckkvRUJhZDJVZXAK",
"endpoints": [
"http://localhost:3007"
],
"endpoints": ["http://localhost:3007"],
"windows": {
"installMode": "quiet"
}
Expand Down
14 changes: 7 additions & 7 deletions examples/isolation/isolation-dist/index.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Isolation Secure Script</title>
</head>
<body>
<script src="index.js"></script>
</body>
<head>
<meta charset="UTF-8" />
<title>Isolation Secure Script</title>
</head>
<body>
<script src="index.js"></script>
</body>
</html>
2 changes: 1 addition & 1 deletion examples/isolation/isolation-dist/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
window.__TAURI_ISOLATION_HOOK__= (payload) => {
window.__TAURI_ISOLATION_HOOK__ = (payload) => {
console.log('hook', payload)
return payload
}
140 changes: 70 additions & 70 deletions examples/multiwindow/index.html
Original file line number Diff line number Diff line change
@@ -1,84 +1,84 @@
<!DOCTYPE html>
<html>
<head>
<style>
#response {
white-space: pre-wrap;
}
</style>
</head>

<head>
<style>
#response {
white-space: pre-wrap;
}
</style>
</head>
<body>
<div id="window-label"></div>
<div id="container"></div>
<div id="response"></div>

<body>
<div id="window-label"></div>
<div id="container"></div>
<div id="response"></div>
<script>
var WebviewWindow = window.__TAURI__.window.WebviewWindow
var appWindow = window.__TAURI__.window.appWindow
var windowLabel = appWindow.label
var windowLabelContainer = document.getElementById('window-label')
windowLabelContainer.innerText = 'This is the ' + windowLabel + ' window.'

<script>
var WebviewWindow = window.__TAURI__.window.WebviewWindow
var appWindow = window.__TAURI__.window.appWindow
var windowLabel = appWindow.label
var windowLabelContainer = document.getElementById('window-label')
windowLabelContainer.innerText = 'This is the ' + windowLabel + ' window.'
var container = document.getElementById('container')

var container = document.getElementById('container')
function createWindowMessageBtn(label) {
var tauriWindow = WebviewWindow.getByLabel(label)
var button = document.createElement('button')
button.innerText = 'Send message to ' + label
button.addEventListener('click', function () {
tauriWindow.emit('clicked', 'message from ' + windowLabel)
})
container.appendChild(button)
}

function createWindowMessageBtn(label) {
var tauriWindow = WebviewWindow.getByLabel(label)
var button = document.createElement('button')
button.innerText = 'Send message to ' + label
button.addEventListener('click', function () {
tauriWindow.emit('clicked', 'message from ' + windowLabel)
// global listener
window.__TAURI__.event.listen('clicked', function (event) {
responseContainer.innerHTML +=
'Got ' + JSON.stringify(event) + ' on global listener\n\n'
})
window.__TAURI__.event.listen('tauri://window-created', function (event) {
createWindowMessageBtn(event.payload.label)
})
container.appendChild(button)
}

// global listener
window.__TAURI__.event.listen('clicked', function (event) {
responseContainer.innerHTML +=
'Got ' + JSON.stringify(event) + ' on global listener\n\n'
})
window.__TAURI__.event.listen('tauri://window-created', function (event) {
createWindowMessageBtn(event.payload.label)
})

var responseContainer = document.getElementById('response')
// listener tied to this window
appWindow.listen('clicked', function (event) {
responseContainer.innerText +=
'Got ' + JSON.stringify(event) + ' on window listener\n\n'
})

var createWindowButton = document.createElement('button')
createWindowButton.innerHTML = 'Create window'
createWindowButton.addEventListener('click', function () {
var webviewWindow = new WebviewWindow(Math.random().toString().replace('.', ''))
webviewWindow.once('tauri://created', function () {
responseContainer.innerHTML += 'Created new webview'
var responseContainer = document.getElementById('response')
// listener tied to this window
appWindow.listen('clicked', function (event) {
responseContainer.innerText +=
'Got ' + JSON.stringify(event) + ' on window listener\n\n'
})
webviewWindow.once('tauri://error', function (e) {
responseContainer.innerHTML += 'Error creating new webview'

var createWindowButton = document.createElement('button')
createWindowButton.innerHTML = 'Create window'
createWindowButton.addEventListener('click', function () {
var webviewWindow = new WebviewWindow(
Math.random().toString().replace('.', '')
)
webviewWindow.once('tauri://created', function () {
responseContainer.innerHTML += 'Created new webview'
})
webviewWindow.once('tauri://error', function (e) {
responseContainer.innerHTML += 'Error creating new webview'
})
})
})
container.appendChild(createWindowButton)
container.appendChild(createWindowButton)

var globalMessageButton = document.createElement('button')
globalMessageButton.innerHTML = 'Send global message'
globalMessageButton.addEventListener('click', function () {
// emit to all windows
window.__TAURI__.event.emit('clicked', 'message from ' + windowLabel)
})
container.appendChild(globalMessageButton)
var globalMessageButton = document.createElement('button')
globalMessageButton.innerHTML = 'Send global message'
globalMessageButton.addEventListener('click', function () {
// emit to all windows
window.__TAURI__.event.emit('clicked', 'message from ' + windowLabel)
})
container.appendChild(globalMessageButton)

var allWindows = window.__TAURI__.window.getAll()
for (var index in allWindows) {
var label = allWindows[index].label
if (label === windowLabel) {
continue
var allWindows = window.__TAURI__.window.getAll()
for (var index in allWindows) {
var label = allWindows[index].label
if (label === windowLabel) {
continue
}
createWindowMessageBtn(label)
}
createWindowMessageBtn(label)
}
</script>
</body>

</html>
</script>
</body>
</html>
32 changes: 15 additions & 17 deletions examples/navigation/public/secondary.html
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Tauri</title>
</head>

<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Tauri</title>
</head>

<body>
<h1></h1>
<button>Back</button>
<script>
const button = document.querySelector('button')
button.addEventListener('click', () => window.history.back())
</script>
<script src="secondary.js"></script>
</body>

<body>
<h1></h1>
<button>Back</button>
<script>
const button = document.querySelector('button')
button.addEventListener('click', () => window.history.back())
</script>
<script src="secondary.js"></script>
</body>
</html>
92 changes: 46 additions & 46 deletions examples/parent-window/index.html
Original file line number Diff line number Diff line change
@@ -1,54 +1,54 @@
<!DOCTYPE html>
<html>
<head>
<style>
#response {
white-space: pre-wrap;
}
</style>
</head>

<head>
<style>
#response {
white-space: pre-wrap;
}
</style>
</head>
<body>
<div id="window-label"></div>
<div id="container"></div>
<div id="response"></div>

<body>
<div id="window-label"></div>
<div id="container"></div>
<div id="response"></div>
<script>
var WebviewWindow = window.__TAURI__.window.WebviewWindow
var thisTauriWindow = window.__TAURI__.window.getCurrent()
var windowLabel = thisTauriWindow.label
var windowLabelContainer = document.getElementById('window-label')
windowLabelContainer.innerText = 'This is the ' + windowLabel + ' window.'

<script>
var WebviewWindow = window.__TAURI__.window.WebviewWindow
var thisTauriWindow = window.__TAURI__.window.getCurrent()
var windowLabel = thisTauriWindow.label
var windowLabelContainer = document.getElementById('window-label')
windowLabelContainer.innerText = 'This is the ' + windowLabel + ' window.'
var container = document.getElementById('container')

var container = document.getElementById('container')
var responseContainer = document.getElementById('response')
function runCommand(commandName, args, optional) {
window.__TAURI__
.invoke(commandName, args)
.then((response) => {
responseContainer.innerText += `Ok(${response})\n\n`
})
.catch((error) => {
responseContainer.innerText += `Err(${error})\n\n`
})
}
window.__TAURI__.event.listen('tauri://window-created', function (event) {
responseContainer.innerText += 'Got window-created event\n\n'
})

var responseContainer = document.getElementById('response')
function runCommand(commandName, args, optional) {
window.__TAURI__
.invoke(commandName, args)
.then((response) => {
responseContainer.innerText += `Ok(${response})\n\n`
})
.catch((error) => {
responseContainer.innerText += `Err(${error})\n\n`
})
}
window.__TAURI__.event.listen('tauri://window-created', function (event) {
responseContainer.innerText += 'Got window-created event\n\n'
})

var createWindowButton = document.createElement('button')
var windowId = Math.random().toString().replace('.', '')
var windowNumber = 1
createWindowButton.innerHTML = 'Create child window ' + windowNumber
createWindowButton.addEventListener('click', function () {
runCommand('create_child_window', { id: `child-${windowId}-${windowNumber}` })
windowNumber += 1
var createWindowButton = document.createElement('button')
var windowId = Math.random().toString().replace('.', '')
var windowNumber = 1
createWindowButton.innerHTML = 'Create child window ' + windowNumber
})
container.appendChild(createWindowButton)
</script>
</body>

</html>
createWindowButton.addEventListener('click', function () {
runCommand('create_child_window', {
id: `child-${windowId}-${windowNumber}`
})
windowNumber += 1
createWindowButton.innerHTML = 'Create child window ' + windowNumber
})
container.appendChild(createWindowButton)
</script>
</body>
</html>
2 changes: 1 addition & 1 deletion examples/resources/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
"scripts": {
"tauri": "node ../../tooling/cli/node/tauri.js"
}
}
}
Loading

0 comments on commit 1d7171a

Please sign in to comment.