Skip to content

Commit b298d59

Browse files
authoredMay 31, 2018
refactor(_meta): replace with build time JSON (Semantic-Org#2840)
* feat(docs): generate individual *.docs.json files * chore(src): remove static _meta * docs(CONTRIBUTING.md): remove _meta instructions * typo(docs): fix docblock casing * refactor(componentInfo): from _meta to docs.json * refactor(subComponent): casing to subcomponent * refactor(commonTests): work with *.info.json * fix(implementsShorthandProp): remove _meta * refactor(withDocInfo): to use *.info.json files * wip DocsRoot dynamic require * refactor(ComponentDoc): use *.info.json files * refactor(Sidebar): use *.info.json files * fix(DocsRoot): handle info.description * feat(ComponentProps): closed by default * fix(ComponentDoc): use *.info.json and simplify * fix(ComponentDocLinks): add suiName * fix(ComponentSidebarSection): update menu json * component menu and example menu json, fix maximize * feat(DocsRoot): async load component info * wip props and bugs * remove cruft, cleanup * fix dockblock typo, docblock * fix(ComponentTable): use props.name for key * fix(ComponentProp): displayName to name * fix(ComponentProps): clear active state on change * fix clicking subcomponent props * fix(ExternalExampleLayout): use example path name * fix tests * rebuild json files on change, rework build tasks * fix tsd:test script * fix(ComponentDoc): missing descriptions * wip split example menu json * prettier ignore generated json * normalize imports * chore(package): add yarn ci command * chore(package): add babel plugin dynamic import
1 parent 2d2d509 commit b298d59

File tree

262 files changed

+3430
-4583
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

262 files changed

+3430
-4583
lines changed
 

‎.babelrc

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"@babel/plugin-proposal-class-properties",
88
"@babel/plugin-proposal-export-default-from",
99
"@babel/plugin-proposal-export-namespace-from",
10+
"@babel/plugin-syntax-dynamic-import",
1011
"lodash",
1112
"transform-react-handled-props",
1213
["transform-react-remove-prop-types", {

‎.github/CONTRIBUTING.md

+8-44
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ CONTRIBUTING
1111
- [Commands](#commands)
1212
- [Workflow](#workflow)
1313
- [Create a Component](#create-a-component)
14-
- [Define _meta](#define-_meta)
1514
- [Using propTypes](#using-proptypes)
1615
- [Conformance Test](#conformance-test)
1716
- [Open A PR](#open-a-pr)
@@ -80,6 +79,8 @@ Please follow the [Angular Git Commit Guidelines][8] format.
8079
```sh
8180
yarn start // run doc site
8281

82+
yarn ci // run all checks CI runs
83+
8384
yarn test // test once
8485
yarn test:watch // test on file change
8586

@@ -98,7 +99,6 @@ yarn lint:watch // lint on file change
9899
## Workflow
99100

100101
- [Create a Component](#create-a-component)
101-
- [Define _meta](#define-_meta)
102102
- [Conformance Test](#conformance-test)
103103
- [Open A PR](#open-a-pr)
104104
- [Spec out the API](#spec-out-the-api)
@@ -127,41 +127,6 @@ class Dropdown extends Component {
127127

128128
>You probably need to extend our [`AutoControlledComponent`](#autocontrolledcomponent) to support both [controlled][2] and [uncontrolled][3] component patterns.
129129
130-
### Define _meta
131-
132-
Every component has a static property called `_meta`. This object defines the component. The values here are used for generated documentation, generated test cases and some utilities.
133-
134-
Here's an example `_meta` object:
135-
136-
```js
137-
import { META } from '../../lib'
138-
139-
const _meta = {
140-
name: 'MyComponent',
141-
type: META.TYPES.MODULE,
142-
}
143-
```
144-
145-
Assuming the above `_meta` is in scope, here's how you should expose it:
146-
147-
```js
148-
function MyComponent() {
149-
return <div>Hello World</div>
150-
}
151-
152-
MyComponent._meta = _meta
153-
```
154-
155-
```js
156-
class MyComponent {
157-
static _meta = _meta
158-
159-
render() {
160-
return <div>Hello World</div>
161-
}
162-
}
163-
```
164-
165130
### Using propTypes
166131

167132
Every component must have fully described `propTypes`.
@@ -390,7 +355,7 @@ There are many common things to test for. Because of this, we have [`test/specs
390355
```js
391356
common.isConformant()
392357
common.hasUIClassName()
393-
common.hasSubComponents()
358+
common.hasSubcomponents()
394359
common.isTabbable()
395360
common.rendersChildren()
396361

@@ -420,7 +385,7 @@ describe('Menu', () => {
420385
common.isConformant(Menu)
421386
common.hasUIClassName(Menu)
422387
common.rendersChildren(Menu)
423-
common.hasSubComponents(Menu, [MenuItem]) // some take additional arguments
388+
common.hasSubcomponents(Menu, [MenuItem]) // some take additional arguments
424389
})
425390
```
426391

@@ -445,7 +410,6 @@ This is the only required test. It ensures a consistent baseline for the framew
445410

446411
>This list is not updated, check the [source][1] for the latest assertions.
447412
448-
1. The [static `_meta`](#_meta) object is valid
449413
1. Component and filename are correct
450414
1. Events are properly handled
451415
1. Extra `props` are spread
@@ -489,7 +453,7 @@ TODO
489453
- [Props](#props)
490454
- [Examples](#examples)
491455

492-
Our docs are generated from doc block comments, `propTypes`, and hand written examples.
456+
Our docs are generated from docblock comments, `propTypes`, and hand written examples.
493457

494458
### Website
495459

@@ -501,7 +465,7 @@ yarn start
501465

502466
### Components
503467

504-
A doc block should appear above a component class or function to describe it:
468+
A docblock should appear above a component class or function to describe it:
505469

506470
```js
507471
/**
@@ -515,7 +479,7 @@ function Select(props) {
515479

516480
### Props
517481

518-
A doc block should appear above each prop in `propTypes` to describe them:
482+
A docblock should appear above each prop in `propTypes` to describe them:
519483

520484
>Limited props shown for brevity.
521485
@@ -539,7 +503,7 @@ Label.propTypes = {
539503
/** Place the label in one of the upper corners . */
540504
corner: PropTypes.oneOfType([
541505
PropTypes.bool,
542-
PropTypes.oneOf(Label._meta.props.corner),
506+
PropTypes.oneOf(['left', 'right']),
543507
]),
544508

545509
/** Add an icon by icon className or pass an <Icon /> */

0 commit comments

Comments
 (0)