Fixed crash in JS environments

dependabot/npm_and_yarn/BuildServer/eslint-7.2.0
Inga 🏳‍🌈 8 years ago
parent 17d326866e
commit 6a9d257136
  1. 20
      BuildServer/lib/tasks/index.ts

@ -1,16 +1,18 @@
"use strict"; "use strict";
import { readdirSync } from "fs"; import { readdirSync } from "fs";
import * as _ from "underscore";
const tasks = {}; const taskNames = _.unique(readdirSync(__dirname).map((file) => {
if (file.match(/\.ts$/) !== null) {
return file.substr(0, file.length - 3);
}
// Code taken from http://stackoverflow.com/a/17204293 if (file.match(/\.js$/) !== null) {
readdirSync(__dirname) return file.substr(0, file.length - 3);
.forEach((file) => {
if (file.match(/\.ts$/) !== null && file !== "index.ts") {
const name = file.replace(".ts", "");
tasks[name] = require(`./${file}`).default;
} }
});
export default tasks as Tasks; return "";
}).filter((file) => file && file !== "index"));
export default _.object(taskNames.map((name) => [name, require(`./${name}`).default])) as Tasks;

Loading…
Cancel
Save