Skip to content

Commit

Permalink
Turbo configuration for Aggregator pkg (#1099)
Browse files Browse the repository at this point in the history
* Turbo configuration for Aggregator pck

* .gitignore

* Changeset version files

* Yarn cache removed

* Setup node with cache

* Lerna config removed

* .turbo cached

* Cache dir at build

* Release workflow with cache

* Bug fix

* Clean command and bug fix with turbo outputs

* Tests with cache-dir
  • Loading branch information
0xp3gasus authored Mar 26, 2024
1 parent 9cfd068 commit 599c34e
Show file tree
Hide file tree
Showing 44 changed files with 820 additions and 3,131 deletions.
5 changes: 5 additions & 0 deletions .changeset/shy-jobs-thank.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@xchainjs/xchain-aggregator': patch
---

Build production mode without sourcemaps and with minification. Build tool updated from Rollup to Tsup
22 changes: 13 additions & 9 deletions .github/workflows/build-and-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,25 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Checkout repo
uses: actions/checkout@v4

- name: Use Node.js
uses: actions/setup-node@v1
- name: Cache turbo build setup
uses: actions/cache@v4
with:
node-version: "20.x"
path: .turbo
key: ${{ runner.os }}-turbo-${{ github.sha }}
restore-keys: |
${{ runner.os }}-turbo-
- name: Cache Yarn packages
uses: actions/cache@v2
- name: Setup Node.js 20.x
uses: actions/setup-node@v4
with:
path: "**/node_modules"
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
node-version: 20.x
cache: yarn

- name: Install dependencies
run: yarn && yarn yarn-audit-ci --high
run: yarn install --frozen-lockfile && yarn yarn-audit-ci --high

- name: Build packages
run: yarn build
Expand Down
15 changes: 12 additions & 3 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,24 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Cache turbo build setup
uses: actions/cache@v4
with:
path: .turbo
key: ${{ runner.os }}-turbo-${{ github.sha }}
restore-keys: |
${{ runner.os }}-turbo-
- name: Setup Node.js 20.x
uses: actions/setup-node@v2
uses: actions/setup-node@v4
with:
node-version: 20.x
cache: yarn

- name: Install dependencies
run: yarn install
run: yarn install --frozen-lockfile

- name: Build packages
run: yarn build
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ results
*.tsbuildinfo
.DS_Store
.idea
.turbo

*.txt

Expand Down
6 changes: 0 additions & 6 deletions lerna.json

This file was deleted.

22 changes: 12 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@
"examples/*"
],
"scripts": {
"clean": "lerna run clean",
"build": "lerna run build",
"clean": "turbo run clean && rm -rf ./.turbo",
"clean:nodemodules": "rm -rf ./packages/*/node_modules && rm -rf ./node_modules",
"build": "turbo run build --cache-dir=.turbo",
"build:examples": "tsc examples/**/*.ts --noEmit --skipLibCheck",
"build:tools": "tsc tools/**/*.ts --noEmit --skipLibCheck",
"pub": "lerna publish",
"test": "lerna run test",
"e2e": "lerna run e2e",
"lint": "lerna run lint",
"test": "turbo run test --cache-dir=.turbo",
"pub": "turbo publish",
"e2e": "turbo run e2e",
"lint": "turbo run lint",
"update-packages": "yarn changeset",
"increase-packages": "yarn changeset version",
"notification:prepare": "ts-node scripts/notification.ts"
Expand Down Expand Up @@ -46,7 +47,6 @@
"eslint-plugin-prettier": "^4.2.1",
"husky": "^8.0.0",
"jest": "^29.3.1",
"lerna": "^6.6.1",
"lint-staged": "^13.1.0",
"prettier": "^2.2.0",
"rimraf": "5.0.0",
Expand All @@ -56,8 +56,10 @@
"ts-jest": "^29.0.3",
"ts-node": "10.9.2",
"tslib": "^2.5.0",
"tsup": "8.0.2",
"turbo": "1.13.0",
"typescript": "^5.0.4",
"yarn-audit-ci": "^1.2.0",
"weighted": "^1.0.0"
"weighted": "^1.0.0",
"yarn-audit-ci": "^1.2.0"
}
}
}
37 changes: 19 additions & 18 deletions packages/xchain-aggregator/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@
"url": "[email protected]:xchainjs/xchainjs-lib.git"
},
"scripts": {
"build": "yarn clean && rollup -c",
"clean": "rimraf -rf ./lib",
"clean": "rm -rf .turbo && rm -rf lib",
"build": "yarn build:pro",
"build:dev": "tsup --env.ENV dev",
"build:pro": "tsup --env.ENV pro",
"prepublishOnly": "yarn run build",
"e2e": "jest --config jest.config.e2e.js",
"test": "jest"
Expand All @@ -28,24 +30,23 @@
"access": "public"
},
"dependencies": {
"@xchainjs/xchain-client": "0.16.2",
"@xchainjs/xchain-mayachain": "1.0.1",
"@xchainjs/xchain-mayachain-query": "0.1.9",
"@xchainjs/xchain-thorchain": "1.0.4",
"@xchainjs/xchain-thorchain-query": "0.7.7",
"@xchainjs/xchain-util": "0.13.3"
"@xchainjs/xchain-client": "*",
"@xchainjs/xchain-mayachain": "*",
"@xchainjs/xchain-mayachain-amm": "*",
"@xchainjs/xchain-mayachain-query": "*",
"@xchainjs/xchain-thorchain": "*",
"@xchainjs/xchain-thorchain-amm": "*",
"@xchainjs/xchain-thorchain-query": "*",
"@xchainjs/xchain-util": "*",
"@xchainjs/xchain-wallet": "*"
},
"devDependencies": {
"@xchainjs/xchain-avax": "0.4.6",
"@xchainjs/xchain-bitcoin": "0.23.13",
"@xchainjs/xchain-binance": "5.7.11",
"@xchainjs/xchain-ethereum": "0.31.6",
"@xchainjs/xchain-kujira": "0.1.12",
"@xchainjs/xchain-avax": "*",
"@xchainjs/xchain-bitcoin": "*",
"@xchainjs/xchain-binance": "*",
"@xchainjs/xchain-ethereum": "*",
"@xchainjs/xchain-kujira": "*",
"axios": "1.3.6",
"axios-mock-adapter": "1.20.0"
},
"peerDependencies": {
"@xchainjs/xchain-mayachain-amm": "1.0.14",
"@xchainjs/xchain-thorchain-amm": "1.0.5",
"@xchainjs/xchain-wallet": "0.1.8"
}
}
38 changes: 0 additions & 38 deletions packages/xchain-aggregator/rollup.config.js

This file was deleted.

20 changes: 20 additions & 0 deletions packages/xchain-aggregator/tsup.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { defineConfig } from 'tsup'

export default defineConfig((options) => {
return {
entry: ['src/index.ts'],
outDir: 'lib',
format: ['cjs', 'esm'],
bundle: true,
skipNodeModulesBundle: true,
outExtension: ({ format }) => {
if (format === 'cjs') return { js: '.js' }
if (format === 'esm') return { js: '.esm.js' }
return { js: `.${format}.js` }
},
minify: options.env?.ENV === 'pro',
dts: true,
sourcemap: options.env?.ENV === 'dev',
clean: true,
}
})
4 changes: 2 additions & 2 deletions packages/xchain-arbitrum/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"url": "[email protected]:xchainjs/xchainjs-lib.git"
},
"scripts": {
"clean": "rimraf --glob ./lib/**",
"clean": "rm -rf .turbo && rm -rf lib",
"build": "yarn clean && rollup -c",
"test": "jest --passWithNoTests",
"e2e": "jest --config jest.config.e2e.js",
Expand Down Expand Up @@ -52,4 +52,4 @@
"axios": "^1.3.6",
"ethers": "^5.7.2"
}
}
}
4 changes: 2 additions & 2 deletions packages/xchain-avax/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"url": "[email protected]:xchainjs/xchainjs-lib.git"
},
"scripts": {
"clean": "rimraf --glob ./lib/**",
"clean": "rm -rf .turbo && rm -rf lib",
"build": "yarn clean && rollup -c",
"test": "jest --passWithNoTests",
"e2e": "jest --config jest.config.e2e.js",
Expand Down Expand Up @@ -52,4 +52,4 @@
"axios": "^1.3.6",
"ethers": "^5.7.2"
}
}
}
4 changes: 2 additions & 2 deletions packages/xchain-binance/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"url": "[email protected]:xchainjs/xchainjs-lib.git"
},
"scripts": {
"clean": "rimraf --glob ./lib/**",
"clean": "rm -rf .turbo && rm -rf lib",
"build": "yarn clean && rollup -c",
"test": "jest",
"compile": "tsc -p tsconfig.build.json",
Expand All @@ -49,4 +49,4 @@
"@xchainjs/xchain-crypto": "^0.3.1",
"@xchainjs/xchain-util": "^0.13.3"
}
}
}
4 changes: 2 additions & 2 deletions packages/xchain-bitcoin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"url": "[email protected]:xchainjs/xchainjs-lib.git"
},
"scripts": {
"clean": "rimraf --glob ./lib/**",
"clean": "rm -rf .turbo && rm -rf lib",
"build": "yarn clean && rollup -c",
"test": "jest",
"e2e": "jest --config jest.config.e2e.js",
Expand Down Expand Up @@ -63,4 +63,4 @@
"dependencies": {
"@ledgerhq/hw-app-btc": "^10.1.0"
}
}
}
4 changes: 2 additions & 2 deletions packages/xchain-bitcoincash/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"url": "[email protected]:xchainjs/xchainjs-lib.git"
},
"scripts": {
"clean": "rimraf --glob ./lib/**",
"clean": "rm -rf .turbo && rm -rf lib",
"build": "yarn clean && rollup -c",
"test": "jest",
"e2e": "jest --config jest.config.e2e.js",
Expand Down Expand Up @@ -64,4 +64,4 @@
"publishConfig": {
"access": "public"
}
}
}
4 changes: 2 additions & 2 deletions packages/xchain-bsc/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"url": "[email protected]:xchainjs/xchainjs-lib.git"
},
"scripts": {
"clean": "rimraf --glob ./lib/**",
"clean": "rm -rf .turbo && rm -rf lib",
"build": "yarn clean && rollup -c",
"test": "jest --passWithNoTests",
"e2e": "jest --config jest.config.e2e.js",
Expand Down Expand Up @@ -52,4 +52,4 @@
"axios": "^1.3.6",
"ethers": "^5.7.2"
}
}
}
4 changes: 2 additions & 2 deletions packages/xchain-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"lib"
],
"scripts": {
"clean": "rimraf --glob ./lib/**",
"clean": "rm -rf .turbo && rm -rf lib",
"build": "yarn clean && rollup -c",
"compile": "tsc -p tsconfig.build.json",
"prepublishOnly": "yarn run build",
Expand All @@ -28,4 +28,4 @@
"@xchainjs/xchain-crypto": "^0.3.1",
"axios": "^1.3.6"
}
}
}
4 changes: 2 additions & 2 deletions packages/xchain-cosmos-sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"url": "[email protected]:xchainjs/xchainjs-lib.git"
},
"scripts": {
"clean": "rimraf --glob ./lib/**",
"clean": "rm -rf .turbo && rm -rf lib",
"build": "yarn clean && rollup -c",
"test": "jest --passWithNoTests",
"e2e": "jest --config jest.config.e2e.js",
Expand Down Expand Up @@ -55,4 +55,4 @@
"bip32": "^2.0.6",
"secp256k1": "^5.0.0"
}
}
}
4 changes: 2 additions & 2 deletions packages/xchain-cosmos/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"url": "[email protected]:xchainjs/xchainjs-lib.git"
},
"scripts": {
"clean": "rimraf --glob ./lib/**",
"clean": "rm -rf .turbo && rm -rf lib",
"build": "yarn clean && rollup -c",
"test": "jest",
"e2e": "jest --config jest.config.e2e.js",
Expand All @@ -47,4 +47,4 @@
"publishConfig": {
"access": "public"
}
}
}
Loading

0 comments on commit 599c34e

Please sign in to comment.