dash-component-boilerplate icon indicating copy to clipboard operation
dash-component-boilerplate copied to clipboard

Anatomy of a Dash component library

Open xhluca opened this issue 4 years ago • 2 comments

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

  • JS (.eslintrc, src/, index.html),
  • webpack (webpack.config.js, webpack.serve.config.js),
  • npm (package.json, .npmignore, package-lock.json),
  • R (.Rbuildignore, R/, inst/deps/),
  • Julia (src/),
  • pypi (MANIFEST.in, setup.py)
  • docs (.md files)
  • etc.

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 avatar Feb 15 '21 19:02 xhluca

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 avatar Aug 16 '21 18:08 xhluca

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 final build/. 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

xhluca avatar Aug 16 '21 18:08 xhluca