Skip to content

Commit

Permalink
perf: speed up local scripts (#810)
Browse files Browse the repository at this point in the history
* chore: parallelize build scripts

* chore: run tests concurrently

* chore: group test log outputs

* chore: execute lint and format scripts concurrently

* refactor: do no use wildcard for test script`
  • Loading branch information
sripwoud authored Jul 4, 2024
1 parent 5fe6e4c commit 1b046fd
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 11 deletions.
7 changes: 4 additions & 3 deletions apps/subgraph/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@
"private": true,
"scripts": {
"codegen": "node scripts/generate-subgraph.js ${0} && graph codegen",
"build": "graph build",
"auth": "graph auth --studio ${0}",
"deploy": "graph deploy --studio ${0}",
"codegen:sepolia": "yarn codegen sepolia",
"build": "yarn codegen:sepolia && graph build",
"auth": "graph auth --studio",
"deploy": "graph deploy --node https://api.studio.thegraph.com/deploy/ ${0}",
"start-ipfs": "node scripts/start-ipfs.js",
"create-local": "graph create --node http://localhost:8020/ semaphore",
"remove-local": "graph remove --node http://localhost:8020/ semaphore",
Expand Down
15 changes: 8 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,19 @@
"bugs": "https://github.com/semaphore-protocol/semaphore/issues",
"private": true,
"scripts": {
"build": "yarn build:libraries && yarn build:subgraph",
"build:libraries": "yarn workspaces foreach -A -t --no-private run build",
"build:subgraph": "yarn workspace semaphore-subgraph codegen sepolia && yarn workspace semaphore-subgraph build",
"build": "yarn workspaces foreach -Ap --topological-dev run build",
"build:libraries": "yarn workspaces foreach -Apt --no-private run build",
"build:subgraph": "yarn workspace semaphore-subgraph build",
"compile:contracts": "yarn workspace semaphore-contracts compile",
"test": "yarn test:libraries && yarn test:contracts && yarn test:circuits && yarn test:subgraph",
"test": "concurrently -g -c auto -n circuits,contracts,libraries,subgraph \"yarn:test:circuits\" \"yarn:test:contracts\" \"yarn:test:libraries\" \"yarn test:subgraph\"",
"test:libraries": "jest --coverage",
"test:library": "jest packages/${0}",
"test:subgraph": "yarn workspace semaphore-subgraph test",
"test:contracts": "yarn workspace semaphore-contracts test:coverage",
"test:circuits": "yarn workspace @semaphore-protocol/circuits test",
"lint": "eslint . --ext .js,.ts,.tsx && yarn workspace semaphore-contracts lint",
"format": "prettier -c . && yarn workspace semaphore-docs format",
"format:write": "prettier -w . && yarn workspace semaphore-docs format:write",
"lint": "concurrently -c auto -g -n eslint,solhint \"eslint . --ext .js,.ts,.tsx\" \"yarn workspace semaphore-contracts lint\"",
"format": "concurrently -c auto -g -n prettier,embark \"prettier -c .\" \"yarn workspace semaphore-docs format\"",
"format:write": "concurrently -c auto -g -n prettier,embark \"prettier -w .\" \"yarn workspace semaphore-docs format:write\"",
"docs": "typedoc",
"version:bump": "yarn workspaces foreach -A --no-private version -d ${0} && yarn version apply --all && yarn remove:stable-version-field && NO_HOOK=1 git commit -am \"chore: v${0}\" && git tag v${0}",
"version:publish": "yarn build:libraries && yarn clean:cli-templates && yarn workspaces foreach -A --no-private npm publish --tolerate-republish --access public",
Expand Down Expand Up @@ -58,6 +58,7 @@
"@typescript-eslint/eslint-plugin": "^7.0.2",
"@typescript-eslint/parser": "^7.0.2",
"changelogithub": "0.12.7",
"concurrently": "^8.2.2",
"czg": "^1.9.1",
"dotenv": "^16.0.2",
"eslint": "^8.56.0",
Expand Down
57 changes: 56 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1691,6 +1691,15 @@ __metadata:
languageName: node
linkType: hard

"@babel/runtime@npm:^7.21.0":
version: 7.24.7
resolution: "@babel/runtime@npm:7.24.7"
dependencies:
regenerator-runtime: "npm:^0.14.0"
checksum: 10/7b77f566165dee62db3db0296e71d08cafda3f34e1b0dcefcd68427272e17c1704f4e4369bff76651b07b6e49d3ea5a0ce344818af9116e9292e4381e0918c76
languageName: node
linkType: hard

"@babel/template@npm:^7.22.15, @babel/template@npm:^7.24.0, @babel/template@npm:^7.3.3":
version: 7.24.0
resolution: "@babel/template@npm:7.24.0"
Expand Down Expand Up @@ -11174,6 +11183,26 @@ __metadata:
languageName: node
linkType: hard

"concurrently@npm:^8.2.2":
version: 8.2.2
resolution: "concurrently@npm:8.2.2"
dependencies:
chalk: "npm:^4.1.2"
date-fns: "npm:^2.30.0"
lodash: "npm:^4.17.21"
rxjs: "npm:^7.8.1"
shell-quote: "npm:^1.8.1"
spawn-command: "npm:0.0.2"
supports-color: "npm:^8.1.1"
tree-kill: "npm:^1.2.2"
yargs: "npm:^17.7.2"
bin:
conc: dist/bin/concurrently.js
concurrently: dist/bin/concurrently.js
checksum: 10/dcb1aa69d9c611a7bda9d4fc0fe1e388f971d1744acec7e0d52dffa2ef55743f1266ec9292f414c5789b9f61734b3fce772bd005d4de9564a949fb121b97bae1
languageName: node
linkType: hard

"confbox@npm:^0.1.3, confbox@npm:^0.1.7":
version: 0.1.7
resolution: "confbox@npm:0.1.7"
Expand Down Expand Up @@ -11886,6 +11915,15 @@ __metadata:
languageName: node
linkType: hard

"date-fns@npm:^2.30.0":
version: 2.30.0
resolution: "date-fns@npm:2.30.0"
dependencies:
"@babel/runtime": "npm:^7.21.0"
checksum: 10/70b3e8ea7aaaaeaa2cd80bd889622a4bcb5d8028b4de9162cbcda359db06e16ff6e9309e54eead5341e71031818497f19aaf9839c87d1aba1e27bb4796e758a9
languageName: node
linkType: hard

"death@npm:^1.1.0":
version: 1.1.0
resolution: "death@npm:1.1.0"
Expand Down Expand Up @@ -24624,6 +24662,7 @@ __metadata:
"@typescript-eslint/eslint-plugin": "npm:^7.0.2"
"@typescript-eslint/parser": "npm:^7.0.2"
changelogithub: "npm:0.12.7"
concurrently: "npm:^8.2.2"
czg: "npm:^1.9.1"
dotenv: "npm:^16.0.2"
eslint: "npm:^8.56.0"
Expand Down Expand Up @@ -25424,6 +25463,13 @@ __metadata:
languageName: node
linkType: hard

"spawn-command@npm:0.0.2":
version: 0.0.2
resolution: "spawn-command@npm:0.0.2"
checksum: 10/f13e8c3c63abd4a0b52fb567eba5f7940d480c5ed3ec61781d38a1850f179b1196c39e6efa2bbd301f82c1bf1cd7807abc8fbd8fc8e44bcaa3975a124c0d1657
languageName: node
linkType: hard

"spdx-correct@npm:^3.0.0":
version: 3.2.0
resolution: "spdx-correct@npm:3.2.0"
Expand Down Expand Up @@ -26454,6 +26500,15 @@ __metadata:
languageName: node
linkType: hard

"tree-kill@npm:^1.2.2":
version: 1.2.2
resolution: "tree-kill@npm:1.2.2"
bin:
tree-kill: cli.js
checksum: 10/49117f5f410d19c84b0464d29afb9642c863bc5ba40fcb9a245d474c6d5cc64d1b177a6e6713129eb346b40aebb9d4631d967517f9fbe8251c35b21b13cd96c7
languageName: node
linkType: hard

"trim-lines@npm:^3.0.0":
version: 3.0.1
resolution: "trim-lines@npm:3.0.1"
Expand Down Expand Up @@ -28579,7 +28634,7 @@ __metadata:
languageName: node
linkType: hard

"yargs@npm:^17.0.0, yargs@npm:^17.3.1":
"yargs@npm:^17.0.0, yargs@npm:^17.3.1, yargs@npm:^17.7.2":
version: 17.7.2
resolution: "yargs@npm:17.7.2"
dependencies:
Expand Down

0 comments on commit 1b046fd

Please sign in to comment.