File tree 3 files changed +54
-1
lines changed
lib/metric/deprecated-images
3 files changed +54
-1
lines changed Original file line number Diff line number Diff line change 85
85
86
86
"node/no-unsupported-features" : " error" ,
87
87
"node/process-exit-as-throw" : " error" ,
88
- "node/shebang" : " warn " ,
88
+ "node/shebang" : " off " ,
89
89
"node/no-deprecated-api" : " warn" ,
90
90
"no-useless-constructor" : " warn" ,
91
91
"no-return-await" : " off"
Original file line number Diff line number Diff line change
1
+ #!/usr/bin/env node
2
+
3
+ async function ackDeprecatedImages ( ) {
4
+ try {
5
+ const count = Number ( process . argv [ 2 ] ) ;
6
+ if ( Number . isNaN ( count ) ) {
7
+ console . error ( 'Usage: node ./ack-deprecated-images.script.js <count>' ) ;
8
+ process . exit ( 1 ) ;
9
+ }
10
+
11
+ const URL = 'http://0.0.0.0:8080/deprecated-images/ack' ;
12
+
13
+ const response = await fetch ( URL , {
14
+ method : 'POST' ,
15
+ headers : {
16
+ 'Content-Type' : 'application/json'
17
+ } ,
18
+ body : JSON . stringify ( { count } ) ,
19
+ } ) ;
20
+
21
+ if ( ! response . ok ) {
22
+ throw new Error ( `Request failed with status ${ response . status } ` ) ;
23
+ }
24
+
25
+ const data = await response . json ( ) ;
26
+ console . log ( JSON . stringify ( data ) ) ;
27
+ } catch ( error ) {
28
+ console . error ( 'Error: ' , error ) ;
29
+ process . exit ( 1 ) ;
30
+ }
31
+ }
32
+
33
+ ackDeprecatedImages ( ) ;
Original file line number Diff line number Diff line change
1
+ #!/usr/bin/env node
2
+
3
+ async function getDeprecatedImages ( ) {
4
+ try {
5
+ const URL = 'http://0.0.0.0:8080/deprecated-images' ;
6
+
7
+ const response = await fetch ( URL ) ;
8
+ if ( ! response . ok ) {
9
+ throw new Error ( `Request failed with status ${ response . status } ` ) ;
10
+ }
11
+
12
+ const data = await response . json ( ) ;
13
+ console . log ( JSON . stringify ( data ) ) ;
14
+ } catch ( error ) {
15
+ console . error ( 'Error: ' , error ) ;
16
+ process . exit ( 1 ) ;
17
+ }
18
+ }
19
+
20
+ getDeprecatedImages ( ) ;
You can’t perform that action at this time.
0 commit comments