File tree Expand file tree Collapse file tree 3 files changed +8
-5
lines changed
Expand file tree Collapse file tree 3 files changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ interface DepsAnalyzerOptions {
1919 mode ?: 'quick' | 'full' | 'deep' ;
2020 runNpmOutdated ?: boolean ;
2121 runNpmAudit ?: boolean ;
22+ forceRefresh ?: boolean ;
2223}
2324
2425interface KnipResult {
@@ -826,8 +827,8 @@ export class DepsAnalyzer implements Analyzer {
826827 // Ignore errors
827828 }
828829
829- // Check cache first (24h TTL)
830- let outdated : Record < string , any > | null = getCachedOutdated ( projectPath ) ;
830+ // Check cache first (24h TTL), skip if forceRefresh
831+ let outdated : Record < string , any > | null = this . options . forceRefresh ? null : getCachedOutdated ( projectPath ) ;
831832
832833 // Run npm outdated if no cache
833834 if ( ! outdated ) {
@@ -923,8 +924,8 @@ export class DepsAnalyzer implements Analyzer {
923924
924925 const findings : Finding [ ] = [ ] ;
925926
926- // Check cache first (6h TTL)
927- let audit : any = getCachedAudit ( projectPath ) ;
927+ // Check cache first (6h TTL), skip if forceRefresh
928+ let audit : any = this . options . forceRefresh ? null : getCachedAudit ( projectPath ) ;
928929
929930 // Run npm audit if no cache
930931 if ( ! audit ) {
Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ interface AnalyzeOptions {
2424 top : number ;
2525 quick ?: boolean ;
2626 deep ?: boolean ;
27+ forceRefresh ?: boolean ;
2728 verbose ?: boolean ;
2829 quiet ?: boolean ;
2930}
@@ -60,7 +61,7 @@ export async function analyzeCommand(options: AnalyzeOptions): Promise<void> {
6061 // Initialize analyzers - pass mode based on quick option
6162 const analyzerMode = options . quick ? 'quick' : 'full' ;
6263 const dockerAnalyzer = new DockerAnalyzer ( { mode : analyzerMode } ) ;
63- const depsAnalyzer = new DepsAnalyzer ( { mode : analyzerMode } ) ;
64+ const depsAnalyzer = new DepsAnalyzer ( { mode : analyzerMode , forceRefresh : options . forceRefresh } ) ;
6465 const ciAnalyzer = new CiAnalyzer ( ) ;
6566
6667 const allFindings : Finding [ ] = [ ] ;
Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ program
2525 . option ( '--top <n>' , 'Show top N findings' , '5' )
2626 . option ( '--quick' , 'Quick mode - fast analysis without npm commands' , false )
2727 . option ( '--deep' , 'Deep mode - thorough analysis with size estimates' , false )
28+ . option ( '--force-refresh' , 'Force refresh - ignore npm cache' , false )
2829 . option ( '--verbose' , 'Verbose output - show more details' , false )
2930 . option ( '--quiet' , 'Quiet mode - minimal output' , false )
3031 . action ( analyzeCommand ) ;
You can’t perform that action at this time.
0 commit comments