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

New build pipeline #3160

Closed
wants to merge 83 commits into from
Closed
Show file tree
Hide file tree
Changes from 78 commits
Commits
Show all changes
83 commits
Select commit Hold shift + click to select a range
ee074d1
basic setup of the new build pipeline
nivida Oct 25, 2019
462f627
globals defined, tree shaking improvements
nivida Oct 25, 2019
58ea9c1
package-locks cleaned up
nivida Oct 25, 2019
28848d7
build for web3.min file optimized
nivida Oct 28, 2019
22cf85b
web3.min.js size is now ~830kb and dedupe option to rollup config fun…
nivida Oct 28, 2019
6447256
process.env.MINIFIED_BUNDLES config option added for rollup
nivida Oct 28, 2019
4e6b41e
additional build scripts added to package.json for CI
nivida Oct 28, 2019
fa89c39
commands in ci.sh updated
nivida Oct 28, 2019
28b4719
cjs exports config handling updated
nivida Oct 28, 2019
d952768
forceAllTransforms set to true
nivida Oct 29, 2019
579122d
rollup config updated for minified bundles, web3 dedup configs update…
nivida Oct 29, 2019
6d62ac9
export config for minified file fixed
nivida Oct 29, 2019
323c994
dedupe rules to required modules applied
nivida Oct 29, 2019
febb094
dependencies updated for web3-eth-abi and import fixed in web3-eth-ac…
nivida Oct 29, 2019
3cd3aec
e2e browser tests tested and setup updated
nivida Oct 30, 2019
c03a6d1
web3 package excluded from karma, dev deps updated in root package.js…
nivida Oct 30, 2019
6b5fea2
RLP import in web3-eth-accounts fixed, CI scripts updated, and script…
nivida Oct 30, 2019
10bf0bf
rollup.config.js function fixed
nivida Oct 30, 2019
e668654
code style consistency improved for all e2e related test files
nivida Oct 30, 2019
4376fa8
build:web3:minified script updated, getWebsocketPort function updated
nivida Oct 30, 2019
2cf94e6
jsdelivr property added to package.json
nivida Oct 30, 2019
f5f50e2
babel config updated for esm bundle
nivida Oct 30, 2019
d6376aa
rollup config updated
nivida Oct 30, 2019
deb285f
build:web3 script updated and CHANGELOG.md updated
nivida Oct 30, 2019
4105387
test:unit script updated in package.json
nivida Oct 30, 2019
8c6bf61
copy pasta issue fixed for getWebsocketPort in test.utils.js
nivida Oct 30, 2019
fc3cd17
code style improved in rollup.config.js and README files updated
nivida Oct 30, 2019
a994faa
getting-started docs updated
nivida Oct 30, 2019
108e5aa
not required starting of the bundling process removed
nivida Oct 30, 2019
15bd37d
Update README.md
nivida Oct 30, 2019
ec5a56d
any-promise re-added to promievent and ci.sh updated
nivida Oct 31, 2019
b9e6801
Merge branch 'issue/3155' of github.com:ethereum/web3.js into issue/3155
nivida Oct 31, 2019
09b8c03
test commands updated with the usage of nyc and babel-plugin-istanbul
nivida Oct 31, 2019
a502549
required reporters and coverage threshold check added to .nycrc
nivida Oct 31, 2019
9a47a69
eth-lib downgraded to 0.2.7 and defined as fixed version
nivida Oct 31, 2019
d5dc3c7
coverage threshold configured in .nycrc file
nivida Oct 31, 2019
ed43f97
Merge branch '1.x' into issue/3155
nivida Oct 31, 2019
2cf2c8a
root README.md contribution section updated
nivida Oct 31, 2019
7f59aa1
test script in root package.json updated
nivida Oct 31, 2019
8c783d3
copy paste issue (unnecessary semicolon) removed in ci.sh
nivida Oct 31, 2019
240053b
coverage threshold removed from nyc; we can add it again after we inc…
nivida Oct 31, 2019
1e5c723
polyfill removed from karma.conf and commented added to require state…
nivida Nov 4, 2019
a777cc6
missing json reporter added to .nycrc
nivida Nov 4, 2019
ded4dd9
test:unit script updated, nyc will now be used to execute the tests f…
nivida Nov 4, 2019
29393ab
coverage json report path updated for e2e.geth.automine.sh and e2e.ge…
nivida Nov 4, 2019
f1a52b2
not required 'nyc report' call removed
nivida Nov 4, 2019
14e4a0a
Merge branch '1.x' into issue/3155
nivida Nov 4, 2019
69c2749
require statement in getWeb3 function of the test.utils.js file updated
nivida Nov 4, 2019
787d8a9
karma.conf.js updated for handling '../../packages/web3' in the test.…
nivida Nov 4, 2019
96b3102
rollup.config.js duplicated babel configs removed
nivida Nov 5, 2019
ee6178d
scripts in package.json updated
nivida Nov 5, 2019
310370c
constants added for targets and the default input source to rollup.co…
nivida Nov 5, 2019
997830c
build step added to postinstall hook
nivida Nov 5, 2019
eeedd8e
any-promise removed because it will get polyfilled by babel
nivida Nov 5, 2019
576eb0f
html reporter added to nycrc and istanbul handling updated
nivida Nov 5, 2019
a9021a7
scripts in package.json updated
nivida Nov 5, 2019
9d9ecb7
duplicated comment removed in index.js of the ens module
nivida Nov 5, 2019
3375590
README.md updated
nivida Nov 5, 2019
5be08ab
bundle size of ens optimized from 581kb to 213kb
nivida Nov 5, 2019
1a52348
logic change removed in package.json
nivida Nov 5, 2019
f296d07
README.md updated
nivida Nov 5, 2019
3081c1b
cjs -> esm module structure. Fixes line shift in coverage and decreas…
nivida Nov 9, 2019
9ff3c76
require statements removed in web3-core-requestmanager
nivida Nov 9, 2019
e4cd0a9
RequestManager export fixed
nivida Nov 9, 2019
df15fde
external parameter added to rollup config and import fixed in web3-core
nivida Nov 9, 2019
a71019f
ipc provider excluded from browser build
nivida Nov 9, 2019
df05836
imports fixed in web3-core module
nivida Nov 9, 2019
b5e0d2e
websocket import fixed
nivida Nov 9, 2019
d7e7ede
Merge branch 'issue/3155' into bundle-improvement-ens
nivida Nov 12, 2019
072bd34
Merge branch 'issue/3155' of github.com:ethereum/web3.js into issue/3155
nivida Nov 12, 2019
213228c
scripts folder re-structured, env vars moved to shell scripts, and sc…
nivida Nov 12, 2019
f31dd17
ES version updated for jshint
nivida Nov 12, 2019
36bac10
execution permission updated for build scripts and jshintrc esversion…
nivida Nov 12, 2019
a07ea24
Merge pull request #3179 from ethereum/bundle-improvement-ens
nivida Nov 12, 2019
b54894c
rollup added as dev-dep to each sub-package
nivida Nov 12, 2019
4a29224
input file updated for UMD min build
nivida Nov 12, 2019
4210808
working global watch all added
nivida Nov 12, 2019
c6e5609
not required option properties removed in watch.all.js
nivida Nov 12, 2019
2575323
babel browser target option updated
nivida Nov 18, 2019
864e4aa
Merge branch '1.x' into issue/3155
nivida Nov 18, 2019
8673bff
rollup devDep from packages removed and build scripts updated to use …
nivida Nov 18, 2019
e6e6d14
dedupe rules for minified browser bundles updated because of better w…
nivida Nov 18, 2019
b56698e
native crypto dependency removed and already used pure JS modules added
nivida Nov 19, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ dist/
packages/web3/dist/
lerna-debug.log
!./dist/web3.min.js
.nyc_output
3 changes: 2 additions & 1 deletion .jshintrc
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@
"undef": true,
"predef": [
"console"
]
],
"esversion": 6
}
4 changes: 4 additions & 0 deletions .nycrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"extends": "@istanbuljs/nyc-config-babel",
"reporter": ["json", "html"]
}
9 changes: 6 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@ Released with 1.0.0-beta.37 code base.
- ``requestOptions`` added to ``WebsocketProvider`` (#2979)
- Node >= v8.0.0 support (#2938)

## [Unreleased]

## [1.2.2]

### Added
Expand Down Expand Up @@ -83,11 +81,16 @@ Released with 1.0.0-beta.37 code base.
- The receipt will now returned on a EVM error (this got removed on beta.18) (#3129)
- Fixes transaction confirmations with the HttpProvider (#3140)

## [Unreleased]

## [1.2.3]

### Added

### Fixed
- New build pipeline (#3160)

## Fixed

- ``regeneratorRuntime`` error fixed (#3155)
- Fix TS types for eth.subscribe syncing, newBlockHeaders, pendingTransactions (#3159)
- Improve web3-eth-abi decodeParameters error message (#3134)
96 changes: 73 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,15 @@ _Note_: works only in the Browser for now. (PR welcome).
meteor add ethereum:web3
```

### In the Browser
### Browser

Use the prebuild `dist/web3.min.js`, or
build using the [web3.js][repo] repository:
There are three ways to use this package in the browser:

Choose a reason for hiding this comment

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

I really like this more detailed explanation.


```bash
npm run-script build
```
- Install it with ``npm`` and bundle it with the preferred bundler (rollup, webpack, or parcel).
- Use the ``unpkg`` or ``jsdelivr`` CDN.
- Install it with ``npm`` and load the minified file from the ``node_modules`` folder.

Then include `dist/web3.js` in your html file.
This will expose `Web3` on the window object.
If you use the CDN or minified version from the ``node_modules`` folder, a ``Web3`` property will be exposed on the ``window`` object in your browser.

## Usage

Expand Down Expand Up @@ -115,27 +113,79 @@ sudo apt-get install nodejs
sudo apt-get install npm
```

### Building (gulp)

Build only the web3.js package

```bash
npm run-script build
### Build Pipeline

**Scripts**

- ``build:all`` - Creates CJS and ESM bundles for all packages
- ``build:all:cjs`` - Creates CJS bundles for all packages
- ``build:all:esm`` - Creates ESM bundles for all packages
- ``build:all:minified`` - Creates minified UMD bundles with the cjs bundles as the source for all packages
- ``build:all:release`` - Creates CJS, ESM, and minified UMD bundles for all packages.
- ``build:web3`` - Creates just the CJS and ESM bundle of the web3 umbrella package
- ``build:web3:minified`` - Creates all CJS and ESM bundles of all packages and creates a web3.min after

**Generated Bundles**

- ``main``
+ Will be used in nodejs on a normal ``require(...)`` and does have the CJS module format.
- ``module``
+ Will be used for ESM-ready tools and does have the ES format.
- ``unpkg``
+ Will be used from the ``unpkg`` CDN and does contain the minified UMD formatted bundle.
- ``jsdelivr``
+ Will be used from the ``jsdelivr`` CDN and does contain the minified UMD formatted bundle.

**Configuration**

The base configuration is located in the root folder of this repository and does return the configuration function which will be used in each package of this project.

Properties of the [config function](https://github.com/ethereum/web3.js/tree/1.x/rollup.config.js):

- ``name: string``
+ Will be used for named exports
- ``outputFileName: string``
+ Name of the output file
- ``globals: {[key: string]: string}``
+ pre-defined names for the globally available packages (used in CJS and ESM)
- ``dedupe: string[]``
+ Will be used to remove duplicated modules in the minified UMD bundles.
- ``namedExports: boolean``
+ Simple config to activate named exports for the bundles of a package

Example Usage:
``` javascript
import pkg from './package.json';
import rollupConfig from '../../rollup.config';

export default rollupConfig(
'Web3Net',
pkg.name,
{
'web3-core': 'Web3Core',
'web3-core-method': 'Web3CoreMethod',
'web3-utils': 'Web3Utils'
},
['bn.js', 'elliptic', 'js-sha3', 'underscore']
);
nivida marked this conversation as resolved.
Show resolved Hide resolved
```

Or build all sub packages as well:

```bash
npm run-script build-all
```
### Testing

This will put all the browser build files into the `dist` folder.
**Scripts**

### Testing (mocha)
- ``test:unit`` - Runs just the unit tests
- ``test:e2e:ganache`` - Runs the e2e tests with ganache
- ``test:e2e:geth:auto`` - Runs the e2e tests with geth automine
- ``test:e2e:geth:insta`` - Runs the e2e tests with geth instaseal
- ``test:e2e:clients`` - Runs the e2e tests with geth and ganache
- ``test:e2e:chrome`` - Runs the e2e tests in Chrome
- ``test:e2e:firefox`` - Runs the e2e tests in Firefox
- ``test:e2e:browsers`` - Runs the e2e tests in Chrome and Firefox
- ``test:e2e:publish`` - Creates a virtual npm registry for running third party tests
- ``test:e2e:truffle`` - Runs the truffle tests with the current working state of web3
nivida marked this conversation as resolved.
Show resolved Hide resolved

```bash
npm test
```

### Contributing

Expand Down
75 changes: 0 additions & 75 deletions bower.json

This file was deleted.

2 changes: 1 addition & 1 deletion docs/getting-started.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ First you need to get web3.js into your project. This can be done using the foll

- npm: ``npm install web3``
- meteor: ``meteor add ethereum:web3``
- pure js: link the ``dist/web3.min.js``
- browser (without bundler): link the ``dist/web3.min.js`` from your ``node_modules`` folder or use the ``unpkg`` or ``jsdelivr`` CDN.

After that you need to create a web3 instance and set a provider.
Ethereum supported Browsers like Mist or MetaMask will have a ``ethereumProvider`` or ``web3.currentProvider`` available. For web3.js, check ``Web3.givenProvider``.
Expand Down
Loading