Code Monkey home page Code Monkey logo

biz-mock's People

Contributors

huoyanwuzhe629 avatar yanyu0517 avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

biz-mock's Issues

关于initFolder设计的一些建议和思考

目前biz-mock在执行initFolder时会默认在指定目录下生成两个文件夹:

|-- config
|-- mock

然后在各自的目录下生成标准结构和一些模板文件。每次执行initFolder时会把工程下模板文件覆盖到已有的目录下,这样会造成用户之前做的一些配置被重置。

关于这两个逻辑个人有一些思考:
一、biz-mock生成两个目录,一个叫mock,一个叫config
从设计简洁的原则出发,是否可以考虑合并成一个目录,比如只保留一个mock目录,mockConfig.json可以放到mock目录的根目录下。
这种设计对于开发者而言,理解成本可能会低一些,只需要定位到mock目录即可,所有和mock相关的配置及数据文件、模板都在这一个目录下;
对根目录保持简洁也有一定的裨益;

二、initFolder方法的覆盖逻辑
在一般使用场景,开发者可以人为去控制只执行initFolder一次。但是在流程工具中,为了达到简单的目的,可能会通过封装来屏蔽一些细节,比如用户可以执行一个命令:bizdp start就可以实现npm install、 webpack-dev-server、biz-mock start的功能。用户每次开发都需要执行这个命令,但显然并不希望上次已经创建的biz-mock的配置被重置。个人认为,这个防止覆盖的逻辑写在biz-mock里是否更为合理一些。
另外,initFolder方法的公开是为了方便开发者可以灵活指定mock配置和mock数据存放的目录,对于大多数开发者而言,如果仅仅想用默认的设置,仍然需要去手动调用一次initFolder,可否考虑直接在start中实现默认逻辑,如果用户不手动设置,就使用默认的路径。

个人建议,仅供参考!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.