README.erb 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. # <%= packageName %>
  2. This is the <%= description %> Superset Chart Plugin.
  3. ### Usage
  4. To build the plugin, run the following commands:
  5. ```
  6. npm ci
  7. npm run build
  8. ```
  9. Alternatively, to run the plugin in development mode (=rebuilding whenever changes are made), start the dev server with the following command:
  10. ```
  11. npm run dev
  12. ```
  13. To add the package to Superset, go to the `superset-frontend` subdirectory in your Superset source folder (assuming both the `<%= packageName %>` plugin and `superset` repos are in the same root directory) and run
  14. ```
  15. npm i -S ../../<%= packageName %>
  16. ```
  17. You may also wish to add the following to the `include` array in `tsconfig.json` to make Superset types available to your plugin:
  18. ```
  19. "../../types/**/*"
  20. ```
  21. Finally, if you wish to ensure your plugin `tsconfig.json` is aligned with the root Superset project, you may add the following to your `tsconfig.json` file:
  22. ```
  23. "extends": "../../tsconfig.json",
  24. ```
  25. After this edit the `superset-frontend/src/visualizations/presets/MainPreset.js` and make the following changes:
  26. ```js
  27. import { <%= packageLabel %> } from '<%= packageName %>';
  28. ```
  29. to import the plugin and later add the following to the array that's passed to the `plugins` property:
  30. ```js
  31. new <%= packageLabel %>().configure({ key: '<%= packageName %>' }),
  32. ```
  33. After that the plugin should show up when you run Superset, e.g. the development server:
  34. ```
  35. npm run dev-server
  36. ```