#7976 JSX support

v1.3.2
closed
sf-2 (994)
General
Heith Seewald
2015-10-05
2015-08-24
No

We may need JSX support for [#7920] If so, we'll need to configure things like:

  • JSX compiling for development (with minimal dependencies added)
    • step-by-step instructions
    • Docker setup
  • script or something to run it for final "production-ready" output
  • run that script during asf-release.sh so that our releases don't require JSX tools to be installed

Related

Tickets: #7920

Discussion

  • Dave Brondsema

    Dave Brondsema - 2015-09-08

    Also consider https://babeljs.io/, Gulp, Broccoli.

    At some point maybe we'll want this system to replace things that EasyWidgets does for js/css minification and concatenation too.

     
  • Dave Brondsema

    Dave Brondsema - 2015-09-08
    • labels: --> sf-current, sf-2
     
  • Dave Brondsema

    Dave Brondsema - 2015-09-17
    • status: open --> in-progress
    • assigned_to: Dave Brondsema
     
  • Dave Brondsema

    Dave Brondsema - 2015-09-17

    Grunt is "old". Gulp would be fine, but perhaps slow (no partial or cached builds). Brunch has partial builds, but isn't too popular and favors conventions (which we would fight with since we have existing setups). Webpack could be nice someday for making separate builds for different pages and loading modules on demand, but we have no module system yet. Broccoli has cached builds to make things fast, and might be a bit shy on docs, but I think it is the best choice to start with. We can keep our implementation light (e.g. just transpile, let EasyWidgets still concatenate for now) and see how it goes so that switching is relatively easy if needed.

     
  • Dave Brondsema

    Dave Brondsema - 2015-09-28
    • status: in-progress --> review
     
  • Dave Brondsema

    Dave Brondsema - 2015-09-28

    db/7976

    Broccoli will be used to transpile *.es6.js files into a build/transpiled.js file that is included just like other JS files are on the page. A sourcemap file is created too. Docs, docker, and release scripts are all updated to account for this build step.

     
  • Heith Seewald - 2015-09-29
    • Reviewer: Heith Seewald
     
  • Heith Seewald - 2015-09-29

    Looking good so far -- just a few things to check into.

    1) Make sure Apache licenses are added to new files (if applicable)
    2) Make sure the build directory Allura/allura/public/nf/js/build/ exists (maybe add a .gitkeep inside the directory)
    3) The package.json could use some additional meta-data. We can also add aliases to many of the scripts we run to make things more intuitive... Maybe something like:

      "homepage": "https://allura.apache.org/",
      "description": "Apache Allura development asset pipeline",
      "bugs": {
        "url": "https://forge-allura.apache.org/p/allura/tickets/"
      },
      "scripts": {
        "test": "tests here?",
        "build": "broccoli build Allura/allura/public/nf/js/build/",
        "web": "gunicorn --paste Allura/development.ini --chdir Allura/"
      },
    
     
  • Heith Seewald - 2015-09-29
    • status: review --> in-progress
     
  • Dave Brondsema

    Dave Brondsema - 2015-09-30
    • status: in-progress --> review
     
  • Dave Brondsema

    Dave Brondsema - 2015-09-30
    • added license to Brocfile.js Skipped package.json since .json files don't support comments and we already have *.json in our rat-excludes.txt list
    • Broccoli works fine for me with a non-existent directory
    • Added broccoli-related tasks to package.json and simplified docs to use it. I'm not sure about other tasks, since some people won't have npm installed if they're using a release version. So we may want a different task runner for other general things like gunicorn.
     
    • Heith Seewald - 2015-09-30

      I see what you're saying about the release version not including npm. But I think most people that would be using a task runner would probably also be using the development version. Either way you make a good point -- we may want to consider having a general purpose task runner.

       
  • Heith Seewald - 2015-10-01

    So for the most part things are working well.

    It looks like there is an issue with the source maps when using chrome.

    I made two test files:

    numbers.es6.js

    //numbers.es6.js
    [1,2,3].forEach(function(n){
        console.log(`${n} is a number`);
    });
    console.log('I was called from "numbers"');
    

    and letters.es6.js

    //letters.es6.js
    ["a", "b", "c"].forEach(function (n) {
        console.log(`${n} is a letter`);
    });
    console.log('I was called from "letters"');
    

    The output is here:
    chrome_output

    Chrome seems to get confused about where things are coming from.
    Firefox doesn't have an issue with it, possibly due to the inline vs external maps?

    Aside from that, this can be merged.

     

    Last edit: Heith Seewald 2015-10-01
  • Heith Seewald - 2015-10-01
    • status: review --> in-progress
     
  • Dave Brondsema

    Dave Brondsema - 2015-10-01
    • status: in-progress --> review
     
  • Dave Brondsema

    Dave Brondsema - 2015-10-01

    Good catch, fix pushed for that using a different package. Firebug doesn't show things quite perfectly, but Chrome seems to be all good.

     
  • Heith Seewald - 2015-10-02
    • status: review --> closed
     
  • Heith Seewald - 2015-10-02

    Great work, Dave. The next step is module support :)

     
  • Dave Brondsema

    Dave Brondsema - 2015-10-05
    • labels: sf-current, sf-2 --> sf-2
     
  • Dave Brondsema

    Dave Brondsema - 2015-12-08
    • Milestone: unreleased --> v1.3.2
     

Log in to post a comment.