Skip to content

A Template literals converter. Mainly used for Chart.js to work on Rhino interpreter

Notifications You must be signed in to change notification settings

gr3enk/NowChartJS

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NowChartJS

NowChartJS creates a modified Chart.js Version for Service Now compatibilty.

The Rhino Intepreter which is used by Service Now to compile JavaScript code is not able to compile Template literals. All Template literals are removed after compilation. Since these are used by the Chart.js library, the compiler throws errors and the JavaScript can't be processed correclty.

NowChartJS transcribes all Template literals for Rhino compatibility.

How to use

Install all dependencies.

npm i

Setup the environment.

npm run setup

Drop the JS-Library into the input directory.

Then run:

npm run build

You will be asked whether the output should be minified (recommended).

The compiled files are written to the output directory. In addition, a changelog file is created in the output directory, which contains all changes from the compilation process.

Explanation with Chart.js

The following example has been changed in the NowChartJS library compared to the original Chart.js library:

// Chart.js v4.4.2
// ❌ does not work with Rhino
return `${t.id}.${e.id}.${i.stack || i.type}`;
// Chart.js v4.4.2 (modified NowChartJS version)
// ✅ works with Rhino
return t.id + "." + e.id + "." + (i.stack || i.type);

Other use cases

Technically, NowChartJS can also be used for libraries other than Chart.js to convert template literals for Rhino compatibilty.

Credits

License

MIT

About

A Template literals converter. Mainly used for Chart.js to work on Rhino interpreter

Topics

Resources

Stars

Watchers

Forks