使用共享代码组织多应用程序项目 [英] Organize multi-app project with share code

查看:143
本文介绍了使用共享代码组织多应用程序项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个关于组织我的开发环境的严重问题(!!!);

我有两个应用程序:app1和app2。这些应用程序是使用OpenUI5编写的(但这个细节并不重要)。

app1和app2是相似的并且共享一些代码(例如登录代码)。
我使用git(使用git-flow)和两个远程repo,并且我有所有相同的代码重复。
现在我想优化我的开发流共享等号(登录代码)。

这是我的第一个想法:一个仓库包含我在这种类型的结构中的所有代码:

  repo 
| _____ share
| | ____ login.js
|
| _____ app1
| | _____ index.html
| | _____资源
| | _________ util1.js
| _____ app2
| _____ index.html
| _____资源
| _________ util2.js

我有两个时间状态:


  • 开发时间,其中每个index.html使用 resources / utilX.js ../ share / login.js

  • RELEASE时间其中每个index.html使用 resources / utilX.js resources / login.js



好!我可以为每个应用程序创建(使用grunt?)RELEASE;例如RELEASE的结果是

pre code $ app
index.html
资源
| _________ util1.js
| _________ login.js.js

我可以将app1文件夹推送至我的服务器,它工作正常!



但现在我有一些疑问:


  1. 使用git-flow我有master和develop分支;只有一个回购我只有一个mastes,因此当在app1上我想要发布一个版本时,我必须给新版本添加标签。我不喜欢它,我想要两个具有自己数字版本的应用程序。

  2. 最好有两个单独的repo(repo_app1& repo_app2)?在这种情况下,共享文件在哪里?

  3. 在其他(编译)语言中,我可以创建仅适用于应用程序的发行版本。 Grunt是准备推送到我的服务器上的app文件夹的正确方法吗?
  4. Git 子模块可能对您有所帮助。它将允许您将app1,app2和共享代码移至不同的回购站,然后将共享代码回购注入您的应用回购站。有关更多信息,请阅读文档


    I have a serious problem (!!!) about organizing my develop environment;

    I have two apps: app1 and app2. This apps are written using OpenUI5 (but this detail is not important)

    app1 and app2 are similar and share some code (for example the code to login). I use git (with git-flow) with two remote repo and I have all equal code duplicate. Now I want optimize my develop-flow sharing equal code (login code).

    This is my first idea: have only one repo contains all my code in a structure of this type:

    repo
    |_____share
    |     |____login.js
    |
    |_____app1
    |     |_____index.html
    |     |_____resources
    |           |_________util1.js
    |_____app2
          |_____index.html
          |_____resources
                |_________util2.js
    

    I have two time state:

    • DEVELOP time where each index.html uses resources/utilX.js and ../share/login.js
    • RELEASE time where each index.html uses resources/utilX.js and resources/login.js

    Good! I can create (using grunt?) a RELEASE for each app; for example the result of RELEASE is

    app1
    |_____index.html
    |_____resources
          |_________util1.js
          |_________login.js.js
    

    I can push app1 folder to my server and it works fine!

    But now I have some doubt:

    1. Using git-flow I have master and develop branch; with only one repo I have only one mastes and consequently when on app1 I want to do a release I must tag the full master with a new release. I don't like it, I would like two apps with their own number version
    2. Is better have two separate repo (repo_app1 & repo_app2)? And in this case where are the share files?
    3. In other (compiled)language I can create release version whit only compiled files of an app. Grunt is the right way to prepare the app folder to push on my server?

    解决方案

    Git Submodules might be helpful for you. It will allow you to move app1, app2 and shared code to different repos and then inject shared code repo to your app repos. For more information read documentation

    这篇关于使用共享代码组织多应用程序项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