ts-json-model
In Typescript development, it’s inevitable to write models; For the simple application of Model is not much, but for the complex and more models, more complex application, writing Model will become boring, tedious physical words; This tool is designed to solve a problem; Of course, the premise refers to the need to provide the corresponding Model json file.
The installation
$ npm install -g ts-json-model
Copy the code
use
Output current version
$ j2m --v
Copy the code
/ SRC /model is the output directory./ SRC /model is the output directory./ SRC /model.
{
"src": "./src/json"."output": "./src/model"
}
Copy the code
The keyword
_extend
: indicates the class to inherit. If it does not exist, create an empty class._name
: The name of the current object class.$
: ‘Custom class name’, if there is no live create an empty class.#{content}#
: Comments for fields/attributes
Run next
$ j2m
Copy the code
demo
The following uses the example provided by the module as an example to explain how to use it:
Directory structure:
run
npm run j2m
Copy the code
process
The results of
Introductions are over, call it a day!
Copy the code