Skip to content

PlantUML class generator for JavaScript

License

Notifications You must be signed in to change notification settings

Justin-Byrne/ClassGenerator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

21 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

ClassGenerator

issues license

PlantUML class generator for JavaScript

Requirements

Program Function Optional Download
PlantUML Render UML images; PNG, SVG, etc... βœ… πŸ’Ύ
Graphviz Render linked UML images. βœ… πŸ’Ύ

Installation

Download a copy of this repository to your system.

Git clone

git clone https://github.com/Justin-Byrne/ClassGenerator.git

Usage

Help menu

python3 BuildClass.py {<source>} [<destination>] [flags] [args[|args...]]

PATHS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

source                       File or directory location of javascript file(s) to convert

                             usage:
                                 (single)    "/javascript/classes/one.js"
                                 (multiple)  "/javascript/classes"

destination                  File or directory location to save class diagrams

                                 usage:
                                     (single)    "/javascript/classes/output/one.txt"
                                     (multiple)  "/javascript/classes/output"

FLAGS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

-o, --omit "<filename>"      Omit the following filenames from the source directory

                             usage:
                                 (single)    --omit "file1"
                                 (multiple)  --omit "file1|file2|file3"

-s, --skin "<skinparam>"     Embed skin parameters within the class uml generated

                             usage:
                                 (single)    --skin "skinparam+one+1"
                                 (multiple)  --skin "skinparam+one+1|skinparam+two+2"

-m, --make "<image_type>"    Make the class generated diagram into an image

                             usage:
                                 (single)    --make "png"
                                 (multiple)  --make "png|svg|eps"

-l, --link                   Link available classes to generated class diagrams

                             usage: --link

-h, --help                   Display this help menu

                             usage: --help

Configuration

Configurations settings for each generated file can be set within ../app/config/config.txt.

These settings are commented out by default

####    FILE OMISSIONS
filename_one
filename_two
filename_three

####    SKIN PARAM
left to right direction
skinparam DefaultFontSize 16
skinparam DefaultFontName Courier New
skinparam ClassAttributeIconSize 0

####    IMAGE OUTPUT
png
svg
eps
eps:text
pdf
vdx
xmi
scxml
html
txt
utxt
latex
latex:nopreamble
braille

####    PLANTUML PATH
path=~/Programs/PlantUML

Note: for best results use the following skin-params:

skinparam DefaultFontSize 16
skinparam DefaultFontName Courier New

Examples

python3 BuildClass.py ~/Programs/JavaScript/Classes/class.js -m "png"

JavaScript PlantUml ( Text ) PlantUml ( PNG )
class ClassName
{
    _prop0 = 0;
    _prop1 = 'string';
    _prop2 = new Two;
    _prop3 = new Three;

    constructor ( ) { }

    set prop0 ( value ) { }
    get prop0 ( ) { }

    set prop1 ( value ) { }
    get prop1 ( ) { }

    set prop2 ( value ) { }
    get prop2 ( ) { }

    set prop3 ( value ) { }
    get prop3 ( ) { }
}
@startuml

class ClassName {
_prop0   {number}
_prop1   {string}
_prop2   {Object}
_prop3   {Object}
__ Setter __
prop0
prop1
prop2
prop3
__ Getter __
prop0
prop1
prop2
prop3
}
@enduml

python3 BuildClass.py ~/Programs/JavaScript/Classes/class.js -l -m "png"

JavaScript PlantUml ( Text ) PlantUml ( PNG )
/**
 * @class     {Object}  One
 * @property  {number}  prop0
 * @property  {string}  prop1
 * @property  {Two}     prop2
 * @property  {Three}   prop3
 *
 */
class One
{
    _prop0 = 0;
    _prop1 = 'string';
    _prop2 = new Two;
    _prop3 = new Three;

    constructor ( ) { }

    set prop0 ( value ) { }
    get prop0 ( ) { }

    set prop1 ( value ) { }
    get prop1 ( ) { }

    set prop2 ( value ) { }
    get prop2 ( ) { }

    set prop3 ( value ) { }
    get prop3 ( ) { }
}
@startuml

class One {
prop0   {number}
prop1   {string}
prop2   {Two}
prop3   {Three}
__ Setter __
prop0
prop1
prop2
prop3
__ Getter __
prop0
prop1
prop2
prop3
}
One *-- Three
One *-- Two

class Two {
prop0   {number}
prop1   {string}
prop2   {One}
prop3   {Three}
__ Setter __
prop0
prop1
prop2
prop3
__ Getter __
prop0
prop1
prop2
prop3
}

class Three {
prop0   {number}
prop1   {string}
prop2   {One}
prop3   {Two}
__ Setter __
prop0
prop1
prop2
prop3
__ Getter __
prop0
prop1
prop2
prop3
}
@enduml

Support

Please open an issue for support.

Structure

.
β”œβ”€β”€ docs
β”‚Β Β  β”œβ”€β”€ CHANGELOG.md
β”‚Β Β  └── FUNDING.yml
β”œβ”€β”€ source
β”‚Β Β  └── app
β”‚Β Β      β”œβ”€β”€ config
β”‚Β Β      β”‚Β Β  └── config.txt
β”‚Β Β      β”œβ”€β”€ core
β”‚Β Β      β”‚Β Β  β”œβ”€β”€ generator.py
β”‚Β Β      β”‚Β Β  └── linker.py
β”‚Β Β      β”œβ”€β”€ utilities
β”‚Β Β      β”‚Β Β  β”œβ”€β”€ custom
β”‚Β Β      β”‚Β Β  β”‚Β Β  β”œβ”€β”€ debug
β”‚Β Β      β”‚Β Β  β”‚Β Β  β”‚Β Β  └── view_arguments.py
β”‚Β Β      β”‚Β Β  β”‚Β Β  β”œβ”€β”€ filter
β”‚Β Β      β”‚Β Β  β”‚Β Β  β”‚Β Β  β”œβ”€β”€ filter_properties.py
β”‚Β Β      β”‚Β Β  β”‚Β Β  β”‚Β Β  └── filter_type.py
β”‚Β Β      β”‚Β Β  β”‚Β Β  β”œβ”€β”€ list
β”‚Β Β      β”‚Β Β  β”‚Β Β  β”‚Β Β  β”œβ”€β”€ get_column_max.py
β”‚Β Β      β”‚Β Β  β”‚Β Β  β”‚Β Β  └── replace_value.py
β”‚Β Β      β”‚Β Β  β”‚Β Β  └── validation
β”‚Β Β      β”‚Β Β  β”‚Β Β      β”œβ”€β”€ is_extension.py
β”‚Β Β      β”‚Β Β  β”‚Β Β      └── is_js_class.py
β”‚Β Β      β”‚Β Β  β”œβ”€β”€ system
β”‚Β Β      β”‚Β Β  β”‚Β Β  β”œβ”€β”€ file
β”‚Β Β      β”‚Β Β  β”‚Β Β  β”‚Β Β  β”œβ”€β”€ get_file_bounds.py
β”‚Β Β      β”‚Β Β  β”‚Β Β  β”‚Β Β  β”œβ”€β”€ get_file_omissions.py
β”‚Β Β      β”‚Β Β  β”‚Β Β  β”‚Β Β  β”œβ”€β”€ get_files.py
β”‚Β Β      β”‚Β Β  β”‚Β Β  β”‚Β Β  └── set_file.py
β”‚Β Β      β”‚Β Β  β”‚Β Β  β”œβ”€β”€ validation
β”‚Β Β      β”‚Β Β  β”‚Β Β  β”‚Β Β  β”œβ”€β”€ is_directory.py
β”‚Β Β      β”‚Β Β  β”‚Β Β  β”‚Β Β  β”œβ”€β”€ is_file.py
β”‚Β Β      β”‚Β Β  β”‚Β Β  β”‚Β Β  β”œβ”€β”€ is_flag.py
β”‚Β Β      β”‚Β Β  β”‚Β Β  β”‚Β Β  └── is_program.py
β”‚Β Β      β”‚Β Β  β”‚Β Β  β”œβ”€β”€ get_command_type.py
β”‚Β Β      β”‚Β Β  β”‚Β Β  β”œβ”€β”€ get_commands.py
β”‚Β Β      β”‚Β Β  β”‚Β Β  └── parse_commands.py
β”‚Β Β      β”‚Β Β  └── util.py
β”‚Β Β      └── BuildClass.py
β”œβ”€β”€ LICENSE
└── README.md

Copyright

Byrne-Systems

== Byrne-Systems Β© 2024 - All rights reserved. ==

About

PlantUML class generator for JavaScript

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages