superset/superset-frontend/packages/generator-superset/generators/plugin-chart/templates
2023-03-29 20:57:27 -07:00
..
src fix(plugin-generator): Addresses linter errors in newly generated Superset plugin (#23513) 2023-03-29 20:57:27 -07:00
test fix(plugin-generator): Addresses linter errors in newly generated Superset plugin (#23513) 2023-03-29 20:57:27 -07:00
types refactor(monorepo): move superset-ui to superset(stage 2) (#17552) 2021-11-30 08:29:57 +08:00
babel.config.erb chore(generator-superset): migrate to monorepo (#17829) 2021-12-21 11:44:21 +02:00
gitignore.erb fix(generator): more cleanup to plugin framework (#18027) 2022-01-17 10:23:35 +02:00
jest.config.erb chore(generator-superset): migrate to monorepo (#17829) 2021-12-21 11:44:21 +02:00
package-lock.erb fix(generator): add lockfile and fix styling issues (#18073) 2022-01-18 12:37:09 +02:00
package.erb fix(plugin-generator): Addresses linter errors in newly generated Superset plugin (#23513) 2023-03-29 20:57:27 -07:00
README.erb docs: Adds notes to Superset plugin generator about TypeScript errors (#23501) 2023-03-27 18:34:26 -07:00
tsconfig.json chore(generator-superset): migrate to monorepo (#17829) 2021-12-21 11:44:21 +02:00

# <%= packageName %>

This is the <%= description %> Superset Chart Plugin.

### Usage

To build the plugin, run the following commands:

```
npm ci
npm run build
```

Alternatively, to run the plugin in development mode (=rebuilding whenever changes are made), start the dev server with the following command:

```
npm run dev
```

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
```
npm i -S ../../<%= packageName %>
```

If your Superset plugin exists in the `superset-frontend` directory and you wish to resolve TypeScript errors about `@superset-ui/core` not being resolved correctly, add the following to your `tsconfig.json` file:

```
"references": [
  {
    "path": "../../packages/superset-ui-chart-controls"
  },
  {
    "path": "../../packages/superset-ui-core"
  }
]
```

You may also wish to add the following to the `include` array in `tsconfig.json` to make Superset types available to your plugin:

```
"../../types/**/*"
```

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:

```
"extends": "../../tsconfig.json",
```

After this edit the `superset-frontend/src/visualizations/presets/MainPreset.js` and make the following changes:

```js
import { <%= packageLabel %> } from '<%= packageName %>';
```

to import the plugin and later add the following to the array that's passed to the `plugins` property:
```js
new <%= packageLabel %>().configure({ key: '<%= packageName %>' }),
```

After that the plugin should show up when you run Superset, e.g. the development server:

```
npm run dev-server
```