1. #1
    Touch Premium Member
    Join Date
    Jan 2008
    Location
    Quebec, Canada
    Posts
    122
    Vote Rating
    1
    nbourdeau is on a distinguished road

      0  

    Question Advice for architecture

    Advice for architecture


    Ok. I searched the docs and forum but could not find an answer to my questions.
    So let's make a scenario.
    I want to create an ExtJS 4.2.x single page app.
    My web backend will be tomcat.
    I want to use sencha cmd to build the application. Mainly to have an optimized build with only the needed ExtJS framework classes.
    So, as I see it (by the docs), I have two options
    First is use the "sencha compile" only command to build a minimized js off all my application code.
    Second is use the "sencha generate app" to generate a complete app structure and then use all sencha commands to generate the stuff I need, and then build the app to have a complete app and optimized ExtJs build...
    My preferred option is the second one ...
    So here are my questions concerning project managment (dev, build, release):
    - Does this scenario supports using an .jsp page to be used ? Because I need some minimalist jsp logic to be embedded in the html...
    - How to manage dev vs release ? all the code is kept in a version control system. let's say I have an index.jsp page using the bootstrap dev environement. when in prod I want to use the builded app... I don't see a clean way of doing this... I am using ant to build my .war file
    - Also, if all the code for dev AND prod(builded) is in the same path under the webapp resources, all this will be packaged in the war and we don't want this. The goal is to deploy in production only the builded stuff. But if I want to test / dev my app, I need the dev files to be there. Again I don't see how I should manage this.

    Hope this is clear enough and that somebody here has the same needs and found solutions.
    I think the doc is missing some "entreprise ready" doc that goes beyond the "hello world" example and recommand some way of managing all the lifecycle of a project using sencha cmd considering we are not using only ExtJs, PHP and Apache ...

    With many developpers on a project, we need the build process not to be dependant on manual steps or such...

    thanks

  2. #2
    Sencha Premium Member varsos's Avatar
    Join Date
    Feb 2008
    Location
    Long Island, NY
    Posts
    342
    Vote Rating
    16
    varsos will become famous soon enough

      0  

    Default


    What you are doing is not much different than what many others are doing, including myself.
    I agree the second option is better.

    You can have a JSP instead of an html, simple sencha.cfg change (app.page.name=index.jsp)
    You can use ant script to run "sencha app build" and generate the build/production folder, and incorporate into the war file so you can switch between dev/prod at run time.
    Code:
      <target name="sencha-app-build" depends="sencha-app-refresh">
        <exec executable="sencha.exe" dir="${web.dir}/MyApp" >
          <arg value="app"/>
          <arg value="build"/>
        </exec>
      </target>
    You do not have to store the /build/production folder in source control.
    In the MyApp/index.jsp you can decide whether to redirect to the MyApp/build/production/index.jsp for prod or stay for dev.

    MyApp/index.jsp
    Code:
    <!DOCTYPE HTML><%
    . . .
    if(isProduction && !isRedirected){
      response.sendRedirect("build/production/index.jsp?redirected=y&" + request.getQueryString());
      return;
    }
    . . .
    %>
    <html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
        <title>...</title>
        <!-- <x-compile> -->
            <!-- <x-bootstrap> -->
                <link rel="stylesheet" href="bootstrap.css">
                <script type="text/javascript" src="/extjs/extjs42/ext-all-dev.js"></script>
                <script type="text/javascript" src="bootstrap.js"></script>
            <!-- </x-bootstrap> -->
            <script type="text/javascript" src="app.js"></script>
        <!-- </x-compile> -->
    </head>
    <body></body>
    </html>
    varsos

  3. #3
    Touch Premium Member
    Join Date
    Jan 2008
    Location
    Quebec, Canada
    Posts
    122
    Vote Rating
    1
    nbourdeau is on a distinguished road

      0  

    Default


    That is an acceptable option... but I don't like is that all the dev code + prod code is included in the war. It means the source code is accessible and the war is double sized because Ext is included two times etc ...
    Not that bad but I think there should be a more "clean" option ...

    I think I will try to use symlinks or such for dev time and/or configure ant to exclude all dev code from the "production" or "testing" build ....

  4. #4
    Sencha Premium Member varsos's Avatar
    Join Date
    Feb 2008
    Location
    Long Island, NY
    Posts
    342
    Vote Rating
    16
    varsos will become famous soon enough

      0  

    Default


    You can code in your ant script to exclude the extjs source in the root of the application or workspace and anything else you do not need.
    Extjs should be placed on the web server for the development mode index.jsp, no need to have inside the war..

    But including both dev and prod versions of the app in a single war file, makes it easy to have one war for dev/test/prod.
    In a public facing app you can choose to have only prod version, but unless you obfuscate, it is in vain the js file can be reformatted easily.
    varsos

Thread Participants: 1