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

[Feature Request] Make all js dependencies as assets #868

Closed
byronz opened this issue Aug 15, 2019 · 3 comments · Fixed by #874
Closed

[Feature Request] Make all js dependencies as assets #868

byronz opened this issue Aug 15, 2019 · 3 comments · Fixed by #874
Assignees
Milestone

Comments

@byronz
Copy link
Contributor

byronz commented Aug 15, 2019

Is your feature request related to a problem? Please describe.
the dash-renderer repo includes both source code and binary assets/bundles for historical reasons. This is in general not good practices:

  1. the repo is bigger than it's needed
  2. the bundles and assets breaks the clean environment rule and make some development confusion/issues from time to time
  3. it also makes the CI job slower and polluted

Describe the solution you'd like
a similar solution as proposed in plotly/dash-core-components#597

the repo should only contain source code, from the clean env, we do the build from a python script:

  • run npm i --ignore-scripts
  • parses the package-lock.json, copy the required bundles into dash_core_components, compute the content hash and dump all the fingerprint in a json file. this file can be included in the release as an alternative way than version to check the assets correctness.
  • update __init__.py, so we have the single version of truth from npm
  • run npm run build
    at this point, we should be able to dev and test from pip install -e .

apply the same procedure in circleci, and see how it applies for the release automation

Additional context
the script should work in both python2 and 3

@byronz byronz added this to the Dash v1.2.0 milestone Aug 15, 2019
@byronz
Copy link
Contributor Author

byronz commented Aug 15, 2019

@rpkyle @alexcjohnson in step2, if we compute all the bundle hash and dump then in a dict like

{ 'prop-types@15.7.2.js': '85947944e396a28895fad5f553eee36f', 'dash_renderer.dev.js': 'e6d5a2bb6733ecd334d8aa4369560afe' ...} 

this can be used as extra test in CI, or local development env whenever we have a doubt, just compare the content with the hash

@byronz byronz self-assigned this Aug 15, 2019
@alexcjohnson
Copy link
Collaborator

Can we just use git to do the comparison for us? something like:

npm run build
git add dash-renderer/dash_renderer
git status -s dash-renderer/dash_renderer  # any output is a failure

@byronz
Copy link
Contributor Author

byronz commented Aug 15, 2019

this is like testing the .gitignore, we can add **/dash_renderer in the ignore file for that.

but the hash output is more like a reference when we release a dash version, we can tell if the bundles we built or copied from npm_modules are changed by git diff.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants