Skip to content

Commit 1d7171a

Browse files
chore: add prettierignore and fmt the repo (tauri-apps#5192)
Co-authored-by: Lucas Nogueira <[email protected]>
1 parent ecb489a commit 1d7171a

File tree

15 files changed

+245
-233
lines changed

15 files changed

+245
-233
lines changed

.prettierignore

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/.github
2+
/.husky
3+
/.vscode
4+
/audits
5+
node_modules
6+
target
7+
dist
8+
/core/tauri/scripts
9+
/tooling/cli/templates
10+
/tooling/cli/node
11+
/tooling/cli/schema.json

.scripts/covector/sync-cli-metadata.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env node
2-
// Copyright 2019-2022 Tauri Programme within The Commons Conservancy
2+
// Copyright 2019-2022 Tauri Programme within The Commons Conservancy
33
// SPDX-License-Identifier: Apache-2.0
44
// SPDX-License-Identifier: MIT
55

@@ -10,26 +10,26 @@ we should look to find a more "rusty way" to import / "pin" a version value in o
1010
rust binaries.
1111
*/
1212

13-
const {
14-
readFileSync,
15-
writeFileSync
16-
} = require('fs')
13+
const { readFileSync, writeFileSync } = require('fs')
1714

1815
const packageNickname = process.argv[2]
19-
const filePath = packageNickname === 'cli.js' ? `../../../tooling/cli/metadata.json` : `../../tooling/cli/metadata.json`
16+
const filePath =
17+
packageNickname === 'cli.js'
18+
? `../../../tooling/cli/metadata.json`
19+
: `../../tooling/cli/metadata.json`
2020
const bump = process.argv[3]
2121
let index = null
2222

2323
switch (bump) {
2424
case 'major':
25-
index = 0;
26-
break;
25+
index = 0
26+
break
2727
case 'minor':
28-
index = 1;
29-
break;
28+
index = 1
29+
break
3030
case 'patch':
31-
index = 2;
32-
break;
31+
index = 2
32+
break
3333
default:
3434
throw new Error('unexpected bump ' + bump)
3535
}

core/tests/app-updater/tauri.conf.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,7 @@
3030
"active": true,
3131
"dialog": false,
3232
"pubkey": "dW50cnVzdGVkIGNvbW1lbnQ6IG1pbmlzaWduIHB1YmxpYyBrZXk6IDE5QzMxNjYwNTM5OEUwNTgKUldSWTRKaFRZQmJER1h4d1ZMYVA3dnluSjdpN2RmMldJR09hUFFlZDY0SlFqckkvRUJhZDJVZXAK",
33-
"endpoints": [
34-
"http://localhost:3007"
35-
],
33+
"endpoints": ["http://localhost:3007"],
3634
"windows": {
3735
"installMode": "quiet"
3836
}
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
<!DOCTYPE html>
22
<html lang="en">
3-
<head>
4-
<meta charset="UTF-8">
5-
<title>Isolation Secure Script</title>
6-
</head>
7-
<body>
8-
<script src="index.js"></script>
9-
</body>
3+
<head>
4+
<meta charset="UTF-8" />
5+
<title>Isolation Secure Script</title>
6+
</head>
7+
<body>
8+
<script src="index.js"></script>
9+
</body>
1010
</html>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
window.__TAURI_ISOLATION_HOOK__= (payload) => {
1+
window.__TAURI_ISOLATION_HOOK__ = (payload) => {
22
console.log('hook', payload)
33
return payload
44
}

examples/multiwindow/index.html

Lines changed: 70 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -1,84 +1,84 @@
11
<!DOCTYPE html>
22
<html>
3+
<head>
4+
<style>
5+
#response {
6+
white-space: pre-wrap;
7+
}
8+
</style>
9+
</head>
310

4-
<head>
5-
<style>
6-
#response {
7-
white-space: pre-wrap;
8-
}
9-
</style>
10-
</head>
11+
<body>
12+
<div id="window-label"></div>
13+
<div id="container"></div>
14+
<div id="response"></div>
1115

12-
<body>
13-
<div id="window-label"></div>
14-
<div id="container"></div>
15-
<div id="response"></div>
16+
<script>
17+
var WebviewWindow = window.__TAURI__.window.WebviewWindow
18+
var appWindow = window.__TAURI__.window.appWindow
19+
var windowLabel = appWindow.label
20+
var windowLabelContainer = document.getElementById('window-label')
21+
windowLabelContainer.innerText = 'This is the ' + windowLabel + ' window.'
1622

17-
<script>
18-
var WebviewWindow = window.__TAURI__.window.WebviewWindow
19-
var appWindow = window.__TAURI__.window.appWindow
20-
var windowLabel = appWindow.label
21-
var windowLabelContainer = document.getElementById('window-label')
22-
windowLabelContainer.innerText = 'This is the ' + windowLabel + ' window.'
23+
var container = document.getElementById('container')
2324

