Feature: hopp-cli in TypeScript (#2074)

Co-authored-by: Andrew Bastin <andrewbastin.k@gmail.com>
Co-authored-by: liyasthomas <liyascthomas@gmail.com>
Co-authored-by: Gita Alekhya Paul <gitaalekhyapaul@gmail.com>
This commit is contained in:
Deepanshu Dhruw
2022-03-28 13:56:15 +05:30
committed by GitHub
parent cdf61079ae
commit 909d524de5
36 changed files with 2654 additions and 119 deletions

View File

@@ -0,0 +1,24 @@
import * as TE from "fp-ts/TaskEither";
import { pipe, flow } from "fp-ts/function";
import {
collectionsRunner,
collectionsRunnerExit,
collectionsRunnerResult,
} from "../utils/collections";
import { handleError } from "../handlers/error";
import { checkFilePath } from "../utils/checks";
import { parseCollectionData } from "../utils/mutators";
export const test = (path: string) => async () => {
await pipe(
path,
checkFilePath,
TE.chain(parseCollectionData),
TE.chainTaskK(collectionsRunner),
TE.chainW(flow(collectionsRunnerResult, collectionsRunnerExit, TE.of)),
TE.mapLeft((e) => {
handleError(e);
process.exit(1);
})
)();
};