Skip to content
This repository was archived by the owner on May 15, 2022. It is now read-only.

Commit 156ec27

Browse files
committed
Add deploy script for publishing /example to gh-pages
1 parent 3bd1f16 commit 156ec27

File tree

5 files changed

+212
-35
lines changed

5 files changed

+212
-35
lines changed

README.md

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -80,24 +80,23 @@ This is the main container component for your GUI and is the default export from
8080
#### required
8181
8282
| prop | Description | Type |
83-
|----------|---------------------------------------------------------------------------------|----------|
83+
| -------- | ------------------------------------------------------------------------------- | -------- |
8484
| data | The data your dat.GUI controller will mutate | object |
8585
| onUpdate | The method which will be called whenever an update is handled by the controller | function |
8686
| children | The dat.GUI components that make up the controller | array |
8787
8888
#### optional
8989
9090
| prop | Description | Type | Default |
91-
|------------|------------------------------------------------|---------|---------|
91+
| ---------- | ---------------------------------------------- | ------- | ------- |
9292
| liveUpdate | Determines if live updates should occur | boolean | true |
9393
| labelWidth | The width of the labels in any valid CSS units | string | "40%" |
9494
| className | The class name to set on the `DatGui` div | string | null |
9595
| style | The style object to set on the `DatGui` div | object | null |
9696
97-
9897
### Control Components
9998
100-
`react-dat-gui` comes with eight built-in control components which can be used by rendering them as direct children of `<DatGui />`.
99+
`react-dat-gui` comes with eight built-in control components which can be used by rendering them as direct children of `<DatGui />`.
101100
102101
- [DatBoolean](#datboolean)
103102
- [DatButton](#datbutton)
@@ -107,18 +106,18 @@ This is the main container component for your GUI and is the default export from
107106
- [DatSelect](#datselect)
108107
- [DatString](#datstring)
109108
110-
Custom control components can also be used so long as they implement the required props.
109+
Custom control components can also be used so long as they implement the required props.
111110
112111
#### Common props
113112
114-
All child components of `<DatGui />` receive the following props implicitly, these are useful when building custom control components. See the built-in control components in [src/components](src/components) for examples of how to implement your own controls.
113+
All child components of `<DatGui />` receive the following props implicitly, these are useful when building custom control components. See the built-in control components in [src/components](src/components) for examples of how to implement your own controls.
115114
116-
| prop | Description | Type |
117-
|----------------|---------------------------------------------------------------------------------------------------------------------------|----------|
118-
| data | The data your dat.GUI controller will mutate, the same object from `<DatGui data={data} /> | object |
119-
| labelWidth | The width of the control name label | string |
120-
| liveUpdate | Determines if live updates should occur | boolean |
121-
| _onUpdateValue | A callback function for `<DatGui onUpdate={this.onUpdate} />, call this method to update dat.Gui state from your control. | function |
115+
| prop | Description | Type |
116+
| --------------- | ------------------------------------------------------------------------------------------------------------------------------------ | ------- |
117+
| data | The data your dat.GUI controller will mutate, the same object from `<DatGui data={data} /> | object |
118+
| labelWidth | The width of the control name label | string |
119+
| liveUpdate | Determines if live updates should occur | boolean |
120+
| \_onUpdateValue | A callback function for `<DatGui onUpdate={this.onUpdate} />, call this method to update dat.Gui state from your control. | function |
122121

123122
Below are docs for the required and optional props you can pass to each built-in control component.
124123

@@ -248,8 +247,8 @@ Changes to the library code should hot reload in the demo app
248247
## Scripts
249248
250249
| Script | Description |
251-
|---------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------|
252-
| `build` | Builds the library for production into `/dist` |
250+
| ------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- |
251+
| `build` | Builds the library for production into `/dist` |
253252
| `start` | Starts the library in development mode with hot module reloading |
254253
| `test` | Runs unit testing suite powered by [Jest](https://github.com/facebook/jest) and [testing-library](https://github.com/testing-library/react-testing-library) |
255254
| `lint` | Runs linting over entire codebase with `prettier`, `eslint` and `stylelint` |
@@ -258,7 +257,7 @@ Changes to the library code should hot reload in the demo app
258257
| `fix` | Runs linting over entire codebase with `prettier`, `eslint` and `stylelint` and applies any available automatic fixes |
259258
| `fix-js` | Lints only javascript files and applies any available automatic fixes |
260259
| `fix-styles` | Lints only stylesheet files and applies any available automatic fixes |
261-
260+
| `deploy` | Compiles and deploys a static build of `/example` next.js app to gh-pages |
262261
263262
## What's missing
264263

example/next.config.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,6 @@
33
*
44
* @see https://nextjs.org/docs/#custom-configuration
55
*/
6-
module.exports = {};
6+
module.exports = {
7+
assetPrefix: process.env.NODE_ENV === 'production' ? '/react-dat-gui' : ''
8+
};

example/package.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,13 @@
1919
"scripts": {
2020
"dev": "next",
2121
"start": "next start",
22-
"build": "next build"
22+
"build": "next build",
23+
"export": "yarn clean && next build && next export",
24+
"clean": "shx rm -rf out",
25+
"deploy": "yarn export && shx touch out/.nojekyll && gh-pages -t -d out && yarn clean"
26+
},
27+
"devDependencies": {
28+
"gh-pages": "^2.1.1",
29+
"shx": "^0.3.2"
2330
}
2431
}

0 commit comments

Comments
 (0)