Skip to content

Commit 81b8dd3

Browse files
[FE] Use path aliases for app dependencies (MystenLabs#4340)
* Use path aliases for app dependencies * Fix all builds * Keep package overrides * Revert overrides change * Use path alias for bcs in tests * Remove jest and fix wallet tests * Run install * Debug wallet * Move to shared runners
1 parent 32adf05 commit 81b8dd3

23 files changed

+142
-1509
lines changed

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@ sui_core/tests/staged/sui.yaml text eol=lf
99

1010
# These files is auto generated
1111
sdk/typescript/src/index.guard.ts linguist-generated=true
12+
sdk/typescript/src/rpc/client.guard.ts linguist-generated=true

.github/workflows/explorer-client-prs.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@ jobs:
2828
cache: "pnpm"
2929
- name: Install dependencies
3030
run: pnpm install --frozen-lockfile
31-
- name: Build SDK
32-
run: pnpm --filter @mysten/sui.js build
3331
- name: Lint
3432
run: pnpm --filter sui-explorer lint
3533
- name: Unit Tests
@@ -54,8 +52,6 @@ jobs:
5452
cache: "pnpm"
5553
- name: Install dependencies
5654
run: pnpm install --frozen-lockfile
57-
- name: Build TS sdk
58-
run: pnpm --filter @mysten/sui.js build
5955
- name: Install Cypress
6056
run: pnpm --filter sui-explorer exec cypress install
6157
- name: Run e2e tests

.github/workflows/wallet-ext-prs.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Wallet Extension PR checks
22
on: pull_request
33
jobs:
44
diff:
5-
runs-on: [ubuntu-ghcloud]
5+
runs-on: [ubuntu-latest]
66
outputs:
77
isWalletExt: ${{ steps.diff.outputs.isWalletExt }}
88
steps:
@@ -14,7 +14,7 @@ jobs:
1414
name: Lint, Test & Build
1515
needs: diff
1616
if: needs.diff.outputs.isWalletExt == 'true'
17-
runs-on: [ubuntu-ghcloud]
17+
runs-on: [ubuntu-latest]
1818
env:
1919
working-directory: ./wallet
2020
steps:
@@ -30,8 +30,6 @@ jobs:
3030
cache: 'pnpm'
3131
- name: Install dependencies
3232
run: pnpm install --frozen-lockfile
33-
- name: Build SDK
34-
run: pnpm --filter @mysten/sui.js build
3533
- name: Lint
3634
working-directory: ${{env.working-directory}}
3735
run: pnpm lint

explorer/client/.eslintrc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
module.exports = {
55
plugins: ['header'],
6-
extends: ['react-app', 'react-app/jest', 'prettier'],
6+
extends: ['react-app', 'prettier'],
77
rules: {
88
'react/jsx-no-bind': ['error'],
99
'import/order': [

explorer/client/README.md

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,6 @@ Dependencies are managed using [`pnpm`](https://pnpm.io/). You can start by inst
1212
$ pnpm install
1313
```
1414

15-
Currently the Explorer depends on an unreleased version of `sui.js`, the TypeScript SDK for Sui. Therefore, you need to build the SDK first:
16-
17-
```bash
18-
$ pnpm --filter @mysten/sui.js... build
19-
```
20-
21-
> **Note:** If you are updating the SDK and Explorer at the same time, you need to re-build the SDK whenever you makes changes for it to be reflected in the Explorer.
22-
2315
# How to Switch Environment
2416

2517
## Connecting to the DevNet Remote Gateway Server
@@ -28,7 +20,6 @@ The Sui Explorer frontend will use the DevNet Gateway server by default: https:/
2820

2921
```bash
3022
pnpm dev
31-
3223
```
3324

3425
## Connecting to a Local RPC Server
@@ -37,7 +28,6 @@ Refer to [Local RPC Server & JSON-RPC API Quick Start](../../doc/src/build/json-
3728

3829
```bash
3930
pnpm dev:local
40-
4131
```
4232

4333
Alternatively, having run `pnpm dev`, click the green button at the top of the page and select the option 'Local'.
@@ -48,7 +38,6 @@ First run the following:
4838

4939
```bash
5040
pnpm dev
51-
5241
```
5342

5443
Then, click the green button at the top and select the option 'Custom RPC URL'. Type the Custom RPC URL into the input box that emerges.

explorer/client/tsconfig.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,12 @@
1414
"resolveJsonModule": true,
1515
"isolatedModules": true,
1616
"noEmit": true,
17-
"jsx": "react-jsx"
17+
"jsx": "react-jsx",
18+
"baseUrl": ".",
19+
"paths": {
20+
"@mysten/sui.js": ["../../sdk/typescript/src/"],
21+
"@mysten/bcs": ["../../sdk/typescript/bcs/src/"]
22+
}
1823
},
1924
"include": ["src"]
2025
}

explorer/client/vite.config.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// SPDX-License-Identifier: Apache-2.0
33

44
import react from '@vitejs/plugin-react';
5+
import path from 'path';
56
import { defineConfig } from 'vite';
67
import svgr from 'vite-plugin-svgr';
78

@@ -12,4 +13,16 @@ export default defineConfig({
1213
// Set the output directory to match what CRA uses:
1314
outDir: 'build',
1415
},
16+
resolve: {
17+
alias: {
18+
'@mysten/sui.js': path.resolve(
19+
__dirname,
20+
'../../sdk/typescript/src/'
21+
),
22+
'@mysten/bcs': path.resolve(
23+
__dirname,
24+
'../../sdk/typescript/bcs/src/'
25+
),
26+
},
27+
},
1528
});

package.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
"pnpm": {
66
"overrides": {
77
"node-notifier": "10.0.0",
8-
"jest": "27",
9-
"ts-jest": "27",
108
"async": "3.2.2",
119
"nth-check": "2.0.1"
1210
}

0 commit comments

Comments
 (0)