Skip to content

Commit 5b6d67a

Browse files
authored
Merge pull request #7 from rollup-umd/dev
Dev
2 parents 8eebb6e + 96dc6d4 commit 5b6d67a

File tree

9 files changed

+99
-89
lines changed

9 files changed

+99
-89
lines changed

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ jobs:
5757

5858
# Job: Release
5959
- stage: release
60-
if: branch = master
60+
if: branch = master AND type = push AND fork = false
6161
node_js:
6262
- 'lts/*'
6363
skip_cleanup: true
@@ -66,7 +66,7 @@ jobs:
6666

6767
# Job: Page
6868
- stage: deploy
69-
if: branch = master
69+
if: branch = master AND type = push AND fork = false
7070
node_js:
7171
- 'lts/*'
7272
script:

docs/configuration/create-config.md

Lines changed: 0 additions & 50 deletions
This file was deleted.

docs/getting-started/configuration/create-config.md

Lines changed: 27 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2,31 +2,34 @@
22

33
## createConfig
44

5-
You need to import `createConfig` into your [react-styleguidist][1] configuration file (generally `styleguide.config.js`).
6-
All options are optional, and can be autoconfigured by installing a [layout package][2].
5+
You need to import `createConfig` into your styleguidist configuration file (generally `styleguide.config.js`).
6+
All options are optional, and can be autoconfigured by installing a [layout package][1].
77

88
### Parameters
99

