Skip to content

Commit

Permalink
Merge pull request #503 from liquity/fix-module-not-found
Browse files Browse the repository at this point in the history
fix: fix `MODULE_NOT_FOUND` error due to missing `dev.json`
  • Loading branch information
danielattilasimon authored Apr 7, 2021
2 parents 337f8d1 + 0a442ee commit 25c7ab7
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
1 change: 0 additions & 1 deletion packages/lib-ethers/.npmignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/live
/accounts.json
/dist/deployments/dev.json
/temp
1 change: 1 addition & 0 deletions packages/lib-ethers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"scripts": {
"hardhat": "hardhat",
"check-live-version": "ts-node scripts/check-live-version.ts",
"prepublishOnly": "ts-node scripts/delete-dev-deployments.ts",
"prepare": "run-s prepare:*",
"prepare:deployments": "ts-node scripts/copy-deployments.ts",
"prepare:types": "ts-node scripts/generate-types.ts",
Expand Down
17 changes: 17 additions & 0 deletions packages/lib-ethers/scripts/delete-dev-deployments.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import fs from "fs";
import path from "path";

const deploymentsDir = "deployments";
const devDeploymentName = "dev.json";

const exists = (file: string) => fs.existsSync(file) && fs.lstatSync(file).isFile();

const devDeployments = () =>
fs
.readdirSync(deploymentsDir, { withFileTypes: true })
.filter(dirent => dirent.isDirectory() && dirent.name !== "backfill")
.map(deploymentDir => path.join(deploymentsDir, deploymentDir.name, devDeploymentName))
.concat(path.join(deploymentsDir, devDeploymentName))
.filter(exists);

devDeployments().forEach(devDeployment => fs.unlinkSync(devDeployment));

0 comments on commit 25c7ab7

Please sign in to comment.