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

Generated barrelfile incomplete #264

Closed
PieterVanEde opened this issue Jun 17, 2020 · 17 comments
Closed

Generated barrelfile incomplete #264

PieterVanEde opened this issue Jun 17, 2020 · 17 comments
Assignees

Comments

@PieterVanEde
Copy link

When I generate using these options:

exportCore: false, exportModels: true, exportSchemas: true, exportServices: false,

Then the barrel file has the following problems:

  • it contains a reference to a service, which is explicitly not generated
  • it contains no references to the models
@ferdikoomen
Copy link
Owner

Hi Pieter, let me check, I'll add some additional test cases for these scenarios.

@ferdikoomen ferdikoomen self-assigned this Jun 17, 2020
@PieterVanEde
Copy link
Author

Great! I'm currently seeing if I can make a PR to fix this.

@PieterVanEde
Copy link
Author

Weird thing is that if I look at your code, it seems valid to me, yet with even version 0.4.4 I see the behaviour is wrong.

@ferdikoomen
Copy link
Owner

@PieterVanEde Can you share you spec with me? Is that possible?

@ferdikoomen
Copy link
Owner

Or the better question: if you generate it with the default options, does everything look good then?

@PieterVanEde
Copy link
Author

Yep, after fooling around a bit, I've found the following:

  • if generated with default options, all looks fine.
  • if generated with everything set to false, the barrel file is empty (correct)
  • if generated with exportCore: true, exportModels: false, exportSchemas: false, exportServices: true, then only the core and models end up in the barrel (wrong)
  • if generated with exportCore: true, exportModels: true, exportSchemas: false, exportServices: false, then I only get the core and services in the barrel (wrong)
  • and like that I see more cases where the generate flags seem to have effect on the wrong section in the barrel file.

@ferdikoomen
Copy link
Owner

Ah maybe the parsing logic of the booleans are wrong somehow, are using the Node API or using it via command line / package json?

@PieterVanEde
Copy link
Author

The parsing is indeed wrong, I've linked my local checkout of my fork inside my test project, and added this to the top of the index.hbs:

{{#if exportCore}} // pieter was here: exportCore true {{/if}} {{#if exportModels}} // pieter was here: exportModels true {{/if}} {{#if exportSchemas}} // pieter was here: exportSchemas true {{/if}} {{#if exportServices}} // pieter was here: exportServices true {{/if}}

Result for config exportCore: true, exportModels: false, exportSchemas: false, exportServices: true, is core and models

@PieterVanEde
Copy link
Author

I'm using the typescript interface to call the library

@PieterVanEde
Copy link
Author

Strangely enough, only the barrel file is wrong. The actual files that are output, are correct.

@PieterVanEde
Copy link
Author

Error spotted, PR on its way

@PieterVanEde
Copy link
Author

I don't have the time to write some tests, could I leave that to you?

@PieterVanEde
Copy link
Author

PR is created, hope you agree ;)

@ferdikoomen
Copy link
Owner

Cool, thanks for spotting this, stupid mistake, will push a new version to npm now

@ferdikoomen
Copy link
Owner

Pushed 0.4.5

@ferdikoomen
Copy link
Owner

I re-opend this as a reminder to add some test cases

@PieterVanEde
Copy link
Author

Great! And well, there is a stupid mistake in a great library that I could use for free, so I don't see a problem ;)

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

No branches or pull requests

2 participants