You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Please do not touch the main keys of package.json. The order that npm init creates the keys is just fine, you should not sort those alphabetically. npm install also only sorts the dependencies, I have never seen it change the other parts of package.json
This has apparently been introduced as a side effect of #7431
Minimal reproducible example
vaadin init --pre packagejson
cd packagejson
mvn
Expected behavior
The name field should still be first in package.json
Actual behavior
The name field is moved below dependencies and devDependencies
Apparently we only fixed the randomness, which is great.
Now the issue apparently is that the order we use for the main level keys is not the same as what npm itself uses.
The problem will be the same - the file is modified when running flow even when there should be no changes - the ordering of keys will change (?) and as the file is in version control, there will be unnecessary updates to it which can cause annoying merge conflicts in projects.
Does it mean that dependencies can be at any place ? Does it mean that devDependencies can be at any place ?
Which can be used as an example of main level keys ordering when we create a new package.json file.
Then I think after that we should not touch the main level keys, except only to add the vaadin main level key at correct location, which I guess should be at the end (after devDependencies) or where it is currently. Then when modifying dependencies or devDependencies, we keep that sorted like it was done.
This is again is not description of the task.
This is an example.
The package.json can be created in many ways: I can create it manually, I can generate it using npm , Flow generates it.
In every such case the order will be different , different keys will be in the file.
The ticket #7431 complains that vaadin key sometimes may be before dependencies .
The main problem for some reason with the tasks is not a technical solution but the absence of the exact description what should be done. Apparently I have to write the exact task description instead of the reporter:
don't sort any key inside the main/root Json object except: vaadin should be the last one.
is this the expected behavior which we can agree on ?
I strongly dislike the situation when the developer has to write the exact description of the task instead of the reporter but apparently this needs to be done now for every ticket from now on.
is this the expected behavior which we can agree on ?
Otherwise seems OK, but in case the vaadin key is already present, and the developer adds another top level key after it, I think flow should not move the vaadin key to be after it as this is again an unnecessary change.
I strongly dislike the situation when the developer has to write the exact description of the task instead of the reporter but apparently this needs to be done now for every ticket from now on.
It is the responsibility of the developer who makes the fix to understand what he is fixing and how it should be fixed. This is regardless of what the reported has written or has not written. Also the reviewer of the code needs to double check this when making the review code - not just look at the code. In case there is no clarity on the fix or report is too obscure, we take the time to discuss or ask for more details.
It is the responsibility of the developer who makes the fix to understand what he is fixing and how it should be fixed.
yes, and this is a responsibility of the reporter to make description so that the fix is done according to the expectation.
The fix for #7431 is done based on the description in the ticket.
Also the reviewer of the code needs to double check this when making the review code - not just look at the code. In case there is no clarity on the fix or report is too obscure, we take the time to discuss or ask for more details.
Apparently this is failing and I would say this is impossible. The reality is incompatible with this wish.
Several hours spent on clarifying the ticket: that's the reality.
Activity
pleku commentedon Jun 23, 2021
So apparently any top level keys should be left unsorted, only the objects that contain the dependencies should be sorted by #7431 https://docs.npmjs.com/cli/v7/configuring-npm/package-json
denis-anisimov commentedon Jun 23, 2021
I don't understand this comment
Does it mean that
dependenciescan be at any place ? Does it mean thatdevDependenciescan be at any place ?pleku commentedon Jun 23, 2021
Apparently we only fixed the randomness, which is great.
Now the issue apparently is that the order we use for the main level keys is not the same as what npm itself uses.
The problem will be the same - the file is modified when running flow even when there should be no changes - the ordering of keys will change (?) and as the file is in version control, there will be unnecessary updates to it which can cause annoying merge conflicts in projects.
When running
I get
Which can be used as an example of main level keys ordering when we create a new package.json file.
Then I think after that we should not touch the main level keys, except only to add the
vaadinmain level key at correct location, which I guess should be at the end (afterdevDependencies) or where it is currently. Then when modifying dependencies or devDependencies, we keep that sorted like it was done.denis-anisimov commentedon Jun 23, 2021
This is again is not description of the task.
This is an example.
The
package.jsoncan be created in many ways: I can create it manually, I can generate it usingnpm, Flow generates it.In every such case the order will be different , different keys will be in the file.
The ticket #7431 complains that
vaadinkey sometimes may be beforedependencies.The main problem for some reason with the tasks is not a technical solution but the absence of the exact description what should be done. Apparently I have to write the exact task description instead of the reporter:
vaadinshould be the last one.dependencies,devDependencies,vaadinobjectsis this the expected behavior which we can agree on ?
I strongly dislike the situation when the developer has to write the exact description of the task instead of the reporter but apparently this needs to be done now for every ticket from now on.
pleku commentedon Jun 23, 2021
Otherwise seems OK, but in case the
vaadinkey is already present, and the developer adds another top level key after it, I think flow should not move thevaadinkey to be after it as this is again an unnecessary change.It is the responsibility of the developer who makes the fix to understand what he is fixing and how it should be fixed. This is regardless of what the reported has written or has not written. Also the reviewer of the code needs to double check this when making the review code - not just look at the code. In case there is no clarity on the fix or report is too obscure, we take the time to discuss or ask for more details.
denis-anisimov commentedon Jun 23, 2021
yes, and this is a responsibility of the reporter to make description so that the fix is done according to the expectation.
The fix for #7431 is done based on the description in the ticket.
Apparently this is failing and I would say this is impossible. The reality is incompatible with this wish.
Several hours spent on clarifying the ticket: that's the reality.
fix: order only dependencies inside package.json
fix: order only dependencies inside package.json (#11318)
fix: order only dependencies inside package.json (#11318)
fix: order only dependencies inside package.json (#11318) (#11331)
fix: order only dependencies inside package.json (#11318)
fix: order only dependencies inside package.json (#11318)
fix: order only dependencies inside package.json (#11318) (#11343)
vaadin-bot commentedon Jun 28, 2021
This ticket/PR has been released with platform 21.0.0.alpha8. For prerelease versions, it will be included in its final version.
fix: order only dependencies inside package.json (#11318) (#11348)
vaadin-bot commentedon Jul 5, 2021
This ticket/PR has been released with platform 20.0.4. For prerelease versions, it will be included in its final version.
vaadin-bot commentedon Aug 9, 2021
This ticket/PR has been released with platform 14.7.0.alpha3 and is also targeting the upcoming stable 14.7.0 version.