Skip to content

Commit b23e125

Browse files
jugglinmikerwaldron
authored andcommittedJan 24, 2022
[[CHORE]] Remove shelljs from internal tooling
The "shelljs" package upon which JSHint depends includes a security vulnerability [1]. Remove it from the project's internal tooling as part of a larger effort to remove it entirely. [1] #3599
1 parent 56d4a47 commit b23e125

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed
 

‎bin/build

+6-7
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,23 @@
11
#!/usr/bin/env node
2-
/*jshint shelljs:true */
32

43
"use strict";
54

5+
var fs = require("fs");
66
var path = require("path");
77
var build = require("../scripts/build");
8-
require("shelljs/make");
98

109
var distDir = path.join(__dirname, "../dist");
1110

12-
if (!test("-e", distDir))
13-
mkdir(distDir);
11+
if (!fs.existsSync(distDir))
12+
fs.mkdirSync(distDir);
1413

1514
build("web", function(err, version, src) {
1615
if (err) {
1716
console.error(err);
1817
process.exit(1);
1918
}
2019

21-
src.to(distDir + "/jshint.js");
20+
fs.writeFileSync(distDir + "/jshint.js", src, "utf8");
2221
console.log("Built: " + version + " (web)");
2322
});
2423

@@ -31,8 +30,8 @@ build("rhino", function(err, version, src) {
3130
}
3231

3332
dest = distDir + "/jshint-rhino.js";
34-
chmod("+x", dest);
3533

36-
src.to(dest);
34+
fs.writeFileSync(dest, src, "utf8");
35+
fs.chmodSync(dest, "0775");
3736
console.log("Built: " + version + " (Rhino)");
3837
});

‎bin/land

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
"use strict";
44

5+
var child_process = require("child_process");
56
var url = "https://github.com/jshint/jshint/pull/" + process.argv[2] + ".patch";
67
var https = require("https");
7-
var shjs = require("shelljs");
88
var opts = require("url").parse(url);
99
var msg = process.argv[3];
1010

@@ -27,7 +27,7 @@ function succ(res) {
2727
data = data[1].replace(/^From\:\s/, "");
2828
data = data.replace(/"/g, "");
2929

30-
shjs.exec("git commit -s --author=\"" + data + "\" --message=\"" + msg + "\"");
30+
child_process.execSync("git commit -s --author=\"" + data + "\" --message=\"" + msg + "\"");
3131
});
3232
}
3333

0 commit comments

Comments
 (0)
Please sign in to comment.