Skip to content

Commit

Permalink
[[CHORE]] Remove shelljs from internal tooling
Browse files Browse the repository at this point in the history
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
  • Loading branch information
jugglinmike authored and rwaldron committed Jan 24, 2022
1 parent 56d4a47 commit b23e125
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
13 changes: 6 additions & 7 deletions bin/build
Original file line number Diff line number Diff line change
@@ -1,24 +1,23 @@
#!/usr/bin/env node
/*jshint shelljs:true */

"use strict";

var fs = require("fs");
var path = require("path");
var build = require("../scripts/build");
require("shelljs/make");

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

if (!test("-e", distDir))
mkdir(distDir);
if (!fs.existsSync(distDir))
fs.mkdirSync(distDir);

build("web", function(err, version, src) {
if (err) {
console.error(err);
process.exit(1);
}

src.to(distDir + "/jshint.js");
fs.writeFileSync(distDir + "/jshint.js", src, "utf8");
console.log("Built: " + version + " (web)");
});

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

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

src.to(dest);
fs.writeFileSync(dest, src, "utf8");
fs.chmodSync(dest, "0775");
console.log("Built: " + version + " (Rhino)");
});
4 changes: 2 additions & 2 deletions bin/land
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

"use strict";

var child_process = require("child_process");
var url = "https://github.com/jshint/jshint/pull/" + process.argv[2] + ".patch";
var https = require("https");
var shjs = require("shelljs");
var opts = require("url").parse(url);
var msg = process.argv[3];

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

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

Expand Down

0 comments on commit b23e125

Please sign in to comment.