You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
535 B
20 lines
535 B
"use strict";
|
|
|
|
import { readdirSync } from "fs";
|
|
import * as _ from "underscore";
|
|
|
|
import { Tasks } from "../types";
|
|
|
|
const taskNames = _.unique(readdirSync(__dirname).map((file) => {
|
|
if (file.match(/\.ts$/) !== null) {
|
|
return file.substr(0, file.length - 3);
|
|
}
|
|
|
|
if (file.match(/\.js$/) !== null) {
|
|
return file.substr(0, file.length - 3);
|
|
}
|
|
|
|
return "";
|
|
}).filter((file) => file && file !== "index"));
|
|
|
|
export default _.object(taskNames.map((name) => [name, require(`./${name}`).default])) as Tasks;
|
|
|