FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

include client files · tweakphp/tweakphp@03d602a · GitHub

Repository navigation

Commit 03d602a

Browse files
committed
include client files
1 parent 2ba75e3 commit 03d602a

9 files changed

Lines changed: 48 additions & 1 deletion

File tree

‎.gitignore‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,5 @@ dist-ssr
2626
release
2727

2828
public/laravel
29-
public/client-*.phar
3029

3130
.env

‎package.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
"main": "dist/main.js",
1212
"scripts": {
1313
"dev": "vite",
14+
"update-clients": "node ./scripts/update-clients.js",
1415
"build": "vue-tsc && vite build",
1516
"build-mac": "npm run build && electron-builder --publish always --mac --universal",
1617
"preview": "vite preview",

‎public/client-7.4.phar‎

943 KB
Binary file not shown.

‎public/client-8.0.phar‎

930 KB
Binary file not shown.

‎public/client-8.1.phar‎

961 KB
Binary file not shown.

‎public/client-8.2.phar‎

963 KB
Binary file not shown.

‎public/client-8.3.phar‎

963 KB
Binary file not shown.
File renamed without changes.

‎scripts/update-clients.js‎

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
import path from 'path'
2+
import fs from 'fs'
3+
import fetch from 'node-fetch'
4+
import * as glob from 'glob'
5+
import { fileURLToPath } from 'url'
6+
7+
const __filename = fileURLToPath(import.meta.url)
8+
const __dirname = path.dirname(__filename)
9+
10+
function cleanup() {
11+
const files = glob.sync(path.join(__dirname, '../public', 'client-*.phar'))
12+
files.forEach(file => {
13+
fs.unlinkSync(file)
14+
})
15+
}
16+
17+
async function downloadFile(url, output) {
18+
const response = await fetch(url)
19+
if (!response.ok) throw new Error(`Failed to fetch ${url}`)
20+
21+
const destPath = path.resolve(__dirname, '..', output)
22+
fs.mkdirSync(path.dirname(destPath), { recursive: true })
23+
24+
const fileStream = fs.createWriteStream(destPath)
25+
response.body.pipe(fileStream)
26+
27+
return new Promise((resolve, reject) => {
28+
fileStream.on('finish', resolve)
29+
fileStream.on('error', reject)
30+
})
31+
}
32+
33+
cleanup()
34+
35+
fetch('https://api.github.com/repos/tweakphp/client/releases/latest')
36+
.then(response => response.json())
37+
.then(data => {
38+
data.assets.forEach(async asset => {
39+
const url = asset.browser_download_url
40+
const filePath = path.join(__dirname, '../public', asset.name)
41+
await downloadFile(url, filePath)
42+
})
43+
console.log('Downloaded all client files.')
44+
})
45+
.catch(err => {
46+
console.error('Error fetching release data:', err.message)
47+
})

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL