Skip to content

Commit 371261d

Browse files
authored
Merge pull request #874 from plotly/assets-#868
Assets #868
2 parents 076f5ec + 6bf596f commit 371261d

28 files changed

+5287
-7275
lines changed

.circleci/config.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,13 +97,12 @@ jobs:
9797
key: dep-{{ checksum "ver.txt" }}-{{ checksum "requires-ci.txt" }}-{{ checksum "requires-install.txt" }}-{{ checksum "requires-testing.txt" }}
9898
paths:
9999
- "venv"
100-
101100
- run:
102101
name: ️️🏗️ build core
103102
command: |
104103
. venv/bin/activate && pip install --upgrade -e . --quiet && mkdir packages
105104
python setup.py sdist && mv dist/* packages/
106-
cd dash-renderer && npm install --ignore-scripts && npm run build:dev && npm run build && python setup.py sdist && mv dist/* ../packages/ && cd ..
105+
cd dash-renderer && npm run build && python setup.py sdist && mv dist/* ../packages/ && cd ..
107106
git clone --depth 1 https://github.com/plotly/dash-core-components.git
108107
cd dash-core-components && npm install --ignore-scripts && npm run build && python setup.py sdist && mv dist/* ../packages/ && cd ..
109108
git clone --depth 1 https://github.com/plotly/dash-renderer-test-components

.gitignore

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ node_modules/
6262
.npm
6363
npm-debug*
6464

65-
dash_renderer/bundle.js
66-
dash_renderer/bundle.js.map
67-
dash_renderer.dev*
68-
dash_renderer.min*
65+
dash_renderer/
66+
digest.json
67+
VERSION.txt

CONTRIBUTING.md

Lines changed: 32 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,41 @@ Glad that you decided to make your contribution in Dash, to set up your developm
88
# in your working directory
99
$ git clone https://github.com/plotly/dash
1010
$ cd dash
11-
# create a virtualenv
12-
$ python3 -m venv venv
13-
# activate the virtualenv (on windows venv\scripts\activate)
14-
$ . venv/bin/activate
15-
# Install the dev dependencies
16-
$ pip install -r .circleci/requirements/dev-requirements.txt
11+
$ python3 -m venv .venv/dev
12+
# activate the virtualenv (on windows .venv\dev\scripts\activate)
13+
$ . .venv/dev/bin/activate
14+
# install dash and dependencies
15+
$ pip install -e .[testing,ci] # in some shells you need \ to escape []
16+
$ cd dash-renderer
17+
# build renderer bundles, this will build all bundles from source code
18+
# the only true source of npm version is defined in package.json
19+
$ npm run build
20+
# install dash-renderer for development
21+
$ pip install -e .
22+
# you should see both dash and dash-renderer are pointed to local source repos
23+
$ pip list | grep dash
1724
```
25+
26+
### Dash-Renderer Beginner Guide
27+
28+
`Dash Renderer` began as a separate repository. It was merged into the main `Dash` repository as part of the 1.0 release. It is the common frontend for all Dash backends (**R** and **Python**), and manages React Component layout and backend event handling.
29+
30+
If you want to contribute or simply dig deeper into Dash, we encourage you to play and taste it. This is the most efficient way to learn and understand everything under the hood.
31+
32+
For contributors with a primarily **Python** or **R** background, this section might help you understand more details about developing and debugging in Javascript world.
33+
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.
40+
41+
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.
42+
1843
## Git
1944

20-
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).
2146

2247
### Organize your commits
2348

dash-renderer/.eslintrc.json

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,27 @@
11
{
22
"extends": ["eslint:recommended", "prettier"],
3+
"settings": {
4+
"react": {
5+
"createClass": "createReactClass", // Regex for Component Factory to use,
6+
// default to "createReactClass"
7+
"pragma": "React", // Pragma to use, default to "React"
8+
"version": "detect" // React version. "detect" automatically picks the version you have installed.
9+
// You can also use `16.0`, `16.3`, etc, if you want to override the detected value.
10+
// default to latest and warns if missing
11+
// It will default to "detect" in the future
12+
},
13+
"propWrapperFunctions": [
14+
// The names of any function used to wrap propTypes, e.g. `forbidExtraProps`. If this isn't set, any propTypes wrapped in a function will be skipped.
15+
"forbidExtraProps",
16+
{"property": "freeze", "object": "Object"},
17+
{"property": "myFavoriteWrapper"}
18+
],
19+
"linkComponents": [
20+
// Components used as alternatives to <a> for linking, eg. <Link to={ url } />
21+
"Hyperlink",
22+
{"name": "Link", "linkAttribute": "to"}
23+
]
24+
},
325
"parser": "babel-eslint",
426
"parserOptions": {
527
"ecmaVersion": 6,

dash-renderer/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22
All notable changes to this project will be documented in this file.
33
This project adheres to [Semantic Versioning](http://semver.org/).
44

5+
## Unreleased
6+
7+
- Clean all the binary assets in dash-renderer repo, add tool to build all the required bundles from fresh source code to avoid confusion of the assets and improve the release process. [#874](https://github.com/plotly/dash/pull/874)
8+
9+
fixes [#868](https://github.com/plotly/dash/pull/868) and [#734](https://github.com/plotly/dash/pull/734)
10+
511
## [1.0.0] - 2019-06-20
612
### Changed
713
- Undo/redo toolbar is removed by default, unless `config.show_undo_redo=true` is provided. The CSS hack `._dash-undo-redo:{display:none;}` is no longer needed [#175](https://github.com/plotly/dash-renderer/pull/175)

dash-renderer/MANIFEST.in

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
include dash_renderer/dash_renderer.dev.js
2-
include dash_renderer/dash_renderer.dev.js.map
3-
include dash_renderer/dash_renderer.min.js
4-
include dash_renderer/dash_renderer.min.js.map
5-
include dash_renderer/react-dom@*.min.js
6-
include dash_renderer/react@*.min.js
7-
include dash_renderer/prop-types@*.js
1+
include package.json
2+
include digest.json
3+
include dash_renderer/*.js
4+
include dash_renderer/*.map

dash-renderer/dash_renderer/__init__.py

Lines changed: 0 additions & 97 deletions
This file was deleted.
-14.7 KB
Binary file not shown.

0 commit comments

Comments
 (0)