ampersand-state icon indicating copy to clipboard operation
ampersand-state copied to clipboard

Upgrade lodash dependency to 4.*

Open dschissler opened this issue 8 years ago • 15 comments

lodash is currently on version 4.2.1 but all of ampersand-* packages are using 3. I think that a complete ampersand project wide upgrade should occur with perhaps a major version bump for each ampersand package. lodash 4.0.0 has been out since 2016-01-12.

Maybe wait another month and then bump it?

dschissler avatar Feb 04 '16 16:02 dschissler

This is certainly something that would be nice to have, it's quite a large undertaking though. Wondering if anyone feels they have the time to carve out to do this?

wraithgar avatar Feb 04 '16 16:02 wraithgar

it may be easy-ish to do using ampersand-family-meeting . could be a good first run with it. need to finish the PR logic, which won't be hard. doesn't cover the package publishing, but could with a little elbow grease :)

cdaringe avatar Feb 04 '16 19:02 cdaringe

Would love to see this. I'm working on migrating a library to lodash 4 using babel-plugin-lodash and the library doubled in size because ampersand is pulling in lodash 3

ianwremmel avatar Feb 29 '16 20:02 ianwremmel

@cdaringe Is it really so difficult to update all packages to use a new lodash?

dschissler avatar Mar 24 '16 22:03 dschissler

@dschissler, full time job, school, and life! you're welcome to start staging these PRs on your own if you want. we'd happily accept them :). the upgrade is not so seamless

  • not all modules are compatible with the upgrade immediately. i did upgrade &-view, and it didn't pass tests. debugging required
  • all lodash refs need to be converted to lodash/mod vs lodash.mod for package size reduction
  • to be most effective, we'd want and try and hit ampersandjs-core modules (most important) but propose the updates to community modules as well. with everyone aligned, bundle sizes continue to drop. npm search will show you that the following pkgs exist:
  1. ampersand-app
  2. ampersand-array-checkbox-view
  3. ampersand-array-input-view
  4. ampersand-auto-closing-view
  5. ampersand-autocomplete-view
  6. ampersand-avatar-field
  7. ampersand-avatar-input-view
  8. ampersand-bootstrap-tagsinput-view
  9. ampersand-bubble-prop
  10. ampersand-calendar
  11. ampersand-chart
  12. ampersand-checkbox-view
  13. ampersand-chess-state
  14. ampersand-chess-view
  15. ampersand-class-extend
  16. ampersand-collection
  17. ampersand-collection-filterable
  18. ampersand-collection-fluxible-mixin
  19. ampersand-collection-history
  20. ampersand-collection-jquery-datatable
  21. ampersand-collection-lodash-mixin
  22. ampersand-collection-pouchdb-mixin
  23. ampersand-collection-pusher-mixin
  24. ampersand-collection-rest-mixin
  25. ampersand-collection-sort-mixin
  26. ampersand-collection-underscore-mixin
  27. ampersand-collection-view
  28. ampersand-controller-router
  29. ampersand-date-view
  30. ampersand-date-view2
  31. ampersand-dependency-mixin
  32. ampersand-dom
  33. ampersand-dom-bindings
  34. ampersand-domthing-mixin
  35. ampersand-drawer-view
  36. ampersand-events
  37. ampersand-expanding-textarea-view
  38. ampersand-express-router
  39. ampersand-fetch
  40. ampersand-file-drop-view
  41. ampersand-filereader-input-view
  42. ampersand-filter-tracker
  43. ampersand-filtered-collection
  44. ampersand-filtered-subcollection
  45. ampersand-floatinglabel-input-view
  46. ampersand-form-manager-view
  47. ampersand-form-view
  48. ampersand-fullcalendar-view
  49. ampersand-grid-view
  50. ampersand-grouped-collection-view
  51. ampersand-hoodie-collection
  52. ampersand-hoodie-mixin
  53. ampersand-hoodie-model
  54. ampersand-infinite-scroll
  55. ampersand-input-view
  56. ampersand-io
  57. ampersand-io-collection
  58. ampersand-io-model
  59. ampersand-jid-datatype-mixin
  60. ampersand-json-patch
  61. ampersand-jsonapi-ajaxconfig
  62. ampersand-jsonapi-collection
  63. ampersand-jsonapi-model
  64. ampersand-local-cache-mixin
  65. ampersand-main-view
  66. ampersand-mixins
  67. ampersand-modal-view
  68. ampersand-model
  69. ampersand-model-optimistic-update-mixin
  70. ampersand-model-patch-mixin
  71. ampersand-model-pouchdb-mixin
  72. ampersand-model-pusher-mixin
  73. ampersand-model-validations-mixin
  74. ampersand-movingobj
  75. ampersand-multifield-view
  76. ampersand-multiselect-view
  77. ampersand-offline-first
  78. ampersand-optimistic-sync
  79. ampersand-paginated-subcollection
  80. ampersand-pagination-mixin
  81. ampersand-pikaday-view
  82. ampersand-pouchdb-sync
  83. ampersand-questionnaire-view
  84. ampersand-radio-view
  85. ampersand-react-connector
  86. ampersand-react-mixin
  87. ampersand-react-view
  88. ampersand-react-view-mixin
  89. ampersand-registry
  90. ampersand-rest-collection
  91. ampersand-router
  92. ampersand-router-query-parameters
  93. ampersand-sanitized-html-data-type
  94. ampersand-search-select
  95. ampersand-select-view
  96. ampersand-single-sync
  97. ampersand-state
  98. ampersand-state-fluxible-mixin
  99. ampersand-state-mixin-datatype-function
  100. ampersand-state-mixin-datatype-iso-date
  101. ampersand-store
  102. ampersand-subcollection
  103. ampersand-sync
  104. ampersand-sync-adapter
  105. ampersand-sync-localforage
  106. ampersand-sync-promise
  107. ampersand-sync-with-promise
  108. ampersand-tab-view
  109. ampersand-time-range
  110. ampersand-version
  111. ampersand-view
  112. ampersand-view-conventions
  113. ampersand-view-jquery-events
  114. ampersand-view-jquery-mixin
  115. ampersand-view-switcher
  116. ampersand-virtual-dom-mixin
  117. ampersand-webcam-snapshot-view
  118. ampersand-websocket-hint
  119. ampersand-webworker-demo
  120. ampersand-wildemitter-datatype-mixin

