[ 
https://issues.apache.org/jira/browse/ATLAS-3819?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17151339#comment-17151339
 ] 

Csaba Koncz commented on ATLAS-3819:
------------------------------------

Opened a number of pull requests that show what the stages of the JavaScript 
source code conversion could be:

https://github.com/csabakoncz/atlas-newui/pulls?q=is%3Apr+is%3Aopen+-label%3Adependencies+

An interesting step in the migration might be Step2 that performs the source 
code conversion using jscodeshift and a modified codemod.

I also implemented sample unit tests.

As I am unsure what kind of testing would best suit us I have set up both 
in-browser (Karma+Jasmine+ChromeHeadless) and Node.JS-based (Jest+jsdom) 
testing.
The few tests I wrote can be executed unchanged in both environments.

`npm test` executes Jest tests, while `npm test-karma` launches in-browser 
tests. Both executions measure code coverage, the reports being output to 
folders `coverage` and `coverage-karma`, respectively.

Backbone views are testable as they are now: 
https://github.com/csabakoncz/atlas-newui/blob/step9/src/views/site/__tests__/AboutAtlas.test.ts#L15

However, some of the code needs to be refactored in order to be able to provide 
sensible mocks (most notably main.js, which could benefit also from Promises 
(available for all browsers through a polyfill)).

The oldest Browser version I checked is Firefox 26.0, which is a browser 
without native Promises. The UI works with the exception of "Add Term" dialog, 
which is rejected because of duplicate entries in object literals (e.g. 
`transitionEffect` in 
https://github.com/csabakoncz/atlas-newui/blob/step9/src/views/glossary/AssignTermLayoutView.js#L117).
This might need to be fixed by hand if I am unable to configure Webpack/Babel 
to omit the strict mode header for the legacy code.

> Modernize client side technology stack
> --------------------------------------
>
>                 Key: ATLAS-3819
>                 URL: https://issues.apache.org/jira/browse/ATLAS-3819
>             Project: Atlas
>          Issue Type: Improvement
>          Components: atlas-webui
>    Affects Versions: 3.0.0
>            Reporter: Csaba Koncz
>            Priority: Major
>
> While RequireJS has its merits and advantages, it might be worth considering 
> replacing it with another technology.
> A bundle loader like Webpack would open up a number of possibilities:
> - use of ES6 modules, which immediately improves tooling support
> - use TypeScript, which improves tooling support even more
> - a manageable code base would enable refactoring of the JavaScript code so 
> that no logic happens in the module initialization code,
> which in turn would make it possible to write tests for the JavaScript logic.
> As a POC I created a NodeJS project that transforms the current dashboardv2 
> code into Webpack bundles and demonstrates
> that the UI is able to work without RequireJS.
> Right now the JavaScript sources and index.html are used unchanged,
> but the next step would be to start converting the source to ES6 modules.
> Here is the code: https://github.com/csabakoncz/atlas-newui
> The most important file there is `webpack.config.js` that takes over the role 
> of RequireJS.config.
> The other file of interest might be `src/index.ts` which demonstrates the 
> ability to use TypeScript code even now.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to