diff --git a/package.json b/package.json index d4f3063ffa..80c93bdd7e 100644 --- a/package.json +++ b/package.json @@ -120,7 +120,7 @@ "np": "4.0.2", "ol": "5.3.0", "react": "16.8.2", - "react-styleguidist": "8.0.6", + "react-styleguidist": "9.0.0", "react-test-renderer": "16.8.2", "regenerator-runtime": "0.13.1", "rimraf": "2.6.3", diff --git a/src/Button/DigitizeButton/DigitizeButton.example.md b/src/Button/DigitizeButton/DigitizeButton.example.md index 063a765940..c57d0bcfac 100644 --- a/src/Button/DigitizeButton/DigitizeButton.example.md +++ b/src/Button/DigitizeButton/DigitizeButton.example.md @@ -1,17 +1,16 @@ This demonstrates the use of DigitizeButton with different interactions. ```jsx -const React = require('react'); -const OlMap = require('ol/Map').default; -const OlView = require('ol/View').default; -const OlLayerTile = require('ol/layer/Tile').default; -const OlSourceOsm = require('ol/source/OSM').default; -const fromLonLat = require('ol/proj').fromLonLat; - -const { - ToggleGroup, - DigitizeButton -} = require('../../index'); +import React from 'react'; + +import OlMap from 'ol/Map'; +import OlView from 'ol/View'; +import OlLayerTile from 'ol/layer/Tile'; +import OlSourceOsm from 'ol/source/OSM'; +import { fromLonLat } from 'ol/proj'; + +import DigitizeButton from '@terrestris/react-geo/Button/DigitizeButton/DigitizeButton'; +import ToggleGroup from '@terrestris/react-geo/Button/ToggleGroup/ToggleGroup'; class DigitizeButtonExample extends React.Component { diff --git a/styleguide.config.js b/styleguide.config.js index 3181666e8d..93f3b4b700 100644 --- a/styleguide.config.js +++ b/styleguide.config.js @@ -22,11 +22,16 @@ module.exports = { getExampleFilename(componentPath) { return componentPath.replace(/\.jsx?$/, '.example.md'); }, + skipComponentsWithoutExample: true, getComponentPathLine(componentPath) { const name = path.basename(componentPath, '.jsx'); const dir = path.dirname(componentPath).replace('src', 'dist'); return `import ${name} from '@terrestris/react-geo/${dir}/${name}';`; }, + moduleAliases: { + '@terrestris/react-geo': path.resolve(__dirname, 'src'), + 'ol': path.resolve(__dirname, 'node_modules/ol') + }, require: [ '@babel/polyfill', 'whatwg-fetch',