10-
- `config` **[Object][3]** for react-styleguidist user configuration, it will be used to override our default styleguide configuration. See [https://react-styleguidist.js.org/docs/configuration.html][4] (optional, default `{}`)
11-
- `options` **[Object][3]** for $PACKAGE_NAME features (optional, default `{}`)
12-
- `options.layout` **[string][5]** options.layout - Name of the layout package (optional, default `''`)
13-
- `options.layoutPath` **[string][5]** options.layoutPath - Location of the Layout component within the layout package (optional, default `lib/Layout`)
14-
- `options.wrapperPath` **[string][5]** options.wrapperPath [options.wrapperPath=lib/Wrapper] - Location of the Wrapper component within the layout package (optional, default `lib/Wrapper`)
15-
- `options.selectionConfigPath` **[string][5]** options.selectionConfigPath - Location of the styleguide.config.js within the layout package (optional, default `lib/styleguide.config.js`)
16-
- `options.styleGuideDirPath` **[string][5]** options.styleGuideDirPath - Location of the styleguide configuration directory within your project (optional, default `styleguide`)
17-
- `options.extensionFile` **[string][5]** options.extensionFile - Name of the styleguide configuration extension within your project (optional, default `styleguide.ext.json`)
18-
- `options.setupFile` **[string][5]** options.setupFile - Name of the setup file within your project (optional, default `setup.js`)
19-
- `options.licensePath` **[string][5]** options.licensePath - Location of the license within your project (optional, default `LICENSE.md`)
20-
- `options.locale` **[string][5]** options.locale - Locale used for the documentation (optional, default `en`)
21-
- `options.loader` **[string][5]** options.loader - Loader to be used for the documentation (optional, default `wave`)
22-
- `options.loaders` **[Object][3]** options.loaders - object available for use (if layout package is installed, they will be automatically added during autoconfiguration) (optional, default `{wave:'<!-- content of wave loader >'}`)
23-
- `options.loaderInnerApp` **[boolean][6]** options.loaderInnerApp - If set to false, the loader will be injected in the main html outside of the react application context (optional, default `true`)
24-
- `options.favicon` **[string][5]** options.favicon - Favicon href url (optional, default `null`)
25-
- `options.head` **[string][5]** options.head - This will be injected at the end of <head /> tag (optional, default `null`)
10+
- `config` **[Object][2]** for react-styleguidist user configuration, it will be used to override our default styleguide configuration. (optional, default `{}`)
11+
- `options` **[Object][2]** for $PACKAGE_NAME features (optional, default `{}`)
12+
- `options.layout` **[string][3]** options.layout - Name of the layout package (optional, default `null`)
13+
- `options.layoutPath` **[string][3]** options.layoutPath - Location of the Layout component within the layout package (optional, default `lib/Layout`)
14+
- `options.wrapperPath` **[string][3]** options.wrapperPath - Location of the Wrapper component within the layout package (optional, default `lib/Wrapper`)
15+
- `options.styleguideConfigPath` **[string][3]** options.styleguideConfigPath - Location of the styleguide.config.js within the layout package (optional, default `lib/styleguide.config.js`)
16+
- `options.loadersConfigPath` **[string][3]** options.loadersConfigPath - Location of the loaders within the layout package (optional, default `lib/loaders`)
17+
- `options.styleGuideDirPath` **[string][3]** options.styleGuideDirPath - Location of the styleguide configuration directory within your project (optional, default `styleguide`)
18+
- `options.extensionFile` **[string][3]** options.extensionFile - Name of the styleguide configuration extension within your project (optional, default `styleguide.ext.json`)
19+
- `options.setupFile` **[string][3]** options.setupFile - Name of the setup file within your project (optional, default `setup.js`)
20+
- `options.licensePath` **[string][3]** options.licensePath - Location of the license within your project (optional, default `LICENSE.md`)
21+
- `options.locale` **[string][3]** options.locale - Locale used for the documentation (optional, default `en`)
22+
- `options.loader` **[string][3]** options.loader - Loader to be used for the documentation (optional, default `wave`)
23+
- `options.loaders` **[Object][2]** options.loaders - object available for use (if layout package is installed, they will be automatically added during autoconfiguration) (optional, default `{wave:'<!-- content of wave loader >'}`)
24+
- `options.loaderInnerApp` **[boolean][4]** options.loaderInnerApp - If set to false, the loader will be injected in the main html outside of the react application context (optional, default `true`)
25+
- `options.favicon` **[string][3]** options.favicon - favicon name (optional, default `null`)
26+
- `options.favicons` **[string][3]** options.favicons - Object with favicon name and href value for favicon (optional, default `{}`)
27+
- `options.head` **[string][3]** options.head - This will be injected at the end of <head /> tag (optional, default `null`)
28+
- `options.disableAutoConf` **[boolean][4]** option.disableAutoConf - Disable auto configuration of layout package (optional, default `false`)
2629

2730
### Examples
2831

29-
```js static
32+
```javascript
3033
// Choose manually a layout package and expand example by default
3134
const { createConfig } = require('$PACKAGE_NAME');
3235
const styleguideConfig = { exampleMode: 'expand' };
@@ -36,16 +39,12 @@ const config = createConfig(styleguideConfig, options);
3639
module.exports = config;
3740
```
3841

39-
Returns **[Object][3]** react-styleguidist [configuration][4] configuration object
42+
Returns **[Object][2]** react-styleguidist configuration
4043

41-
[1]: https://react-styleguidist.js.org
44+
[1]: #layout-package-create
4245

43-
[2]: #layout-package-create
46+
[2]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object
4447

45-
[3]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object
48+
[3]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String
4649

47-
[4]: https://react-styleguidist.js.org/docs/configuration.html
48-
49-
[5]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String
50-
51-
[6]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean
50+
[4]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean

docs/getting-started/documenting/jsdoc.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
We use JSdoc annotations for annotating javascript and generating our markdown doc.
1+
We use JSdoc annotations in our javascript to generate documentation in markdown.
22

33
If you don't know what JSdoc is, you should read their website:
44

docs/installation.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Or use `--save` if you are within a [layout package](#layout-package) you have c
99
### 2. Create `styleguide.config.js` in root of your project.
1010

1111
```js static
12-
const { createConfig } = require('$PACKAGE_NAME/lib/styleguide.config.js');
12+
const { createConfig } = require('$PACKAGE_NAME');
1313

1414
module.exports = createConfig();
1515

docs/layout-package/layout-package-create.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,3 +67,60 @@ export default makeTheme;
6767
If you don't know what is a `makeTheme` or a `theme`, you should read [Bootstrap Styled documentation](https://bootstrap-styled.github.com/bootstrap-styled).
6868

6969
If you don't know how theme work, please read the [theme](#layout-theme) section of this documentation.
70+
71+
Generally, if all you want is updating the theme, you will need to create a `Layout` in your layout package as follow:
72+
73+
74+
```js static
75+
import React, { Component } from 'react';
76+
import PropTypes from 'prop-types';
77+
import StyleGuideRenderer from '@rollup-umd/documentation/lib/Layout';
78+
import theme from '../theme';
79+
80+
export default class LayoutRenderer extends Component { // eslint-disable-line react/prefer-stateless-function
81+
static defaultProps = {
82+
theme, // <--- this is where you hook your theme, this way, even your own LayoutRenderer can be extended and used another theme
83+
ga: process.env.GA_ID,
84+
logoMenu: {
85+
logo: null,
86+
href: null,
87+
alt: 'Example of layout renderer',
88+
},
89+
logoFooter: {
90+
logo: null,
91+
href: null,
92+
alt: 'Example of layout renderer',
93+
},
94+
};
95+
96+
static propTypes = {
97+
/** Our edited theme */
98+
theme: PropTypes.object,
99+
/** Google analytics configuration */
100+
ga: PropTypes.shape({
101+
/** Google analytics id */
102+
id: PropTypes.string,
103+
}),
104+
/** Logo to use in sidebar menu */
105+
logoMenu: PropTypes.shape({
106+
logo: PropTypes.node,
107+
href: PropTypes.string,
108+
alt: PropTypes.string,
109+
}),
110+
/** Logo to use in footer */
111+
logoFooter: PropTypes.shape({
112+
logo: PropTypes.node,
113+
href: PropTypes.string,
114+
alt: PropTypes.string,
115+
}),
116+
};
117+
118+
render() {
119+
const { ...rest } = this.props;
120+
return (
121+
<StyleGuideRenderer {...rest} />
122+
);
123+
}
124+
}
125+
126+
```

docs/layout-package/layout-package.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
1-
Layout package are useful when you want to maintain a documentation (layout/configuration) across multiple projects.
1+
Layout package are useful when you want to maintain a documentation layout and/or configuration across multiple projects.
22

3-
It's easy because all you need to is upgrade the version in `package.json` to get the latest update.
3+
It's convenient because it just need to be installed and does not require any code change.
4+
5+
Updating can be done by upgrading the version of your layout package in `package.json`.
46

57
It can contains customs:
68

79
- `Layout`: the documentation layout
810
- `Wrapper`: the wrapper for examples
9-
- `styleguide.config.js`: styleGuide configuration (will be merged into ours)
11+
- `styleguide.config.js`: styleGuide configuration (will be merged into our configuration)
1012
- `loaders`: Loaders injected by the package
11-
- `theme`: The `theme` and `makeTheme` respecting the Bootstrap Styled chart.
13+
- `theme`: The `theme` and `makeTheme` respecting the Bootstrap Styled chart. It can be used in `Layout` using `props.theme`.
14+
15+
None of them is required,
1216

styleguide/jsdoc.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
#!/usr/bin/env bash
22

3-
npm run jsdoc-documentation src docs/configuration/create-config.md
3+
npm run jsdoc-documentation src/createConfig.js docs/getting-started/configuration/create-config.md

styleguide/styleguide.ext.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@
136136
}
137137
],
138138
"ribbon": {
139-
"url": "",
139+
"url": "https://github.com/rollup-umd/documentation",
140140
"text": "Fork us on GitHub"
141141
}
142-
}
142+
}

0 commit comments

Comments
 (0)