Skip to content

Commit 199d257

Browse files
committed
use mkdtempSync
1 parent 91490e8 commit 199d257

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

data/update-lists.js

+9-6
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
const { execSync } = require("child_process");
22
const fs = require("fs");
3+
const path = require("path");
34

45
// Remove readline and use command line arguments
56
const args = process.argv.slice(2);
67

78
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+
);
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");
3338
try {
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`);

0 commit comments

Comments
 (0)