Skip to content

Commit

Permalink
Merge pull request #20 from rollup-umd/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
kopax authored Dec 21, 2018
2 parents 3fa8b8a + 11b570b commit 9ae1738
Show file tree
Hide file tree
Showing 8 changed files with 46 additions and 29 deletions.
2 changes: 2 additions & 0 deletions docs/getting-started/configuration/create-config.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,14 @@ All options are optional, and can be autoconfigured by installing a [layout pack
- `options.licensePath` **[string][3]** options.licensePath - Location of the license within your project (optional, default `LICENSE.md`)
- `options.locale` **[string][3]** options.locale - Locale used for the documentation (optional, default `en`)
- `options.loader` **[string][3]** options.loader - Loader to be used for the documentation (optional, default `wave`)
- `options.optionsPath` **[string][3]** options.optionsPath - Object of options that will be hooked and used for generating the configuration. This options **can't** contains options related to path and autoconfigrauton, it can **only** exploit features that happen after. (optional, default `lib/options.js`)
- `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 >'}`)
- `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`)
- `options.favicon` **[string][3]** options.favicon - favicon name (optional, default `null`)
- `options.favicons` **[string][3]** options.favicons - Object with favicon name and href value for favicon (optional, default `{}`)
- `options.head` **[string][3]** options.head - This will be injected at the end of <head /> tag (optional, default `null`)
- `options.disableAutoConf` **[boolean][4]** option.disableAutoConf - Disable auto configuration of layout package (optional, default `false`)
- `options.themeColor` **[string][3]** option.themeColor - This will add a meta with name `theme-color` and content using color in opts.themeColor (optional, default `null`)

### Examples

