Skip to content

Commit 599c34e

Browse files
authored
Turbo configuration for Aggregator pkg (#1099)
* 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
1 parent 9cfd068 commit 599c34e

File tree

44 files changed

+820
-3131
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+820
-3131
lines changed

.changeset/shy-jobs-thank.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@xchainjs/xchain-aggregator': patch
3+
---
4+
5+
Build production mode without sourcemaps and with minification. Build tool updated from Rollup to Tsup

.github/workflows/build-and-test.yaml

+13-9
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,25 @@ jobs:
88
build:
99
runs-on: ubuntu-latest
1010
steps:
11-
- uses: actions/checkout@v2
11+
- name: Checkout repo
12+
uses: actions/checkout@v4
1213

13-
- name: Use Node.js
14-
uses: actions/setup-node@v1
14+
- name: Cache turbo build setup
15+
uses: actions/cache@v4
1516
with:
16-
node-version: "20.x"
17+
path: .turbo
18+
key: ${{ runner.os }}-turbo-${{ github.sha }}
19+
restore-keys: |
20+
${{ runner.os }}-turbo-
1721
18-
- name: Cache Yarn packages
19-
uses: actions/cache@v2
22+
- name: Setup Node.js 20.x
23+
uses: actions/setup-node@v4
2024
with:
21-
path: "**/node_modules"
22-
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
25+
node-version: 20.x
26+
cache: yarn
2327

2428
- name: Install dependencies
25-
run: yarn && yarn yarn-audit-ci --high
29+
run: yarn install --frozen-lockfile && yarn yarn-audit-ci --high
2630

2731
- name: Build packages
2832
run: yarn build

.github/workflows/release.yaml

+12-3
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,24 @@ jobs:
1515
runs-on: ubuntu-latest
1616
steps:
1717
- name: Checkout repo
18-
uses: actions/checkout@v2
18+
uses: actions/checkout@v4
19+
20+
- name: Cache turbo build setup
21+
uses: actions/cache@v4
22+
with:
23+
path: .turbo
24+
key: ${{ runner.os }}-turbo-${{ github.sha }}
25+
restore-keys: |
26+
${{ runner.os }}-turbo-
1927
2028
- name: Setup Node.js 20.x
21-
uses: actions/setup-node@v2
29+
uses: actions/setup-node@v4
2230
with:
2331
node-version: 20.x
32+
cache: yarn
2433

2534
- name: Install dependencies
26-
run: yarn install
35+
run: yarn install --frozen-lockfile
2736

2837
- name: Build packages
2938
run: yarn build

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ results
66
*.tsbuildinfo
77
.DS_Store
88
.idea
9+
.turbo
910

1011
*.txt
1112

lerna.json

-6
This file was deleted.

package.json

+12-10
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,15 @@
77
"examples/*"
88
],
99
"scripts": {
10-
"clean": "lerna run clean",
11-
"build": "lerna run build",
10+
"clean": "turbo run clean && rm -rf ./.turbo",
11+
"clean:nodemodules": "rm -rf ./packages/*/node_modules && rm -rf ./node_modules",
12+
"build": "turbo run build --cache-dir=.turbo",
1213
"build:examples": "tsc examples/**/*.ts --noEmit --skipLibCheck",
1314
"build:tools": "tsc tools/**/*.ts --noEmit --skipLibCheck",
14-
"pub": "lerna publish",
15-
"test": "lerna run test",
16-
"e2e": "lerna run e2e",
17-
"lint": "lerna run lint",
15+
"test": "turbo run test --cache-dir=.turbo",
16+
"pub": "turbo publish",
17+
"e2e": "turbo run e2e",
18+
"lint": "turbo run lint",
1819
"update-packages": "yarn changeset",
1920
"increase-packages": "yarn changeset version",
2021
"notification:prepare": "ts-node scripts/notification.ts"
@@ -46,7 +47,6 @@
4647
"eslint-plugin-prettier": "^4.2.1",
4748
"husky": "^8.0.0",
4849
"jest": "^29.3.1",
49-
"lerna": "^6.6.1",
5050
"lint-staged": "^13.1.0",
5151
"prettier": "^2.2.0",
5252
"rimraf": "5.0.0",
@@ -56,8 +56,10 @@
5656
"ts-jest": "^29.0.3",
5757
"ts-node": "10.9.2",
5858
"tslib": "^2.5.0",
59+
"tsup": "8.0.2",
60+
"turbo": "1.13.0",
5961
"typescript": "^5.0.4",
60-
"yarn-audit-ci": "^1.2.0",
61-
"weighted": "^1.0.0"
62+
"weighted": "^1.0.0",
63+
"yarn-audit-ci": "^1.2.0"
6264
}
63-
}
65+
}

