Open Blasz opened 4 years ago
I ran into an edge case when trying to add lodash to a package that had lodash.union installed.
lodash
lodash.union
⚡️ bolt v0.24.4 (node v12.3.1) error TypeError: Cannot read property '0' of undefined error at sort (/Users/mblaszczyk/.config/yarn/global/node_modules/sort-object/index.js:71:29) error at Package._updateDependencies (/Users/mblaszczyk/.config/yarn/global/node_modules/bolt/dist/modern/Package.js:136:43) error at Package.setDependencyVersionRange (/Users/mblaszczyk/.config/yarn/global/node_modules/bolt/dist/modern/Package.js:110:16) error at addDependenciesToPackage (/Users/mblaszczyk/.config/yarn/global/node_modules/bolt/dist/modern/utils/addDependenciesToPackages.js:107:15) error at async Object.workspaceAdd (/Users/mblaszczyk/.config/yarn/global/node_modules/bolt/dist/modern/commands/workspace/add.js:76:3) error at async cli (/Users/mblaszczyk/.config/yarn/global/node_modules/bolt/dist/modern/cli.js:347:5)
The sort-object npm module treats keys with dots in them as nested object keys. If both lodash and lodash.xxx exist, it falls over completely.
sort-object
lodash.xxx
I think we should just sort the object ourselves.
This is still a problem in 2024.
I ran into an edge case when trying to add
lodash
to a package that hadlodash.union
installed.The
sort-object
npm module treats keys with dots in them as nested object keys. If bothlodash
andlodash.xxx
exist, it falls over completely.I think we should just sort the object ourselves.