javascript - Change project directory structure in Cordova - Stack Overflow

When we create a new project in cordova we get below folders:App|- hooks|- platforms|- plugins|- www|-

When we create a new project in cordova we get below folders:

App
 |- hooks
 |- platforms
 |- plugins
 |- www
 |- config.xml

But per our client has a standard project structure across the projects, they want project structure should be somewhat similar to like this:

App
|- build
|- plugins
|- release
    |- platforms
        |-Android
        |-ios
|- src
    |- www
|- config.xml

Is there anyway to achieve this structure (or basically chage the defauly project structure generated by cordova CLI) ? I searched a lot and didnt find any userful information regarding this. Kindly help me.

When we create a new project in cordova we get below folders:

App
 |- hooks
 |- platforms
 |- plugins
 |- www
 |- config.xml

But per our client has a standard project structure across the projects, they want project structure should be somewhat similar to like this:

App
|- build
|- plugins
|- release
    |- platforms
        |-Android
        |-ios
|- src
    |- www
|- config.xml

Is there anyway to achieve this structure (or basically chage the defauly project structure generated by cordova CLI) ? I searched a lot and didnt find any userful information regarding this. Kindly help me.

Share Improve this question asked Aug 31, 2015 at 6:46 Pradeep SimhaPradeep Simha 18.1k19 gold badges59 silver badges112 bronze badges 3
  • 1 Well if it is the standard structure for cordova, then why your clients are so eager to change that. Best you can do is write a grunt or gulp task and put release builds in release folder. – Mudasser Ajaz Commented Aug 31, 2015 at 7:12
  • Well it's their organisation standard structure, they need to follow it seams. – Pradeep Simha Commented Aug 31, 2015 at 7:22
  • If you change the cordova structure some thing won't work (or maybe any). – jcesarmobile Commented Sep 8, 2015 at 12:09
Add a ment  | 

1 Answer 1

Reset to default 9

In general, I find that 'standard project structure' is actually pretty specific to a particular language/context, or to a few with similar characteristics. And Cordova is its own particular context, with its own 'standard project structure'. And while you want to make life easy for your humans where you can, by reducing their cognitive friction when moving between contexts, you need to be flexible about that in cases that won't support it.

This is one of those cases. Significantly, Cordova simply doesn't offer any configuration options for the paths. The Cordova CLI has very specific, very rigid expectations, and doesn't offer to let us modify those expectations via an .rc file or something. It probably could, if someone wanted to prioritize that feature. But as of 5.x, it doesn't.

Our shop has hundreds of Cordova builds in production, created by many teams. And quite a few of those teams, ing from different languages and approaches, have attempted to impose their will upon Cordova and to rearrange its folder structure. (I'm on one such team right now...) To the very best of my knowledge, and from consultation with our resident go-to guy on Cordova, none of them have truly succeeded, at least not without significant hacky workarounds that exceeded the value of the alleged consistency. (Like scripts that copy all the files from where you want them, to where Cordova actually requires them, runs the build there, then cleans up again afterwards.)

I think that until Cordova explicitly supports alternate folder structures, folks are ill-advised to fight it on this. But this is opinion, not fact. The only fact is: Cordova doesn't itself support doing what you want to do, so it'll take you lots of work to get around that.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745327045a4622705.html

相关推荐

  • javascript - Change project directory structure in Cordova - Stack Overflow

    When we create a new project in cordova we get below folders:App|- hooks|- platforms|- plugins|- www|-

    5小时前
    10

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信