build4code
Version:
The repository supports the NPM build process based on UML models created and managed with the JSONEditor4Code. A JSON file defines the attributes and methods of a class and a JSON editor running in a browser allows the generation of Javascript code. In t
603 lines (602 loc) • 35.1 kB
JSON
{
"data": {
"classname": "CodeGen",
"superclassname": " ",
"comment": "The repository supports the NPM build process based on UML models created and managed with the JSONEditor4Code. A JSON file defines the attributes and methods of a class and a JSON editor running in a browser allows the generation of Javascript code. In turn any alteration of the code in the folder src/ of the main Javascript code will update the UML model in the folder jscc/.",
"reposinfo": {
"JSCC_type": "CLASS",
"JSCC_version": "2",
"UML_editor": "https://niebert.github.io/ClassEditorUML",
"repository": "https://www.gitlab.com/user/reponame",
"static": "yes",
"debugheader": "no",
"require_classes": "yes",
"author": "User Name",
"email": "user on GitLab",
"created": "",
"modified": "",
"configcode": "// the configuration code will be used to create some constants",
"requirelist": []
},
"attributes": [
{
"visibility": "public",
"name": "mynumber",
"init": "45",
"comment": "the attribute stores ..."
}
],
"methods": [
{
"visibility": "public",
"name": "capitalizeFirstLetter",
"parameter": [
{
"name": "string",
"class": "String",
"comment": "the parameter provides ..."
}
],
"return": " ",
"comment": "the method performs ...",
"code": "\n return string.charAt(0).toUpperCase() + string.slice(1);\n"
},
{
"visibility": "public",
"name": "is_function",
"parameter": [
{
"name": "obj",
"class": "Object",
"comment": "the parameter provides ..."
}
],
"return": " ",
"comment": "the method performs ...",
"code": "\n // test if an object is a function\n return !!(obj && obj.constructor && obj.call && obj.apply);\n"
},
{
"visibility": "public",
"name": "load_file",
"parameter": [
{
"name": "pFilename",
"class": "String",
"comment": "the parameter provides ..."
}
],
"return": " ",
"comment": "the method performs ...",
"code": "\n //var fs = require('fs');\n var vContent = fs.readFileSync(pFilename, 'utf8');\n //console.log(vContent);\n if (vContent) {\n console.log(\"load_file('\" + pFilename + \"') was sucessful\");\n } else {\n vContent = \" \";\n console.log(\"WARNING: load_file('\" + pFilename + \"') has no content\");\n }\n return vContent;\n"
},
{
"visibility": "public",
"name": "save_file",
"parameter": [
{
"name": "pFilename",
"class": "String",
"comment": "the parameter provides ..."
},
{
"name": " pContent",
"class": "String",
"comment": "the parameter provides ..."
}
],
"return": " ",
"comment": "the method performs ...",
"code": "\n\tfs.writeFile(pFilename, pContent, function(err) {\n if(err) {\n return console.log(err);\n }\n console.log(\"The file '\" + pFilename + \"' was saved!\");\n });\n"
},
{
"visibility": "public",
"name": "load_json",
"parameter": [
{
"name": "pFilename",
"class": "String",
"comment": "the parameter provides ..."
}
],
"return": " ",
"comment": "the method performs ...",
"code": "\n // vJSON = require(pFilename);\n\tvar vJSON = null;\n if (fs.existsSync(pFilename)) {\n console.log(\"Found file '\" + pFilename + \"'\");\n\t\tvar vJSONstring = load_file(pFilename);\n\t try {\n\t vJSON = JSON.parse(vJSONstring);\n\t console.log(\"load_json('\" + pFilename + \"')\");\n\t // console.log(JSON.parse(vJSONstring));\n\t } catch (objError) {\n\t if (objError instanceof SyntaxError) {\n\t console.error(objError.name);\n\t } else {\n\t console.error(objError.message);\n\t }\n\t vJSON = null;\n\t }\n\n\t} else {\n\t\tconsole.error(\"File '\" + pFilename + \"' does not exist!'\");\n\t}\n return vJSON;\n"
},
{
"visibility": "public",
"name": "save_json",
"parameter": [
{
"name": "pFilename",
"class": "String",
"comment": "the parameter provides ..."
},
{
"name": "pJSON",
"class": "Object",
"comment": "the parameter provides ..."
}
],
"return": " ",
"comment": "the method performs ...",
"code": "\n var vContent = JSON.stringify(pJSON,null,4);\n save_file(pFilename,vContent);\n"
},
{
"visibility": "public",
"name": "concat_files_to_string",
"parameter": [
{
"name": "pFileArr",
"class": " ",
"comment": "the parameter provides ..."
}
],
"return": " ",
"comment": "the method performs ...",
"code": "\n var vOut = \"\";\n for (var i = 0; i < pFileArr.length; i++) {\n vOut += load_file(pFileArr[i]);\n }\n return vOut;\n"
},
{
"visibility": "public",
"name": "concat_libs",
"parameter": [
{
"name": "pFilename",
"class": " ",
"comment": "the parameter provides ..."
},
{
"name": "pLibArray",
"class": " ",
"comment": "the parameter provides ..."
}
],
"return": " ",
"comment": "the method performs ...",
"code": "\n console.log(\"Create Library '\"+pFilename+\"'\");\n concat(pLibArray, pFilename, function(err) {\n if (err) {\n console.log(\"ERROR: generating '\"+pFilename+\"'\\n\"+err);\n throw err;\n }\n console.log(\"File: '\"+pFilename+\"' generated for libraries successfully!\\n Libs:\\n \"+pLibArray.join(\"\\n \"));\n });\n"
},
{
"visibility": "public",
"name": "concat_main",
"parameter": [
{
"name": "pFilename",
"class": "String",
"comment": "the parameter provides ..."
},
{
"name": "pLibArray",
"class": " ",
"comment": "the parameter provides ..."
},
{
"name": "pkg",
"class": "Hash",
"comment": "the parameter provides ..."
}
],
"return": " ",
"comment": "the method performs ...",
"code": "\n var vLibTailArray = clone_json(pLibArray);\n vLibTailArray.push('./src/npm_tail.js');\n var vMainJS = pFilename || \"./\"+pkg.main;\n concat_libs(vMainJS,vLibTailArray);\n"
},
{
"visibility": "public",
"name": "concat_html",
"parameter": [
{
"name": "pFilename",
"class": "String",
"comment": "the parameter provides ..."
},
{
"name": "pFileArray",
"class": " ",
"comment": "the parameter provides ..."
},
{
"name": "pkg",
"class": "Hash",
"comment": "the parameter provides ..."
}
],
"return": " ",
"comment": "the method performs ...",
"code": "\n console.log(\"Create HTML '\"+pFilename+\"'\");\n concat(pFileArray, pFilename, function(err) {\n if (err) {\n console.log(\"ERROR: generating HTML '\"+pFilename+\"'\\n\"+err);\n throw err;\n }\n console.log(\"File: '\"+pFilename+\"' generated for HTML parts successfully!\\n HTML files:\\n \"+pFileArray.join(\"\\n \"));\n });\n\n"
},
{
"visibility": "public",
"name": "concat_css",
"parameter": [
{
"name": "pFilename",
"class": "String",
"comment": "the parameter provides ..."
},
{
"name": "pFileArray",
"class": " ",
"comment": "the parameter provides ..."
},
{
"name": "pkg",
"class": "Hash",
"comment": "the parameter provides ..."
}
],
"return": " ",
"comment": "the method performs ...",
"code": "\n console.log(\"Create CSS '\"+pFilename+\"'\");\n concat(pFileArray, pFilename, function(err) {\n if (err) {\n console.log(\"ERROR: generating CSS '\"+pFilename+\"'\\n\"+err);\n throw err;\n }\n console.log(\"File: '\"+pFilename+\"' generated from CSS style sheet files successfully!\\n CSS files:\\n \"+pFileArray.join(\"\\n \"));\n });\n\n"
},
{
"visibility": "public",
"name": "concat_readme",
"parameter": [
{
"name": "pFilename",
"class": "String",
"comment": "the parameter provides ..."
},
{
"name": "pFileArray",
"class": " ",
"comment": "the parameter provides ..."
},
{
"name": "pkg",
"class": "Hash",
"comment": "the parameter provides ..."
}
],
"return": " ",
"comment": "the method performs ...",
"code": "\n console.log(\"Create README file '\"+pFilename+\"'\");\n concat(pFileArray, pFilename, function(err) {\n if (err) {\n console.log(\"ERROR: generating HTML '\"+pFilename+\"'\\n\"+err);\n throw err\n }\n console.log(\"File: '\"+pFilename+\"' generated for HTML parts successfully!\\n README files:\\n \"+pFileArray.join(\"\\n \"));\n });\n\n"
},
{
"visibility": "public",
"name": "concat_libraries",
"parameter": [
{
"name": "pFilename",
"class": "String",
"comment": "the parameter provides ..."
},
{
"name": "pLibArray",
"class": "Array",
"comment": "the parameter provides ..."
},
{
"name": "pkg",
"class": "Hash",
"comment": "the parameter provides ..."
}
],
"return": " ",
"comment": "the method performs ...",
"code": "\n concat_libs(pFilename,pLibArray);\n var vLibTailArray = clone_json(pLibArray);\n vLibTailArray.push('./src/npm_tail.js');\n var vMainJS = \"./\"+pkg.main;\n concat_libs(vMainJS,vLibTailArray);\n"
},
{
"visibility": "public",
"name": "create_header",
"parameter": [
{
"name": "pkg",
"class": "Hash",
"comment": "the parameter provides ..."
}
],
"return": " ",
"comment": "the method performs ...",
"code": "\n var vFileName = \"npm_header.js\";\n var vHeader = get_header(pkg);\n save_file(\"./src/\"+vFileName , vHeader,\"Module Header file 'src/\"+vFileName +\"' was saved!\");\n"
},
{
"visibility": "public",
"name": "create_inherit",
"parameter": [
{
"name": "pkg",
"class": "Hash",
"comment": "the parameter provides ..."
}
],
"return": " ",
"comment": "the method performs ...",
"code": "\n var vInherit = \"\\n\";\n var vFileName = \"npm_inherit.js\";\n\tcheck_exportvar(pkg);\n if (pkg.hasOwnProperty(\"inherit\")) {\n vInherit += \"\\n\";\n vInherit += \"\\n//--------------------------------------\";\n vInherit += \"\\n//---Super Class------------------------\";\n vInherit += \"\\n// Inheritance: '\"+pkg.exportvar+\"' inherits from '\"+pkg.inherit+\"'\";\n vInherit += \"\\n\"+pkg.exportvar+\".prototype = new \"+pkg.inherit+\"();\";\n vInherit += \"\\n// Constructor for instances of '\"+pkg.exportvar+\"' has to updated.\";\n vInherit += \"\\n// Otherwise constructor of '\"+pkg.inherit+\"' is called\";\n vInherit += \"\\n\"+pkg.exportvar+\".prototype.constructor=\"+pkg.exportvar+\";\";\n vInherit += \"\\n// see http://phrogz.net/js/classes/OOPinJS2.html for explanation\";\n vInherit += \"\\n//--------------------------------------\";\n vInherit += \"\\n\";\n }\n save_file(\"./src/\"+vFileName, vInherit,\"create Inheritage code file 'src/\"+vFileName+\"' was saved!\");\n"
},
{
"visibility": "public",
"name": "create_inherit_static",
"parameter": [
{
"name": "pkg",
"class": "Hash",
"comment": "the parameter provides ..."
}
],
"return": " ",
"comment": "the method performs ...",
"code": "\n var vInherit = \"\\n\";\n\tvar vFileName = \"npm_inherit.js\";\n\tcheck_exportvar(pkg);\n if (pkg.hasOwnProperty(\"inherit\")) {\n vInherit += \"\\n\";\n vInherit += \"\\n//--------------------------------------\";\n vInherit += \"\\n//---Extend Module----------------------\";\n vInherit += \"\\n// The module '\"+pkg.exportvar+\"' extends '\"+pkg.inherit+\"' and\";\n vInherit += \"\\n// inherits all attributes and methods form '\"+pkg.inherit+\"'\";\n vInherit += \"\\n\"+pkg.exportvar+\" = \"+pkg.inherit+\";\";\n vInherit += \"\\n//--------------------------------------\";\n vInherit += \"\\n\";\n }\n save_file(\"./src/\"+vFileName, vInherit,\"create Inheritage code file 'src/\"+vFileName+\"' was saved!\");\n"
},
{
"visibility": "public",
"name": "create_tail",
"parameter": [
{
"name": "pkg",
"class": "Hash",
"comment": "the parameter provides ..."
}
],
"return": " ",
"comment": "the method performs ...",
"code": "\n var vTail = get_tail(pkg);\n var vFileName = \"npm_tail.js\";\n save_file(\"./src/\"+vFileName, vTail,\"Module Header file 'src/\"+vFileName+\"' was saved!\");\n"
},
{
"visibility": "public",
"name": "create_html_title",
"parameter": [
{
"name": "pkg",
"class": "Hash",
"comment": "the parameter provides ..."
}
],
"return": " ",
"comment": "the method performs ...",
"code": "\n\tvar vFileName = \"html_title.html\";\n\tcheck_exportvar(pkg);\n var vOut = `\n <title>` + pkg.exportvar + `</title>\n <meta http-equiv=\"author\" content=\"`+pkg.author+`\">\n`;\n\n\tsave_file(\"./src/\"+vFileName, vOut,\"create HTML Title code - file 'src/\"+vFileName+\"' was saved!\");\n"
},
{
"visibility": "public",
"name": "create_html_description",
"parameter": [
{
"name": "pkg",
"class": "Hash",
"comment": "the parameter provides ..."
}
],
"return": " ",
"comment": "the method performs ...",
"code": "\n var vFileName = \"html_description.html\";\n\tcheck_exportvar(pkg);\n var vOut = \"\";\n vOut += \"\\nThe library <tt>\"+pkg.exportvar+\"</tt> is a \"+pkg.description+\". \";\n vOut += \"\\nThe source code of \"+pkg.exportvar+\" can be downloaded as <a href=\\\"\" + get_zip_url(pkg) + \"\\\" target=\\\"_blank\\\">ZIP-file \"+pkg.name+\".zip</a>\";\n vOut += \"\\n\";\n save_file(\"./src/\"+vFileName, vOut,\"create HTML code - 'src/\"+vFileName+\"' was saved!\");\n"
},
{
"visibility": "public",
"name": "create_html_tail",
"parameter": [
{
"name": "pkg",
"class": "Hash",
"comment": "the parameter provides ..."
}
],
"return": " ",
"comment": "the method performs ...",
"code": "\n\tvar vFileName = \"html_tail.html\";\n\tvar vRepo = pkg.repository.url;\n\tvar vBegin = vRepo.indexOf(\"https:\");\n\tvar vEnd = vRepo.lastIndexOf(\".git\");\n\tvar vURL = pkg.repository.url;\n\tif ((vBegin >= 0) && (vEnd > vBegin)) {\n\t\tvURL = vRepo.substring(vBegin,vEnd);\n\t};\n var vOut = `\n\t <!-- BEGIN: src/`+vFileName+` -->\n\t <center style=\"font-size: 10px;\">\n\t\t\t <a href=\"`+vURL+`\" target=\"_blank\"> Git Sources `+pkg.exportvar+`</a> - <a href=\"`+ get_zip_url(pkg) + `\" target=\"_blank\">Download `+pkg.exportvar+` ZIP</a>\n\t\t\t <br>\n\t\t\t Version: `+pkg.version+` Date: `+getDateTime()+` Author: `+pkg.author+`\n\t </center>\n <!-- END: src/`+vFileName+` -->\n\n\t`;\n\tsave_file(\"./src/\"+vFileName, vOut,\"HTML Title code file 'src/\"+vFileName+\"' was saved!\");\n"
},
{
"visibility": "public",
"name": "create_readme_header",
"parameter": [
{
"name": "pkg",
"class": "Hash",
"comment": "the parameter provides ..."
}
],
"return": " ",
"comment": "the method performs ...",
"code": "\n var vFileName = \"readme_header.md\";\n\tcheck_exportvar(pkg);\n var vOut = \"\";\n vOut += \"# \"+pkg.exportvar;\n vOut += \"\\n`\"+pkg.exportvar+\"` is a \"+pkg.description;\n\tif (pkg.hasOwnProperty(\"demolink\")) {\n\t\tvOut += \"\\n* **[Demo \"+pkg.exportvar+\"](\" + pkg.demolink + \")**\";\n\t}\n vOut += \"\\n\";\n save_file(\"./src/\"+vFileName, vOut,\"README.md code file 'src/\"+vFileName+\"' was saved!\");\n"
},
{
"visibility": "public",
"name": "create_readme_install",
"parameter": [
{
"name": "pkg",
"class": "Hash",
"comment": "the parameter provides ..."
}
],
"return": " ",
"comment": "the method performs ...",
"code": "\n var vFileName = \"readme_install.md\";\n\tcheck_exportvar(pkg);\n var vOut = \"\\n\";\n vOut += \"\\n## Installation `\"+pkg.exportvar+\"`\";\n vOut += \"\\nIf you want to install `\"+pkg.exportvar+\"` in Node NPM use the following require-call:\";\n\tvOut += \"\\n```javascript\";\n\tvOut += \"\\nconst \"+pkg.exportvar+\" = require('\"+pkg.name+\"');\";\n vOut += \"\\nlet v\"+pkg.name+\" = new \"+pkg.exportvar+\"();\";\n\tvOut += \"\\n```\";\n\tvOut += \"\\nIf you want to use the library `\"+pkg.name+\".js` in a browser, please copy the file `dist/\"+pkg.name+\".js` into your library folder (e.g. `docs/js`) and\"\n vOut += \"\\nimport the library with `script`-tag with:\";\n vOut += \"\\n```html\";\n\tvOut += \"\\n<script src=\\\"js/\"+pkg.name+\".js\\\"></script>\";\n vOut += \"\\n```\";\n vOut += \"\\nNow it is possible to use the constructor of `\"+pkg.exportvar+\"`\";\n vOut += \"\\n```javascript\";\n\tvOut += \"\\nvar v\"+pkg.name+\" = new \"+pkg.exportvar+\"();\";\n\tvOut += \"\\n```\";\n\tvOut += \"\\n\";\n save_file(\"./src/\"+vFileName, vOut,\"README.md code file 'src/\"+vFileName+\"' was saved!\");\n"
},
{
"visibility": "public",
"name": "create_readme_inherit",
"parameter": [
{
"name": "pkg",
"class": "Hash",
"comment": "the parameter provides ..."
}
],
"return": " ",
"comment": "the method performs ...",
"code": "\n var vInherit = \"\\n\";\n var vFileName = \"readme_inherit.md\";\n\tcheck_exportvar(pkg);\n if (pkg.hasOwnProperty(\"inherit\")) {\n vInherit += \"\\n## Extension with a Super Class\";\n vInherit += \"\\nThe library `\"+pkg.exportvar+\"` extends the library `\"+pkg.inherit+\"` and `\"+pkg.exportvar+\"` inherits all attributes and methods from `\"+pkg.inherit+\"` \";\n vInherit += \"\\nThe inheritance for `\"+pkg.exportvar+\"` from `\"+pkg.inherit+\"` can defined with the following code:\";\n vInherit += \"\\n```javascript\";\n vInherit += \"\\n\"+pkg.exportvar+\" = \"+pkg.inherit+\";\";\n vInherit += \"\\n\"+pkg.exportvar.mymethod+\" = function (param1,param2) {\\n ...\\n};\";\n vInherit += \"\\n```\";\n vInherit += \"\\nNow the library `\"+pkg.exportvar+\"` has an additional method `mymethod()`.\";\n vInherit += \"\\n\";\n }\n save_file(\"./src/\"+vFileName, vInherit,\"Inheritage README file 'src/\"+vFileName+\"' was saved!\");\n"
},
{
"visibility": "public",
"name": "create_readme_inherit_static",
"parameter": [
{
"name": "pkg",
"class": "Hash",
"comment": "the parameter provides ..."
}
],
"return": " ",
"comment": "the method performs ...",
"code": "\n var vInherit = \"\\n\";\n var vFileName = \"readme_inherit.md\";\n\tcheck_exportvar(pkg);\n if (pkg.hasOwnProperty(\"inherit\")) {\n vInherit += \"\\n## Extension of Library `\"+pkg.inherit+\"`\";\n vInherit += \"\\nThe library `\"+pkg.exportvar+\"` extends the library `\"+pkg.inherit+\"` with additional feature and an extended API, so `\"+pkg.exportvar+\"` inherits all attributes and methods from `\"+pkg.inherit+\"` \";\n vInherit += \"\\nThe extension for `\"+pkg.exportvar+\"` from `\"+pkg.inherit+\"` can defined with the following code:\";\n vInherit += \"\\n```javascript\";\n vInherit += \"\\n\"+pkg.exportvar+\".prototype = new \"+pkg.inherit+\"();\";\n vInherit += \"\\n// Constructor for instances of '\"+pkg.exportvar+\"' must be updated.\";\n vInherit += \"\\n// Otherwise constructor of '\"+pkg.inherit+\"' is called\";\n vInherit += \"\\n\"+pkg.exportvar+\".prototype.constructor=\"+pkg.exportvar+\";\";\n vInherit += \"\\n```\";\n vInherit += \"\\nFor further details see http://phrogz.net/js/classes/OOPinJS2.html and explanation for inheritance with JavaScript.\";\n vInherit += \"\\n\";\n }\n save_file(\"./src/\"+vFileName, vInherit,\"Inheritage README file 'src/\"+vFileName+\"' was saved!\");\n"
},
{
"visibility": "public",
"name": "create_readme_devlibs",
"parameter": [
{
"name": "pkg",
"class": "Hash",
"comment": "the parameter provides ..."
}
],
"return": " ",
"comment": "the method performs ...",
"code": "\n var vFileName = \"readme_devlibs.md\";\n var vOut = \"\";\n vOut += getLibs4readme(pkg);\n vOut += getDevLibs4readme(pkg);\n save_file(\"./src/\"+vFileName, vOut,\"README.md code file 'src/\"+vFileName+\"' was saved!\");\n"
},
{
"visibility": "public",
"name": "create_readme_tail",
"parameter": [
{
"name": "pkg",
"class": "Hash",
"comment": "the parameter provides ..."
}
],
"return": " ",
"comment": "the method performs ...",
"code": "\n var vFileName = \"readme_tail.md\";\n var vOut = \"## NPM Library Information\";\n\tcheck_exportvar(pkg);\n vOut += \"\\n* Exported Module Variable: `\"+pkg.exportvar+\"`\";\n vOut += \"\\n* Package: `\"+pkg.name+\"`\";\n vOut += \"\\n* Version: `\"+pkg.version + \"` (last build \"+getDateTime()+\")\";\n vOut += \"\\n* Homepage: `\"+pkg.homepage+\"`\";\n vOut += \"\\n* License: \"+pkg.license;\n\tvOut += \"\\n* Date: \"+getDateTime();\n if (pkg.hasOwnProperty(\"inherit\")) {\n vOut += \"\\n* Inheritance: `\"+pkg.exportvar+\"` inherits from `\"+pkg.inherit+\"`\";\n }\n vOut += \"\\n* Require Module with:\";\n vOut += \"\\n```javascript\";\n vOut += \"\\n const v\"+pkg.exportvar+\" = require('\" + pkg.name+ \"');\";\n vOut += \"\\n```\";\n vOut += \"\\n* JSHint: installation can be performed with `npm install jshint -g`\";\n vOut += \"\\n\";\n save_file(\"./src/\"+vFileName , vOut,\"create README content - file 'src/\"+vFileName +\"' was saved!\");\n"
},
{
"visibility": "public",
"name": "create_script_tags4libs",
"parameter": [
{
"name": "pFilename",
"class": "String",
"comment": "the parameter provides ..."
},
{
"name": "pLibArray",
"class": "Array",
"comment": "the parameter provides ..."
},
{
"name": "pkg",
"class": "Hash",
"comment": "the parameter provides ..."
}
],
"return": " ",
"comment": "the method performs ...",
"code": "\n\tvar vLibURL = [];\n\tfor (var i = 0; i < pLibArray.length; i++) {\n\t\tvLibURL.push(\"../\"+pLibArray[i]);\n\t};\n\tvar vPrefix = \"\\n<script src='\";\n\tvar vPostfix = \"'></script>\";\n\tvar vOut = \"<!-- HTML code for embedding the source libraries into docs/index_src_libs.html -->\";\n\tvOut += vPrefix + vLibURL.join(vPostfix+vPrefix) + vPostfix;\n save_file(pFilename,vOut, \"Save '\"+pFilename+\"' as HTML code for embedding the source libraries\");\n"
},
{
"visibility": "public",
"name": "get_header",
"parameter": [
{
"name": "pkg",
"class": "Hash",
"comment": "the parameter provides ..."
}
],
"return": " ",
"comment": "the method performs ...",
"code": "\n\tcheck_exportvar(pkg);\n var vHeader = \"/* ---------------------------------------\";\n vHeader += \"\\n Exported Module Variable: \"+pkg.exportvar;\n vHeader += \"\\n Package: \"+pkg.name;\n vHeader += \"\\n Version: \"+pkg.version + \" Date: \"+getDateTime();\n vHeader += \"\\n Homepage: \"+pkg.homepage;\n vHeader += \"\\n Author: \"+pkg.author;\n vHeader += \"\\n License: \"+pkg.license;\n\tvHeader += \"\\n Date: \"+getDateTime();\n if (pkg.hasOwnProperty(\"inherit\")) {\n vHeader += \"\\n Inheritance: '\"+pkg.exportvar+\"' inherits from '\"+pkg.inherit+\"'\";\n }\n vHeader += \"\\n Require Module with:\";\n vHeader += \"\\n const \"+pkg.exportvar+\" = require('\" + pkg.name+ \"');\";\n\tif (pkg.is_constructor && pkg.is_constructor == true ) {\n\t\tvHeader += \"\\n var v\" + pkg.name+ \" = new \"+pkg.exportvar+\"();\";\n\t}\n //vHeader += \"\\n var compileCode = \"+pkg.exportvar+\".compile(vTemplate);\";\n vHeader += \"\\n JSHint: installation with 'npm install jshint -g'\";\n vHeader += \"\\n ------------------------------------------ */\";\n vHeader += \"\\n\";\n vHeader += \"\\n/*jshint laxcomma: true, asi: true, maxerr: 150 */\";\n vHeader += \"\\n/*global alert, confirm, console, prompt */\";\n vHeader += \"\\n\";\n\treturn vHeader\n"
},
{
"visibility": "public",
"name": "get_tail",
"parameter": [
{
"name": "pkg",
"class": "Hash",
"comment": "the parameter provides ..."
}
],
"return": " ",
"comment": "the method performs ...",
"code": "\n\tvar vTail = \"\\n\";\n\tcheck_exportvar(pkg);\n vTail += \"\\n// -------NPM Export Variable: \" +pkg.exportvar+ \"---------------\";\n //vTail += \"\\nmodule.exports = \"+pkg.exportvar+\";\";\n vTail += \"\\nmodule.exports = \"+pkg.exportvar+\";\";\n\n\treturn vTail\n"
},
{
"visibility": "public",
"name": "write_convert_json",
"parameter": [
{
"name": "srcPath",
"class": "String",
"comment": "the parameter provides ..."
},
{
"name": "savPath",
"class": "String",
"comment": "the parameter provides ..."
},
{
"name": " pJSON",
"class": "Object",
"comment": "the parameter provides ..."
}
],
"return": " ",
"comment": "the method performs ...",
"code": "\n fs.readFile(srcPath, 'utf8', function(err, contents) {\n var vContent = processJSON(contents,pJSON);\n if (vContent) {\n fs.writeFile (savPath, vContent, function(err) {\n if (err) throw err;\n //console.log('DONE: writeConvertJSON(\"'+savPath+'\",\"'+srcPath+'\",pJSON)-Call complete');\n });\n } else {\n console.log(\"ERROR writeConvertJSON(): generating '\"+savPath+\"' failed - no content generated\\n\");\n throw err;\n }\n\t});\n"
}
]
},
"settings": {
"extension4code": ".js",
"extension4json": "_uml.json",
"localclasslist": [
{
"name": "JSONEditor",
"initvalue": "new JSONEditor()",
"repo": "jsoneditor"
}
],
"remoteclasslist": [
{
"name": "LoadFile4DOM",
"initvalue": "new LoadFile4DOM()",
"repo": "loadfile4dom"
},
{
"name": "LinkParam",
"initvalue": "new LinkParam()",
"repo": "linkparam"
}
],
"baseclasslist": [
{
"name": "Array",
"initvalue": "[]"
},
{
"name": "Boolean",
"initvalue": "true"
},
{
"name": "Float",
"initvalue": "0.0"
},
{
"name": "Function",
"initvalue": "function my_fun() {}"
},
{
"name": "Document",
"initvalue": "document"
},
{
"name": "Integer",
"initvalue": "0"
},
{
"name": "String",
"initvalue": "\"\""
},
{
"name": "Hash",
"initvalue": "{}"
},
{
"name": "Object",
"initvalue": "null"
},
{
"name": "RegularExp",
"initvalue": "/search/g"
}
]
}
}