plotly / dash-component-boilerplate

Get started creating your own Dash components here.
265 stars 182 forks source link

Anatomy of a Dash component library #119

Open xhluca opened 3 years ago

xhluca commented 3 years ago

When we look at the root of the generated component library, we notice a lot of files from various aspects of Dash. We will have files related to

Although you get a hang of what each file does after a while, I think it might be a bit disorienting for a beginner, especially since the files span 4 different languages. It would be nice to have a md doc describing what each file does, whether you will need to worry about it not. The doc could be grouped by language (Python, R, JS, Julia).

Thoughts on this?

xhluca commented 2 years ago

To expand on this, if there's some way to move all files related to a directory, that'd make the repo much cleaner, e.g.:

js_dev/
  .eslintrc
  demo/
    App.js
    index.js
  index.html
  .npmignore
  webpack.config.js
  webpack.serve.config.js
  package-lock.json
  package.json
  ...

jl_dev/
  MyDashComponent.jl
  ...

r_dev/
  .Rbuildignore/
  ...

py_dev/
  tests/
  venv/
  demos/
  usage.py

dash_builds/
  my_dash_component/
  R/
  inst/deps
  man/
  NAMESPACE

This is a simple way for everyone to understand which files you are supposed to edit if you are building a component for a certain language, and you can also ignore dash_builds if you don't want to commit auto-generated files. Also it will result in significantly less files in the root directory (I don't use 80% of them most of the time)

xhluca commented 2 years ago

Or perhaps we can adopt the CRA approach: a root level public/ directory for files that should be included in the build/.

Then we can additionally have a public/ directory inside each *_dev directory that add to/overrides the files in public/ in the finalbuild/. We could have a structure like this:

js_dev/
  public/
    my_file.js
  ...

py_dev/
  public/
    setup.py

jl_dev/
  public/
     custom.jl

r_dev/
  public/
    .RBuildignore

public/
  LICENSE
  README.md

# Auto-generated:
build/
  python/
    README.md
    LICENSE
    setup.py
  r/
    README.md
    LICENSE
    .Rbuildignore
  jl/
    README.md
    LICENSE
    custom.jl