packages/xchain-aggregator/package.json

+19-18
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,10 @@
1818
"url": "git@github.com:xchainjs/xchainjs-lib.git"
1919
},
2020
"scripts": {
21-
"build": "yarn clean && rollup -c",
22-
"clean": "rimraf -rf ./lib",
21+
"clean": "rm -rf .turbo && rm -rf lib",
22+
"build": "yarn build:pro",
23+
"build:dev": "tsup --env.ENV dev",
24+
"build:pro": "tsup --env.ENV pro",
2325
"prepublishOnly": "yarn run build",
2426
"e2e": "jest --config jest.config.e2e.js",
2527
"test": "jest"
@@ -28,24 +30,23 @@
2830
"access": "public"
2931
},
3032
"dependencies": {
31-
"@xchainjs/xchain-client": "0.16.2",
32-
"@xchainjs/xchain-mayachain": "1.0.1",
33-
"@xchainjs/xchain-mayachain-query": "0.1.9",
34-
"@xchainjs/xchain-thorchain": "1.0.4",
35-
"@xchainjs/xchain-thorchain-query": "0.7.7",
36-
"@xchainjs/xchain-util": "0.13.3"
33+
"@xchainjs/xchain-client": "*",
34+
"@xchainjs/xchain-mayachain": "*",
35+
"@xchainjs/xchain-mayachain-amm": "*",
36+
"@xchainjs/xchain-mayachain-query": "*",
37+
"@xchainjs/xchain-thorchain": "*",
38+
"@xchainjs/xchain-thorchain-amm": "*",
39+
"@xchainjs/xchain-thorchain-query": "*",
40+
"@xchainjs/xchain-util": "*",
41+
"@xchainjs/xchain-wallet": "*"
3742
},
3843
"devDependencies": {
39-
"@xchainjs/xchain-avax": "0.4.6",
40-
"@xchainjs/xchain-bitcoin": "0.23.13",
41-
"@xchainjs/xchain-binance": "5.7.11",
42-
"@xchainjs/xchain-ethereum": "0.31.6",
43-
"@xchainjs/xchain-kujira": "0.1.12",
44+
"@xchainjs/xchain-avax": "*",
45+
"@xchainjs/xchain-bitcoin": "*",
46+
"@xchainjs/xchain-binance": "*",
47+
"@xchainjs/xchain-ethereum": "*",
48+
"@xchainjs/xchain-kujira": "*",
49+
"axios": "1.3.6",
4450
"axios-mock-adapter": "1.20.0"
45-
},
46-
"peerDependencies": {
47-
"@xchainjs/xchain-mayachain-amm": "1.0.14",
48-
"@xchainjs/xchain-thorchain-amm": "1.0.5",
49-
"@xchainjs/xchain-wallet": "0.1.8"
5051
}
5152
}

packages/xchain-aggregator/rollup.config.js

-38
This file was deleted.
+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import { defineConfig } from 'tsup'
2+
3+
export default defineConfig((options) => {
4+
return {
5+
entry: ['src/index.ts'],
6+
outDir: 'lib',
7+
format: ['cjs', 'esm'],
8+
bundle: true,
9+
skipNodeModulesBundle: true,
10+
outExtension: ({ format }) => {
11+
if (format === 'cjs') return { js: '.js' }
12+
if (format === 'esm') return { js: '.esm.js' }
13+
return { js: `.${format}.js` }
14+
},
15+
minify: options.env?.ENV === 'pro',
16+
dts: true,
17+
sourcemap: options.env?.ENV === 'dev',
18+
clean: true,
19+
}
20+
})

packages/xchain-arbitrum/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"url": "git@github.com:xchainjs/xchainjs-lib.git"
2525
},
2626
"scripts": {
27-
"clean": "rimraf --glob ./lib/**",
27+
"clean": "rm -rf .turbo && rm -rf lib",
2828
"build": "yarn clean && rollup -c",
2929
"test": "jest --passWithNoTests",
3030
"e2e": "jest --config jest.config.e2e.js",
@@ -52,4 +52,4 @@
5252
"axios": "^1.3.6",
5353
"ethers": "^5.7.2"
5454
}
55-
}
55+
}

packages/xchain-avax/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"url": "git@github.com:xchainjs/xchainjs-lib.git"
2525
},
2626
"scripts": {
27-
"clean": "rimraf --glob ./lib/**",
27+
"clean": "rm -rf .turbo && rm -rf lib",
2828
"build": "yarn clean && rollup -c",
2929
"test": "jest --passWithNoTests",
3030
"e2e": "jest --config jest.config.e2e.js",
@@ -52,4 +52,4 @@
5252
"axios": "^1.3.6",
5353
"ethers": "^5.7.2"
5454
}
55-
}
55+
}

packages/xchain-binance/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"url": "git@github.com:xchainjs/xchainjs-lib.git"
2626
},
2727
"scripts": {
28-
"clean": "rimraf --glob ./lib/**",
28+
"clean": "rm -rf .turbo && rm -rf lib",
2929
"build": "yarn clean && rollup -c",
3030
"test": "jest",
3131
"compile": "tsc -p tsconfig.build.json",
@@ -49,4 +49,4 @@
4949
"@xchainjs/xchain-crypto": "^0.3.1",
5050
"@xchainjs/xchain-util": "^0.13.3"
5151
}
52-
}
52+
}

packages/xchain-bitcoin/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"url": "git@github.com:xchainjs/xchainjs-lib.git"
2525
},
2626
"scripts": {
27-
"clean": "rimraf --glob ./lib/**",
27+
"clean": "rm -rf .turbo && rm -rf lib",
2828
"build": "yarn clean && rollup -c",
2929
"test": "jest",
3030
"e2e": "jest --config jest.config.e2e.js",
@@ -63,4 +63,4 @@
6363
"dependencies": {
6464
"@ledgerhq/hw-app-btc": "^10.1.0"
6565
}
66-
}
66+
}

packages/xchain-bitcoincash/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"url": "git@github.com:xchainjs/xchainjs-lib.git"
2626
},
2727
"scripts": {
28-
"clean": "rimraf --glob ./lib/**",
28+
"clean": "rm -rf .turbo && rm -rf lib",
2929
"build": "yarn clean && rollup -c",
3030
"test": "jest",
3131
"e2e": "jest --config jest.config.e2e.js",
@@ -64,4 +64,4 @@
6464
"publishConfig": {
6565
"access": "public"
6666
}
67-
}
67+
}

packages/xchain-bsc/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"url": "git@github.com:xchainjs/xchainjs-lib.git"
2525
},
2626
"scripts": {
27-
"clean": "rimraf --glob ./lib/**",
27+
"clean": "rm -rf .turbo && rm -rf lib",
2828
"build": "yarn clean && rollup -c",
2929
"test": "jest --passWithNoTests",
3030
"e2e": "jest --config jest.config.e2e.js",
@@ -52,4 +52,4 @@
5252
"axios": "^1.3.6",
5353
"ethers": "^5.7.2"
5454
}
55-
}
55+
}

packages/xchain-client/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"lib"
1313
],
1414
"scripts": {
15-
"clean": "rimraf --glob ./lib/**",
15+
"clean": "rm -rf .turbo && rm -rf lib",
1616
"build": "yarn clean && rollup -c",
1717
"compile": "tsc -p tsconfig.build.json",
1818
"prepublishOnly": "yarn run build",
@@ -28,4 +28,4 @@
2828
"@xchainjs/xchain-crypto": "^0.3.1",
2929
"axios": "^1.3.6"
3030
}
31-
}
31+
}

packages/xchain-cosmos-sdk/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"url": "git@github.com:xchainjs/xchainjs-lib.git"
2525
},
2626
"scripts": {
27-
"clean": "rimraf --glob ./lib/**",
27+
"clean": "rm -rf .turbo && rm -rf lib",
2828
"build": "yarn clean && rollup -c",
2929
"test": "jest --passWithNoTests",
3030
"e2e": "jest --config jest.config.e2e.js",
@@ -55,4 +55,4 @@
5555
"bip32": "^2.0.6",
5656
"secp256k1": "^5.0.0"
5757
}
58-
}
58+
}

packages/xchain-cosmos/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"url": "git@github.com:xchainjs/xchainjs-lib.git"
2525
},
2626
"scripts": {
27-
"clean": "rimraf --glob ./lib/**",
27+
"clean": "rm -rf .turbo && rm -rf lib",
2828
"build": "yarn clean && rollup -c",
2929
"test": "jest",
3030
"e2e": "jest --config jest.config.e2e.js",
@@ -47,4 +47,4 @@
4747
"publishConfig": {
4848
"access": "public"
4949
}
50-
}
50+
}

0 commit comments

Comments
 (0)