mirror of
https://github.com/semaphore-protocol/semaphore.git
synced 2026-01-09 14:48:12 -05:00
chore: improve scripts to clean repo
This commit is contained in:
@@ -10,7 +10,6 @@
|
||||
"build:libraries": "yarn workspaces foreach -t --no-private run build",
|
||||
"build:subgraph": "yarn workspace semaphore-subgraph codegen sepolia && yarn workspace semaphore-subgraph build",
|
||||
"compile:contracts": "yarn workspace semaphore-contracts compile",
|
||||
"remove:template-files": "ts-node scripts/remove-template-files.ts",
|
||||
"test": "yarn test:libraries && yarn test:contracts && yarn test:circuits && yarn test:subgraph",
|
||||
"test:libraries": "jest --coverage",
|
||||
"test:subgraph": "yarn workspace semaphore-subgraph test",
|
||||
@@ -21,10 +20,10 @@
|
||||
"prettier:write": "prettier -w .",
|
||||
"docs": "typedoc --cname js.semaphore.pse.dev --githubPages true",
|
||||
"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 remove:template-files && yarn workspaces foreach --no-private npm publish --tolerate-republish --access public",
|
||||
"version:publish": "yarn build:libraries && yarn clean:cli-templates && yarn workspaces foreach --no-private npm publish --tolerate-republish --access public",
|
||||
"version:release": "changelogithub",
|
||||
"clean": "rimraf node_modules docs coverage packages/*/node_modules packages/*/dist apps/*/node_modules apps/*/build apps/*/.next apps/*/generated",
|
||||
"clean:contracts": "rimraf packages/contracts/artifacts packages/contracts/typechain-types packages/contracts/cache",
|
||||
"clean": "ts-node scripts/clean-apps.ts && ts-node scripts/clean-packages.ts && yarn clean:cli-templates && rimraf node_modules",
|
||||
"clean:cli-templates": "ts-node scripts/clean-cli-templates.ts",
|
||||
"commit": "cz",
|
||||
"precommit": "lint-staged",
|
||||
"postinstall": "husky install"
|
||||
|
||||
30
scripts/clean-apps.ts
Normal file
30
scripts/clean-apps.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
import { readdirSync, rmSync } from "fs"
|
||||
|
||||
const folderName = "apps"
|
||||
|
||||
const gitIgnored = [
|
||||
"node_modules",
|
||||
"build",
|
||||
".next",
|
||||
"generated",
|
||||
"out",
|
||||
"subgraph.yaml",
|
||||
"tests/.bin",
|
||||
".docusaurus",
|
||||
".cache-loader"
|
||||
]
|
||||
|
||||
async function main() {
|
||||
const apps = readdirSync(folderName, { withFileTypes: true })
|
||||
.filter((file) => file.isDirectory())
|
||||
.map((dir) => dir.name)
|
||||
|
||||
apps.map((app) => gitIgnored.map((f) => rmSync(`${folderName}/${app}/${f}`, { recursive: true, force: true })))
|
||||
}
|
||||
|
||||
main()
|
||||
.then(() => process.exit(0))
|
||||
.catch((error) => {
|
||||
console.error(error)
|
||||
process.exit(1)
|
||||
})
|
||||
26
scripts/clean-cli-templates.ts
Normal file
26
scripts/clean-cli-templates.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
import { rmSync } from "fs"
|
||||
|
||||
const folderName = "packages"
|
||||
|
||||
const gitIgnored = [
|
||||
"contracts/build",
|
||||
"contracts/cache",
|
||||
"contracts/node_modules",
|
||||
"web-app/node_modules",
|
||||
"web-app/.next"
|
||||
]
|
||||
|
||||
const packages = ["cli-template-monorepo-ethers", "cli-template-monorepo-subgraph"]
|
||||
|
||||
async function main() {
|
||||
packages.map((pkg) =>
|
||||
gitIgnored.map((f) => rmSync(`${folderName}/${pkg}/apps/${f}`, { recursive: true, force: true }))
|
||||
)
|
||||
}
|
||||
|
||||
main()
|
||||
.then(() => process.exit(0))
|
||||
.catch((error) => {
|
||||
console.error(error)
|
||||
process.exit(1)
|
||||
})
|
||||
23
scripts/clean-packages.ts
Normal file
23
scripts/clean-packages.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import { readdirSync, rmSync } from "fs"
|
||||
|
||||
const folderName = "packages"
|
||||
|
||||
const gitIgnored = ["node_modules", "dist", "build", "ptau", "artifacts", "typechain-types", "cache"]
|
||||
|
||||
async function main() {
|
||||
const apps = readdirSync(folderName, { withFileTypes: true })
|
||||
.filter((file) => file.isDirectory())
|
||||
.map((dir) => dir.name)
|
||||
|
||||
apps.map((app) => gitIgnored.map((f) => rmSync(`${folderName}/${app}/${f}`, { recursive: true, force: true })))
|
||||
|
||||
rmSync(`${folderName}/circuit/main`, { recursive: true, force: true })
|
||||
rmSync(`${folderName}/circuit/test`, { recursive: true, force: true })
|
||||
}
|
||||
|
||||
main()
|
||||
.then(() => process.exit(0))
|
||||
.catch((error) => {
|
||||
console.error(error)
|
||||
process.exit(1)
|
||||
})
|
||||
@@ -1,24 +0,0 @@
|
||||
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)
|
||||
})
|
||||
Reference in New Issue
Block a user