forked from ethers-io/ethers.js
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
contributing.wrm
145 lines (92 loc) · 4.87 KB
/
contributing.wrm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
_section: Contributing and Hacking @<contributing>
The ethers.js library is something that I've written out of necessity,
and has grown somewhat organically over time.
Many things are the way they are for good (at the time, at least) reasons,
but I always welcome criticism, and am completely willing to have my mind
changed on things.
So, pull requests are always welcome, but please keep a few points in mind:
- Backwards-compatibility-breaking changes will not be accepted; they may be
considered for the next major version
- Security is important; adding dependencies require fairly convincing
arguments as to why
- The library aims to be lean, so keep an eye on the dist/ethers.min.js
file size before and after your changes
- Add test cases for both expected and unexpected input
- Any new features need to be supported by me (future issues, documentation,
testing, migration), so anything that is overly complicated or specific
may not be accepted
In general, **please start an issue //before// beginning a pull request**, so we can
have a public discussion and figure out the best way to address to problem/feature.
**:)**
_subsection: Building @<contributing--building>
If you wish to modify the source code, there are a few steps involved in
setting up your environment.
Since the library uses a monorepo, you must install an initial required
set of libraries, which can then be used to install the remaining libraries
used within each package, as well as link all the packages within the repo
with each other.
_code: Preparing for builds @lang<shell>
# Clone the repository
/home/ricmoo> git clone [email protected]:ethers-io/ethers.js.git
/home/ricmoo> cd ethers.js
# Install the base dependencies
/home/ricmoo/ethers.js> npm install
# Install each module's dependencies and link the libraries
# internally, so they reference each other
/home/ricmoo/ethers.js> npm run bootstrap
_subsection: Making your changes @<contributing--updating>
TODO: Add more information here.
_code: Watching and Building @lang<shell>
# Begin watching the files and re-building whenever they change
/home/ricmoo/ethers.js> npm run auto-build
# Sometimes the issue only affects the ESM modules
/home/ricmoo/ethers.js> npm run auto-build-esm
# Or if you only need to run a single build
/home/ricmoo/ethers.js> npm run _build-cjs
/home/ricmoo/ethers.js> npm run _build-esm
_code: Testing @lang<shell>
# Rebuilds all files and bundles testcases up for testing
/home/ricmoo/ethers.js> npm test
# Often you don't need the full CI experience
/home/ricmoo/ethers.js> npm run _test-node
_code: Preparing the Distribution @lang<shell>
/home/ricmoo/ethers.js> npm run update-version
_subsection: Documentation @<contributing--documentation>
The documents are generated using [Flatworm](flatworm) documentation
generation tool, which was written for the purpose of writing the documentation
for ethers.
Style Guide (this section will have much more coming):
- Try to keep lines no longer than //around// 80 characters
- Avoid inline links in the source; use the ``externalLinks`` field in the config.js
- Prefix external links with ``link-``
- Changing an anchor name must be well justified, as it will break all existing links
to that section; flatworm will support symlinks in the future
- In general, I aim for xonsistency; look to similar situations throughout the documentation
_heading: Building
To build the documentation, you should first follow the
[above steps](contributing--building) to build the ethers library.
Building the docs will generate several types of output:
- A full set of HTML pages, linking across each other
- A single one-page HTML page with all pages linking to local anchors
- A full set of README.md pages organized to be browsable and linkable in GitHub
- A metadata dump for tool ingestion (still needs more work)
- (@TODO; only half done) The documentation as a LaTeX and generated PDF
_code: Building the Documentations @lang<shell>
/home/ricmoo/ethers.js> npm run build-docs
_heading: Evaluation
When building the documentation, all code samples are run through a JavaScript
VM to ensure there are no typos in the example code, as well the exact output
of results are injected into the output, so there is no need to keep the results
and code in-sync.
However, this can be a bit of a headache when making many small changes, so to
build the documentation faster, you can skip the evaluation step, which will
inject the code directly.
_code: Build docs skipping evaluation @lang<shell>
/home/ricmoo/ethers.js> npm run build-docs -- --skip-eval
_heading: Previewing Changes
To preview the changes locally, you can use any standard web server and run
from the ``/docs/`` folder, or use the built-in web server.
The same caveats as normal web development apply, such flushing browser
caches after changing (and re-building) the docs.
_code: Running a webserver @lang<shell>
/home/ricmoo/ethers.js> npm run serve-docs