Skip to content

Commit

Permalink
feat: initial checkin docz
Browse files Browse the repository at this point in the history
  • Loading branch information
atanasster committed Apr 12, 2020
1 parent b8ff182 commit 7f5d5c6
Show file tree
Hide file tree
Showing 19 changed files with 5,806 additions and 313 deletions.
246 changes: 246 additions & 0 deletions examples/docz/.docz/app/db.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,246 @@
{
"config": {
"title": "Component Controls Docz Example",
"description": "My awesome app using docz",
"menu": [],
"version": "0.6.0",
"repository": null,
"native": false,
"themeConfig": {},
"separator": "-",
"typescript": true,
"docgenConfig": {
"searchPath": "../"
}
},
"entries": [
{
"key": "src/index.mdx",
"value": {
"name": "Getting Started",
"route": "/",
"id": "6576455a124f9aaefd860597f03a8fe4",
"filepath": "src/index.mdx",
"fullpath": "/Users/atanasster/component-controls/examples/docz/src/index.mdx",
"link": "",
"hidden": false,
"slug": "src-index",
"menu": "",
"headings": [
{
"slug": "home-page",
"depth": 1,
"value": "Home Page"
},
{
"slug": "button",
"depth": 2,
"value": "Button"
}
]
}
}
],
"props": [
{
"key": "../storybook-6/src/components/Button.tsx",
"value": [
{
"description": "Button with react Typescript properties",
"displayName": "Button",
"methods": [],
"props": {
"disabled": {
"defaultValue": null,
"description": "Boolean indicating whether the button should render as disabled",
"name": "disabled",
"required": false,
"type": {
"name": "boolean | undefined"
}
},
"label": {
"defaultValue": null,
"description": "button label.",
"name": "label",
"required": false,
"type": {
"name": "string | undefined"
}
},
"onClick": {
"defaultValue": null,
"description": "onClick handler",
"name": "onClick",
"required": true,
"type": {
"name": "() => void"
}
},
"style": {
"defaultValue": null,
"description": "Custom styles",
"name": "style",
"required": true,
"type": {
"name": "object"
}
},
"backgroundColor": {
"defaultValue": null,
"description": "Background color",
"name": "backgroundColor",
"required": true,
"type": {
"name": "string"
}
},
"color": {
"defaultValue": null,
"description": "Text color, default black",
"name": "color",
"required": true,
"type": {
"name": "string"
}
},
"type": {
"defaultValue": null,
"description": "Button type",
"name": "type",
"required": true,
"type": {
"name": "\"button\" | \"reset\" | \"submit\""
}
},
"padding": {
"defaultValue": null,
"description": "Numeric field type",
"name": "padding",
"required": true,
"type": {
"name": "number"
}
}
}
}
]
},
{
"key": "../storybook-6/src/components/PropTypesButton.js",
"value": [
{
"description": "Button with react PropTypes",
"displayName": "Button",
"methods": [],
"actualName": "Button",
"props": {
"disabled": {
"type": {
"name": "bool"
},
"required": false,
"description": "Boolean indicating whether the button should render as disabled",
"defaultValue": {
"value": "false",
"computed": false
}
},
"label": {
"type": {
"name": "string"
},
"required": false,
"description": "button label.",
"defaultValue": {
"value": "'default'",
"computed": false
}
},
"onClick": {
"type": {
"name": "func"
},
"required": false,
"description": "onClick handler",
"defaultValue": {
"value": "() => {}",
"computed": false
}
},
"style": {
"type": {
"name": "shape",
"value": {}
},
"required": false,
"description": "Custom styles",
"defaultValue": {
"value": "{}",
"computed": false
}
},
"backgroundColor": {
"type": {
"name": "string"
},
"required": false,
"description": "Background color",
"defaultValue": {
"value": "'#fefefe'",
"computed": false
}
},
"color": {
"type": {
"name": "string"
},
"required": false,
"description": "Text color, default black",
"defaultValue": {
"value": "'black'",
"computed": false
}
},
"type": {
"type": {
"name": "enum",
"value": [
{
"value": "'button'",
"computed": false
},
{
"value": "'reset'",
"computed": false
},
{
"value": "'submit'",
"computed": false
}
]
},
"required": false,
"description": "Button type",
"defaultValue": {
"value": "'button'",
"computed": false
}
},
"padding": {
"type": {
"name": "number"
},
"required": false,
"description": "Numeric field type",
"defaultValue": {
"value": "5",
"computed": false
}
}
}
}
]
}
]
}
12 changes: 12 additions & 0 deletions examples/docz/.docz/doczrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
export default {
typescript: true,
docgenConfig: {
searchPath: '../',
},
// files: '../src/**/*.stories.(js|tsx|mdx)',
filterComponents: files => {
return files.filter(filepath =>
/\/[A-Z]\w*\.(js|jsx|ts|tsx)$/.test(filepath),
);
},
};
134 changes: 134 additions & 0 deletions examples/docz/.docz/gatsby-config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
const { mergeWith } = require('docz-utils')
const fs = require('fs-extra')

