Skip to content

Commit

Permalink
fix: no out directory (#25) v1.0.3
Browse files Browse the repository at this point in the history
* fix: no out directory

* refactor: fmt before merge
  • Loading branch information
nohehf authored Aug 8, 2022
1 parent 5fb0832 commit b747704
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 4 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { createPostmanCollection, saveJsonFormatted } from "./lib.ts";
import { parse } from "https://deno.land/std@0.149.0/flags/mod.ts";
import { ensureDirSync } from "https://deno.land/std@0.151.0/fs/mod.ts";

function help() {
console.log(`Error: not enough arguments.
Expand Down Expand Up @@ -36,8 +37,9 @@ console.log(`Creating the postman collection for ${url}`);

const collection = await createPostmanCollection(url, authorization);

path = path || "out/" + collection.info.name + ".postman_collection.json";
path = path || "./out/" + collection.info.name + ".postman_collection.json";
ensureDirSync("./out/");
saveJsonFormatted(collection, path);

console.log(`Collection saved at ${path}`);

console.log(`Import it in postman and complete the queries ! 🚀`);
4 changes: 3 additions & 1 deletion src/lib.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ function findType(
}

export function saveJsonFormatted(json: any, path: string) {
Deno.writeTextFileSync(path, JSON.stringify(json, null, "\t"));
Deno.writeTextFileSync(path, JSON.stringify(json, null, "\t"), {
create: true,
});
}
interface Argument {
formatedType: string;
Expand Down

0 comments on commit b747704

Please sign in to comment.