Expand Down
5 changes: 5 additions & 0 deletions docs/getting-started/deployment/ga.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
The documentation can be connected to any Google Analytics account from [it's tracking id](https://support.google.com/analytics/answer/1008080?hl=en).

Just set the environment variable `GA_TRACKING_ID` before running `npm run styleguide:build`.

If you build and deploy within a CI, just set the environment variable within your CI.
17 changes: 8 additions & 9 deletions docs/installation.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
### 1. Install `$PACKAGE_NAME` and it dependencies:
```bash static
```bash
$ npm install $PACKAGE_NAME --save-dev
```

Expand All @@ -12,13 +12,12 @@ Or use `--save` if you are within a [layout package](#layout-package) you have c
const { createConfig } = require('$PACKAGE_NAME');

module.exports = createConfig();

```

### 3. Create documentations in `docs/` and add `.md` files

Documentation folder example:
```bash static
```bash
root/
└── docs/
├── installation.md
Expand All @@ -29,7 +28,7 @@ root/

Example:

```json static
```json
{
"sections": [
{
Expand All @@ -40,7 +39,7 @@ Example:
"name": "General",
"content": "docs/general.md",
"components": "src/**/*.js",
"sections: [] // more sections
"sections": [] // more sections
}
]
}
Expand All @@ -49,10 +48,10 @@ Example:

### 5. Add scripts into `package.json`:

```json static
```json
{
"scripts": {
"jsdoc: "jsdoc-documentation --file",
"jsdoc": "jsdoc-documentation --file",
"prestyleguide": "npm run jsdoc",
"styleguide": "styleguidist server",
"prestyleguide:build": "npm run jsdoc",
Expand All @@ -72,8 +71,8 @@ Example:

### 6. Run your documentation on `localhost:6060`:

```bash static
npm run styleguide
```bash
$ npm run styleguide
```

> You can change port using: `NODE_PORT=7070 npm run styleguide`
4 changes: 3 additions & 1 deletion docs/layout-package/layout-package-create.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,9 @@ import theme from '../theme';
export default class LayoutRenderer extends Component { // eslint-disable-line react/prefer-stateless-function
static defaultProps = {
theme, // <--- this is where you hook your theme, this way, even your own LayoutRenderer can be extended and used another theme
ga: process.env.GA_ID,
ga: {
id: process.env.GA_TRACKING_ID,
},
logoMenu: {
logo: null,
href: null,
Expand Down
34 changes: 17 additions & 17 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -160,11 +160,11 @@
"lint-staged"
],
"devDependencies": {
"@babel/cli": "^7.2.0",
"@babel/cli": "^7.2.3",
"@babel/core": "^7.2.2",
"@babel/plugin-external-helpers": "^7.2.0",
"@babel/plugin-proposal-class-properties": "^7.2.1",
"@babel/plugin-proposal-decorators": "^7.2.2",
"@babel/plugin-proposal-class-properties": "^7.2.3",
"@babel/plugin-proposal-decorators": "^7.2.3",
"@babel/plugin-proposal-json-strings": "^7.2.0",
"@babel/plugin-proposal-object-rest-spread": "^7.2.0",
"@babel/plugin-syntax-dynamic-import": "^7.2.0",
Expand All @@ -174,11 +174,11 @@
"@babel/plugin-transform-react-constant-elements": "^7.2.0",
"@babel/plugin-transform-react-inline-elements": "^7.2.0",
"@babel/plugin-transform-runtime": "^7.2.0",
"@babel/preset-env": "^7.2.0",
"@babel/preset-env": "^7.2.3",
"@babel/preset-react": "^7.0.0",
"@semantic-release/changelog": "^3.0.1",
"@semantic-release/git": "^7.0.5",
"@semantic-release/github": "^5.2.6",
"@semantic-release/git": "^7.0.6",
"@semantic-release/github": "^5.2.7",
"@semantic-release/npm": "^5.1.2",
"babel-core": "^7.0.0-bridge.0",
"babel-eslint": "^10.0.1",
Expand All @@ -188,7 +188,7 @@
"babel-plugin-add-module-exports": "^1.0.0",
"babel-plugin-dynamic-import-node": "^2.2.0",
"babel-plugin-react-transform": "^3.0.0",
"babel-plugin-styled-components": "^1.9.4",
"babel-plugin-styled-components": "^1.10.0",
"babel-plugin-transform-react-remove-prop-types": "^0.4.21",
"cz-conventional-changelog": "^2.1.0",
"enzyme": "^3.8.0",
Expand All @@ -206,28 +206,28 @@
"pre-commit": "^1.2.2",
"raf": "^3.4.1",
"react-styleguidist": "^8.0.6",
"react-test-renderer": "^16.6.3",
"semantic-release": "^15.13.0",
"react-test-renderer": "^16.7.0",
"semantic-release": "^15.13.1",
"sinon": "^7.2.2",
"toctoc": "^0.3.2",
"webpack": "^4.27.1"
"webpack": "^4.28.1"
},
"dependencies": {
"@babel/runtime": "^7.2.0",
"@bootstrap-styled/rsg-components": "^1.1.0",
"documentation": "^9.0.0",
"file-loader": "^2.0.0",
"@bootstrap-styled/rsg-components": "^1.1.2",
"documentation": "^9.1.1",
"file-loader": "^3.0.1",
"lodash.omit": "^4.5.0",
"mini-html-webpack-plugin": "^0.2.3",
"parse-author": "^2.0.0",
"exports-loader": "^0.7.0",
"image-webpack-loader": "^4.6.0",
"prop-types": "^15.6.2",
"react": "^16.6.3",
"react-dom": "^16.6.3",
"react": "^16.7.0",
"react-dom": "^16.7.0",
"react-ga": "^2.5.6",
"react-transition-group": "^2.5.1",
"styled-components": "^4.1.2",
"react-transition-group": "^2.5.2",
"styled-components": "^4.1.3",
"url-loader": "^1.1.2",
"webpack-merge": "^4.1.5"
},
Expand Down
2 changes: 1 addition & 1 deletion src/Layout/LayoutRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export default class LayoutRenderer extends Component {
static defaultProps = {
title: '@rollup-umd/documentation',
ga: {
id: null,
id: process.env.GA_TRACKING_ID,
},
};

Expand Down
3 changes: 3 additions & 0 deletions src/createConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,9 @@ export function createConfig(config = {}, options = {}) {
'node_modules/**/*.js',
],
}),
new webpack.DefinePlugin({
'process.env.GA_TRACKING_ID': JSON.stringify(process.env.GA_TRACKING_ID),
}),
],
resolve: {
alias: {
Expand Down
8 changes: 7 additions & 1 deletion styleguide/styleguide.ext.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,13 @@
},
{
"name": "Deploy the documentation",
"content": "docs/getting-started/deployment/prepare.sh.md"
"content": "docs/getting-started/deployment/prepare.sh.md",
"section": [
{
"name": "Google Analytics",
"content": "docs/getting-started/deployment/ga.md"
}
]
}
]
},
Expand Down

0 comments on commit 9ae1738

Please sign in to comment.