let custom = {}
const hasGatsbyConfig = fs.existsSync('./gatsby-config.custom.js')

if (hasGatsbyConfig) {
try {
custom = require('./gatsby-config.custom')
} catch (err) {
console.error(
`Failed to load your gatsby-config.js file : `,
JSON.stringify(err),
)
}
}

const config = {
pathPrefix: '/',

siteMetadata: {
title: 'Component Controls Docz Example',
description: 'My awesome app using docz',
},
plugins: [
{
resolve: 'gatsby-plugin-typescript',
options: {
isTSX: true,
allExtensions: true,
},
},
{
resolve: 'gatsby-theme-docz',
options: {
themeConfig: {},
src: './',
gatsbyRoot: null,
themesDir: 'src',
mdxExtensions: ['.md', '.mdx'],
docgenConfig: { searchPath: '../' },
menu: [],
mdPlugins: [],
hastPlugins: [],
ignore: [],
typescript: true,
ts: false,
propsParser: true,
'props-parser': true,
debug: false,
native: false,
openBrowser: null,
o: null,
open: null,
'open-browser': null,
root: '/Users/atanasster/component-controls/examples/docz/.docz',
base: '/',
source: './',
'gatsby-root': null,
files: '**/*.{md,markdown,mdx}',
public: '/public',
dest: '.docz/dist',
d: '.docz/dist',
editBranch: 'master',
eb: 'master',
'edit-branch': 'master',
config: '',
title: 'Component Controls Docz Example',
description: 'My awesome app using docz',
host: 'localhost',
port: 3000,
p: 3000,
separator: '-',
paths: {
root: '/Users/atanasster/component-controls/examples/docz',
templates:
'/Users/atanasster/component-controls/node_modules/docz-core/dist/templates',
docz: '/Users/atanasster/component-controls/examples/docz/.docz',
cache:
'/Users/atanasster/component-controls/examples/docz/.docz/.cache',
app: '/Users/atanasster/component-controls/examples/docz/.docz/app',
appPackageJson:
'/Users/atanasster/component-controls/examples/docz/package.json',
appTsConfig:
'/Users/atanasster/component-controls/examples/docz/tsconfig.json',
gatsbyConfig:
'/Users/atanasster/component-controls/examples/docz/gatsby-config.js',
gatsbyBrowser:
'/Users/atanasster/component-controls/examples/docz/gatsby-browser.js',
gatsbyNode:
'/Users/atanasster/component-controls/examples/docz/gatsby-node.js',
gatsbySSR:
'/Users/atanasster/component-controls/examples/docz/gatsby-ssr.js',
importsJs:
'/Users/atanasster/component-controls/examples/docz/.docz/app/imports.js',
rootJs:
'/Users/atanasster/component-controls/examples/docz/.docz/app/root.jsx',
indexJs:
'/Users/atanasster/component-controls/examples/docz/.docz/app/index.jsx',
indexHtml:
'/Users/atanasster/component-controls/examples/docz/.docz/app/index.html',
db:
'/Users/atanasster/component-controls/examples/docz/.docz/app/db.json',
},
},
},
{
resolve: 'gatsby-plugin-eslint',
options: {
test: /\.js$|\.jsx$/,
exclude: /.*/,
stages: ['develop'],
options: {
emitWarning: false,
failOnError: false,
},
},
},
{
resolve: 'gatsby-plugin-compile-es6-packages',
options: {
modules: ['docz', 'gatsby-theme-docz'],
},
},
],
}

const merge = mergeWith((objValue, srcValue) => {
if (Array.isArray(objValue)) {
return objValue.concat(srcValue)
}
})

module.exports = merge(config, custom)
Loading

0 comments on commit 7f5d5c6

Please sign in to comment.