ethers.js/docs/v5/contributing/README.md

107 lines
2.5 KiB
Markdown
Raw Normal View History

2020-06-10 06:56:58 +03:00
-----
2020-07-03 08:54:56 +03:00
Documentation: [html](https://docs.ethers.io/)
2020-06-10 06:56:58 +03:00
-----
Contributing and Hacking
========================
Building
--------
```
2020-07-03 08:54:56 +03:00
# Clone the repository
2021-02-08 23:26:10 +03:00
/home/ricmoo> git clone https://github.com/ethers-io/ethers.js.git
2020-06-10 06:56:58 +03:00
/home/ricmoo> cd ethers.js
2021-02-08 23:26:10 +03:00
# Install all dependencies:
# - Hoists all sub-package dependencies in the package.json (preinstall)
# - Installs all the (hoisted) dependencies and devDependencies (install)
# - Build the rat-nests (in .package_node_modules) (postinstall)
# - Create a dependency graph for the TypeScript (postinstall)
# - Link the rat-nets into each project (postinstall)
2020-06-10 06:56:58 +03:00
/home/ricmoo/ethers.js> npm install
```
2021-02-08 23:26:10 +03:00
### Making Changes
2020-07-03 08:54:56 +03:00
2020-06-10 06:56:58 +03:00
```
# Begin watching the files and re-building whenever they change
/home/ricmoo/ethers.js> npm run auto-build
2021-02-08 23:26:10 +03:00
# Or if you do not want to watch and just build
/home/ricmoo/ethers.js> npm run build
```
2020-06-10 06:56:58 +03:00
2021-02-08 23:26:10 +03:00
### Creating Browser-Ready Files
2020-06-10 06:56:58 +03:00
```
2021-02-08 23:26:10 +03:00
# If you need to rebuild all the libs (esm + cjs) and dist files
# Note: this requires node 10 or newer
/home/ricmoo/ethers.js> npm run build-all
```
### Testing
2020-06-10 06:56:58 +03:00
```
2021-02-08 23:26:10 +03:00
# Rebuilds all files (npm run build-all) and bundles testcases up for testing
2020-06-10 06:56:58 +03:00
/home/ricmoo/ethers.js> npm test
# Often you don't need the full CI experience
2021-02-08 23:26:10 +03:00
/home/ricmoo/ethers.js> npm run test-node
2020-06-10 06:56:58 +03:00
```
2021-02-08 23:26:10 +03:00
### Distribution
2020-06-10 06:56:58 +03:00
```
2021-02-08 23:26:10 +03:00
# Prepare all the distribution files
# - Remove all generated files (i.e. npm run clean)
# - Re-install all dependencies, hoisting, etc. (npm install)
# - Spell check all strings in every TypeScript files
# - Build everything from scratch with this clean install
# - Compare local with npm, bumping the version if changed
# - Build everything again (with the updated versions)
# - Update the CHANGELOG.md with the git history since the last change
2020-06-10 06:56:58 +03:00
/home/ricmoo/ethers.js> npm run update-version
```
2021-02-08 23:26:10 +03:00
#### Do NOT check in dist files in a PR
For Pull Requests, please ONLY commit files in the `docs.wrm/` and `packages/*/src.ts/` folders. I will prepare the distribution builds myself and keeping the PR relevant makes it easier to verify the changes.
### Publishing
```
# Publish
# - Update any changed packages to NPM
# - Create a release on GitHub with the latest CHANGELOG.md description
# - Upload the bundled files the the CDN
# - Flush the CDN edge caches
/home/ricmoo/ethers.js> npm run publish-all
```
2020-07-03 08:54:56 +03:00
Documentation
-------------
### Building
```
/home/ricmoo/ethers.js> npm run build-docs
```
### Evaluation
```
/home/ricmoo/ethers.js> npm run build-docs -- --skip-eval
```
### Previewing Changes
```
/home/ricmoo/ethers.js> npm run serve-docs
```