Skip to content
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

Shared Local Bundler E2E Setup #314

Merged
merged 1 commit into from
Mar 18, 2024
Merged

Shared Local Bundler E2E Setup #314

merged 1 commit into from
Mar 18, 2024

Conversation

nlordell
Copy link
Collaborator

@nlordell nlordell commented Mar 7, 2024

This PR adds a new workspace packages/4337-local-bundler which exposes a bin executable called 4337-local-bundler-test which runs a local bundler using Docker, and then executes hardhat tests using the @4337 tag.

This allows us to have a homogeneous setup between both the 4337 and passkey repositories (as well as any future modules that we want to be 4337-compliant).

Along the way, I was also able to share 4337 and Safe deployment scripts across the projects when bootstrapping the local development node.

@nlordell nlordell requested a review from a team as a code owner March 7, 2024 20:02
@nlordell nlordell requested review from akshay-ap, mmv08 and remedcu and removed request for a team March 7, 2024 20:02
@@ -0,0 +1,68 @@
#!/usr/bin/env node
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ported from the original run.sh script to JS so that it can be exported as a bin.

@nlordell nlordell force-pushed the chore/refactor-monorepo-2 branch from d9828e8 to ca79025 Compare March 7, 2024 20:04
@coveralls
Copy link

coveralls commented Mar 7, 2024

Pull Request Test Coverage Report for Build 8194488336

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+62.4%) to 76.923%

Totals Coverage Status
Change from base Build 8187577883: 62.4%
Covered Lines: 131
Relevant Lines: 155

💛 - Coveralls

@@ -10,7 +10,8 @@
],
"scripts": {
"fmt:global": "prettier --write .",
"fmt:global-check": "prettier --check ."
"fmt:global-check": "prettier --check .",
"postinstall": "npm rebuild --skip-scripts @safe-global/safe-4337-local-bundler"
Copy link
Collaborator Author

@nlordell nlordell Mar 7, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks weird, bit it is a work around to re-link the bin from the workspace package. The issue is that the JS file that is referenced in the bin field from the package.json is in the dist/ folder and generated by the build step, and NPM can't figure out how to link it correctly.

The work-around is to manually re-build the package, this forces NPM to regenerate bin links. Note that, by the time the postinstall step happens, the package is guarateed to have compiled the JS to the dist/ directory, as it is a dependency of other packages in the workspace, and this happens in the prepackage step for the workspace package.

@nlordell nlordell force-pushed the chore/refactor-monorepo-2 branch from 87f28bc to 2507654 Compare March 7, 2024 20:26
@nlordell nlordell force-pushed the chore/refactor-monorepo-2 branch 2 times, most recently from 4fd20e4 to c2b7f01 Compare March 8, 2024 06:42
@nlordell nlordell merged commit a00c264 into main Mar 18, 2024
22 checks passed
@nlordell nlordell deleted the chore/refactor-monorepo-2 branch March 18, 2024 14:16
@github-actions github-actions bot locked and limited conversation to collaborators Mar 18, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants