-
Notifications
You must be signed in to change notification settings - Fork 86
⭐️ [Refactor] [bun > pnpm] Feature/jss 93 refactor bun pnpm #889
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: naga
Are you sure you want to change the base?
Conversation
…typedoc-theme-hierarchy because it blocked upgrades, and moved typedoc to 0.28.12 for compatibility with TypeScript 5.8+.
… minimal module mapping, dotenvx for envs - Switched Bun TS runner to Node + tsx with dotenvx wrapping for env loading. - Replaced Bun E2E runner with Jest using a dedicated jest e2e config - Resolved CJS/ESM breakages by using Babel transfomer for .ts|.js| in Jest. - Avoided duplicated module resolution: ignored `.nx/` and `dist/` in Jest. - Prevented hijacking external `@lit-protocol/*` and only map local packages
… minimal module mapping, dotenvx for envs - Switched Bun TS runner to Node + tsx with dotenvx wrapping for env loading. - Replaced Bun E2E runner with Jest using a dedicated jest e2e config - Resolved CJS/ESM breakages by using Babel transfomer for .ts|.js| in Jest. - Avoided duplicated module resolution: ignored `.nx/` and `dist/` in Jest. - Prevented hijacking external `@lit-protocol/*` and only map local packages
… only supports `babel-jest@^.29`.
…update reset script in package.json
- ESlint 8.48.0 no longer supported - @walletconnect/ethereum-provider is unused - uuidv4 to `crypto.randomUUID()` `@simplewebauthn/typescript-types` is NOT yet replaced with later types as unsure with side effects, locked-in to a particular version instead.
…s and remove module type; add TypeScript configuration
- remove unused artillery scripts - and update test command in package.json - remove unused packages
- Update type definitions to replace deprecated PKPInfo with PKPData across auth and e2e packages. - Modify Jest configuration to match all spec files in e2e tests. - Add .e2e to .gitignore for better file management. - Enhance e2e package structure with new types and utility functions for improved clarity and maintainability.
- moved inline import to top of the file - migrated to jest syntax - export utils from e2e and consumed by artillery - moved artillery as its own package - migrated script commands
…or better type safety
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems pretty straightforward - looks good to me
…tocol/js-sdk into feature/jss-107-refactor-move-e2e-and-artillery-into-packages
…ve-e2e-and-artillery-into-packages Feature/jss 107 refactor move e2e and artillery into packages
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Nothing blocking, added a few nits and it looks like we've still got auth data schemas duplicated in a few places which I noted.
import { getOrCreatePkp } from '@lit-protocol/e2e/src/helper/pkp-utils'; | ||
import * as NetworkManager from '@lit-protocol/e2e/src/helper/NetworkManager'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be importing from the package exports instead of reaching into the sub-director?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes it should!
metadata: z.unknown().optional(), | ||
}) | ||
.superRefine((val, ctx) => { | ||
if (val.authMethodType == null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not just make this required on the schema?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we need to update this branch to use the changes we made in the WebAuthn bug fix branch and reuse the auth data schema changes we made there.
message: 'authMethodType is required', | ||
}); | ||
} | ||
if (val.authMethodId == null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not just make this required on the schema, so that it's type-safe for consumers as well as being enforced automatically by ZOD's parsing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as #889 (comment)
}); | ||
} | ||
}) | ||
.transform(({ authMethodType, authMethodId, accessToken }) => ({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not use z.coerce.bigint()
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as #889 (comment)
}) | ||
.transform(({ authMethodType, authMethodId, accessToken }) => ({ | ||
authMethodType: | ||
typeof authMethodType === 'bigint' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not use z.coerce.bigint()
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as #889 (comment)
(effChain.rpcUrls as any)['public']?.http | ||
); | ||
} | ||
} catch {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why ignore errors here? If this code doesn't work, shouldn't this suite fail?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea you're right - I didn’t want the tests to fail since they’re purely for logging purposes to check the overridden private RPC URL, but we should just throw an error.
// signingScheme: 'EcdsaK256Sha256', | ||
authContext: getAuthContext(), | ||
pubKey: ctx.aliceViemAccountPkp.publicKey, | ||
pubKey: pubkey || ctx.aliceViemAccountPkp.pubkey, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:nit: Would be preferable to enforce that the caller always passes in the expected pubkey vs. having an implicit fallback
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This makes sense - the pubkey ||
was added only for custom auth, but rearranging it to have the pkp-sign.ts
NOT binding to a particular account makes sense!
expect(decryptedStringResponse).toBeDefined(); | ||
expect(decryptedStringResponse.convertedData).toBe(stringData); | ||
|
||
// Test 6: Decrypt JSON data (traditional method) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:nit: It would be preferable if these were actually different tests instead of just described as such by comments; e.g. 1 describe per type of encrypt/decrypt flow, with a case for encrypting and a case for decrypting
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed - so we can pinpoint which test failed exactly instead of the whole flow.
"@nx/plugin": "17.3.0", | ||
"@nx/react": "17.3.0", | ||
"@nx/web": "17.3.0", | ||
"@nx/esbuild": "21.2.1", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💖 New hotness.
- raise all workspace TS configs (including wasm) to ES2022 to match emitted code - add missing noble/ethers dependencies and tighten e2e peer/dev requirements so pnpm resolves - re-export PKP managers/types from networks and cast chainApi mint functions for strong typing - switch PKP storage provider interface to PKPData and drop the unused ethers provider - reuse existing Alice/Eve contexts in e2e helpers/specs to satisfy the new typings
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR migrates the build system from Bun to PNPM, upgrades NX from 17.3.0 to 21.2.1, and modernizes TypeScript configuration to use ES2022. The migration also includes restructuring test configurations to use Jest instead of Bun's test runner and updating package dependencies across the monorepo.
- Migrates package manager from Bun to PNPM with workspace configuration
- Upgrades NX to v21.2.1 and TypeScript target to ES2022
- Restructures testing to use Jest with proper ESM configuration and babel transforms
Reviewed Changes
Copilot reviewed 83 out of 100 changed files in this pull request and generated 5 comments.
Show a summary per file
File | Description |
---|---|
tsconfig.base.json | Updates TypeScript target and module from ES2020 to ES2022 |
package.json | Removes Bun-specific scripts and adds Jest-based E2E testing configuration |
jest.e2e.config.ts | Adds comprehensive Jest configuration for E2E testing with babel transforms |
packages/e2e/src/* | Restructures E2E tests to use standard Jest expectations instead of custom assertions |
packages/networks/src/* | Updates type definitions and removes references to deprecated PKPInfo interface |
babel.config.json | Adds Babel configuration for Jest TypeScript/ESM support |
pnpm-workspace.yaml | Adds PNPM workspace configuration |
Comments suppressed due to low confidence (1)
packages/networks/src/networks/vNaga/shared/managers/contract-manager/createContractsManager.ts:1
- The refactored function removes the comprehensive null/undefined check and error handling logic that was present in the original implementation. The original code had more detailed error messages and validation. Consider preserving the more robust error handling to maintain code reliability.
import type { Account, Chain, WalletClient, Client } from 'viem';
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
packages/networks/src/networks/vNaga/shared/managers/contract-manager/createContractsManager.ts
Show resolved
Hide resolved
…s-93-refactor-bun-pnpm
WHAT
17.3.0
and pinned to21.2.1
0.19.2
to satisfy Nx, removedtypedoc-theme-hierarchy
because it blocked upgrades, and movedtypedoc
to0.28.12
for compatibility with TypeScript 5.8+..env
and run thegen:local-network-context
usingtsx
. PreviouslyBun
would automatically detect and load the.env
file.Do not merge this until these are merged
Based off this branch (pnpm migration)
UPDATE 22/09/2025
Do not merge until load testing is done or ✅ from @hwrdtm