From 33931743c4e83e8bb3c057c26d6ca98fa34c68f2 Mon Sep 17 00:00:00 2001 From: Agustincito Date: Wed, 25 Dec 2024 21:20:07 -0300 Subject: [PATCH] Fix checks --- .github/workflows/{tests.yml => checks.yml} | 5 ++++- package.json | 15 ++++++++------- scripts/build-deployment-address.ts | 15 ++++++--------- 3 files changed, 18 insertions(+), 17 deletions(-) rename .github/workflows/{tests.yml => checks.yml} (86%) diff --git a/.github/workflows/tests.yml b/.github/workflows/checks.yml similarity index 86% rename from .github/workflows/tests.yml rename to .github/workflows/checks.yml index 31837c3..3596ea2 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/checks.yml @@ -1,4 +1,4 @@ -name: Smart Contract Tests +name: Smart Contract Checks on: push: @@ -30,3 +30,6 @@ jobs: - name: Run Tests run: pnpm test + + - name: Run Lint + run: pnpm lint:fail diff --git a/package.json b/package.json index 38507a5..f66c4b9 100644 --- a/package.json +++ b/package.json @@ -22,21 +22,22 @@ ], "homepage": "https://sci.domains/", "scripts": { - "prepublish": "pnpm build; pnpm lint; pnpm test:cov; ", - "build": "pnpm compile; tsc", + "prepublish": "corepack pnpm build; corepack pnpm lint; corepack pnpm test:cov; ", + "build": "corepack pnpm compile; tsc", "compile": "hardhat compile", "node": "hardhat node", "clean": "rm -r artifacts cache types dist", "test": "hardhat test", "test:cov": "hardhat coverage", - "lint": "hardhat check; lint --fix .; prettier --write .", - "dev": "pnpm setup:localhost; pnpm deploy:localhost", + "lint:fail": "hardhat check; prettier --check .", + "lint": "hardhat check; prettier --write .", + "dev": "corepack pnpm setup:localhost; pnpm deploy:localhost", "setup:localhost": "hardhat run scripts/setup-localhost.ts --network localhost", "deploy": "hardhat ignition deploy ignition/modules/ProtocolModule.ts", "save:deployments": "hardhat run scripts/build-deployment-address.ts", - "deploy:sepolia": "pnpm run deploy --verify --network sepolia --parameters ignition/parameters/sepolia.json5", - "deploy:localhost": "pnpm run deploy --network localhost --parameters ignition/parameters/sepolia.json5", - "prepare:package": "pnpm clean; pnpm build; pnpm save:deployments" + "deploy:sepolia": "corepack pnpm run deploy --verify --network sepolia --parameters ignition/parameters/sepolia.json5", + "deploy:localhost": "corepack pnpm run deploy --network localhost --parameters ignition/parameters/sepolia.json5", + "prepare:package": "corepack pnpm clean; corepack pnpm build; corepack pnpm save:deployments" }, "engines": { "node": ">=20", diff --git a/scripts/build-deployment-address.ts b/scripts/build-deployment-address.ts index 1f379e7..9fd9391 100644 --- a/scripts/build-deployment-address.ts +++ b/scripts/build-deployment-address.ts @@ -10,28 +10,26 @@ async function main() { // Filter for directories matching "chain-" const validChains = files - .filter((file) => /^chain-\d+$/.test(file)) // Matches "chain-" - .map((file) => file.split('-')[1]) // Extract the chain number - .filter((chain) => !EXCLUDE_CHAINS.includes(chain)); // Exclude chains + .filter((file) => /^chain-\d+$/.test(file)) // Matches "chain-" + .map((file) => file.split('-')[1]) // Extract the chain number + .filter((chain) => !EXCLUDE_CHAINS.includes(chain)); // Exclude chains const outputJson: { [key: string]: Object } = {}; for (const chain of validChains) { const deployedAddressesPath = path.join( - deploymentsDir, - `chain-${chain}`, - 'deployed_addresses.json' + deploymentsDir, + `chain-${chain}`, + 'deployed_addresses.json', ); try { - // Read and include deployed addresses outputJson[chain] = await readJson(deployedAddressesPath); } catch (error) { console.warn(`Skipping chain-${chain}: Failed to read deployed_addresses.json.`); } } - // Write the JSON output await writeJson('deployments.json', outputJson, { spaces: 2 }); console.log(`Created`); } catch (error) { @@ -39,5 +37,4 @@ async function main() { } } -// Execute the script main();