File tree Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Original file line number Diff line number Diff line change 11const { execSync } = require ( "child_process" ) ;
22const fs = require ( "fs" ) ;
3+ const path = require ( "path" ) ;
34
45// Remove readline and use command line arguments
56const args = process . argv . slice ( 2 ) ;
67
78if ( 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+ ) ;
912 process . exit ( 1 ) ;
1013}
1114
@@ -30,15 +33,15 @@ execSync(
3033 `https://brave-core-ext.s3.brave.com/release/${ extensionId } /extension_${ versionNumber } .crx`
3134) ;
3235
36+ const tempDir = fs . mkdtempSync ( "temp-brave-list" ) ;
37+ const listPath = path . join ( tempDir , "list.txt" ) ;
3338try {
34- execSync ( "unzip extension.zip list.txt" ) ;
39+ execSync ( "unzip extension.zip -d " + tempDir ) ;
3540} catch ( e ) {
36- if ( ! fs . existsSync ( "list.txt" ) ) {
41+ if ( ! fs . existsSync ( listPath ) ) {
3742 console . error ( "Failed to find list.txt in extension.zip" ) ;
3843 process . exit ( 1 ) ;
3944 }
4045}
4146
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