mirror of
https://github.com/Kuingsmile/PicList.git
synced 2026-06-28 02:52:16 +08:00
🎨 Style(custom): lint code
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import axios from 'axios'
|
||||
import { run } from 'npm-check-updates'
|
||||
|
||||
async function getRepositoryInfo (packageName) {
|
||||
async function getRepositoryInfo(packageName) {
|
||||
try {
|
||||
const { data } = await axios.get(`https://registry.npmjs.org/${packageName}`)
|
||||
const repository = data.repository
|
||||
@@ -17,7 +17,7 @@ async function getRepositoryInfo (packageName) {
|
||||
return null
|
||||
}
|
||||
|
||||
async function checkUpdates () {
|
||||
async function checkUpdates() {
|
||||
const updated = await run({
|
||||
packageFile: './package.json',
|
||||
upgrade: false
|
||||
|
||||
@@ -1,66 +1,66 @@
|
||||
// different platform has different format
|
||||
|
||||
// macos
|
||||
const darwin = [
|
||||
{
|
||||
appNameWithPrefix: 'PicList-',
|
||||
ext: '.dmg',
|
||||
arch: '-arm64',
|
||||
'version-file': 'latest-mac.yml'
|
||||
},
|
||||
{
|
||||
appNameWithPrefix: 'PicList-',
|
||||
ext: '.dmg',
|
||||
arch: '-x64',
|
||||
'version-file': 'latest-mac.yml'
|
||||
}
|
||||
]
|
||||
|
||||
const linux = [
|
||||
{
|
||||
appNameWithPrefix: 'PicList-',
|
||||
ext: '.AppImage',
|
||||
arch: '',
|
||||
'version-file': 'latest-linux.yml'
|
||||
},
|
||||
{
|
||||
appNameWithPrefix: 'piclist_',
|
||||
ext: '.snap',
|
||||
arch: '_amd64',
|
||||
'version-file': 'latest-linux.yml'
|
||||
}
|
||||
]
|
||||
|
||||
// windows
|
||||
const win32 = [
|
||||
{
|
||||
appNameWithPrefix: 'PicList-Setup-',
|
||||
ext: '.exe',
|
||||
arch: '-ia32',
|
||||
'version-file': 'latest.yml'
|
||||
},
|
||||
{
|
||||
appNameWithPrefix: 'PicList-Setup-',
|
||||
ext: '.exe',
|
||||
arch: '-x64',
|
||||
'version-file': 'latest.yml'
|
||||
},
|
||||
{
|
||||
appNameWithPrefix: 'PicList-Setup-',
|
||||
ext: '.exe',
|
||||
arch: '', // 32 & 64
|
||||
'version-file': 'latest.yml'
|
||||
},
|
||||
{
|
||||
appNameWithPrefix: 'PicList-Setup-',
|
||||
ext: '.exe',
|
||||
arch: '-arm64',
|
||||
'version-file': 'latest.yml'
|
||||
}
|
||||
]
|
||||
|
||||
export default {
|
||||
darwin,
|
||||
linux,
|
||||
win32
|
||||
}
|
||||
// different platform has different format
|
||||
|
||||
// macos
|
||||
const darwin = [
|
||||
{
|
||||
appNameWithPrefix: 'PicList-',
|
||||
ext: '.dmg',
|
||||
arch: '-arm64',
|
||||
'version-file': 'latest-mac.yml'
|
||||
},
|
||||
{
|
||||
appNameWithPrefix: 'PicList-',
|
||||
ext: '.dmg',
|
||||
arch: '-x64',
|
||||
'version-file': 'latest-mac.yml'
|
||||
}
|
||||
]
|
||||
|
||||
const linux = [
|
||||
{
|
||||
appNameWithPrefix: 'PicList-',
|
||||
ext: '.AppImage',
|
||||
arch: '',
|
||||
'version-file': 'latest-linux.yml'
|
||||
},
|
||||
{
|
||||
appNameWithPrefix: 'piclist_',
|
||||
ext: '.snap',
|
||||
arch: '_amd64',
|
||||
'version-file': 'latest-linux.yml'
|
||||
}
|
||||
]
|
||||
|
||||
// windows
|
||||
const win32 = [
|
||||
{
|
||||
appNameWithPrefix: 'PicList-Setup-',
|
||||
ext: '.exe',
|
||||
arch: '-ia32',
|
||||
'version-file': 'latest.yml'
|
||||
},
|
||||
{
|
||||
appNameWithPrefix: 'PicList-Setup-',
|
||||
ext: '.exe',
|
||||
arch: '-x64',
|
||||
'version-file': 'latest.yml'
|
||||
},
|
||||
{
|
||||
appNameWithPrefix: 'PicList-Setup-',
|
||||
ext: '.exe',
|
||||
arch: '', // 32 & 64
|
||||
'version-file': 'latest.yml'
|
||||
},
|
||||
{
|
||||
appNameWithPrefix: 'PicList-Setup-',
|
||||
ext: '.exe',
|
||||
arch: '-arm64',
|
||||
'version-file': 'latest.yml'
|
||||
}
|
||||
]
|
||||
|
||||
export default {
|
||||
darwin,
|
||||
linux,
|
||||
win32
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ import path from 'node:path'
|
||||
import axios from 'axios'
|
||||
import fs from 'fs-extra'
|
||||
|
||||
import pkg from '../package.json' with { type: 'json'}
|
||||
import pkg from '../package.json' with { type: 'json' }
|
||||
const version = process.argv[2] || pkg.version
|
||||
|
||||
// Configuration
|
||||
@@ -26,7 +26,7 @@ const files = [
|
||||
/**
|
||||
* Create progress bar string
|
||||
*/
|
||||
function getProgressBar (current, total, length = 20) {
|
||||
function getProgressBar(current, total, length = 20) {
|
||||
const progress = Math.round((current / total) * length)
|
||||
const percentage = Math.round((current / total) * 100)
|
||||
const bar = '█'.repeat(progress) + '░'.repeat(length - progress)
|
||||
@@ -36,7 +36,7 @@ function getProgressBar (current, total, length = 20) {
|
||||
/**
|
||||
* Format bytes to human-readable format
|
||||
*/
|
||||
function formatBytes (bytes, decimals = 2) {
|
||||
function formatBytes(bytes, decimals = 2) {
|
||||
if (bytes === 0) return '0 Bytes'
|
||||
const k = 1024
|
||||
const sizes = ['Bytes', 'KB', 'MB', 'GB']
|
||||
@@ -47,7 +47,7 @@ function formatBytes (bytes, decimals = 2) {
|
||||
/**
|
||||
* Download file and calculate SHA256 hash
|
||||
*/
|
||||
async function downloadAndHash (fileInfo) {
|
||||
async function downloadAndHash(fileInfo) {
|
||||
const { url, name } = fileInfo
|
||||
const filePath = path.join(DOWNLOAD_DIR, name)
|
||||
|
||||
@@ -103,7 +103,7 @@ async function downloadAndHash (fileInfo) {
|
||||
/**
|
||||
* Main function
|
||||
*/
|
||||
async function main () {
|
||||
async function main() {
|
||||
console.log(`Generating SHA256 hashes for PicList v${version}`)
|
||||
console.log(`Download directory: ${DOWNLOAD_DIR}`)
|
||||
|
||||
|
||||
@@ -1,26 +1,26 @@
|
||||
import pkg from '../package.json' with { type: 'json' }
|
||||
const version = pkg.version
|
||||
// TODO: use the same name format
|
||||
const generateURL = (platform, ext, prefix = 'PicList-') => {
|
||||
return `https://release.piclist.cn/latest/${prefix}${version}${platform}${ext}`
|
||||
}
|
||||
|
||||
const template = `
|
||||
### 加速下载地址
|
||||
|
||||
#### MacOS
|
||||
[PicList-${version}-arm64.dmg](${generateURL('-arm64', '.dmg', 'PicList-')})
|
||||
[PicList-${version}-x64.dmg](${generateURL('-x64', '.dmg', 'PicList-')})
|
||||
[PicList-${version}-universal.dmg](${generateURL('-universal', '.dmg', 'PicList-')})
|
||||
|
||||
#### Windows
|
||||
[PicList-Setup-${version}-ia32.exe](${generateURL('-ia32', '.exe', 'PicList-Setup-')})
|
||||
[PicList-Setup-${version}-x64.exe](${generateURL('-x64', '.exe', 'PicList-Setup-')})
|
||||
[PicList-Setup-${version}-arm64.exe](${generateURL('-arm64', '.exe', 'PicList-Setup-')})
|
||||
[PicList-Setup-${version}.exe](${generateURL('', '.exe', 'PicList-Setup-')})
|
||||
|
||||
#### Linux
|
||||
[PicList-${version}.AppImage](${generateURL('', '.AppImage', 'PicList-')})
|
||||
[piclist_${version}_amd64.snap](${generateURL('_amd64', '.snap', 'piclist_')})`
|
||||
|
||||
console.log(template)
|
||||
import pkg from '../package.json' with { type: 'json' }
|
||||
const version = pkg.version
|
||||
// TODO: use the same name format
|
||||
const generateURL = (platform, ext, prefix = 'PicList-') => {
|
||||
return `https://release.piclist.cn/latest/${prefix}${version}${platform}${ext}`
|
||||
}
|
||||
|
||||
const template = `
|
||||
### 加速下载地址
|
||||
|
||||
#### MacOS
|
||||
[PicList-${version}-arm64.dmg](${generateURL('-arm64', '.dmg', 'PicList-')})
|
||||
[PicList-${version}-x64.dmg](${generateURL('-x64', '.dmg', 'PicList-')})
|
||||
[PicList-${version}-universal.dmg](${generateURL('-universal', '.dmg', 'PicList-')})
|
||||
|
||||
#### Windows
|
||||
[PicList-Setup-${version}-ia32.exe](${generateURL('-ia32', '.exe', 'PicList-Setup-')})
|
||||
[PicList-Setup-${version}-x64.exe](${generateURL('-x64', '.exe', 'PicList-Setup-')})
|
||||
[PicList-Setup-${version}-arm64.exe](${generateURL('-arm64', '.exe', 'PicList-Setup-')})
|
||||
[PicList-Setup-${version}.exe](${generateURL('', '.exe', 'PicList-Setup-')})
|
||||
|
||||
#### Linux
|
||||
[PicList-${version}.AppImage](${generateURL('', '.AppImage', 'PicList-')})
|
||||
[piclist_${version}_amd64.snap](${generateURL('_amd64', '.snap', 'piclist_')})`
|
||||
|
||||
console.log(template)
|
||||
|
||||
@@ -5,7 +5,7 @@ require('dotenv').config()
|
||||
const { notarize } = require('@electron/notarize')
|
||||
const { ELECTRON_SKIP_NOTARIZATION, XCODE_APP_LOADER_EMAIL, XCODE_APP_LOADER_PASSWORD, XCODE_TEAM_ID } = process.env
|
||||
|
||||
async function main (context) {
|
||||
async function main(context) {
|
||||
const { electronPlatformName, appOutDir } = context
|
||||
|
||||
if (
|
||||
|
||||
Reference in New Issue
Block a user