Use `packageManager` field in `package.json` for package manager detection
Currently NodeBB uses either config.json or it falls back to basic lockfile detection.
However, with the addition of corepack, package.json can now carry that information in packageManager field.
I think it would be reasonable to also respect that field, though I'm not sure if it should take precedence over lockfiles (I guess it should be below explicit NodeBB configuration though).
Additionally, I think the logic for selecting package manager from package.json and lockfiles could be expanded to work without nconf.
I can try doing both when I know the preferred priority of packageManager/lockfile check :)
Probably something like this:
- If
packageManagerdefined inpackage.json, use that value - Otherwise, check
package_managerinconfig.json(legacy) - Finally, use lockfile detection if all else fails (which then falls back to npm if the detection comes up empty)
That said, we wouldn't explicitly set packageManager in install/package.json. This would be something an admin would elect to add to their own package.json