mirror of
https://github.com/Kuingsmile/PicList.git
synced 2026-05-06 20:42:57 +08:00
📦 Chore(custom): remove unused scripts
This commit is contained in:
@@ -1,38 +0,0 @@
|
||||
import axios from 'axios'
|
||||
import { run } from 'npm-check-updates'
|
||||
|
||||
async function getRepositoryInfo(packageName) {
|
||||
try {
|
||||
const { data } = await axios.get(`https://registry.npmjs.org/${packageName}`)
|
||||
const repository = data.repository
|
||||
if (repository && repository.url) {
|
||||
const gitUrl = repository.url.replace('git+', '').replace('.git', '')
|
||||
const isGitHub = gitUrl.includes('github.com')
|
||||
|
||||
return isGitHub ? `${gitUrl}/releases` : gitUrl
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(`Error fetching repository info for ${packageName}: ${error.message}`)
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
async function checkUpdates() {
|
||||
const updated = await run({
|
||||
packageFile: './package.json',
|
||||
upgrade: false
|
||||
})
|
||||
|
||||
if (!Object.keys(updated).length) {
|
||||
console.log('All dependencies are up-to-date!')
|
||||
return
|
||||
}
|
||||
|
||||
console.log('Dependencies that need to be updated:')
|
||||
for (const [key] of Object.entries(updated)) {
|
||||
const repoUrl = await getRepositoryInfo(key)
|
||||
console.log(`${key}: ${updated[key]} ${repoUrl ? `- [GitHub/Repo](${repoUrl})` : ''}`)
|
||||
}
|
||||
}
|
||||
|
||||
checkUpdates().catch(err => console.error(err))
|
||||
Reference in New Issue
Block a user