File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2,6 +2,10 @@ import { computed } from "vue";
22import { useRepositoriesStore } from "@/store/repositories" ;
33import type { Repository } from "./useRepo" ;
44
5+ function isLocalDependency ( version : string ) : boolean {
6+ return version . startsWith ( "link:" ) || version . startsWith ( "file:" ) ;
7+ }
8+
59export function useDependencyTable ( ) {
610 const { repositories } = useRepositoriesStore ( ) ;
711
@@ -12,7 +16,10 @@ export function useDependencyTable() {
1216 if ( ! hasDependencies . value ) return [ ] ;
1317 const set : Set < string > = new Set ( ) ;
1418 for ( const repo of repositoriesWithDependencies . value ) {
15- for ( const key in repo . dependencies ) { set . add ( key ) ; }
19+ for ( const key in repo . dependencies ) {
20+ const version = repo . dependencies [ key ] ;
21+ if ( version && ! isLocalDependency ( version ) ) { set . add ( key ) ; }
22+ }
1623 }
1724 return [ ...set ] . sort ( ( a , b ) => a . localeCompare ( b ) ) ;
1825 } ) ;
Original file line number Diff line number Diff line change @@ -13,10 +13,10 @@ const DEFAULT_STORE: LatestVersionsStore = {
1313 data : { }
1414} ;
1515
16- async function fetchLatestVersion ( dependency : string ) {
16+ async function fetchLatestVersion ( dependency : string ) : Promise < string | null > {
1717 const response = await fetch ( `https://registry.npmjs.org/${ dependency } /latest` ) ;
1818 const data = await response . json ( ) as PackageJson ;
19- return data . version ;
19+ return data . version ?? null ;
2020} ;
2121
2222export const useLatestVersionsStore = createSharedComposable ( ( ) => {
@@ -32,7 +32,7 @@ export const useLatestVersionsStore = createSharedComposable(() => {
3232 const isEmpty = computed ( ( ) => ! Object . keys ( latestVersions . value ) . length ) ;
3333
3434 const { dependencies } = useDependencyTable ( ) ;
35- async function updateLatestVersions ( ) {
35+ async function updateLatestVersions ( ) : Promise < void > {
3636 const fetchPromises = dependencies . value . map ( async ( dependency ) => {
3737 const latestVersion = await fetchLatestVersion ( dependency ) ;
3838 if ( latestVersion ) latestVersions . value [ dependency ] = latestVersion ;
You can’t perform that action at this time.
0 commit comments