Magic Code Generator
WARNING: What is missing is a documentation about the model and how to create code templates. I am working on it. Be patient...
To install
This package needs to be installed globally to make it accessible from anywhere.
Exemple: npm -g install magiccode
Code is generated from templates located in the serviceTemplates directory. At first, a data model or schema is defined and then, code is generated from it.
When installed globally, the magic code generator can be in be used from anywhere either from a bash or a powershell.
To run an example:
1 - Download a model file from this link:
2 - Change the ouput directory path in the last line of the model (i.e the .mdl file).
Start ( Ledger, "insert here your ouput path where to store the generated files" );
3 - Finally, in bash or powershell run:
magic ledger.mdl
If you get an EACCES error, you should fix your permissions. You could also try using sudo, but this should be avoided: sudo npm install -g magiccode
Model definition
Model specifications are defined in an array of objects. Dependent on the needs, more than one service can be defined as well as more than one collection can also be specified. The relationship between all the objects, organized as a hierarchy of object type, is:
- server (only one)
- service (one or more)
- collection (one or more)
- service (one or more)
The model available from ledger.mdl provides an example of this hierarchical organization.
Updates
version 0.0.21
- added new documentation
version 0.0.20
- Bug fixes
- better template processing
version 0.0.19
- added a sample model as demo
version 0.0.18
- bug fixes
- added a new bootstrap template
version 0.0.17
- added new documentation
version 0.0.16
- added new templates for ionic, nativescript, bootstrap and mongoose/mongodb
- fixes several bugs
- improved user feedback by displaying the generated code as it is processed.
- better error handling.
version 0.0.15
Several bug fixes
version 0.0.14
fixed several problems in nativeScript_mongoose template
version 0.0.13
fixed runonce problem in the projectRegistry.
version 0.0.12
fixed error message
version 0.0.11
Several bug fixes. fixed parameters
version 0.0.10
Several bug fixes. Now it should run in the Mac environment.
files modified: magicCode.js, index and nativescript templates
- the compilers now provides more significant messages, including more significant error handlebars messages.
- The nativescript_mongoose template as now a service to access the backend. However, this latter is still under development and should be handled with care.
version 0.0.8
files modified: magicCode.js, index and nativescript templates
the magicCode compiler can now be used as a command line command. it is primed by the index command, which, in turn, execute in a different address space magicCode.js. Several features have been added:
- a new runone section will execute only one time. This is used when it is necessary to install a specific environment to run the code.
- a pre and post processing section is now fonctional
- several bugs have been fixed.