Skip to content

Commit

Permalink
feat: ts-md in own package
Browse files Browse the repository at this point in the history
  • Loading branch information
atanasster committed Jun 25, 2020
1 parent 7047031 commit d849383
Show file tree
Hide file tree
Showing 39 changed files with 339 additions and 76 deletions.
3 changes: 2 additions & 1 deletion core/config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"scripts": {
"build": "yarn cross-env NODE_ENV=production rollup -c",
"dev": "yarn cross-env NODE_ENV=development rollup -cw",
"docs": "ts-node -O '{\"module\": \"commonjs\" }' ../../scripts/docs.ts",
"docs": "ts-md",
"fix": "yarn lint --fix",
"lint": "yarn eslint . --ext mdx,ts,tsx",
"prepare": "yarn build",
Expand All @@ -36,6 +36,7 @@
"yargs": "^15.3.1"
},
"devDependencies": {
"@component-controls/ts-markdown-docs": "^1.3.0",
"@types/faker": "^4.1.9",
"@types/jest": "^25.1.2",
"cross-env": "^5.2.1",
Expand Down
71 changes: 36 additions & 35 deletions core/core/README.md

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion core/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"scripts": {
"build": "yarn cross-env NODE_ENV=production rollup -c",
"dev": "yarn cross-env NODE_ENV=development rollup -cw",
"docs": "ts-node -O '{\"module\": \"commonjs\"}' ../../scripts/docs.ts",
"docs": "ts-md",
"fix": "yarn lint --fix",
"lint": "yarn eslint . --ext mdx,ts,tsx",
"prepare": "yarn build",
Expand All @@ -38,6 +38,7 @@
"typescript": "^3.8.3"
},
"devDependencies": {
"@component-controls/ts-markdown-docs": "^1.3.0",
"@types/faker": "^4.1.9",
"@types/jest": "^25.1.2",
"cross-env": "^5.2.1",
Expand Down
3 changes: 2 additions & 1 deletion core/instrument/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"scripts": {
"build": "yarn cross-env NODE_ENV=production rollup -c",
"dev": "yarn cross-env NODE_ENV=development rollup -cw",
"docs": "ts-node -O '{\"module\": \"commonjs\"}' ../../scripts/docs.ts",
"docs": "ts-md",
"fix": "yarn lint --fix",
"lint": "yarn eslint . --ext mdx,ts,tsx",
"prepare": "yarn build",
Expand Down Expand Up @@ -49,6 +49,7 @@
"typescript": "^3.8.3"
},
"devDependencies": {
"@component-controls/ts-markdown-docs": "^1.3.0",
"@babel/types": "^7.9.0",
"@rollup/plugin-node-resolve": "^7.1.1",
"@types/find-cache-dir": "^3.2.0",
Expand Down
3 changes: 2 additions & 1 deletion core/loader/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"scripts": {
"build": "yarn cross-env NODE_ENV=production rollup -c",
"dev": "yarn cross-env NODE_ENV=development rollup -cw",
"docs": "ts-node -O '{\"module\": \"commonjs\" }' ../../scripts/docs.ts",
"docs": "ts-md",
"fix": "yarn lint --fix",
"lint": "yarn eslint . --ext mdx,ts,tsx",
"prepare": "yarn build",
Expand Down Expand Up @@ -46,6 +46,7 @@
"webpack": "^4.41.6"
},
"devDependencies": {
"@component-controls/ts-markdown-docs": "^1.3.0",
"@types/jest": "^25.1.2",
"@types/loader-utils": "^1.1.3",
"cross-env": "^5.2.1",
Expand Down
3 changes: 2 additions & 1 deletion core/store/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"scripts": {
"build": "yarn cross-env NODE_ENV=production rollup -c",
"dev": "yarn cross-env NODE_ENV=development rollup -cw",
"docs": "ts-node -O '{\"module\": \"commonjs\"}' ../../scripts/docs.ts",
"docs": "ts-md",
"fix": "yarn lint --fix",
"lint": "yarn eslint . --ext mdx,ts,tsx",
"prepare": "yarn build",
Expand All @@ -43,6 +43,7 @@
"typescript": "^3.8.3"
},
"devDependencies": {
"@component-controls/ts-markdown-docs": "^1.3.0",
"@types/jest": "^25.1.2",
"@types/webpack-env": "^1.15.1",
"cross-env": "^5.2.1",
Expand Down
3 changes: 2 additions & 1 deletion core/webpack-compile/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"scripts": {
"build": "yarn cross-env NODE_ENV=production rollup -c",
"dev": "yarn cross-env NODE_ENV=development rollup -cw",
"docs": "ts-node -O '{\"module\": \"commonjs\" }' ../../scripts/docs.ts",
"docs": "ts-md",
"fix": "yarn lint --fix",
"lint": "yarn eslint . --ext mdx,ts,tsx",
"prepare": "yarn build",
Expand All @@ -39,6 +39,7 @@
"webpack": "^4.43.0"
},
"devDependencies": {
"@component-controls/ts-markdown-docs": "^1.3.0",
"@types/jest": "^25.1.2",
"@types/memory-fs": "^0.3.2",
"cross-env": "^5.2.1",
Expand Down
3 changes: 2 additions & 1 deletion core/webpack-configs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"scripts": {
"build": "yarn cross-env NODE_ENV=production rollup -c",
"dev": "yarn cross-env NODE_ENV=development rollup -cw",
"docs": "ts-node -O '{\"module\": \"commonjs\" }' ../../scripts/docs.ts",
"docs": "ts-md",
"fix": "yarn lint --fix",
"lint": "yarn eslint . --ext mdx,ts,tsx",
"prepare": "yarn build",
Expand All @@ -37,6 +37,7 @@
},
"devDependencies": {
"@babel/preset-env": "^7.9.0",
"@component-controls/ts-markdown-docs": "^1.3.0",
"@types/jest": "^25.1.2",
"cross-env": "^5.2.1",
"eslint": "^6.5.1",
Expand Down
3 changes: 2 additions & 1 deletion integrations/gatsby-theme-stories/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"scripts": {
"build": "yarn cross-env NODE_ENV=production rollup -c",
"dev": "yarn cross-env NODE_ENV=development rollup -cw",
"docs": "ts-node -O '{\"module\": \"commonjs\"}' ../../scripts/docs.ts",
"docs": "ts-md",
"fix": "yarn lint --fix",
"lint": "yarn eslint . --ext mdx,ts,tsx",
"prepare": "yarn build",
Expand Down Expand Up @@ -50,6 +50,7 @@
"theme-ui": "next"
},
"devDependencies": {
"@component-controls/ts-markdown-docs": "^1.3.0",
"typescript": "^3.8.3"
},
"peerDependencies": {
Expand Down
3 changes: 2 additions & 1 deletion integrations/storybook/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"scripts": {
"build": "yarn cross-env NODE_ENV=production rollup -c",
"dev": "yarn cross-env NODE_ENV=development rollup -cw",
"docs": "ts-node -O '{\"module\": \"commonjs\"}' ../../scripts/docs.ts",
"docs": "ts-md",
"fix": "yarn lint --fix",
"lint": "yarn eslint . --ext mdx,ts,tsx",
"prepare": "yarn build",
Expand Down Expand Up @@ -53,6 +53,7 @@
"typescript": "^3.8.3"
},
"devDependencies": {
"@component-controls/ts-markdown-docs": "^1.3.0",
"@storybook/addons": "next",
"@storybook/api": "next",
"@storybook/client-api": "next",
Expand Down
103 changes: 103 additions & 0 deletions misc/storybook-custom-docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,16 @@
- [Simple page](#simple-page)
- [Render story](#render-story)
- [API](#api)
- [globalStoryId](#globalstoryid)
- [getCurrentStoryId](#getcurrentstoryid)
- [getGlobalOptions](#getglobaloptions)
- [getGlobalStoryId](#getglobalstoryid)
- [useContext](#usecontext)
- [useStoryId](#usestoryid)
- [CustomPageDef](#custompagedef)
- [CustomPageRenderFnParams](#custompagerenderfnparams)
- [CustomPageRenderFn](#custompagerenderfn)
- [UPDATE_STORY_CONTEXT](#update_story_context)

# In action

Expand Down Expand Up @@ -120,4 +130,97 @@ export default {

<!-- START-TSDOC-TYPESCRIPT -->

## globalStoryId

_defined in [@component-controls/storybook-custom-docs/src/index.tsx](https://github.com/ccontrols/component-controls/tree/master/misc/storybook-custom-docs/src/index.tsx#L38)_



## getCurrentStoryId

function returning the current story id

_defined in [@component-controls/storybook-custom-docs/src/index.tsx](https://github.com/ccontrols/component-controls/tree/master/misc/storybook-custom-docs/src/index.tsx#L25)_

**function** getCurrentStoryId(): string | undefined;

## getGlobalOptions

function returning the global options
parameters and decorators

_defined in [@component-controls/storybook-custom-docs/src/index.tsx](https://github.com/ccontrols/component-controls/tree/master/misc/storybook-custom-docs/src/index.tsx#L11)_

**function** getGlobalOptions(): any;

## getGlobalStoryId

_defined in [@component-controls/storybook-custom-docs/src/index.tsx](https://github.com/ccontrols/component-controls/tree/master/misc/storybook-custom-docs/src/index.tsx#L39)_

**function** getGlobalStoryId(): string;

## useContext

React hook - returns a context similar (but not identical) that can be used as an input attribute to \`&lt;DocsContainer />\`

_defined in [@component-controls/storybook-custom-docs/src/index.tsx](https://github.com/ccontrols/component-controls/tree/master/misc/storybook-custom-docs/src/index.tsx#L72)_

**function** useContext(): any;

## useStoryId

React hook hook that tracks the changes to the current story and returns it's id

_defined in [@component-controls/storybook-custom-docs/src/index.tsx](https://github.com/ccontrols/component-controls/tree/master/misc/storybook-custom-docs/src/index.tsx#L50)_

**function** useStoryId(): string;

## CustomPageDef

_defined in [@component-controls/storybook-custom-docs/src/types.ts](https://github.com/ccontrols/component-controls/tree/master/misc/storybook-custom-docs/src/types.ts#L29)_



### properties

| Name | Type | Description |
| --------- | ----------------------------------------- | ------------------------------ |
| `key*` | string | key used for router navigation |
| `render*` | [CustomPageRenderFn](#custompagerenderfn) | react render function. |
| `title*` | string | title of the page's tab |

## CustomPageRenderFnParams

Custom page default export
example:

_defined in [@component-controls/storybook-custom-docs/src/types.ts](https://github.com/ccontrols/component-controls/tree/master/misc/storybook-custom-docs/src/types.ts#L18)_



### properties

| Name | Type | Description |
| --------- | ------- | -------------------------------------------- |
| `active*` | boolean | is the page active (visible) or not (hidden) |

## CustomPageRenderFn

_defined in [@component-controls/storybook-custom-docs/src/types.ts](https://github.com/ccontrols/component-controls/tree/master/misc/storybook-custom-docs/src/types.ts#L25)_

**function** (`params`\*: [CustomPageRenderFnParams](#custompagerenderfnparams)): [React.ReactNode](#react.reactnode);

### parameters

| Name | Type | Description |
| --------- | ----------------------------------------------------- | ----------- |
| `params*` | [CustomPageRenderFnParams](#custompagerenderfnparams) | |
| `returns` | [React.ReactNode](#react.reactnode) | |

## UPDATE_STORY_CONTEXT

_defined in [@component-controls/storybook-custom-docs/src/types.ts](https://github.com/ccontrols/component-controls/tree/master/misc/storybook-custom-docs/src/types.ts#L51)_



<!-- END-TSDOC-TYPESCRIPT -->
3 changes: 2 additions & 1 deletion misc/storybook-custom-docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"scripts": {
"build": "yarn cross-env NODE_ENV=production rollup -c",
"dev": "yarn cross-env NODE_ENV=development rollup -cw",
"docs": "ts-node -O '{\"module\": \"commonjs\"}' ../../scripts/docs.ts",
"docs": "ts-md",
"fix": "yarn lint --fix",
"lint": "yarn eslint . --ext mdx,ts,tsx",
"prepare": "yarn build",
Expand All @@ -39,6 +39,7 @@
"react-dom": "^16.13.1"
},
"devDependencies": {
"@component-controls/ts-markdown-docs": "^1.3.0",
"@storybook/addons": "next",
"@storybook/api": "next",
"@storybook/client-api": "next",
Expand Down
1 change: 1 addition & 0 deletions misc/ts-markdown/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dist
21 changes: 21 additions & 0 deletions misc/ts-markdown/LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2020 Atanas Stoyanov

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
17 changes: 17 additions & 0 deletions misc/ts-markdown/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Table of contents

- [Overview](#overview)
- [Getting Started](#getting-started)
- [Install](#install)

# Overview

Markdown documentation generator/enhancer tailored mostly for typescript and react typescript projects

# Getting Started

## Install

```sh
yarn add @component-controls/ts-markdown-docs --dev
```
3 changes: 3 additions & 0 deletions misc/ts-markdown/bin/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env node
const run = require('../dist/index.js');
run();
55 changes: 55 additions & 0 deletions misc/ts-markdown/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{
"name": "@component-controls/ts-markdown-docs",
"version": "1.3.0",
"description": "Typescript documentation generator for markdown files",
"keywords": [
"markdown",
"typescript",
"readme"
],
"main": "bin/index.js",
"files": [
"dist/",
"package.json",
"README.md"
],
"scripts": {
"build": "yarn cross-env NODE_ENV=production rollup -c",
"dev": "yarn cross-env NODE_ENV=development rollup -cw",
"docs": "node .",
"fix": "yarn lint --fix",
"lint": "yarn eslint . --ext mdx,ts,tsx",
"prepare": "yarn build",
"test": "yarn jest --passWithNoTests"
},
"homepage": "https://github.com/ccontrols/component-controls",
"bugs": {
"url": "https://github.com/ccontrols/component-controls/issues"
},
"bin": {
"ts-md": "./bin/index.js"
},
"repository": {
"type": "git",
"url": "https://github.com/ccontrols/component-controls.git",
"directory": "misc/ts-markdown"
},
"license": "MIT",
"dependencies": {
"chalk": "^4.0.0",
"react-docgen-typescript": "^1.16.1",
"remark": "^11.0.2",
"remark-toc": "^7.0.0",
"typedoc": "^0.17.7",
"typescript": "^3.8.3",
"unified": "^9.0.0",
"yargs": "^15.3.1"
},
"publishConfig": {
"access": "public"
},
"authors": [
"Atanas Stoyanov"
],
"gitHead": "c5145d66c6b8a355839e53c3bca97fd361ce9377"
}
5 changes: 5 additions & 0 deletions misc/ts-markdown/rollup.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { config } from '../../rollup-config';

export default config({
input: ['./src/index.ts'],
});
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit d849383

Please sign in to comment.