chore(cli): create a script to remove unnecessary files in monorepo templates

This commit is contained in:
vplasencia
2023-04-07 17:28:18 +02:00
parent 02d1395828
commit 02658c0780
2 changed files with 26 additions and 1 deletions

View File

@@ -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",

View File

@@ -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)
})