当前位置:网站首页>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
边栏推荐
- About Adobe Photoshop adjusting selection
- Argo 全家桶如何让 DevOps 变的更容易?
- VaR in PHP_ export、print_ r、var_ Differences in dump debugging
- JVM GC garbage collection detailed introduction quick check of learning notes
- 怎样申请打新债 开户是安全的吗
- Tsingsee green rhino video "cloud side end" +ai intelligent security system is integrated into the mainstream development trend
- How can I open an account with new bonds? Is it safe
- A flaw in R markdown: folders cannot have Chinese
- Ten thousand campus developers play AI in a fancy way. It's enough to see this picture!
- [tke] GPU node NVIDIA Tesla driver reinstallation
猜你喜欢

How can a shell script (.Sh file) not automatically close or flash back after execution?
Database migration tool flyway vs liquibase (II)

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

文本转语音功能上线,可以体验专业播音员的服务,诚邀试用
Cloud native database: the outlet of the database, you can also take off

《回归故里》阅读笔记
Deep parsing and implementation of redis pub/sub publish subscribe mode message queue

ArrayList # sublist these four holes, you get caught accidentally

MySQL 外键影响

FreeRTOS overview and experience
随机推荐
5 points + single gene pan cancer pure Shengxin idea!
怎样申购打新债 开户是安全的吗
Tencent cloud and the ICT Institute launched the preparation of the "cloud native open source white paper" to deeply interpret cloud native
Deep learning ~11+ a new perspective on disease-related miRNA research
LS-DYNA新手入门经验
Go basic series | 1 Leading
I'm in Shenzhen. Where can I open an account? Is it safe to open an account online now?
Is it safe to apply for new bonds to open an account
How can I open an account with new bonds? Is it safe
How to check the situation that the national standard platform easygbs equipment video cannot be accessed by grabbing packets?
99% of the students can't write good code because of this problem!
Google hacking search engine attack and Prevention
微医CodeReview工具链
Popular science of data annotation: ten common image annotation methods
How to make Baidu quickly include its own personal website?
2021-06-02: given the head node of a search binary tree, it will be transformed into an ordered two-way linked list with head and tail connected.
Cryptography series: collision defense and collision attack
Conceptual analysis of DDD Domain Driven Design
Opencv learning notes - loading and saving images
嵌入式必学!硬件资源接口详解——基于ARM AM335X开发板 (下)