@@ -3,6 +3,7 @@ import * as fs from "node:fs";
3
3
import path from "node:path" ;
4
4
import JSON5 from "json5" ;
5
5
import yargs from "yargs" ;
6
+ import { getFrameworks } from "./utils/frameworks/index.js" ;
6
7
7
8
const args = yargs ( process . argv )
8
9
. usage ( "$0 [--debug]" )
@@ -21,22 +22,6 @@ const DEBUG = args.debug;
21
22
* @property {string } type - Type of the framework (e.g., "keyed" or "non-keyed")
22
23
*/
23
24
24
- /**
25
- * Returns an array of frameworks with their type and name
26
- * @example getFramewokrs()
27
- * @returns {Framework[] }
28
- */
29
- function getFrameworks ( ) {
30
- const framewokrsTypes = [ "keyed" , "non-keyed" ] ;
31
- const framewokrs = framewokrsTypes . flatMap ( ( type ) =>
32
- fs
33
- . readdirSync ( path . join ( "framewokrs" , type ) )
34
- . map ( ( framework ) => ( { name : framework , type } ) )
35
- ) ;
36
-
37
- return framewokrs ;
38
- }
39
-
40
25
const frameworks = getFrameworks ( ) ;
41
26
42
27
/**
@@ -47,7 +32,7 @@ const frameworks = getFrameworks();
47
32
function findDuplicateFrameworks ( frameworks ) {
48
33
const names = frameworks . map ( ( framework ) => framework . name ) ; // Creates an array with framework names only
49
34
const duplicateNames = names . filter (
50
- ( name , index ) => names . indexOf ( name ) !== index
35
+ ( name , index ) => names . indexOf ( name ) !== index ,
51
36
) ; // Filters out repetitive framework names
52
37
53
38
return duplicateNames ;
@@ -88,7 +73,7 @@ function maybeObsolete(packageName) {
88
73
const obsoleteDate = new Date (
89
74
now . getFullYear ( ) - 1 ,
90
75
now . getMonth ( ) ,
91
- now . getDay ( )
76
+ now . getDay ( ) ,
92
77
) ;
93
78
94
79
const modifiedDate = new Date ( timeData . modified ) ;
@@ -98,7 +83,7 @@ function maybeObsolete(packageName) {
98
83
return { isObsolete, packageName, lastUpdate : formattedDate } ;
99
84
} catch ( error ) {
100
85
console . error (
101
- `Failed to execute npm view for ${ packageName } . Error Code ${ error . status } and message: ${ error . message } `
86
+ `Failed to execute npm view for ${ packageName } . Error Code ${ error . status } and message: ${ error . message } ` ,
102
87
) ;
103
88
return { isObsolete : false , packageName, lastUpdate : null } ;
104
89
}
@@ -118,7 +103,7 @@ function checkFrameworks() {
118
103
119
104
if ( ! fs . existsSync ( packageJSONPath ) ) {
120
105
missingPackageWarnings . push (
121
- `WARN: skipping ${ type } /${ name } since there's no package.json`
106
+ `WARN: skipping ${ type } /${ name } since there's no package.json` ,
122
107
) ;
123
108
continue ;
124
109
}
@@ -144,7 +129,7 @@ function checkFrameworks() {
144
129
}
145
130
146
131
const anyPackageObsolete = isPackageObsolete . some (
147
- ( packageFramework ) => packageFramework . isObsolete
132
+ ( packageFramework ) => packageFramework . isObsolete ,
148
133
) ;
149
134
150
135
if ( anyPackageObsolete ) {
@@ -153,14 +138,14 @@ function checkFrameworks() {
153
138
. join ( ", " ) ;
154
139
155
140
console . log (
156
- `Last npm update for ${ type } /${ name } - ${ mainPackages } is older than a year: ${ formattedPackages } `
141
+ `Last npm update for ${ type } /${ name } - ${ mainPackages } is older than a year: ${ formattedPackages } ` ,
157
142
) ;
158
143
continue ;
159
144
}
160
145
161
146
if ( DEBUG ) {
162
147
console . log (
163
- `Last npm update for ${ type } /${ name } ${ mainPackages } is newer than a year`
148
+ `Last npm update for ${ type } /${ name } ${ mainPackages } is newer than a year` ,
164
149
) ;
165
150
}
166
151
}
@@ -170,7 +155,7 @@ function checkFrameworks() {
170
155
if ( manualChecks . length > 0 )
171
156
console . warn (
172
157
"\nThe following frameworks must be checked manually\n" +
173
- manualChecks . join ( "\n" )
158
+ manualChecks . join ( "\n" ) ,
174
159
) ;
175
160
}
176
161
0 commit comments