24-
var container = document.getElementById('container')
25+
function createWindowMessageBtn(label) {
26+
var tauriWindow = WebviewWindow.getByLabel(label)
27+
var button = document.createElement('button')
28+
button.innerText = 'Send message to ' + label
29+
button.addEventListener('click', function () {
30+
tauriWindow.emit('clicked', 'message from ' + windowLabel)
31+
})
32+
container.appendChild(button)
33+
}
2534

26-
function createWindowMessageBtn(label) {
27-
var tauriWindow = WebviewWindow.getByLabel(label)
28-
var button = document.createElement('button')
29-
button.innerText = 'Send message to ' + label
30-
button.addEventListener('click', function () {
31-
tauriWindow.emit('clicked', 'message from ' + windowLabel)
35+
// global listener
36+
window.__TAURI__.event.listen('clicked', function (event) {
37+
responseContainer.innerHTML +=
38+
'Got ' + JSON.stringify(event) + ' on global listener\n\n'
39+
})
40+
window.__TAURI__.event.listen('tauri://window-created', function (event) {
41+
createWindowMessageBtn(event.payload.label)
3242
})
33-
container.appendChild(button)
34-
}
35-
36-
// global listener
37-
window.__TAURI__.event.listen('clicked', function (event) {
38-
responseContainer.innerHTML +=
39-
'Got ' + JSON.stringify(event) + ' on global listener\n\n'
40-
})
41-
window.__TAURI__.event.listen('tauri://window-created', function (event) {
42-
createWindowMessageBtn(event.payload.label)
43-
})
44-
45-
var responseContainer = document.getElementById('response')
46-
// listener tied to this window
47-
appWindow.listen('clicked', function (event) {
48-
responseContainer.innerText +=
49-
'Got ' + JSON.stringify(event) + ' on window listener\n\n'
50-
})
5143

52-
var createWindowButton = document.createElement('button')
53-
createWindowButton.innerHTML = 'Create window'
54-
createWindowButton.addEventListener('click', function () {
55-
var webviewWindow = new WebviewWindow(Math.random().toString().replace('.', ''))
56-
webviewWindow.once('tauri://created', function () {
57-
responseContainer.innerHTML += 'Created new webview'
44+
var responseContainer = document.getElementById('response')
45+
// listener tied to this window
46+
appWindow.listen('clicked', function (event) {
47+
responseContainer.innerText +=
48+
'Got ' + JSON.stringify(event) + ' on window listener\n\n'
5849
})
59-
webviewWindow.once('tauri://error', function (e) {
60-
responseContainer.innerHTML += 'Error creating new webview'
50+
51+
var createWindowButton = document.createElement('button')
52+
createWindowButton.innerHTML = 'Create window'
53+
createWindowButton.addEventListener('click', function () {
54+
var webviewWindow = new WebviewWindow(
55+
Math.random().toString().replace('.', '')
56+
)
57+
webviewWindow.once('tauri://created', function () {
58+
responseContainer.innerHTML += 'Created new webview'
59+
})
60+
webviewWindow.once('tauri://error', function (e) {
61+
responseContainer.innerHTML += 'Error creating new webview'
62+
})
6163
})
62-
})
63-
container.appendChild(createWindowButton)
64+
container.appendChild(createWindowButton)
6465

65-
var globalMessageButton = document.createElement('button')
66-
globalMessageButton.innerHTML = 'Send global message'
67-
globalMessageButton.addEventListener('click', function () {
68-
// emit to all windows
69-
window.__TAURI__.event.emit('clicked', 'message from ' + windowLabel)
70-
})
71-
container.appendChild(globalMessageButton)
66+
var globalMessageButton = document.createElement('button')
67+
globalMessageButton.innerHTML = 'Send global message'
68+
globalMessageButton.addEventListener('click', function () {
69+
// emit to all windows
70+
window.__TAURI__.event.emit('clicked', 'message from ' + windowLabel)
71+
})
72+
container.appendChild(globalMessageButton)
7273

73-
var allWindows = window.__TAURI__.window.getAll()
74-
for (var index in allWindows) {
75-
var label = allWindows[index].label
76-
if (label === windowLabel) {
77-
continue
74+
var allWindows = window.__TAURI__.window.getAll()
75+
for (var index in allWindows) {
76+
var label = allWindows[index].label
77+
if (label === windowLabel) {
78+
continue
79+
}
80+
createWindowMessageBtn(label)
7881
}
79-
createWindowMessageBtn(label)
80-
}
81-
</script>
82-
</body>
83-
84-
</html>
82+
</script>
83+
</body>
84+
</html>
Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,19 @@
11
<!DOCTYPE html>
22
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
7+
<title>Tauri</title>
8+
</head>
39

4-
<head>
5-
<meta charset="UTF-8" />
6-
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
7-
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
8-
<title>Tauri</title>
9-
</head>
10-
11-
<body>
12-
<h1></h1>
13-
<button>Back</button>
14-
<script>
15-
const button = document.querySelector('button')
16-
button.addEventListener('click', () => window.history.back())
17-
</script>
18-
<script src="secondary.js"></script>
19-
</body>
20-
10+
<body>
11+
<h1></h1>
12+
<button>Back</button>
13+
<script>
14+
const button = document.querySelector('button')
15+
button.addEventListener('click', () => window.history.back())
16+
</script>
17+
<script src="secondary.js"></script>
18+
</body>
2119
</html>

examples/parent-window/index.html

Lines changed: 46 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,54 @@
11
<!DOCTYPE html>
22
<html>
3+
<head>
4+
<style>
5+
#response {
6+
white-space: pre-wrap;
7+
}
8+
</style>
9+
</head>
310

4-
<head>
5-
<style>
6-
#response {
7-
white-space: pre-wrap;
8-
}
9-
</style>
10-
</head>
11+
<body>
12+
<div id="window-label"></div>
13+
<div id="container"></div>
14+
<div id="response"></div>
1115

12-
<body>
13-
<div id="window-label"></div>
14-
<div id="container"></div>
15-
<div id="response"></div>
16+
<script>
17+
var WebviewWindow = window.__TAURI__.window.WebviewWindow
18+
var thisTauriWindow = window.__TAURI__.window.getCurrent()
19+
var windowLabel = thisTauriWindow.label
20+
var windowLabelContainer = document.getElementById('window-label')
21+
windowLabelContainer.innerText = 'This is the ' + windowLabel + ' window.'
1622

17-
<script>
18-
var WebviewWindow = window.__TAURI__.window.WebviewWindow
19-
var thisTauriWindow = window.__TAURI__.window.getCurrent()
20-
var windowLabel = thisTauriWindow.label
21-
var windowLabelContainer = document.getElementById('window-label')
22-
windowLabelContainer.innerText = 'This is the ' + windowLabel + ' window.'
23+
var container = document.getElementById('container')
2324

24-
var container = document.getElementById('container')
25+
var responseContainer = document.getElementById('response')
26+
function runCommand(commandName, args, optional) {
27+
window.__TAURI__
28+
.invoke(commandName, args)
29+
.then((response) => {
30+
responseContainer.innerText += `Ok(${response})\n\n`
31+
})
32+
.catch((error) => {
33+
responseContainer.innerText += `Err(${error})\n\n`
34+
})
35+
}
36+
window.__TAURI__.event.listen('tauri://window-created', function (event) {
37+
responseContainer.innerText += 'Got window-created event\n\n'
38+
})
2539

26-
var responseContainer = document.getElementById('response')
27-
function runCommand(commandName, args, optional) {
28-
window.__TAURI__
29-
.invoke(commandName, args)
30-
.then((response) => {
31-
responseContainer.innerText += `Ok(${response})\n\n`
32-
})
33-
.catch((error) => {
34-
responseContainer.innerText += `Err(${error})\n\n`
35-
})
36-
}
37-
window.__TAURI__.event.listen('tauri://window-created', function (event) {
38-
responseContainer.innerText += 'Got window-created event\n\n'
39-
})
40-
41-
var createWindowButton = document.createElement('button')
42-
var windowId = Math.random().toString().replace('.', '')
43-
var windowNumber = 1
44-
createWindowButton.innerHTML = 'Create child window ' + windowNumber
45-
createWindowButton.addEventListener('click', function () {
46-
runCommand('create_child_window', { id: `child-${windowId}-${windowNumber}` })
47-
windowNumber += 1
40+
var createWindowButton = document.createElement('button')
41+
var windowId = Math.random().toString().replace('.', '')
42+
var windowNumber = 1
4843
createWindowButton.innerHTML = 'Create child window ' + windowNumber
49-
})
50-
container.appendChild(createWindowButton)
51-
</script>
52-
</body>
53-
54-
</html>
44+
createWindowButton.addEventListener('click', function () {
45+
runCommand('create_child_window', {
46+
id: `child-${windowId}-${windowNumber}`
47+
})
48+
windowNumber += 1
49+
createWindowButton.innerHTML = 'Create child window ' + windowNumber
50+
})
51+
container.appendChild(createWindowButton)
52+
</script>
53+
</body>
54+
</html>

examples/resources/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44
"scripts": {
55
"tauri": "node ../../tooling/cli/node/tauri.js"
66
}
7-
}
7+
}

0 commit comments

Comments
 (0)