NationalBankBelgium / stark

Modern client-side Web application framework based on Angular, Angular Material / Material Design, TypeScript, Redux, RxJS, ...

Home Page:https://stark.nbb.be

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ui: replace pretty-data library

SuperITMan opened this issue · comments

I'm submitting a...


[ ] Regression (a behavior that used to work and stopped working in a new release)
[X] Bug report  
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead see https://github.com/NationalBankBelgium/stark/blob/master/CONTRIBUTING.md#got-a-question-or-problem

Current behavior

After upgrading Stark to Angular 8, we get the following error when running the showcase:

Uncaught ReferenceError: assignment to undeclared variable maxdeep
    pp pretty-data.js:54
    js pretty-data.js:334
    Webpack 14
pretty-data.js:54:2
    pp pretty-data.js:54
    js pretty-data.js:334
    Webpack 16

An issue about this has been opened on vkiryukhin/pretty-data#26 and didn't receive any answer for a year. Since this library does not seem to be maintained anymore, we should investigate to replace it by another library.

Minimal reproduction of the problem with instructions

  1. Checkout master branch
  2. Edit "packages/stark-ui/src/modules/pretty-print/components/pretty-print.component.ts" file as following:
// Line 53 uncomment following line:
const prettyData: any = require("pretty-data").pd;

// +- Line 160 adapt as follows:
this.prettyString = prettyData.xml(this.data);
// this.prettyString = this.data;

// +- Line 188 adapt as follows:
this.prettyString = prettyData.sql(this.data);
// this.prettyString = this.data;
  1. Run npm run build && npm run update:showcase && npm run showcase

What is the motivation / use case for changing the behavior?

Fix support for all extensions in pretty-print component.

To do so, we could use different formatters to replace ones supported by pretty-data in stark-ui:

Environment


Angular version: 8x