-
-
Notifications
You must be signed in to change notification settings - Fork 726
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
Getting random project id #2890
Comments
Generated IDs are not randomized. They are sequentially assigned for each created reflection. It sounds to me like you're generating multiple projects in different orders as the root level project will always have ID 0 if only generating one project. TypeDoc provides the resetReflectionID function to reset it, but if you combine reflections objects from multiple invocations of TypeDoc after calling that, the behavior is completely undefined. |
It is impossible to say what is going on with your setup without a reproduction. You are only saving one project, but it clearly isn't the first one created, which tells me that more than one is being converted. |
We have a service that generates npm packages. Are you suggesting that the reason the project ID doesn't reset to 0 is because this service is continuously creating more packages? if so I can just call resetReflectionID before creating the typedoc |
Yes, that's exactly what I'm saying. That ID is a global which is incremented while typedoc is running. M |
Got it now, thanks for the detailed explanation! Maybe it's possible to add an option Something like:
|
That option isn't suitable for general use, and wouldn't make sense to set in any usage which isn't programmatic where multiple conversions are being done. Further, putting the option there would imply that's when resetting should be done, which isn't true. Both TypeDoc's usage and several plugin's test code's usage of that is to reset several many for a single application instance during unit testing. If anywhere it would make sense as an option to one of the convert functions, but as it modifies global state I prefer the API which makes it obvious that something fishy is going on. |
Could you please clarify why we might choose not to reset the index? Wouldn't it be preferable to assign a the same initial ID (0) to each execution? It seems a bit unusual for the class to maintain state that changes between runs. |
Search terms
random project id value
Expected Behavior
Generated TypeDoc for the same npm package input will be the same for all CI runs
Actual Behavior
Generated TypeDoc project gets random ids causing the whole objects to get different ids on every CI run.
Steps to reproduce the bug
We have a service that generates npm packages, then creates Typedoc for the generated package and commit all the code to github, we noticed that we have a lot of dummy commits where
ids
changed only, without any change in the npm pakcage source code, for example:changed to:
and then changed to
And thats the only changes in the commit.. (no npm page source file changed).
How is it possible? Do we have a way to
set
the project initial id so all the other ids will be the same per run? Do we have a different way to do it?Environment
0.24.8
4.7.4
18.18.2
How do we run it:
The text was updated successfully, but these errors were encountered: