Skip to content

Commit

Permalink
fix: use prettier via api instead of invoking its cli
Browse files Browse the repository at this point in the history
  • Loading branch information
ansgarm committed Mar 2, 2023
1 parent e76e7f0 commit 5723a2c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tools/generate-function-bindings/scripts/fetch-metadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import { execSync } from "child_process";
import fs from "fs/promises";
import * as path from "path";
import prettier from "prettier";

export const FUNCTIONS_METADATA_FILE = "functions.json";
const TERRAFORM_BINARY_NAME = process.env.TERRAFORM_BINARY_NAME || "terraform";
Expand All @@ -15,8 +16,7 @@ async function fetchMetadata() {
`${TERRAFORM_BINARY_NAME} metadata functions -json`
).toString();
const out = path.join(__dirname, FUNCTIONS_METADATA_FILE);
await fs.writeFile(out, json);
execSync(`yarn run prettier --write ${out}`); // prettify
await fs.writeFile(out, prettier.format(json, { parser: "json" }));
}

// run main entrypoint if we've been invoked directly
Expand Down

0 comments on commit 5723a2c

Please sign in to comment.