Skip to content

Commit

Permalink
improve: export type
Browse files Browse the repository at this point in the history
  • Loading branch information
shoma-mano committed Sep 5, 2024
1 parent 943bc55 commit 7ccf1b5
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
import type { ECSTaskDefinition } from "./interface";
import { writeFileSync } from "fs";
import getCallerFile from "get-caller-file";

export const defineTaskDefinition = (
props: ECSTaskDefinition,
distPath?: string,
) => {
console.log("defineTaskDefinition");
const callerFile = getCallerFile();
if (!callerFile) {
throw new Error("Cannot find caller file");
}
distPath = distPath ?? (callerFile.replace(".ts", ".json") as string);
console.log(`Writing to ${distPath}`);
const json = JSON.stringify(props, null, 2);
writeFileSync(distPath, json);
};

export type { ECSTaskDefinition } from "./interface";

0 comments on commit 7ccf1b5

Please sign in to comment.