Skip to content

Conversation

Ansonhkg
Copy link
Collaborator

@Ansonhkg Ansonhkg commented Sep 15, 2025

WHAT

  • A refactor from Bun to PNPM
  • Migrated NX from 17.3.0 and pinned to 21.2.1
  • Upgraded esbuild to 0.19.2 to satisfy Nx, removed typedoc-theme-hierarchy because it blocked upgrades, and moved typedoc to 0.28.12 for compatibility with TypeScript 5.8+.
  • Use dotenvx to load .env and run the gen:local-network-context using tsx. Previously Bun would automatically detect and load the .env file.
  • Migrated test to jest

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

…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
- 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.
@Ansonhkg Ansonhkg changed the title Feature/jss 93 refactor bun pnpm [Refactor] [bun > pnpm] Feature/jss 93 refactor bun pnpm Sep 15, 2025
@Ansonhkg Ansonhkg self-assigned this Sep 15, 2025
…ata. This changes are added in #891 and #892 but they are pull in so this PR can build
- 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
@Ansonhkg Ansonhkg changed the title [Refactor] [bun > pnpm] Feature/jss 93 refactor bun pnpm ⭐️ [Refactor] [bun > pnpm] Feature/jss 93 refactor bun pnpm Sep 15, 2025
Copy link
Collaborator

@glitch003 glitch003 left a 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

@Ansonhkg Ansonhkg mentioned this pull request Sep 18, 2025
…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
Copy link
Contributor

@MaximusHaximus MaximusHaximus left a 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.

Comment on lines +9 to +10
import { getOrCreatePkp } from '@lit-protocol/e2e/src/helper/pkp-utils';
import * as NetworkManager from '@lit-protocol/e2e/src/helper/NetworkManager';
Copy link
Contributor

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?

Copy link
Collaborator Author

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) {
Copy link
Contributor

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?

Copy link
Collaborator Author

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) {
Copy link
Contributor

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?

Copy link
Collaborator Author

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 }) => ({
Copy link
Contributor

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()?

Copy link
Collaborator Author

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'
Copy link
Contributor

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()?

Copy link
Collaborator Author

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 {}
Copy link
Contributor

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?

Copy link
Collaborator Author

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,
Copy link
Contributor

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

Copy link
Collaborator Author

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)
Copy link
Contributor

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

Copy link
Collaborator Author

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",
Copy link
Contributor

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
@Copilot Copilot AI review requested due to automatic review settings September 25, 2025 00:20
Copy link
Contributor

@Copilot Copilot AI left a 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants