Skip to content

Commit 6bf596f

Browse files
author
byron
committed
👌
1 parent 0c5df92 commit 6bf596f

File tree

2 files changed

+10
-13
lines changed

2 files changed

+10
-13
lines changed

CONTRIBUTING.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,18 @@ If you want to contribute or simply dig deeper into Dash, we encourage you to pl
3131

3232
For contributors with a primarily **Python** or **R** background, this section might help you understand more details about developing and debugging in Javascript world.
3333

34-
After Dash 1.2, The renderer bundle and its peer dependencies can be packed and generated from the source code. The only version of the truth is defined in `dash-renderer\package.json` file. A build tool `renderer`, which is a tiny Python script defined as a Dash entry point, has few commands like:
35-
1. `renderer npm` installs all the npm modules using this `package.json` files. Note that the `package-lock.json` file is the computed reference product for the versions defined with tilde(~) or caret(^) syntax in **npm**
36-
2. `renderer bundles` parses the locked version JSON, copies all the peer dependencies into dash_renderer folder, bundles the renderer assets, and generates an `__init__.py` to map all the resources
37-
3. `renderer digest {renderer version}` computes the content hash of each asset in `dash_renderer` folder, prints out the result in logs, and dumps into a JSON file `digest.json`
38-
4. `renderer watch` runs webpack in watch mode, so any source code change triggers a rebuild. Use this if you are actively updating renderer code and you want to test your changes immediately.
34+
As of Dash 1.2, the renderer bundle and its peer dependencies can be packed and generated from the source code. The `dash-renderer\package.json` file is the one version of the truth for dash renderer version and npm dependencies. A build tool `renderer`, which is a tiny Python script installed by Dash as a command-line tool, has a few commands:
35+
36+
1. `renderer npm` installs all the npm modules using this `package.json` files. Note that the `package-lock.json` file is the computed reference product for the versions defined with tilde(~) or caret(^) syntax in npm.
37+
2. `renderer bundles` parses the locked version JSON, copies all the peer dependencies into dash_renderer folder, bundles the renderer assets, and generates an `__init__.py` to map all the resources. There are also a list of helpful `scripts` defined in `package.json` you might need to do some handy tasks like linting, syntax format with prettier, etc.
38+
3. `renderer digest` computes the content hash of each asset in `dash_renderer` folder, prints out the result in logs, and dumps into a JSON file `digest.json`. Use this when you have a doubt about the current assets in `dash_renderer`, and compare it with previous result in one shot by this command.
39+
4. `renderer watch` runs the webpack in watch mode, so any source code change triggers a rebuild. Use this if you are actively updating renderer code and you want to test your changes immediately.
3940

4041
When a change in renderer code doesn't reflect in your browser as expected, this could be: confused bundle generation, caching issue in a browser, python package not in `editable` mode, etc. The new tool reduces the risk of bundle assets by adding the digest to help compare asset changes.
4142

4243
## Git
4344

44-
Use the [GitHub flow][] when proposing contributions to this repository (i.e. create a feature branch and submit a PR against the default branch).
45+
Use the [GitHub flow](https://guides.github.com/introduction/flow/) when proposing contributions to this repository (i.e. create a feature branch and submit a PR against the default branch).
4546

4647
### Organize your commits
4748

dash/development/build_renderer.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -115,12 +115,7 @@ def bundles():
115115

116116

117117
@job("compute the hash digest for assets")
118-
def digest(version):
119-
"""compute the hash digest of assets in dash_renderer
120-
121-
version: str
122-
the dash_renderer version
123-
"""
118+
def digest(version=None):
124119
copies = (
125120
_
126121
for _ in os.listdir(assets)
@@ -129,7 +124,8 @@ def digest(version):
129124
logger.info("bundles in dash_renderer %s", copies)
130125

131126
# compute the fingerprint for all the assets
132-
payload = {"dash_renderer": version}
127+
if version is not None:
128+
payload = {"dash_renderer": version}
133129
for copy in copies:
134130
payload["MD5 ({})".format(copy)] = compute_md5(_concat((assets, copy)))
135131

0 commit comments

Comments
 (0)