Skip to content
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

chore: add lodash/fp #19

Merged
merged 1 commit into from
Feb 20, 2018
Merged

chore: add lodash/fp #19

merged 1 commit into from
Feb 20, 2018

Conversation

AfonsoVReis
Copy link
Contributor

Closes #18 .

@codecov
Copy link

codecov bot commented Feb 19, 2018

Codecov Report

Merging #19 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@          Coverage Diff          @@
##           master    #19   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files           1      1           
  Lines          20     21    +1     
  Branches        6      6           
=====================================
+ Hits           20     21    +1
Impacted Files Coverage Δ
index.js 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5e4ede1...2c30efe. Read the comment docs.

Copy link
Contributor

@andregoncalvesdev andregoncalvesdev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

I would just change the commit message to something more explicit like:

chore: add lodash/fp as default id on babel-plugin-lodash

@andregoncalvesdev
Copy link
Contributor

This is just an opinion but defaultLodashOptionsIds sounds overridable. I prefer baseLodasOptionsIds as it sounds more extensible like this case.

index.js Outdated
[require.resolve('babel-plugin-lodash')],
Object.assign({},
options.lodash,
{ id: options.lodash.id ? defaultLodashOptionsIds.concat(options.lodash.id) : defaultLodashOptionsIds }),
Copy link
Contributor

@satazor satazor Feb 19, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should document the defaults in the README and perhaps add an example adding recompose?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, i will add the information with an example in the README.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

@satazor
Copy link
Contributor

satazor commented Feb 19, 2018

I agree with having a more specific commit message.

index.js Outdated
@@ -94,9 +94,13 @@ module.exports = (context, options) => {

// Cherry-pick lodash modules for smaller bundles
if (options.lodash) {
const defaultLodashOptionsIds = ['lodash/fp'];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at https://github.com/lodash/babel-plugin-lodash/blob/master/src/config.js#L17, I think that when we pass id, it completely overrides the default ones. This means that we must include all those defaults.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It has been reported in this issue. lodash/babel-plugin-lodash#184 .
We can re-include the defaults, but we should be concerned about future fixes on this matter.

index.js Outdated
[require.resolve('babel-plugin-lodash')],
Object.assign({},
options.lodash,
{ id: options.lodash.id ? baseLodashOptionsIds.concat(options.lodash.id) : baseLodashOptionsIds }),
Copy link
Contributor

@satazor satazor Feb 20, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this be changed to:

{ id: baseLodashOptionsIds.concat(options.lodash.id || []) }

? It's a bit simpler.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

"lodash-es",
"lodash-compat",
"lodash/fp",
"lodash-compat",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a repeated lodash-compat here. Can you change the test to use recompose instead?

README.md Outdated

Transform to cherry-pick Lodash modules is enabled.

`lodash-es` `lodash-compat` and `lodash/fp` are added by default, but you can cherry-pick any module you need as long as you specify it on `options.id`.
Copy link
Contributor

@satazor satazor Feb 20, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we change this part to:


Specify which modules will have the cherry-pick transformation applied.

Note that lodash-es, lodash-compat and lodash/fp are always added for you, regardless of having this option defined or not.

For instance, to have smaller bundles when using recompose:

README.md Outdated

Note that `lodash-es`, `lodash-compat` and `lodash/fp` are always added for you, regardless of having this option defined or not.

For instance, to have smaller bundles when using [recompose](https://github.com/acdlite/recompose) :
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove extra space before :.

@satazor
Copy link
Contributor

satazor commented Feb 20, 2018

@AfonsoVReis I would consider this a feat don't you think @andregoncalvesdev ?

@andregoncalvesdev
Copy link
Contributor

Yes @satazor , i agree this is feat.

@AfonsoVReis
Copy link
Contributor Author

Changed to feat instead of chore.

@satazor satazor merged commit 9694af3 into master Feb 20, 2018
@satazor satazor deleted the add-lodashfp branch February 20, 2018 15:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants