diff --git a/package.json b/package.json index 89510b5f2..39785687b 100644 --- a/package.json +++ b/package.json @@ -10,6 +10,7 @@ "build:libraries": "yarn workspaces foreach -t --no-private run build", "compile:contracts": "yarn workspace contracts compile", "download:snark-artifacts": "rimraf snark-artifacts && ts-node scripts/download-snark-artifacts.ts", + "remove:template-files": "ts-node scripts/remove-template-files.ts", "test": "yarn test:libraries && yarn test:contracts", "test:libraries": "jest --coverage", "test:contracts": "yarn workspace contracts test:coverage", @@ -18,7 +19,7 @@ "prettier:write": "prettier -w .", "docs": "yarn workspaces foreach --no-private run docs", "version:bump": "yarn workspaces foreach --no-private version -d ${0} && yarn version apply --all && git commit -am \"chore: v${0}\" && git tag v${0}", - "version:publish": "yarn build:libraries && yarn workspaces foreach --no-private npm publish --tolerate-republish --access public", + "version:publish": "yarn build:libraries && yarn remove:template-files && yarn workspaces foreach --no-private npm publish --tolerate-republish --access public", "version:release": "changelogithub", "commit": "cz", "precommit": "lint-staged", diff --git a/scripts/remove-template-files.ts b/scripts/remove-template-files.ts new file mode 100644 index 000000000..8f00c2feb --- /dev/null +++ b/scripts/remove-template-files.ts @@ -0,0 +1,24 @@ +import { rmSync } from "fs" + +async function main() { + const templates = ["cli-template-monorepo-ethers", "cli-template-monorepo-subgraph"] + const files: string[] = [ + "contracts/build", + "contracts/cache", + "contracts/node_modules", + "web-app/node_modules", + "web-app/.next", + "web-app/next-env.d.ts" + ] + + templates.map((template) => + files.map((file) => rmSync(`packages/${template}/apps/${file}`, { recursive: true, force: true })) + ) +} + +main() + .then(() => process.exit(0)) + .catch((error) => { + console.error(error) + process.exit(1) + })