@latticexyz/common
Advanced tools
Comparing version
@@ -214,7 +214,7 @@ import { Hex } from 'viem'; | ||
* Formats solidity code using prettier and write it to a file | ||
* @param output solidity code | ||
* @param content solidity code | ||
* @param fullOutputPath full path to the output file | ||
* @param logPrefix prefix for debug logs | ||
*/ | ||
declare function formatAndWriteSolidity(output: string, fullOutputPath: string, logPrefix: string): Promise<void>; | ||
declare function formatAndWriteSolidity(content: string, fullOutputPath: string, logPrefix: string): Promise<void>; | ||
/** | ||
@@ -221,0 +221,0 @@ * Formats typescript code using prettier and write it to a file |
@@ -741,6 +741,11 @@ import { | ||
// src/codegen/utils/formatAndWrite.ts | ||
async function formatAndWriteSolidity(output, fullOutputPath, logPrefix) { | ||
const formattedOutput = await formatSolidity(output); | ||
async function formatAndWriteSolidity(content, fullOutputPath, logPrefix) { | ||
let output = content; | ||
try { | ||
output = await formatSolidity(output); | ||
} catch (e) { | ||
error(`Error while attempting to format ${fullOutputPath}`, e); | ||
} | ||
await fs.mkdir(path2.dirname(fullOutputPath), { recursive: true }); | ||
await fs.writeFile(fullOutputPath, formattedOutput); | ||
await fs.writeFile(fullOutputPath, output); | ||
debug2(`${logPrefix}: ${fullOutputPath}`); | ||
@@ -747,0 +752,0 @@ } |
{ | ||
"name": "@latticexyz/common", | ||
"version": "2.2.22-d83a0fd5283b7bea7e9a5372ea3c45ab9aea350f", | ||
"version": "2.2.22-f0c0b982573f9953e1c726c0bef91671efaaa545", | ||
"description": "Common low level logic shared between packages", | ||
@@ -72,3 +72,3 @@ "repository": { | ||
"prettier-plugin-solidity": "1.3.1", | ||
"@latticexyz/schema-type": "2.2.22-d83a0fd5283b7bea7e9a5372ea3c45ab9aea350f" | ||
"@latticexyz/schema-type": "2.2.22-f0c0b982573f9953e1c726c0bef91671efaaa545" | ||
}, | ||
@@ -75,0 +75,0 @@ "devDependencies": { |
Sorry, the diff of this file is not supported yet
287021
0.1%3876
0.13%