File tree 1 file changed +8
-21
lines changed 1 file changed +8
-21
lines changed Original file line number Diff line number Diff line change 1
- const https = require ( 'https' ) ;
2
1
const path = require ( 'path' ) ;
3
2
const fs = require ( 'fs' ) ;
4
3
const { spawnSync } = require ( 'child_process' ) ;
5
4
6
- https . get ( 'https://api.github.com/repos/next-theme/hexo-theme-next/releases' , {
7
- headers : {
8
- 'User-Agent' : 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36'
9
- }
10
- } , res => {
11
- let data = '' ;
12
- res . on ( 'data' , chunk => {
13
- data += chunk ;
14
- } ) ;
15
- res . on ( 'end' , ( ) => {
16
- if ( res . statusCode === 200 ) {
17
- data = JSON . parse ( data ) ;
18
- parse ( data ) ;
19
- }
20
- } ) ;
21
- } ) . on ( 'error' , err => {
22
- console . error ( 'Failed to download release messages.' ) ;
23
- console . log ( err ) ;
24
- } ) ;
25
-
26
5
function parse ( data ) {
27
6
data . sort ( ( a , b ) => {
28
7
return new Date ( b . created_at ) - new Date ( a . created_at ) ;
@@ -53,3 +32,11 @@ ${body}
53
32
stdio : "inherit"
54
33
} ) ;
55
34
}
35
+
36
+ fetch ( 'https://api.github.com/repos/next-theme/hexo-theme-next/releases' , {
37
+ headers : {
38
+ 'User-Agent' : 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36'
39
+ }
40
+ } )
41
+ . then ( res => res . json ( ) )
42
+ . then ( parse ) ;
You can’t perform that action at this time.
0 commit comments