{"id":19620594,"url":"https://github.com/jpiazzal/ts2doc","last_synced_at":"2025-04-28T03:32:07.026Z","repository":{"id":64046190,"uuid":"571974202","full_name":"jpiazzal/ts2doc","owner":"jpiazzal","description":"Parse exported declarations from typescript files into object, for documentation","archived":false,"fork":false,"pushed_at":"2025-02-20T15:27:46.000Z","size":4918,"stargazers_count":7,"open_issues_count":2,"forks_count":3,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-21T10:53:41.523Z","etag":null,"topics":["documentation","hacktoberfest","json","storybook","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jpiazzal.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2022-11-29T09:40:26.000Z","updated_at":"2025-02-20T15:27:49.000Z","dependencies_parsed_at":"2025-04-10T15:03:07.691Z","dependency_job_id":"11073fea-5305-4eb4-b044-e9c4d9beef20","html_url":"https://github.com/jpiazzal/ts2doc","commit_stats":{"total_commits":66,"total_committers":1,"mean_commits":66.0,"dds":0.0,"last_synced_commit":"12e1a645771ef31b2798889aa9d79f2d3107e5a8"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jpiazzal%2Fts2doc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jpiazzal%2Fts2doc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jpiazzal%2Fts2doc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jpiazzal%2Fts2doc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jpiazzal","download_url":"https://codeload.github.com/jpiazzal/ts2doc/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251246151,"owners_count":21558759,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["documentation","hacktoberfest","json","storybook","typescript"],"created_at":"2024-11-11T11:19:23.443Z","updated_at":"2025-04-28T03:32:06.427Z","avatar_url":"https://github.com/jpiazzal.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ts2doc\n\nTs2doc is a tool to generate documentation from TypeScript exported declarations (interfaces, classes, functions, etc.).\n\nFor now it can be used as a **storybook addon**.\n\nIf you like this project, please give it a star ⭐️\n\n## Install storybook addon\n\n```sh\nnpm install --save-dev @ts2doc/storybook-addon\n```\n\n## Example\n\n![Interface example](docs/images/interface-example.png)\n\nIs displayed from the following TypeScript interface:\n\n```ts\n/**\n * A movie is a piece of media that is intended to be viewed as a film.\n * @link https://wikipedia.org/wiki/Film | Useful link\n */\nexport interface Movie extends Media {\n    /**\n     * The title of the movie\n     */\n    readonly title: string;\n    /**\n     * The year the movie was released\n     * @type {Date}\n     */\n    year: number;\n    /**\n     * The rating of the movie\n     * @link https://wikipedia.org/wiki/Film_rating_system Film rating system\n     * @default 0\n     */\n    rating?: number;\n    genres: string[];\n    /**\n     * The actors in the movie\n     */\n    cast: Actor[];\n    /**\n     * @deprecated\n     */\n    director: Director;\n}\n```\n\n## Usage\n\nTo display the example above, you need to:\n\n### Setup storybook addon\n\nIn your `main.js` file:\n\n```js\n/* .storybook/main.js */\n\nmodule.exports = {\n    addons: [\n        // ... other addons\n        {\n            name: '@ts2doc/storybook-addon',\n            options: {\n                patternDocType: 'src/**/*.ts',\n                compilerOptions: {} // Optional\n            }\n        }\n    ]\n};\n```\n\n**patternDocType:**\n\nThe pattern to find the files to document, using [glob](https://www.npmjs.com/package/glob) syntax. The pattern will be resolved from your project root.\n\n**compilerOptions:**\n\nOptional. The compiler options to use to parse the files. If not provided, the default compiler options will be used.\nSee [compiler options](https://www.typescriptlang.org/docs/handbook/compiler-options.html) for more information.\n\n### Write your stories\n\nIn your `.mdx` file, to document a TypeScript exported declaration:\n\n**/!\\ It only works with `.mdx` files**\n\n```js\n/* src/movie.stories.mdx */\n\nimport { Meta } from '@storybook/addon-docs';\nimport { InterfaceDoc } from '@ts2doc/components';\n// Always import the doc.json file with the following path\nimport doc from '.cache/ts2doc/doc.json';\n\n\u003cMeta title=\"Docs/Interfaces\" /\u003e\n\n\u003cInterfaceDoc doc={doc.Movie} /\u003e\n```\n\nThe `doc` variable is the content of the `doc.json` file generated by the addon in your `node_modules` folder at `node_modules/.cache/ts2doc/doc.json`.\n\n**Title:**\n\nIf you want to update the title of the `Doc`, you can use the `title` prop:\n\n```js\nimport { InterfaceDoc } from '@ts2doc/components';\n// ...\n\u003cInterfaceDoc doc={doc.Movie} title=\"Movie\" /\u003e;\n```\n\n**Description:**\n\nIf you want to update the description of the `Doc`, you can use the `description` prop:\n\n```js\nimport { InterfaceDoc } from '@ts2doc/components';\n// ...\n\u003cInterfaceDoc doc={doc.Movie} description=\"Some description\" /\u003e;\n```\n\n## More examples\n\nMore examples can be found in the [examples](examples/storybook-app/) folder.\n\n## Supported declarations\n\n| Declaration | Supported |\n| ----------- | --------- |\n| `interface` | ✅        |\n| `JSDOC`     | ✅        |\n| `variable`  | ❌        |\n| `function`  | ❌        |\n| `type`      | ❌        |\n| `enum`      | ❌        |\n| `class`     | ❌        |\n| `namespace` | ❌        |\n\nJSDoc tags supported:\n\n-   `@type`\n-   `@link`\n-   `@default`\n-   `@deprecated`\n\n## Roadmap\n\n-   [x] Add support for `interface`\n-   [x] Add support for JSDoc `@type`, `@link`, `@default` and `@deprecated`\n-   [ ] Add support for `variable`\n-   [ ] Add support for `enum`\n-   [ ] Add support for `type`\n-   [ ] Add support for `function`\n-   [ ] Add support for `class`\n-   [ ] Add support for `namespace`\n\nIf you have a suggestion or you want to contribute, feel free to open an issue or a PR.\n\n## Contributing\n\nAny contributions you make are greatly appreciated.\n\n1. Fork the Project\n2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)\n3. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)\n4. Push to the Branch (`git push origin feature/AmazingFeature`)\n5. Open a Pull Request\n\n## Development\n\n### Install dependencies\n\n```sh\nnpm ci\n```\n\n### Build addon\n\n```sh\nnpm run build\n```\n\n### Start storybook app\n\n```sh\nnpm start\n```\n\n### Lint\n\n```sh\nnpm run lint\n```\n\n### Test\n\n```sh\nnpm test\n```\n\n## License\n\nDistributed under the `MIT` License. See `LICENSE` file for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjpiazzal%2Fts2doc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjpiazzal%2Fts2doc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjpiazzal%2Fts2doc/lists"}