so, in summary, (not to be curt), it is difficult and very time consuming. that's why i started working on ampersand-family-agenda--to help automate these upgrades and to ease the synchronization of our loosely-coupled framework!

cdaringe avatar Mar 24 '16 23:03 cdaringe

Hey @cdaringe Thanks for all the details. Why is lodash/get better for package size reduction over lodash.get ? Doesn't the roll-up technique work the same on both?

pgilad avatar Mar 25 '16 05:03 pgilad

hey @pgilad! how's it goin man?

j dalton explained in a presentation that the lodash.xzy inlines the module with all of its dependencies. so, if .get and .set both have a common dep (which they do, _isKey), you will consequently "over-bundle" it using the dot strategy.

by example:

// get-set-dot-strategy.js
var set = require('lodash.set');
var get = require('lodash.get');
// get-set-slash-strategy.js
var set = require('lodash/set');
var get = require('lodash/get');
# post browserify
cdieringer  staff  17038 Mar 25 00:34 get-set-dot-strategy.bundled.js
cdieringer  staff  15318 Mar 25 00:35 get-set-slash-strategy.bundled.js # less, yahtzee!

cdaringe avatar Mar 25 '16 06:03 cdaringe

@cdaringe Once everything is upgraded when using NPM 3 it would be the same since it installs flat dependencies. Just sayin'.

dschissler avatar Mar 25 '16 08:03 dschissler

@cdaringe Would we bump the major version on every single post 1.0 module? Also I think that if someone committed to upgrading about 20 core packages that they should be allowed a commit freeze for a defined period of time to get it all done. It could become very annoying if tiny commits were sneaked into various packages during this conversion.

dschissler avatar Mar 25 '16 08:03 dschissler

I'm not sure how I would test it since I'm using only the following in my project:

ampersand-class-extend
ampersand-collection
ampersand-collection-view
ampersand-dom
ampersand-dom-bindings
ampersand-events
ampersand-router
ampersand-state
ampersand-version
ampersand-view
ampersand-view-switcher

dschissler avatar Mar 25 '16 08:03 dschissler

@cdaringe thanks for the info man!

I could get the upgrades in some of the packages if you want

pgilad avatar Mar 25 '16 16:03 pgilad

@cdaringe Once everything is upgraded when using NPM 3 it would be the same since it installs flat dependencies. Just sayin'.

hey @dschissler, the dot strategy inlines the dependencies, so even if npm3 flattens deps, they will still be duplicated in each lodash module :)

I could get the upgrades in some of the packages if you want

@pgilad, if you'd like to! it's really about keepin' the users happy by this point, and churning to keep our deps up to date. maybe greenkeeper is something we should consider? i'm definitely not opposed to getting the ball rolling, i'm just swamped ATM

cdaringe avatar Mar 25 '16 16:03 cdaringe

Given our test coverage, and the fact that greenkeeper makes PRs from local branches (i.e. the saucelabs credentials would show up) I'd be all for enabling greenkeeper.

wraithgar avatar Mar 25 '16 17:03 wraithgar

@cdaringe Can you verify this is the proper direction? https://github.com/AmpersandJS/ampersand-events/pull/15

pgilad avatar Mar 26 '16 07:03 pgilad

Looks good @pgilad and that's a good module to start in cause it's at the top of the dependency tree.

wraithgar avatar Mar 29 '16 15:03 wraithgar