Skip to content

Justin-Byrne/ClassGenerator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 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
│       │   │   └── 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 © 2023 - All rights reserved. ==