Skip to content

Commit 35dbafc

Browse files
authored
chore: prune PNPM dependency FOD (#5224)
This PR overhauls PNPM integration with Nix in the interests of safety and developer experience. The result is fewer changes to per-project [`pnpm.fetchDeps`](https://github.com/nixos/nixpkgs/blob/nixos-25.05/pkgs/development/tools/pnpm/fetch-deps/default.nix#L14) fixed-output derivations in instances a dependency change in one project should not impact the dependencies of any unrelated project. This succeeds with the exception of instances where optional peer dependencies may be satisfied by workspace projects. This may be related to pnpm/pnpm#10046 or pnpm/pnpm#9288. - Pin `pnpm` and `nodejs` within Nix such that versions are shared across the dev shell and `buildPnpmPackage`. - Prefer `nodejs-slim*` package to remove `npm`. - Remove project-specific `.npmrc` files such that a root `pnpm-workspace.yaml` consolidates dependency resolution configuration. - Remove `scripts/docs.mjs` in favor of Nix output for TSDoc generated Markdown. - Remove a substantial set of root workspace dependencies from root `package.json`. - Enhance PNPM integration: - Enforce strict peer dependencies and removal of peer auto-install to fortify reproducibility. - Enforce [minimum dependency release age](https://pnpm.io/settings#minimumreleaseage) to fortify supply-chain attack protection. - Use PNPM [catalogs](https://pnpm.io/catalogs) to easily specify consistent versions of common dependencies. - Declare a `peer` catalog to relax version range when specifying peer dependencies. - Cleanup unused/deprecated dependencies in `app`: - Remove `@aptos-labs/*` which improves bundle output size by ~50%. - Remove `@unionlabs/client` which is deprecated in favor of `@unionlabs/sdk` and family. - Bump various dependencies, notably: - `@types/nodejs@^24` to align with the pinned Node.js version for shell & build.
2 parents de77528 + 53d588e commit 35dbafc

File tree

86 files changed

+5159
-8749
lines changed

Some content is hidden

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

86 files changed

+5159
-8749
lines changed

.github/workflows/package-snapshot.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@ on:
66
- 'ts-sdk/**'
77
- '.changeset/**'
88
workflow_dispatch: {}
9-
109
permissions: {}
11-
1210
jobs:
1311
snapshot:
1412
name: Snapshot
@@ -32,7 +30,7 @@ jobs:
3230
- name: Make writable snapshot copy
3331
run: |
3432
rm -rf ./snapshot-pkg
35-
rsync -a --copy-links ./result/dist ./snapshot-pkg/
33+
rsync -a --copy-links ./result/ ./snapshot-pkg/
3634
chmod -R u+w ./snapshot-pkg
3735
- uses: actions/setup-node@v4
3836
with: {node-version: 22}
@@ -42,4 +40,4 @@ jobs:
4240
run_install: false
4341
- name: Create snapshot
4442
id: snapshot
45-
run: pnpm dlx [email protected] publish --pnpm --comment=off ./snapshot-pkg/dist
43+
run: pnpm dlx [email protected] publish --pnpm --comment=off ./snapshot-pkg

.github/workflows/typescript-sdk-preview.yml

Lines changed: 0 additions & 53 deletions
This file was deleted.

.github/workflows/typescript-sdk-publish.yml

Lines changed: 0 additions & 64 deletions
This file was deleted.

app2/.npmrc

Lines changed: 0 additions & 1 deletion
This file was deleted.

app2/app2.nix

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,13 @@ _: {
44
pkgs,
55
pkgsUnstable,
66
ensureAtRepositoryRoot,
7-
lib,
87
gitShortRev,
98
lastModified,
109
lastModifiedDate,
10+
buildPnpmPackage,
1111
...
1212
}:
1313
let
14-
buildPnpmPackage = import ../tools/typescript/buildPnpmPackage.nix {
15-
inherit pkgs lib;
16-
};
1714
deps = with pkgsUnstable; [
1815
python3
1916
stdenv.cc
@@ -35,24 +32,21 @@ _: {
3532
packageJsonPath = ./package.json;
3633
extraSrcs = [
3734
../app2
38-
../typescript-sdk
3935
../ts-sdk
4036
../ts-sdk-evm
4137
../ts-sdk-cosmos
4238
];
43-
hash = "sha256-+eBL34sxYBIt2SiiLeSbn93zBN/JqGDJSaKY+3DpSos=";
39+
hash = "sha256-VkzzXZr7WNTSE8pBOcLLd9vZThjFqsSJaEKwb7bi4PY=";
4440
buildInputs = deps;
4541
nativeBuildInputs = buildInputs;
4642
pnpmWorkspaces = [
4743
"app2"
4844
"@unionlabs/sdk"
4945
"@unionlabs/sdk-evm"
5046
"@unionlabs/sdk-cosmos"
51-
"@unionlabs/client"
5247
];
5348
buildPhase = ''
5449
runHook preBuild
55-
5650
export PUBLIC_DATADOG_CLIENT_TOKEN="${PUBLIC_DATADOG_CLIENT_TOKEN}"
5751
export PUBLIC_GIT_REV="${PUBLIC_GIT_REV}"
5852
export PUBLIC_LAST_MODIFIED_DATE="${PUBLIC_LAST_MODIFIED_DATE}"

app2/package.json

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,18 @@
1717
"supabase:generate": "supabase gen types --lang='typescript' --project-id='uorqzpuryrgfnecadajo' > './src/lib/dashboard/database.types.ts'"
1818
},
1919
"devDependencies": {
20-
"@types/node": "^24.3.1",
21-
"@aptos-labs/ts-sdk": "1.38.0",
2220
"@chain-registry/types": "^0.50.144",
2321
"@cosmjs/amino": "^0.33.1",
24-
"@cosmjs/cosmwasm-stargate": "0.33.1",
25-
"@cosmjs/math": "^0.33.1",
26-
"@cosmjs/proto-signing": "^0.33.1",
27-
"@cosmjs/stargate": "0.33.1",
28-
"@cosmjs/tendermint-rpc": "^0.33.1",
22+
"@cosmjs/cosmwasm-stargate": "catalog:",
23+
"@cosmjs/math": "0.33.1",
24+
"@cosmjs/proto-signing": "catalog:",
25+
"@cosmjs/stargate": "catalog:",
26+
"@cosmjs/tendermint-rpc": "catalog:",
2927
"@datadog/browser-logs": "^6.6.4",
30-
"@effect/experimental": "0.48.6",
31-
"@effect/platform": "0.84.6",
32-
"@effect/typeclass": "^0.35.5",
28+
"@effect/experimental": "catalog:",
29+
"@effect/platform": "catalog:",
30+
"@effect/typeclass": "catalog:",
31+
"@effect/vitest": "catalog:",
3332
"@eslint/compat": "^1.2.8",
3433
"@eslint/js": "^9.24.0",
3534
"@keplr-wallet/types": "^0.12.220",
@@ -39,42 +38,45 @@
3938
"@safe-global/safe-gateway-typescript-sdk": "^3.23.1",
4039
"@scure/base": "^1.2.4",
4140
"@supabase/supabase-js": "^2.49.4",
42-
"@sveltejs/adapter-static": "^3.0.8",
43-
"@sveltejs/kit": "^2.21.3",
44-
"@sveltejs/vite-plugin-svelte": "^5.1.0",
41+
"@sveltejs/adapter-static": "catalog:svelte",
42+
"@sveltejs/kit": "catalog:svelte",
43+
"@sveltejs/vite-plugin-svelte": "catalog:svelte",
4544
"@tailwindcss/vite": "^4.1.4",
4645
"@testing-library/jest-dom": "^6.6.3",
47-
"@testing-library/svelte": "^5.2.4",
48-
"@unionlabs/client": "workspace:*",
46+
"@testing-library/svelte": "catalog:svelte",
47+
"@types/node": "24.6.1",
4948
"@unionlabs/sdk": "workspace:*",
5049
"@unionlabs/sdk-cosmos": "workspace:*",
5150
"@unionlabs/sdk-evm": "workspace:*",
5251
"@wagmi/connectors": "^5.7.12",
5352
"@wagmi/core": "^2.16.7",
54-
"@web3modal/wagmi": "5.1.11",
5553
"clsx": "^2.1.1",
56-
"effect": "3.16.3",
54+
"effect": "catalog:",
5755
"eslint": "^9.24.0",
58-
"eslint-plugin-svelte": "^3.5.1",
56+
"eslint-plugin-svelte": "catalog:svelte",
5957
"globals": "^16.0.0",
6058
"gql.tada": "^1.8.10",
6159
"graphql": "^16.10.0",
6260
"graphql-request": "^7.1.2",
6361
"happy-dom": "^17.4.4",
6462
"knip": "^5.63.0",
6563
"ox": "^0.6.9",
64+
"react": "catalog:",
6665
"rehype-rewrite": "^4.0.2",
6766
"rehype-stringify": "^10.0.1",
6867
"remark-parse": "^11.0.0",
6968
"remark-rehype": "^11.1.2",
70-
"svelte": "^5.33.18",
71-
"svelte-check": "^4.2.1",
69+
"starknet": "catalog:",
70+
"svelte": "catalog:svelte",
71+
"svelte-check": "catalog:svelte",
7272
"tailwind-merge": "^3.2.0",
7373
"tailwindcss": "^4.1.4",
74+
"typescript": "catalog:",
7475
"typescript-eslint": "^8.30.1",
7576
"unified": "^11.0.5",
7677
"vfile": "^6.0.3",
77-
"viem": "^2.33.3",
78-
"vite": "^6.3.1"
78+
"viem": "2.33.3",
79+
"vite": "catalog:",
80+
"vitest": "catalog:"
7981
}
8082
}

app2/src/app.d.ts

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,9 @@
11
import type { Window as KeplrWindow } from "@keplr-wallet/types"
22
import type { LeapWindow } from "@leapwallet/types"
3-
import type { AptosBrowserWallet } from "@unionlabs/client"
43

54
type FeaturesQuery = ReturnType<typeof enabledFeatures>
65
type Features = NonNullable<FeaturesQuery["data"]>["v1_ibc_union_chains"]
76

8-
interface AptosWindow {
9-
aptos: AptosBrowserWallet
10-
petra: AptosBrowserWallet
11-
martian: AptosBrowserWallet
12-
okxwallet: {
13-
aptos: AptosBrowserWallet
14-
}
15-
}
16-
177
declare global {
188
namespace App {
199
// interface Locals {
@@ -24,7 +14,7 @@ declare global {
2414
// }
2515
}
2616

27-
interface Window extends AptosWindow, KeplrWindow, LeapWindow, Browser {
17+
interface Window extends KeplrWindow, LeapWindow, Browser {
2818
EventEmitter: typeof EventEmitter
2919

3020
/** Guard to ensure GitHub logo proxy patches are applied only once */

app2/src/lib/components/model/ErrorComponent.svelte

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
<script lang="ts">
22
import Button from "$lib/components/ui/Button.svelte"
33
import type { GraphQLError } from "$lib/graphql/error"
4-
import { FetchAptosTokenBalanceError } from "$lib/services/aptos/balances"
54
import type { QueryBankBalanceError } from "$lib/services/cosmos/balances"
65
import type { FetchNativeBalanceError, ReadContractError } from "$lib/services/evm/balances"
76
import type { NoViemChainError } from "$lib/services/evm/clients"
@@ -73,7 +72,6 @@ interface Props {
7372
| CreateWalletClientError
7473
| CryptoError
7574
| ExecuteContractError
76-
| FetchAptosTokenBalanceError
7775
| FetchNativeBalanceError
7876
| FromHexError
7977
| GasPriceError
@@ -128,7 +126,6 @@ const getUserFriendlyMessage = pipe(
128126
FromHexError: () => `Failed to decode hex.`,
129127
GetChainInfoError: (x) => `No info for EVM chain ${x.chainId}.`, // TODO: rename to EVM
130128
NoCosmosChainInfoError: (x) => `No info for Cosmos chain ${x.chain.display_name}.`,
131-
FetchAptosTokenBalanceError: () => `Failed to fetch aptos token balance.`,
132129
NoRpcError: (error) => `No ${error.type} endpoint available for ${error.chain.display_name}.`,
133130
NoSuchElementException: () => "An unexpected error occurred.", // TODO: remove me for more explicit errors
134131
NoViemChain: () => "Chain configuration not found for the selected network.",

0 commit comments

Comments
 (0)