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

Update Builds Directories to Make Use of Both lib and dist #5739

Merged
merged 10 commits into from
Jan 10, 2023

Conversation

spacesailor24
Copy link
Contributor

@spacesailor24 spacesailor24 commented Jan 10, 2023

This PR moves the tsc compiled files from dist/ to lib/ for all packages that weren't already doing so. Additionally, web3 and web3-validator will compile their web builds to dist/. These changes are to address an issue found when developing the Chainlink plugin that needs to build it's code for the browser. It was discovered that there was a filename conflict between files such as the tsc compiled web3_validator.ts and it's webpack compiled version. By putting tsc compiled files in lib/ and webpack compiled files in dist/, we completely avoid this issue for all packages, and users are able to pull in published 4.x Web3.js packages and build using webpack

@spacesailor24 spacesailor24 self-assigned this Jan 10, 2023
@spacesailor24 spacesailor24 added the 4.x 4.0 related label Jan 10, 2023
@github-actions github-actions bot temporarily deployed to Preview: (wyatt/4.x/fix-build) January 10, 2023 03:03 Inactive
@cloudflare-pages
Copy link

cloudflare-pages bot commented Jan 10, 2023

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: 266b612
Status: ✅  Deploy successful!
Preview URL: https://232e7388.web3-js-docs.pages.dev
Branch Preview URL: https://wyatt-4-x-fix-build.web3-js-docs.pages.dev

View logs

@spacesailor24 spacesailor24 marked this pull request as ready for review January 10, 2023 03:15
@github-actions github-actions bot temporarily deployed to Preview: (wyatt/4.x/fix-build) January 10, 2023 03:20 Inactive
@github-actions github-actions bot temporarily deployed to Preview: (wyatt/4.x/fix-build) January 10, 2023 06:25 Inactive
@github-actions github-actions bot temporarily deployed to Preview: (wyatt/4.x/fix-build) January 10, 2023 06:38 Inactive
@github-actions github-actions bot temporarily deployed to Preview: (wyatt/4.x/fix-build) January 10, 2023 06:53 Inactive
"clean": "rimraf dist",
"prebuild": "rimraf dist",
"clean": "rimraf dist && rimraf lib",
"prebuild": "yarn clean",
"build": "tsc --build",
"build:check": "node -e \"require('./dist')\"",
Copy link
Contributor

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 build:check as well

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This commit addresses this

"repository": "https://github.com/ChainSafe/web3.js",
"author": "ChainSafe Systems",
"license": "LGPL-3.0",
"files": [
"dist/**/*"
"lib/**/*"
Copy link
Contributor

Choose a reason for hiding this comment

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

For npm whitelisting only lib , this will filter out dist form including in published lib.
This will impact CDN as current CDN is configured to pick minified build through npm ( as per Greg info, I discussed with him last time ).

I personally like it, as it will reduce lib size , so users node_modules will be of less size ( by excluding minified builds) but we will need to configure explicitly CDN for 4.x.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Created #5743 to track this

Copy link
Contributor

@jdevcs jdevcs left a comment

Choose a reason for hiding this comment

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

tsconfig of some of package is not updated ( web3-erros eth-ens iban http ws rpc-methods )?, all packages should have consistent lib output.

@spacesailor24
Copy link
Contributor Author

tsconfig of some of package is not updated ( web3-erros eth-ens iban http ws rpc-methods )?, all packages should have consistent lib output.

@jdevcs These packages have a symlink for the tsconfig.json, so updating the template covers these packages

@github-actions github-actions bot temporarily deployed to Preview: (wyatt/4.x/fix-build) January 10, 2023 17:31 Inactive
@spacesailor24 spacesailor24 merged commit 23805df into 4.x Jan 10, 2023
@spacesailor24 spacesailor24 deleted the wyatt/4.x/fix-build branch January 10, 2023 23:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4.x 4.0 related
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants