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

remove symlinks #6189

Closed
wants to merge 18 commits into from
Closed

remove symlinks #6189

wants to merge 18 commits into from

Conversation

luu-alex
Copy link
Contributor

@luu-alex luu-alex commented Jun 12, 2023

Description

#5075

this PR addresses an issue with building errors from windows computers.

Symlinks paths are not supported the same way on windows/linux leading to an error when trying to build.
This PR replaces the symlink files with the actual file. As well I added a new script, it generates files based on the source template and target directory.

in this pr as well, theres some config and template clean up

The notable changes in this PR:

  • a new script
  • symlinks are removed in favor of generating templates into project folders
  • some config folders are moved to the config directory

Please include a summary of the changes and be sure to follow our Contribution Guidelines.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist:

  • I have selected the correct base branch.
  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have made corresponding changes to the documentation.
  • My changes generate no new warnings.
  • Any dependent changes have been merged and published in downstream modules.
  • I ran npm run lint with success and extended the tests and types if necessary.
  • I ran npm run test:unit with success.
  • I ran npm run test:coverage and my test cases cover all the lines and branches of the added code.
  • I ran npm run build and tested dist/web3.min.js in a browser.
  • I have tested my code on the live network.
  • I have checked the Deploy Preview and it looks correct.
  • I have updated the CHANGELOG.md file in the root folder.
  • I have linked Issue(s) with this PR in "Linked Issues" menu.

@github-actions
Copy link

Bundle Stats

Hey there, this message comes from a github action that helps you and reviewers to understand how these changes affect the size of this project's bundle.

As this PR is updated, I'll keep you updated on how the bundle size is impacted.

Total

Asset Old size New size Diff Diff %
Total 638 KB 638 KB 0 0.00%
View detailed bundle breakdown

Added

No assets were added

Removed

No assets were removed

Bigger

No assets were bigger

Smaller

No assets were smaller

Unchanged

Asset Old size New size Diff Diff %
web3.min.js 621 KB 621 KB 0 0.00%
../lib/commonjs/index.d.ts 8.56 KB 8.56 KB 0 0.00%
../lib/commonjs/accounts.d.ts 3.67 KB 3.67 KB 0 0.00%
../lib/commonjs/types.d.ts 2.37 KB 2.37 KB 0 0.00%
../lib/commonjs/abi.d.ts 1000 bytes 1000 bytes 0 0.00%
../lib/commonjs/web3.d.ts 811 bytes 811 bytes 0 0.00%
../lib/commonjs/eth.exports.d.ts 280 bytes 280 bytes 0 0.00%
../lib/commonjs/providers.exports.d.ts 148 bytes 148 bytes 0 0.00%
../lib/commonjs/version.d.ts 60 bytes 60 bytes 0 0.00%

@codecov
Copy link

codecov bot commented Jun 12, 2023

Codecov Report

Merging #6189 (17067c9) into 4.x (51a59f9) will not change coverage.
The diff coverage is n/a.

❗ Current head 17067c9 differs from pull request most recent head 305d9d6. Consider uploading reports for the commit 305d9d6 to get more accurate results

Additional details and impacted files
@@           Coverage Diff           @@
##              4.x    #6189   +/-   ##
=======================================
  Coverage   87.46%   87.46%           
=======================================
  Files         197      197           
  Lines        7557     7557           
  Branches     2060     2060           
=======================================
  Hits         6610     6610           
  Misses        947      947           
Flag Coverage Δ
UnitTests 87.46% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
web3 ∅ <ø> (∅)
web3-core ∅ <ø> (∅)
web3-errors ∅ <ø> (∅)
web3-eth ∅ <ø> (∅)
web3-eth-abi ∅ <ø> (∅)
web3-eth-accounts ∅ <ø> (∅)
web3-eth-contract ∅ <ø> (∅)
web3-eth-ens ∅ <ø> (∅)
web3-eth-iban ∅ <ø> (∅)
web3-eth-personal ∅ <ø> (∅)
web3-net ∅ <ø> (∅)
web3-providers-http ∅ <ø> (∅)
web3-providers-ipc ∅ <ø> (∅)
web3-providers-ws ∅ <ø> (∅)
web3-rpc-methods ∅ <ø> (∅)
web3-utils ∅ <ø> (∅)
web3-validator ∅ <ø> (∅)

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Jun 12, 2023

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: 305d9d6
Status: ✅  Deploy successful!
Preview URL: https://0a00a309.web3-js-docs.pages.dev
Branch Preview URL: https://5075-symlinks.web3-js-docs.pages.dev

View logs

@jdevcs
Copy link
Contributor

jdevcs commented Jun 15, 2023

@luu-alex have you tried building 4.x using:
Windows Subsystem for Linux (WSL)

@luu-alex
Copy link
Contributor Author

@jdevcs yes it works properly

@luu-alex
Copy link
Contributor Author

The windows build properly now, but it runs into a typescript compile issue

web3-errors: $ yarn build:cjs & yarn build:esm & yarn build:types     
web3-errors: $ tsc --build tsconfig.cjs.json && echo '{"type": "commonjs"}' > ./lib/commonjs/package.json
web3-errors: C:\Users\Im cyborg\web3.js\packages\web3-errors\node_modules\typescript\lib\tsc.js:96888
web3-errors:                 throw e;
web3-errors:                 ^
web3-errors: SyntaxError: Unexpected token ' in JSON at position 0    
web3-errors:     at JSON.parse (<anonymous>)
web3-errors:     at tryDirectoryWithPackageJson (C:\Users\Im cyborg\web3.js\packages\web3-errors\node_modules\typescript\lib\tsc.js:101146:163)
web3-errors:     at tryGetModuleNameAsNodeModule (C:\Users\Im cyborg\web3.js\packages\web3-errors\node_modules\typescript\lib\tsc.js:101105:30)
web3-errors:     at computeModuleSpecifiers (C:\Users\Im cyborg\web3.js\packages\web3-errors\node_modules\typescript\lib\tsc.js:100757:33)  
web3-errors:     at getModuleSpecifiersWithCacheInfo (C:\Users\Im cyborg\web3.js\packages\web3-errors\node_modules\typescript\lib\tsc.js:100728:26)
web3-errors:     at Object.getModuleSpecifiers (C:\Users\Im cyborg\web3.js\packages\web3-errors\node_modules\typescript\lib\tsc.js:100712:20)
web3-errors:     at getSpecifierForModuleSymbol (C:\Users\Im cyborg\web3.js\packages\web3-errors\node_modules\typescript\lib\tsc.js:44013:62)
web3-errors:     at C:\Users\Im cyborg\web3.js\packages\web3-errors\node_modules\typescript\lib\tsc.js:43887:39
web3-errors:     at Array.map (<anonymous>)
web3-errors:     at getSymbolChain (C:\Users\Im cyborg\web3.js\packages\web3-errors\node_modules\typescript\lib\tsc.js:43885:58)
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
web3-errors: error Command failed with exit code 1.
web3-errors: $ tsc --build tsconfig.esm.json && echo '{"type": "module"}' > ./lib/esm/package.json
web3-errors: $ tsc --build tsconfig.types.json
web3-errors: C:\Users\Im cyborg\web3.js\packages\web3-errors\node_modules\typescript\lib\tsc.js:96888
web3-errors:                 throw e;
web3-errors:                 ^
web3-errors: SyntaxError: Unexpected token ' in JSON at position 0    
web3-errors:     at JSON.parse (<anonymous>)
web3-errors:     at tryDirectoryWithPackageJson (C:\Users\Im cyborg\web3.js\packages\web3-errors\node_modules\typescript\lib\tsc.js:101146:163)
web3-errors:     at tryGetModuleNameAsNodeModule (C:\Users\Im cyborg\web3.js\packages\web3-errors\node_modules\typescript\lib\tsc.js:101105:30)
web3-errors:     at computeModuleSpecifiers (C:\Users\Im cyborg\web3.js\packages\web3-errors\node_modules\typescript\lib\tsc.js:100757:33)  
web3-errors:     at getModuleSpecifiersWithCacheInfo (C:\Users\Im cyborg\web3.js\packages\web3-errors\node_modules\typescript\lib\tsc.js:100728:26)
web3-errors:     at Object.getModuleSpecifiers (C:\Users\Im cyborg\web3.js\packages\web3-errors\node_modules\typescript\lib\tsc.js:100712:20)
web3-errors:     at getSpecifierForModuleSymbol (C:\Users\Im cyborg\web3.js\packages\web3-errors\node_modules\typescript\lib\tsc.js:44013:62)
web3-errors:     at C:\Users\Im cyborg\web3.js\packages\web3-errors\node_modules\typescript\lib\tsc.js:43887:39
web3-errors:     at Array.map (<anonymous>)
web3-errors:     at getSymbolChain (C:\Users\Im cyborg\web3.js\packages\web3-errors\node_modules\typescript\lib\tsc.js:43885:58)
web3-errors: error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
web3-errors: error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

@spacesailor24
Copy link
Contributor

The windows build properly now, but it runs into a typescript compile issue

web3-errors: $ yarn build:cjs & yarn build:esm & yarn build:types     
web3-errors: $ tsc --build tsconfig.cjs.json && echo '{"type": "commonjs"}' > ./lib/commonjs/package.json
web3-errors: C:\Users\Im cyborg\web3.js\packages\web3-errors\node_modules\typescript\lib\tsc.js:96888
web3-errors:                 throw e;
web3-errors:                 ^
web3-errors: SyntaxError: Unexpected token ' in JSON at position 0    
web3-errors:     at JSON.parse (<anonymous>)
web3-errors:     at tryDirectoryWithPackageJson (C:\Users\Im cyborg\web3.js\packages\web3-errors\node_modules\typescript\lib\tsc.js:101146:163)
web3-errors:     at tryGetModuleNameAsNodeModule (C:\Users\Im cyborg\web3.js\packages\web3-errors\node_modules\typescript\lib\tsc.js:101105:30)
web3-errors:     at computeModuleSpecifiers (C:\Users\Im cyborg\web3.js\packages\web3-errors\node_modules\typescript\lib\tsc.js:100757:33)  
web3-errors:     at getModuleSpecifiersWithCacheInfo (C:\Users\Im cyborg\web3.js\packages\web3-errors\node_modules\typescript\lib\tsc.js:100728:26)
web3-errors:     at Object.getModuleSpecifiers (C:\Users\Im cyborg\web3.js\packages\web3-errors\node_modules\typescript\lib\tsc.js:100712:20)
web3-errors:     at getSpecifierForModuleSymbol (C:\Users\Im cyborg\web3.js\packages\web3-errors\node_modules\typescript\lib\tsc.js:44013:62)
web3-errors:     at C:\Users\Im cyborg\web3.js\packages\web3-errors\node_modules\typescript\lib\tsc.js:43887:39
web3-errors:     at Array.map (<anonymous>)
web3-errors:     at getSymbolChain (C:\Users\Im cyborg\web3.js\packages\web3-errors\node_modules\typescript\lib\tsc.js:43885:58)
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
web3-errors: error Command failed with exit code 1.
web3-errors: $ tsc --build tsconfig.esm.json && echo '{"type": "module"}' > ./lib/esm/package.json
web3-errors: $ tsc --build tsconfig.types.json
web3-errors: C:\Users\Im cyborg\web3.js\packages\web3-errors\node_modules\typescript\lib\tsc.js:96888
web3-errors:                 throw e;
web3-errors:                 ^
web3-errors: SyntaxError: Unexpected token ' in JSON at position 0    
web3-errors:     at JSON.parse (<anonymous>)
web3-errors:     at tryDirectoryWithPackageJson (C:\Users\Im cyborg\web3.js\packages\web3-errors\node_modules\typescript\lib\tsc.js:101146:163)
web3-errors:     at tryGetModuleNameAsNodeModule (C:\Users\Im cyborg\web3.js\packages\web3-errors\node_modules\typescript\lib\tsc.js:101105:30)
web3-errors:     at computeModuleSpecifiers (C:\Users\Im cyborg\web3.js\packages\web3-errors\node_modules\typescript\lib\tsc.js:100757:33)  
web3-errors:     at getModuleSpecifiersWithCacheInfo (C:\Users\Im cyborg\web3.js\packages\web3-errors\node_modules\typescript\lib\tsc.js:100728:26)
web3-errors:     at Object.getModuleSpecifiers (C:\Users\Im cyborg\web3.js\packages\web3-errors\node_modules\typescript\lib\tsc.js:100712:20)
web3-errors:     at getSpecifierForModuleSymbol (C:\Users\Im cyborg\web3.js\packages\web3-errors\node_modules\typescript\lib\tsc.js:44013:62)
web3-errors:     at C:\Users\Im cyborg\web3.js\packages\web3-errors\node_modules\typescript\lib\tsc.js:43887:39
web3-errors:     at Array.map (<anonymous>)
web3-errors:     at getSymbolChain (C:\Users\Im cyborg\web3.js\packages\web3-errors\node_modules\typescript\lib\tsc.js:43885:58)
web3-errors: error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
web3-errors: error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

