当前位置:网站首页>Five minutes to develop your own code generator
Five minutes to develop your own code generator
2022-06-24 12:34:00 【Mr egg】
This article is very short , But full of sincerity Can not use 2 You can read it in minutes Then you'll probably be amazed Originally, I developed my own code generator , It's so simple
reminder : This article is about 《 The code generator of the new generation of small fresh meat 》 A continuation of , If you don't know ncgen This little fresh meat , Then you'd better go first Look One Look 《 The code generator of the new generation of small fresh meat 》
Daniel : Brother egg , After last goodbye , According to the method you taught me , I configured a code generator that fully met my needs in a few minutes , It's so powerful and simple
Mr. egg : Do as you say , I admire your hands-on ability
Daniel : Laugh, laugh . But I came here today with questions
Mr. egg : Wait a long time
Daniel : I put ncgen-config.js Hanging in the cloud , Then my friends complained that the command was too long to remember :
$ ncgen https://raw.githubusercontent.com/daniel-dx/vue3-ncgen-demo/master/ncgen-config.js Copy code
You see , Is it a little long ? Brother Dan, do you have any good suggestions ?
Mr. egg : Of course ,ncgen A very attractive scheme has been prepared for this purpose
Daniel : What fascinating scheme ? How charming ? Tell me, tell me
Mr. egg : That's it - adopt ncgen Rapid development of Your own code generator
Daniel :Wo~, My own , It sounds so refreshing , Yesterday ? Yesterday ?
Mr. egg : Suppose we now want to develop a code generator , Call vue-ncgen-demo-cli Well , Guess how many steps you can take ?
Daniel : I guess , Just one step .
Mr. egg : this , It's a bit too much , I can't do it , bye
Daniel : Joke, joke , Brother Dan, just say it straight
Mr. egg : Let's go in three steps
- First step : Generate code generator project
$ yarn create @ncgen/app # npm init @ncgen/app Copy code
- The second step : Write code generator logic
Found in the generated project ncgen-config.js , According to the logic of your code generator , Modify the configuration file
The sample configuration is here :github.com/daniel-dx/v…
Here's a tip , When you need to add subcommands , Except copy and paste , In fact, you can do it more gracefully by means of subcommands
cd vue-ncgen-demo-cli $ yarn create @ncgen/app add-sub # # npm init @ncgen/app add-sub Copy code
- The third step : To the world
$ npm run release Copy code
Daniel : Finished ?
Mr. egg : Yes , Finished , It's that simple
Daniel : How should my friends use this code generator ?
Mr. egg : Ash is often simple , Example walk
# install $ npm i vue-ncgen-demo-cli -g # Execute the main command to generate scaffold project $ vue-ncgen-demo-cli # Execute subcommands to insert code $ vue-ncgen-demo-cli add-component Copy code
Daniel : perfect , I can't wait to develop my own code generator
Mr. egg : Looking forward to your feedback
ncgen github: github.com/daniel-dx/n… 【 Please add one Star Chant 】
ncgen file :daniel-dx.github.io/ncgen/
keyword :ncgen, scaffolding, generator, Code generator , The scaffold
边栏推荐
- Process of solving easydss virtual live video jam and instability problems by replacing push-pull stream Library
- Data stack technology sharing: open source · data stack - extend flinksql to realize the join of flow and dimension tables
- Continuous testing | making testing more free: practicing automated execution of use cases in coding
- Variable parameter template implements max (accepts multiple parameters, two implementation methods)
- 怎样申请打新债 开户是安全的吗
- A good habit that makes your programming ability soar
- 9+! Predicting lymph node status from histology of colorectal cancer by deep learning
- Is it safe to open an account for how many new bonds you can apply for
- Pipeline shared library
- Istio practical skills: using prism to construct multi version test services
猜你喜欢

Linker --- linker

How to write controller layer code gracefully?
[mysql_16] variables, process control and cursors

微医CodeReview工具链
Cloud native database: the outlet of the database, you can also take off

一纸英雄帖,激起千层浪,横跨10国,一线大厂都派人来了!-GWEI 2022-新加坡

Installation and operation of libuv

GLOG from getting started to getting started

从《梦华录》的争议性,谈谈数字版权作品的价值泡沫

How stupid of me to hire a bunch of programmers who can only "Google"!
随机推荐
Clickhouse uses distributed join of pose series
Is it safe to open an account for how many new bonds you can apply for
5分+的单基因泛癌纯生信思路!
Google hacking search engine attack and Prevention
Automatic reconstruction of pod after modifying resource object
巧妙构思-铁死亡调节因子分型预后发6+
微医CodeReview工具链
Install MySQL in docker and modify my CNF profile
As one of the bat, what open source projects does Tencent have?
Popular science of data annotation: ten common image annotation methods
Speculation London gold short-term stable money making skills? Where is it safe to fry London gold?
MySQL 外键影响
Deep learning ~11+ a new perspective on disease-related miRNA research
Essential key steps in the construction of e-commerce live broadcast source code
Cryptography series: collision defense and collision attack
VaR in PHP_ export、print_ r、var_ Differences in dump debugging
The world's largest meat processor has been "blackmailed", how many industries will blackmail virus poison?
Opencv learning notes - loading and saving images
How do websites and we media tap user needs? Deeply expose the secrets behind the keywords!
Adjustment method of easynvr video platform equipment channel page display error