zhaoyongjie commented on pull request #18027:
URL: https://github.com/apache/superset/pull/18027#issuecomment-1013232623


   Add some instructions on how to use this awesome plugin system:
   1. Install `yo` in your local machine
   ```shell
   npm i -g yo
   ```
   2. Install and link `@superset-ui/generator-superset`
   ```shell
   cd superset-frontend/packages/generator-superset
   npm i
   npm link
   ```
   
   3. Check if the installation is successful
   ```
   $ npm list -g
   /Users/user-name/.nvm/versions/node/v16.9.1/lib
   ├── @superset-ui/generator-superset@0.18.25 -> 
./../../../../../workspace/warehouse/superset/incubator-superset/superset-frontend/packages/generator-superset
   ├── corepack@0.9.0
   ├── npm@7.21.1
   ├── po2json@0.4.5
   ├── yarn@1.22.17
   └── yo@4.3.0
   ```
   
   4. Create a plugin directory
   ```
   mkdir -p /tmp/superset-plugin-hello-world
   cd /tmp/superset-plugin-hello-world
   ```
   
   5. initialize the plugin
   ```
   yo @superset-ui/superset
   ```
   
   6. install and build `superset-plugin-hello-world`
   ```
   npm i --force
   npm run build
   ```
   
   7. Install `superset-plugin-hello-world` into Superset
   ```
   npm i -S /tmp/superset-plugin-hello-world
   ```
   
   8. load customize the plugin. This is git-diff in my local machine
   ```
   (superset) yongjie.zhao@:incubator-superset$ git diff
   diff --git a/superset-frontend/package.json b/superset-frontend/package.json
   index 439322dce..d9b87130b 100644
   --- a/superset-frontend/package.json
   +++ b/superset-frontend/package.json
   @@ -195,6 +195,7 @@
        "rison": "^0.1.1",
        "scroll-into-view-if-needed": "^2.2.28",
        "shortid": "^2.2.6",
   +    "superset-plugin-hello-world": 
"file:../../../../../superset-plugin-hello-world",
        "urijs": "^1.19.6",
        "use-immer": "^0.6.0",
        "use-query-params": "^1.1.9",
   diff --git a/superset-frontend/src/visualizations/presets/MainPreset.js 
b/superset-frontend/src/visualizations/presets/MainPreset.js
   index a32fbb2b7..1318bbb9c 100644
   --- a/superset-frontend/src/visualizations/presets/MainPreset.js
   +++ b/superset-frontend/src/visualizations/presets/MainPreset.js
   @@ -80,6 +80,7 @@ import {
    import { PivotTableChartPlugin as PivotTableChartPluginV2 } from 
'@superset-ui/plugin-chart-pivot-table';
    import FilterBoxChartPlugin from '../FilterBox/FilterBoxChartPlugin';
    import TimeTableChartPlugin from '../TimeTable/TimeTableChartPlugin';
   +import { SupersetPluginHelloWorld } from 'superset-plugin-hello-world';
   
    export default class MainPreset extends Preset {
      constructor() {
   @@ -164,6 +165,7 @@ export default class MainPreset extends Preset {
            new TimeColumnFilterPlugin().configure({ key: 'filter_timecolumn' 
}),
            new TimeGrainFilterPlugin().configure({ key: 'filter_timegrain' }),
            new EchartsTreeChartPlugin().configure({ key: 'tree_chart' }),
   +        new SupersetPluginHelloWorld().configure({ key: 'hello_world'}),
            ...experimentalplugins,
          ],
        });
   ```
   
   9. run development server in Superset
   ```
   npm run dev-server
   ```
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org
For additional commands, e-mail: notifications-h...@superset.apache.org

Reply via email to