Skip to content

Commit

Permalink
swap to prettier.format
Browse files Browse the repository at this point in the history
  • Loading branch information
douglance committed Oct 21, 2024
1 parent bafcfd7 commit 692c50f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 16 deletions.
1 change: 0 additions & 1 deletion packages/scripts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
"zod": "^3.23.8"
},
"devDependencies": {
"@actions/exec": "^1.1.1",
"@types/node": "^22.7.1",
"@typescript-eslint/eslint-plugin": "^5.0.0",
"@typescript-eslint/parser": "^5.0.0",
Expand Down
12 changes: 9 additions & 3 deletions packages/scripts/src/addOrbitChain/transforms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ import { warning } from "@actions/core";
import axios from "axios";
import * as fs from "fs";
import sharp from "sharp";
// @ts-expect-error - @actions/exec is not typed
import { exec } from "@actions/exec";
import prettier from "prettier";

import {
commitChanges,
Expand Down Expand Up @@ -435,7 +434,14 @@ export const updateOrbitChainsFile = (

export async function runPrettier(targetJsonPath: string): Promise<void> {
try {
await exec("yarn", ["prettier:format", targetJsonPath]);
const fileContent = fs.readFileSync(targetJsonPath, "utf8");
const prettierConfig = await prettier.resolveConfig(targetJsonPath);
const formattedContent = await prettier.format(fileContent, {
...prettierConfig,
filepath: targetJsonPath,
});
fs.writeFileSync(targetJsonPath, formattedContent);
console.log(`Prettier formatting applied to ${targetJsonPath}`);
} catch (error) {
warning(`Failed to run Prettier: ${error}`);
}
Expand Down
12 changes: 0 additions & 12 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,6 @@
"@actions/http-client" "^2.0.1"
uuid "^8.3.2"

"@actions/exec@^1.1.1":
version "1.1.1"
resolved "https://registry.yarnpkg.com/@actions/exec/-/exec-1.1.1.tgz#2e43f28c54022537172819a7cf886c844221a611"
integrity sha512-+sCcHHbVdk93a0XT19ECtO/gIXoxvdsgQLzb2fE2/5sIZmWQuluYyjPQtrtTHdU1YzTZ7bAPN4sITq2xi1679w==
dependencies:
"@actions/io" "^1.0.1"

"@actions/github@^6.0.0":
version "6.0.0"
resolved "https://registry.npmjs.org/@actions/github/-/github-6.0.0.tgz"
Expand All @@ -35,11 +28,6 @@
tunnel "^0.0.6"
undici "^5.25.4"

"@actions/io@^1.0.1":
version "1.1.3"
resolved "https://registry.yarnpkg.com/@actions/io/-/io-1.1.3.tgz#4cdb6254da7962b07473ff5c335f3da485d94d71"
integrity sha512-wi9JjgKLYS7U/z8PPbco+PvTb/nRWjeoFlJ1Qer83k/3C5PHQi28hiVdeE2kHXmIL99mQFawx8qt/JPjZilJ8Q==

"@adraffy/[email protected]":
version "1.10.0"
resolved "https://registry.npmjs.org/@adraffy/ens-normalize/-/ens-normalize-1.10.0.tgz"
Expand Down

0 comments on commit 692c50f

Please sign in to comment.