Make Eve onboarding contracts portable
This commit is contained in:
parent
0c486796ab
commit
ad32be863c
6 changed files with 15 additions and 11 deletions
|
|
@ -56,7 +56,7 @@ function generatedHeader() {
|
|||
async function checkOrWrite(path, expected) {
|
||||
if (process.argv.includes("--check")) {
|
||||
const actual = await readFile(path, "utf8").catch(() => "");
|
||||
if (actual !== expected) {
|
||||
if (normalizeNewlines(actual) !== normalizeNewlines(expected)) {
|
||||
throw new Error(`${path} is stale. Run npm run generate in ${packageRoot}.`);
|
||||
}
|
||||
return;
|
||||
|
|
@ -64,6 +64,10 @@ async function checkOrWrite(path, expected) {
|
|||
await writeFile(path, expected, "utf8");
|
||||
}
|
||||
|
||||
function normalizeNewlines(value) {
|
||||
return value.replace(/\r\n/g, "\n");
|
||||
}
|
||||
|
||||
function inlineKnownRefs(value) {
|
||||
if (Array.isArray(value)) return value.map(inlineKnownRefs);
|
||||
if (!value || typeof value !== "object") return value;
|
||||
|
|
|
|||
Loading…
Reference in a new issue