I know the time has already been invested in refactoring our use of symlinks, but it seems like solving this TS issue, keeping the symlinks and current repo config, and having Windows users use WSL would be a better approach. It's nice to have a single source of truth for these config files, and having each package have their own version of the files seem like an easy way for an update to get missed for a particular package

@luu-alex
Copy link
Contributor Author

@spacesailor24 i think thats fine, i'll close the pr + issue

@luu-alex luu-alex closed this Jun 23, 2023
@hammersharkfish
Copy link

I am facing this issue on windows .
In web3-providers-http
yarn build

yarn run v1.22.19
$ yarn clean
$ rimraf dist && rimraf lib
$ yarn build:cjs & yarn build:esm & yarn build:types
$ tsc --build tsconfig.cjs.json && echo '{"type": "commonjs"}' > ./lib/commonjs/package.json
tsconfig.cjs.json:1:1 - error TS1005: '{' expected.

1 ../../config/tsconfig.cjs.json
  ~

tsconfig.cjs.json:1:2 - error TS1003: Identifier expected.

1 ../../config/tsconfig.cjs.json
   ~

tsconfig.cjs.json:1:3 - error TS1003: Identifier expected.

1 ../../config/tsconfig.cjs.json
    ~

tsconfig.cjs.json:1:4 - error TS1109: Expression expected.

1 ../../config/tsconfig.cjs.json
     ~

tsconfig.cjs.json:1:5 - error TS1003: Identifier expected.

1 ../../config/tsconfig.cjs.json
      ~

tsconfig.cjs.json:1:6 - error TS1003: Identifier expected.

1 ../../config/tsconfig.cjs.json
       ~

tsconfig.cjs.json:1:31 - error TS1005: '}' expected.

1 ../../config/tsconfig.cjs.json


tsconfig.cjs.json:1:1 - error TS1327: String literal with double quotes expected.

1 ../../config/tsconfig.cjs.json


tsconfig.cjs.json:1:1 - error TS1328: Property value can only be string literal, numeric literal, 'true', 'false', 'null', object literal or array literal.

1 ../../config/tsconfig.cjs.json
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

test/fixtures/system_test_utils.ts:1:1 - error TS1128: Declaration or statement expected.

1 ../../../../scripts/system_tests_utils.ts
  ~

test/fixtures/system_test_utils.ts:1:2 - error TS1128: Declaration or statement expected.

1 ../../../../scripts/system_tests_utils.ts
   ~

test/fixtures/system_test_utils.ts:1:8 - error TS1003: Identifier expected.

1 ../../../../scripts/system_tests_utils.ts
         ~

test/fixtures/system_test_utils.ts:1:9 - error TS1003: Identifier expected.

1 ../../../../scripts/system_tests_utils.ts
          ~

test/fixtures/system_test_utils.ts:1:10 - error TS1109: Expression expected.

1 ../../../../scripts/system_tests_utils.ts
           ~

test/fixtures/system_test_utils.ts:1:11 - error TS1003: Identifier expected.

1 ../../../../scripts/system_tests_utils.ts
            ~

test/fixtures/system_test_utils.ts:1:12 - error TS1003: Identifier expected.

1 ../../../../scripts/system_tests_utils.ts
             ~


Found 16 errors.

error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
$ tsc --build tsconfig.esm.json && echo '{"type": "module"}' > ./lib/esm/package.json
tsconfig.esm.json:1:1 - error TS1005: '{' expected.

1 ../../config/tsconfig.esm.json
  ~

tsconfig.esm.json:1:2 - error TS1003: Identifier expected.

1 ../../config/tsconfig.esm.json
   ~

tsconfig.esm.json:1:3 - error TS1003: Identifier expected.

1 ../../config/tsconfig.esm.json
    ~

tsconfig.esm.json:1:4 - error TS1109: Expression expected.

1 ../../config/tsconfig.esm.json
     ~

tsconfig.esm.json:1:5 - error TS1003: Identifier expected.

1 ../../config/tsconfig.esm.json
      ~

tsconfig.esm.json:1:6 - error TS1003: Identifier expected.

1 ../../config/tsconfig.esm.json
       ~

tsconfig.esm.json:1:31 - error TS1005: '}' expected.

1 ../../config/tsconfig.esm.json


tsconfig.esm.json:1:1 - error TS1327: String literal with double quotes expected.

1 ../../config/tsconfig.esm.json


tsconfig.esm.json:1:1 - error TS1328: Property value can only be string literal, numeric literal, 'true', 'false', 'null', object literal or array literal.

1 ../../config/tsconfig.esm.json
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

test/fixtures/system_test_utils.ts:1:1 - error TS1128: Declaration or statement expected.

1 ../../../../scripts/system_tests_utils.ts
  ~

test/fixtures/system_test_utils.ts:1:2 - error TS1128: Declaration or statement expected.

1 ../../../../scripts/system_tests_utils.ts
   ~

test/fixtures/system_test_utils.ts:1:8 - error TS1003: Identifier expected.

1 ../../../../scripts/system_tests_utils.ts
         ~

test/fixtures/system_test_utils.ts:1:9 - error TS1003: Identifier expected.

1 ../../../../scripts/system_tests_utils.ts
          ~

test/fixtures/system_test_utils.ts:1:10 - error TS1109: Expression expected.

1 ../../../../scripts/system_tests_utils.ts
           ~

test/fixtures/system_test_utils.ts:1:11 - error TS1003: Identifier expected.

1 ../../../../scripts/system_tests_utils.ts
            ~

test/fixtures/system_test_utils.ts:1:12 - error TS1003: Identifier expected.

1 ../../../../scripts/system_tests_utils.ts
             ~


Found 16 errors.

error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
$ tsc --build tsconfig.types.json
tsconfig.types.json:1:1 - error TS1005: '{' expected.

1 ../../config/tsconfig.types.json
  ~

tsconfig.types.json:1:2 - error TS1003: Identifier expected.

1 ../../config/tsconfig.types.json
   ~

tsconfig.types.json:1:3 - error TS1003: Identifier expected.

1 ../../config/tsconfig.types.json
    ~

tsconfig.types.json:1:4 - error TS1109: Expression expected.

1 ../../config/tsconfig.types.json
     ~

tsconfig.types.json:1:5 - error TS1003: Identifier expected.

1 ../../config/tsconfig.types.json
      ~

tsconfig.types.json:1:6 - error TS1003: Identifier expected.

1 ../../config/tsconfig.types.json
       ~

tsconfig.types.json:1:33 - error TS1005: '}' expected.

1 ../../config/tsconfig.types.json


tsconfig.types.json:1:1 - error TS1327: String literal with double quotes expected.

1 ../../config/tsconfig.types.json


tsconfig.types.json:1:1 - error TS1328: Property value can only be string literal, numeric literal, 'true', 'false', 'null', object literal or array literal.

1 ../../config/tsconfig.types.json
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

test/fixtures/system_test_utils.ts:1:1 - error TS1128: Declaration or statement expected.

1 ../../../../scripts/system_tests_utils.ts
  ~

test/fixtures/system_test_utils.ts:1:2 - error TS1128: Declaration or statement expected.

1 ../../../../scripts/system_tests_utils.ts
   ~

test/fixtures/system_test_utils.ts:1:8 - error TS1003: Identifier expected.

1 ../../../../scripts/system_tests_utils.ts
         ~

test/fixtures/system_test_utils.ts:1:9 - error TS1003: Identifier expected.

1 ../../../../scripts/system_tests_utils.ts
          ~

test/fixtures/system_test_utils.ts:1:10 - error TS1109: Expression expected.

1 ../../../../scripts/system_tests_utils.ts
           ~

test/fixtures/system_test_utils.ts:1:11 - error TS1003: Identifier expected.

1 ../../../../scripts/system_tests_utils.ts
            ~

test/fixtures/system_test_utils.ts:1:12 - error TS1003: Identifier expected.

1 ../../../../scripts/system_tests_utils.ts
             ~


Found 16 errors.

error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

@luu-alex luu-alex deleted the 5075/symlinks branch October 4, 2023 02:22
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.

4 participants