File tree 1 file changed +9
-6
lines changed
1 file changed +9
-6
lines changed Original file line number Diff line number Diff line change 1
1
const { execSync } = require ( "child_process" ) ;
2
2
const fs = require ( "fs" ) ;
3
+ const path = require ( "path" ) ;
3
4
4
5
// Remove readline and use command line arguments
5
6
const args = process . argv . slice ( 2 ) ;
6
7
7
8
if ( args . length < 2 ) {
8
- console . error ( "Usage: node update-lists.js <Brave Services Key> <target version for brave list (i.e. 1.0.10268)>" ) ;
9
+ console . error (
10
+ "Usage: node update-lists.js <Brave Services Key> <target version for brave list (i.e. 1.0.10268)>"
11
+ ) ;
9
12
process . exit ( 1 ) ;
10
13
}
11
14
@@ -30,15 +33,15 @@ execSync(
30
33
`https://brave-core-ext.s3.brave.com/release/${ extensionId } /extension_${ versionNumber } .crx`
31
34
) ;
32
35
36
+ const tempDir = fs . mkdtempSync ( "temp-brave-list" ) ;
37
+ const listPath = path . join ( tempDir , "list.txt" ) ;
33
38
try {
34
- execSync ( "unzip extension.zip list.txt" ) ;
39
+ execSync ( "unzip extension.zip -d " + tempDir ) ;
35
40
} catch ( e ) {
36
- if ( ! fs . existsSync ( "list.txt" ) ) {
41
+ if ( ! fs . existsSync ( listPath ) ) {
37
42
console . error ( "Failed to find list.txt in extension.zip" ) ;
38
43
process . exit ( 1 ) ;
39
44
}
40
45
}
41
46
42
- execSync ( "mv -f list.txt data/brave/brave-main-list.txt" ) ;
43
-
44
- fs . unlinkSync ( "extension.zip" ) ;
47
+ execSync ( `mv -f ${ listPath } data/brave/brave-main-list.txt` ) ;
You can’t perform that action at this time.
0 commit comments