Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apply custom format filter on JSON output #141

Closed
wants to merge 5 commits into from
Closed

Apply custom format filter on JSON output #141

wants to merge 5 commits into from

Conversation

btxtiger
Copy link

@btxtiger btxtiger commented Mar 8, 2018

I have no experience in writing tests. Maybe a test for --json --customPath should be added.

@davglass
Copy link
Owner

davglass commented Mar 8, 2018

Thanks for this, I'll try to get this merged and write some tests for it when I get a chance..

@btxtiger
Copy link
Author

btxtiger commented Mar 8, 2018

Im still running into issues when trying to 'hack' the json output file into my Typescript Application by saving the output in a .ts file, and place export default at the beginning of the object, and replacing all "with '. There seem to be too many different characters in the strings to work properly.

Therefor I added a param, which converts the strings to base64. If you find that function useful, I can commit it to the pull request.

The output will look like this:

{
    "@angular/core": {
        "licenses": "TUlU",
        "name": "QGFuZ3VsYXIvY29yZQ==",
        "version": "NS4yLjY=",
        "description": "QW5ndWxhciAtIHRoZSBjb3JlIGZyYW1ld29yaw==",
        "licenseText": "QW5ndWxhcgo9PT09PT09CgpUaGUgc291cmNlcyBmb3IgdGhpcyBwYWNrYWdlIGFyZSBpbiB0aGUgbWFpbiBbQW5ndWxhcl0oaHR0cHM6Ly9naXRodWIuY29tL2FuZ3VsYXIvYW5ndWxhcikgcmVwby4gUGxlYXNlIGZpbGUgaXNzdWVzIGFuZCBwdWxsIHJlcXVlc3RzIGFnYWluc3QgdGhhdCByZXBvLgoKTGljZW5zZTogTUlU"
    }
}

With my post-modifications it is handleable as a regular object:

export default {
    '@angular/core': {
        'licenses': 'TUlU',
        'name': 'QGFuZ3VsYXIvY29yZQ==',
        'version': 'NS4yLjY=',
        'description': 'QW5ndWxhciAtIHRoZSBjb3JlIGZyYW1ld29yaw==',
        'licenseText': 'QW5ndWxhcgo9PT09PT09CgpUaGUgc291cmNlcyBmb3IgdGhpcyBwYWNrYWdlIGFyZSBpbiB0aGUgbWFpbiBbQW5ndWxhcl0oaHR0cHM6Ly9naXRodWIuY29tL2FuZ3VsYXIvYW5ndWxhcikgcmVwby4gUGxlYXNlIGZpbGUgaXNzdWVzIGFuZCBwdWxsIHJlcXVlc3RzIGFnYWluc3QgdGhhdCByZXBvLgoKTGljZW5zZTogTUlU'
    }
}

@k-sai-kiranmayee
Copy link

Hello @davglass, have you had a chance on this one...Could you check once, please

Thank you :)

@btxtiger btxtiger closed this by deleting the head repository Feb 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants