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

feat(builtins): load min versions if available #1741

Closed
wants to merge 5 commits into from

Conversation

martell
Copy link

@martell martell commented Jul 16, 2018

helpers.js prelude2.js and prelude.js don't have min versions in git tree.
I think we should have a fallback these instead of blindly checking for the minified versions.
(For when someone wants to use master directly for testing in their package.json instead of using a release bundle)
Thoughts?

Copy link
Member

@DeMoorJasper DeMoorJasper left a comment

Choose a reason for hiding this comment

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

This can probably be cleaner if you write a helper function with the path of the original and minified one.

Something like this: getExisting(preferred, fallback)

@martell
Copy link
Author

martell commented Jul 17, 2018

@DeMoorJasper I created a file src/utils/getExisting.js with the other utils which should be cleaner and is used for all 3 builtins.

@martell martell force-pushed the builtins-min-fixes branch from bedbcfd to 27b1897 Compare July 17, 2018 18:45
fs
.readFileSync(path.join(__dirname, '../builtins/helpers.js'), 'utf8')
.trim() + '\n';
const prelude = getExisting(path.join(__dirname, '../builtins/prelude2'));
Copy link
Member

@DeMoorJasper DeMoorJasper Jul 17, 2018

Choose a reason for hiding this comment

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

Sorry for being difficult, but I'd prefer this to be more explicit.
Use the full paths, because this overcomplicates it a little in my opinion

Copy link
Author

Choose a reason for hiding this comment

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

Understood. I did it in a separate commit.
I'll squash after we get this into an approved state.

* we use min.js and .js (with .js as the minified fallback).
*/
module.exports = function(minified, source) {
if(minified.split('.').length < 2 && source === undefined) {
Copy link
Author

Choose a reason for hiding this comment

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

Do you want me to remove this?

Copy link
Member

Choose a reason for hiding this comment

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

Yeah sure seems obsolete now that you've written them explicitly

@martell martell force-pushed the builtins-min-fixes branch 2 times, most recently from 6e8d77d to ae66d69 Compare July 17, 2018 20:44
@martell
Copy link
Author

martell commented Jul 17, 2018

done, this should be good to go. I also squashed it.

Copy link
Member

@DeMoorJasper DeMoorJasper left a comment

Choose a reason for hiding this comment

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

Awesome, thanks for the nice cleanup!

.replace(/;$/, '')
};
const prelude = getExisting(
path.join(__dirname, '../builtins/prelude.min.js')
Copy link
Member

Choose a reason for hiding this comment

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

It appears you forgot a , here though

Copy link
Author

Choose a reason for hiding this comment

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

thanks, done

@martell martell force-pushed the builtins-min-fixes branch from ae66d69 to db168d7 Compare July 17, 2018 21:23
Copy link
Member

@DeMoorJasper DeMoorJasper left a comment

Choose a reason for hiding this comment

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

For some reason a lot of travis tests are failing, I'll look into that before anyone can merge this

Copy link
Member

@DeMoorJasper DeMoorJasper left a comment

Choose a reason for hiding this comment

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

For some reason a lot of travis tests are failing, I'll look into that before anyone can merge this

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.

2 participants