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

Release two builds of the project #603

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ node_modules
package-lock.json
yarn.lock

# Build folder
# Build folders
dist
/es2017

1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ dist
.nyc_output
*.json
docs
es2017
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,19 @@ by it, the exception will bubble into the VM and interrupt it, possibly
corrupting its state. It's strongly recommended not to throw from withing
event handlers.

# Running the project in modern environments

The NPM `ethereumjs-vm` package includes two different builds of the project:

1. The default one, located in the `dist/` directory, is an ES5 compatible build, distributed as
CommonJS modules.

2. A second build, targeting Node and modern JavaScript bundlers, located in the `es2017/`
directory, is an ES2017 build, distributed as CommonJS modules. To use this version, you should
import the VM form `"ethereumjs-vm/es2017"`.

Using the second build is recommended when possible, as it has significant performance improvements.

# DEVELOPMENT

Developer documentation - currently mainly with information on testing and debugging - can be found [here](./developer.md).
Expand Down
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@
"main": "dist/index.js",
"types": "dist/index.d.ts",
"files": [
"dist/**/*"
"dist/**/*",
"es2017/**/*"
],
"scripts": {
"build:dist": "ethereumjs-config-build",
"prepublishOnly": "npm run lint && npm run build:dist && npm run testBuildIntegrity",
"build:dist:es2017": "tsc -p ./tsconfig.es2017.json",
"prepublishOnly": "npm run lint && npm run build:dist && npm run build:dist:es2017 && npm run testBuildIntegrity",
"coverage": "nyc npm run coverageTests && nyc report --reporter=text-lcov > .nyc_output/lcov.info",
"coverageTests": "npm run build:dist && tape './tests/api/**/*.js' ./tests/tester.js -s --dist",
"coveralls": "npm run coverage && if [ -n \"$COVERALLS_REPO_TOKEN\" ]; then coveralls <.nyc_output/lcov.info; fi",
Expand Down
8 changes: 8 additions & 0 deletions tsconfig.es2017.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": "@ethereumjs/config-tsc",
"compilerOptions": {
"target": "ES2017",
"outDir": "./es2017"
},
"include": ["lib/**/*.ts"]
}