Page MenuHomeSoftware Heritage

common/highlightjs: Use dynamically generated languages data
ClosedPublic

Authored by anlambert on Nov 20 2020, 7:18 PM.

Details

Summary

Instead of hardcoding the set of supported programming languages and their
aliases in the common.highlightjs module, read those data from a JSON file
instead.

That JSON file is generated during frontend assets processing by webpack
by using the highlightjs library API.
This ensures languages data will always be in sync with current release
of the highlightjs library.

The produced JSON file is stored in git as it is needed to execute backend tests.
Its content might change each time a new release of highlightjs is available.

Test Plan

I have updated Python tests to match latest highlightjs release and ensured the
cypress tests related to languages highlighting I put in place some times ago
still pass (can be executed by invoking make test-frontend-full).

Diff Detail

Repository
rDWAPPS Web applications
Branch
highlightjs-dump-data-webpack-plugin
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 17354
Build 26808: Phabricator diff pipeline on jenkinsJenkins console · Jenkins
Build 26807: arc lint + arc unit

Event Timeline

Build is green

Patch application report for D4551 (id=16154)

Rebasing onto 6cc8f01cce...

Current branch diff-target is up to date.
Changes applied before test
commit bd5ad05ea37fb8d5c2c1544c10c5a8b3cecb3e3b
Author: Antoine Lambert <antoine.lambert@inria.fr>
Date:   Fri Nov 20 18:46:58 2020 +0100

    common/highlightjs: Use dynamically generated languages data
    
    Instead of hardcoding the set of supported programming languages and their
    aliases in the common.highlightjs module, read those data from a JSON file
    instead.
    
    That JSON file is generated during frontend assets processing by webpack.
    This ensures languages data will always be in sync with current release
    of the highlightjs library.

See https://jenkins.softwareheritage.org/job/DWAPPS/job/tests-on-diff/487/ for more details.

Build is green

Patch application report for D4551 (id=16155)

Rebasing onto 6cc8f01cce...

Current branch diff-target is up to date.
Changes applied before test
commit 5c915825bd2ff1f9db5592cd702a6970c5fd483e
Author: Antoine Lambert <antoine.lambert@inria.fr>
Date:   Fri Nov 20 18:46:58 2020 +0100

    common/highlightjs: Use dynamically generated languages data
    
    Instead of hardcoding the set of supported programming languages and their
    aliases in the common.highlightjs module, read those data from a JSON file
    instead.
    
    That JSON file is generated during frontend assets processing by webpack.
    This ensures languages data will always be in sync with current release
    of the highlightjs library.

See https://jenkins.softwareheritage.org/job/DWAPPS/job/tests-on-diff/488/ for more details.

This revision is now accepted and ready to land.Nov 23 2020, 10:41 AM