mirror of
https://github.com/wassname/talk.git
synced 2026-06-29 05:35:42 +08:00
3bfcc509d2
* chore: setup eslint * chore: tslint checks with types & check for import order * chore: complete eslint transition * fix: tests * fix: linting after rebase, faster lint for lint-staged * chore: remove line * fix: lint rules * feat: add a11y linter and fix errors * fix: tests
38 lines
900 B
TypeScript
38 lines
900 B
TypeScript
#!/usr/bin/env ts-node
|
|
|
|
import program from "commander";
|
|
import path from "path";
|
|
import watch from "../";
|
|
|
|
async function run(
|
|
args: ReadonlyArray<string>,
|
|
options: Record<string, string>
|
|
) {
|
|
const only = args;
|
|
const { config: configFile = "" } = options;
|
|
if (!configFile) {
|
|
throw new Error("Config file not specified");
|
|
}
|
|
|
|
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
let config: any = require(path.resolve(configFile));
|
|
if (config.__esModule) {
|
|
config = config.default;
|
|
}
|
|
|
|
await watch(config, { only });
|
|
}
|
|
|
|
const cmd = program
|
|
.version("0.1.0")
|
|
.usage("[watchers or sets]")
|
|
.option("-c, --config <configFile>", "Use given config file")
|
|
.description("Run watchers defined in <configFile>")
|
|
.parse(process.argv);
|
|
|
|
run(cmd.args, cmd.opts()).catch(err => {
|
|
// eslint-disable-next-line no-console
|
|
console.error(err);
|
|
process.exit(1);
|
|
});
|