Coder Social home page Coder Social logo

krisztianb / typedoc-umlclass Goto Github PK

View Code? Open in Web Editor NEW
17.0 17.0 5.0 859 KB

Plugin for TypeDoc that generates UML class diagrams

License: ISC License

TypeScript 72.46% JavaScript 2.73% CSS 24.81%
diagrams plugin typedoc typedoc-plugin uml

typedoc-umlclass's People

Contributors

krisztianb avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

typedoc-umlclass's Issues

Improve performance

Dear @krisztianb

Which mode is the best to renderize the class diagram ?

mode setting

mode: 'file'

The render is fast.

mode: 'modules'

It takes long time and CPU 100% for rendering the class diagram.

Best Regards,
Youssef

TypeDoc 0.25.x support

The peer dependency declaration:

  "peerDependencies": {
        "typedoc": "0.23.x || 0.24.x"
   }

breaks compatibility with typedoc 0.25 due to dependency conflicts

Automatically determine number of CPUs

The plugin has an option to specify the number of processes that should be used to generate the diagrams. This option can speed up the plugin dramatically but can easily be overlooked.

It would make sense to detect the number of CPUs available on the system and use that value as the default value for the option instead of defaulting to 1.

Here is how this could be done: https://stackoverflow.com/questions/26049013/node-js-get-number-of-processors-available/37871843

UML CODE

Dear @krisztianb

UML CODE

Could you generate into a seperate file the uml code compatible plantuml ;-) and better if it is in a markdown file.

Best Regards,
Youssef

Sort class members by visibility

Currently in the class diagram the class/interface members (properties and methods) are sorted alphabetically. It makes sense to add an option to sort them by visibility: first static, then public, then protected and then private members.

Failure to load module with error for umlClassDiagramBoxBorderWidth value

When I attempt to run typedoc I get an error for a value being invalid.

Full stack is:

Error: The plugin /Project/node_modules/typedoc-umlclass could not be loaded.

Error: umlClassDiagramBoxBorderWidth must be >= 0
    at Object.convert (/usr/lib/node_modules/typedoc/dist/lib/utils/options/declaration.js:37:23)
    at Options.setOptionValueToDefault (/usr/lib/node_modules/typedoc/dist/lib/utils/options/options.js:119:64)
    at Options.addDeclaration (/usr/lib/node_modules/typedoc/dist/lib/utils/options/options.js:53:14)
    at PluginOptions.addToApplication (/Project/node_modules/typedoc-umlclass/dist/plugin_options.js:287:25)
    at Plugin.addOptionsToApplication (/Project/node_modules/typedoc-umlclass/dist/plugin.js:51:22)
    at Plugin.initialize (/Project/node_modules/typedoc-umlclass/dist/plugin.js:43:14)
    at load (/Project/node_modules/typedoc-umlclass/dist/index.js:9:27)
    at PluginHost.load (/usr/lib/node_modules/typedoc/dist/lib/utils/plugins.js:28:21)
    at CliApplication.bootstrap (/usr/lib/node_modules/typedoc/dist/lib/application.js:50:22)
    at CliApplication.bootstrap (/usr/lib/node_modules/typedoc/dist/lib/cli.js:29:30)
/usr/lib/node_modules/typedoc/dist/lib/utils/options/declaration.js:37
                throw new Error(getBoundsError(numberOption.name, numberOption.minValue, numberOption.maxValue));
                ^

Error: umlClassDiagramBoxBorderWidth must be >= 0
    at Object.convert (/usr/lib/node_modules/typedoc/dist/lib/utils/options/declaration.js:37:23)
    at Options.setOptionValueToDefault (/usr/lib/node_modules/typedoc/dist/lib/utils/options/options.js:119:64)
    at Options.reset (/usr/lib/node_modules/typedoc/dist/lib/utils/options/options.js:24:18)
    at CliApplication.bootstrap (/usr/lib/node_modules/typedoc/dist/lib/application.js:51:22)
    at CliApplication.bootstrap (/usr/lib/node_modules/typedoc/dist/lib/cli.js:29:30)
    at Object.<anonymous> (/usr/lib/node_modules/typedoc/bin/typedoc:5:5)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)

I am using typedoc with no other extensions.
I installed using the command "npm install typedoc-umlclass --save-dev"
I have tried adding a value to my typedoc.json for the umlClassDiagramBoxBorderWidth option with values of -1, 0, and 1; all failed.

Typedoc keeps hanging and generates a lot of logs

When I run typedoc with this plugin enabled, the console hangs at Documentation generated at ... and doesn't continue. The only thing that happens is that it keeps generating log-files hs_err_pidxxxx.log with a trace starting with There is insufficient memory for the Java Runtime Environment to continue. Also log files called replay_pid1000.log. I'm guessing this plugin consumes too much memory.

Console output:

> typedoc --umlClassDiagramType detailed --excludePrivate --tsconfig src/tsconfig.app.json --mode modules -module commonjs --exclude **/*.spec.ts --out documentation/typedoc src/app && documentation\serve-typedoc

Loaded plugin C:\Users\Werk\Desktop\beerhive\venuewebsite\node_modules\typedoc-umlclass

Using TypeScript 3.8.3 from C:\Users\Werk\Desktop\beerhive\venuewebsite\node_modules\typescript\lib
Rendering [========================================] 100%

Documentation generated at C:\Users\Werk\Desktop\beerhive\venuewebsite\documentation\typedoc

hs_err_pid1000.log
replay_pid1000.log

typedoc-config-uml.ts settings

Dear @krisztianb

Happy to see I can generate class-diagram now ;-)

This is my status after installing the plugin.

Typedoc-umclass-plugin : settings

Would you like to verify if my settings are the optimal to generate the uml class diagram ?

module.exports = {
    inputFiles: ['./src/'],
    mode: 'file',
    includeDeclarations: true,
    tsconfig: 'tsconfig.json',
    out: './docs/dist/docs-class-diagram/',
    excludePrivate: false,
    excludeProtected: false,
    excludeExternals: true,
    readme: './README.md',
    name: 'Demo Library project',
    ignoreCompilerErrors: true,
    plugin: 'typedoc-umlclass',
    listInvalidSymbolLinks: true,
    entryPoint: 'index',
    categorizeByGroup: true,
    media: './medias',
    version: '',
    gitRemote: 'remote',
    gitRevision: 'revision',
    theme: 'default',
    umlClassDiagramType: 'detailed',
    umlClassDiagramLocation: 'local',
    umlClassDiagramFormat: 'png',
    umlClassDiagramSectionTitle: 'Class-Diagram',
    umlClassDiagramPosition: 'above',
    umlClassDiagramHideEmptyMembers: 'false',
    umlClassDiagramTopDownLayoutMaxSiblings: 6,
    umlClassDiagramMemberVisibilityStyle: 'icon',
    umlClassDiagramHideCircledChar: 'false',
    umlClassDiagramHideShadow: 'false',
    // umlClassDiagramBoxBackgroundColor: 'transparent',
    // umlClassDiagramBoxBorderColor : 'transparent',
    umlClassDiagramBoxBorderRadius: 2,
    // umlClassDiagramBoxBorderWidth : 6,
    // umlClassDiagramArrowColor: 3,
    umlClassDiagramClassFontName: 'Courier',
    umlClassDiagramClassFontStyle: 'bold',
    umlClassDiagramClassAttributeFontStyle: 'italic'
};

Would you like to share the minimum required to optimize the rendering and get all the information.

Best Regards,
Youssef

Wrong return value of methods

Dear @krisztianb

If I compare the uml generated and the type of the methods, ... are not the same and missing information :

image

If I compare with other tools, the same class, I have this :

  • Your plugin :

image

  • vscode tools :

image

Best Regards,
Youssef

markdown table not rendered correctly

Dear @krisztianb

My config :

module.exports = {
    inputFiles: ['./src/'],
    mode: 'file',
    //mode: 'modules',
    includeDeclarations: true,
    tsconfig: 'tsconfig.json',
    out: './docs/dist/docs-class-diagram-files/',
    excludePrivate: false,
    excludeProtected: false,
    excludeExternals: true,
    readme: './README.md',
    name: 'Axon ACP protocol Library project',
    ignoreCompilerErrors: true,
    plugin: 'typedoc-umlclass',
    listInvalidSymbolLinks: true,
    entryPoint: 'index',
    categorizeByGroup: true,
    media: './docs/dist/docs-class-diagram/assets',
    version: '',
    gitRemote: 'remote',
    gitRevision: 'revision',
    theme: 'default',

    // Basic Settings
    umlClassDiagramType: 'detailed',
    umlClassDiagramLocation: 'embed',
    //umlClassDiagramFormat: 'png',
    umlClassDiagramFormat: 'svg',

    // HTML output
    umlClassDiagramSectionTitle: 'Class-Diagram',
    umlClassDiagramPosition: 'above',
    umlClassDiagramLegendType: 'full',
    //umlClassDiagramLegendType: 'none',
    //umlClassDiagramLegendType: 'only-included',

    // Class diagram formating
    umlClassDiagramMethodParameterOutput: 'complete',
    //umlClassDiagramMemberOrder: 'private-to-public',
    umlClassDiagramMemberOrder: 'public-to-private',
    //umlClassDiagramMemberOrder: 'abc',
    umlClassDiagramHideEmptyMembers: 'false',
    // umlClassDiagramTopDownLayoutMaxSiblings: 6,
    umlClassDiagramMemberVisibilityStyle: 'icon',
    umlClassDiagramHideCircledChar: 'false',
    umlClassDiagramHideShadow: 'false',
    //umlClassDiagramBoxBackgroundColor: transparent | #RGBHEX ,
    //umlClassDiagramBoxBorderColor: transparent | #RGBHEX ,
    umlClassDiagramBoxBorderRadius: 2,
    //umlClassDiagramBoxBorderWidth: 1,
    //umlClassDiagramArrowColor: #RGBHEX ,
    umlClassDiagramClassFontName: 'Courier',
    //umlClassDiagramClassFontSize: integer ,
    umlClassDiagramClassFontStyle: 'bold',
    //umlClassDiagramClassFontColor: transparent|#RGBHEX ,
    //umlClassDiagramClassAttributeFontName: font-name ,
    umlClassDiagramClassAttributeFontStyle: 'italic',
    //umlClassDiagramClassAttributeFontColor: transparent|#RGBHEX,

    // Other settings
    umlClassDiagramGeneratorProcessCount: 1,
    umlClassDiagramHideProgressBar: true,
    umlClassDiagramCreatePlantUmlFiles: true,
    umlClassDiagramVerboseOutput: false
};

The markdown is not rendered on 'Global' page and on each 'interface' the markdown comment + table are not rendered.

image

On 'type' and 'enum', I have the markdown content and table rendered.

Best regards,
Youssef

Add support for PlantUML picoweb

The latest PlantUML version includes a small web server called PicoWeb that can be used to generate class diagrams on the fly. It works just like the one on the PlantUML website.

More info here: https://plantuml.com/picoweb

We could extend the umlClassDiagramLocation option with another value to support this.

Maximum call stack size exceeded

Hi,

First of all thank you for the initiative for this package.
I installed the package and tried to generate the documentation but I got a Maximum call stack size exceeded error in return.

Have you ever had this problem before?

Thank you in advance

My package.json file.

{
  ...
  "devDependencies": {
    ...
    "typedoc": "0.18.0",
    "typedoc-plugin-mermaid": "1.3.0",
    "typedoc-plugin-pages": "1.0.1",
    "typedoc-umlclass": "0.2.2",
    "typescript": "3.9.7",
    ...
  }
}

My command line.

rimraf dist-doc && typedoc --out dist-doc --mode file --tsconfig src/tsconfig.json --theme pages-plugin types src

The error

Loaded plugin /.../node_modules/typedoc-plugin-mermaid
Loaded plugin /.../node_modules/typedoc-plugin-pages
Loaded plugin /.../node_modules/typedoc-umlclass

Using TypeScript 3.9.7 from /.../node_modules/typescript/lib
Rendering [==============--------------------------] 34%/.../node_modules/typedoc-umlclass/dist/typedoc/typedoc_utils.js:163
        let subTypes = new Array();
                       ^

RangeError: Maximum call stack size exceeded
    at Function.getSubTypesForReflection (/.../node_modules/typedoc-umlclass/dist/typedoc/typedoc_utils.js:163:24)
    at Function.getSubTypesForReflection (/.../node_modules/typedoc-umlclass/dist/typedoc/typedoc_utils.js:181:65)
    at Function.getSubTypesForReflection (/.../node_modules/typedoc-umlclass/dist/typedoc/typedoc_utils.js:181:65)
    at Function.getSubTypesForReflection (/.../node_modules/typedoc-umlclass/dist/typedoc/typedoc_utils.js:181:65)
    at Function.getSubTypesForReflection (/.../node_modules/typedoc-umlclass/dist/typedoc/typedoc_utils.js:181:65)
    at Function.getSubTypesForReflection (/.../node_modules/typedoc-umlclass/dist/typedoc/typedoc_utils.js:181:65)
    at Function.getSubTypesForReflection (/.../node_modules/typedoc-umlclass/dist/typedoc/typedoc_utils.js:181:65)
    at Function.getSubTypesForReflection (/.../node_modules/typedoc-umlclass/dist/typedoc/typedoc_utils.js:181:65)
    at Function.getSubTypesForReflection (/.../node_modules/typedoc-umlclass/dist/typedoc/typedoc_utils.js:181:65)
    at Function.getSubTypesForReflection (/.../node_modules/typedoc-umlclass/dist/typedoc/typedoc_utils.js:181:65)

Format functions in diagrams

Hi,

I started to use this extension. However, I noticed that the generated graphs are quite hard to read due to the lack of formatting.

Could it be possible to add some formatting, e.g. putting functions and argument names in bold, putting the return value in italic/red, or whatever, to improve the graphs readability ?

It seems possible as I saw that plantUML allows some formatting :
https://plantuml.com/en/creole

Cordially,

Move options into object

The plugin has a lot of options that are all prefixed with umlClassDiagram. It would make sense to move these into an object and so get rid of having to prefix each option with the same string.

TypeDoc 0.24.x support

The plugin does not seem to support typedoc 0.24.x and gives the error:
" Tried to set an option (umlClassDiagram) that was not declared"

0.23.x works perfectly fine

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.