Skip to content

Commit

Permalink
chore(cli): optimize bundle size
Browse files Browse the repository at this point in the history
- [x] Use tsconfig.build.json for build stage
- [x] Remove source files from bundle for cli
  • Loading branch information
0xmad committed Jan 9, 2024
1 parent d8c808e commit 6d3b23c
Show file tree
Hide file tree
Showing 12 changed files with 56 additions and 7 deletions.
2 changes: 1 addition & 1 deletion circuits/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"build-test-circuits-c": "bash ./scripts/build_intel.sh",
"build-test-circuits-wasm": "bash ./scripts/build_arm.sh",
"watch": "tsc --watch",
"build": "tsc",
"build": "tsc -p tsconfig.build.json",
"types": "tsc -p tsconfig.json --noEmit",
"test": "ts-mocha --exit ts/__tests__/*.test.ts",
"test:hasher": "ts-mocha --exit ts/__tests__/Hasher.test.ts",
Expand Down
8 changes: 8 additions & 0 deletions circuits/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "./build"
},
"include": ["./ts"],
"exclude": ["**/__tests__/**", "**/__tests__/**/*.test.ts", "**/__tests__/**/*.test.ts"]
}
3 changes: 1 addition & 2 deletions cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,11 @@
"maci-cli": "./build/ts/index.js"
},
"files": [
"ts",
"package.json"
],
"scripts": {
"watch": "tsc --watch",
"build": "tsc",
"build": "tsc -p tsconfig.build.json",
"postbuild": "cp package.json ./build",
"types": "tsc -p tsconfig.json --noEmit",
"test": "nyc ts-mocha --exit tests/**/*.test.ts",
Expand Down
9 changes: 9 additions & 0 deletions cli/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "./build"
},
"include": ["./ts"],
"exclude": ["**/__tests__/**", "**/__tests__/**/*.test.ts", "**/__tests__/**/*.test.ts"],
"files": ["./hardhat.config.ts"]
}
2 changes: 1 addition & 1 deletion contracts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"compileSol": "./scripts/compileSol.sh $1",
"moveIntegrationArtifacts": "cp -r artifacts/ ../integrationTests/artifacts",
"prebuild": "npm run compileSol",
"build": "tsc",
"build": "tsc -p tsconfig.build.json",
"postbuild": "cp -r ./artifacts ./build",
"types": "tsc -p tsconfig.json --noEmit",
"docs": "hardhat docgen",
Expand Down
9 changes: 9 additions & 0 deletions contracts/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "./build"
},
"include": ["./ts", "./typechain-types"],
"exclude": ["**/__tests__/**", "**/__tests__/**/*.test.ts", "**/__tests__/**/*.test.ts"],
"files": ["./hardhat.config.ts"]
}
2 changes: 1 addition & 1 deletion core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"types": "build/ts/index.d.ts",
"scripts": {
"watch": "tsc --watch",
"build": "tsc",
"build": "tsc -p tsconfig.build.json",
"types": "tsc -p tsconfig.json --noEmit",
"test:processMessage": "ts-mocha --exit ts/__tests__/ProcessMessage.test.ts",
"test:maciState": "ts-mocha --exit ts/__tests__/MaciState.test.ts",
Expand Down
8 changes: 8 additions & 0 deletions core/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "./build"
},
"include": ["./ts"],
"exclude": ["**/__tests__/**", "**/__tests__/**/*.test.ts", "**/__tests__/**/*.test.ts"]
}
2 changes: 1 addition & 1 deletion crypto/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"main": "build/ts/index.js",
"scripts": {
"watch": "tsc --watch",
"build": "tsc",
"build": "tsc -p tsconfig.build.json",
"types": "tsc -p tsconfig.json --noEmit",
"test": "nyc ts-mocha --exit ts/__tests__/*.test.ts",
"test:crypto": "ts-mocha --exit ts/__tests__/Crypto.test.ts",
Expand Down
8 changes: 8 additions & 0 deletions crypto/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "./build"
},
"include": ["./ts"],
"exclude": ["**/__tests__/**", "**/__tests__/**/*.test.ts", "**/__tests__/**/*.test.ts"]
}
2 changes: 1 addition & 1 deletion domainobjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"main": "build/ts/index.js",
"scripts": {
"watch": "tsc --watch",
"build": "tsc",
"build": "tsc -p tsconfig.build.json",
"types": "tsc -p tsconfig.json --noEmit",
"test": "nyc ts-mocha --exit ts/__tests__/**.test.ts"
},
Expand Down
8 changes: 8 additions & 0 deletions domainobjs/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "./build"
},
"include": ["./ts"],
"exclude": ["**/__tests__/**", "**/__tests__/**/*.test.ts", "**/__tests__/**/*.test.ts"]
}

0 comments on commit 6d3b23c

Please sign in to comment.