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

Update package.json to point 'main' at dist/katex.js #791

Merged
merged 2 commits into from
Aug 14, 2017

Conversation

kevinbarabash
Copy link
Member

Summary:
Now that we're using ES6 import statements in our source code
it makes it difficult for people to consume the katex package
as a node module unless they're using node.js version 8.x.

This diff points the node entry point to dist/katex.js which
is the compiled version of katex.js.

Test Plan:

  • publish
  • create a new project node project and add the new npm katex package as a deep
  • require katex in a test file and run it using node.js version 6.x

Fixes: #786

@edemaine
Copy link
Member

Testing:

  • Install Node 6 (in my case, I use nvm so it's easy to switch between Node versions)
  • Within checkout point_main_to_dist, run npm link
  • Then in another directory, npm link katex and then try node -e "require('katex')"

But I get the same error. If I change the main key to point to lib/katex.js, it works.

@edemaine edemaine self-requested a review August 13, 2017 13:34
Copy link
Member

@edemaine edemaine left a comment

Choose a reason for hiding this comment

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

See above.

package.json Outdated
@@ -8,7 +8,7 @@
"url": "git://github.com/Khan/KaTeX.git"
},
"files": [
"katex.js",
"dist/katex.js",
Copy link
Member

Choose a reason for hiding this comment

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

In fact, I think this line edit should be reverted. It's probably good to include the root (ES6) katex.js in the NPM package (why not? then people can choose). dist is already fully included 3 lines below. It's the main key, 6 lines above, that seems to need to change.

Copy link
Member Author

Choose a reason for hiding this comment

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

Good call. I totally messed this up. I meant to change main.

Summary:
Now that we're using ES6 import statements in our source code
it makes it difficult for people to consume the katex package
as a node module unless they're using node.js version 8.x.

This diff points the node entry point to dist/katex.js which
is the compiled version of katex.js.

Test Plan:
- publish
- create a new project node project and add the new npm katex package as a deep
- require katex in a test file and run it using node.js version 6.x
@edemaine edemaine merged commit e192be2 into master Aug 14, 2017
@edemaine
Copy link
Member

Tested and it works. Thanks @kevinbarabash for implementing this!

@kevinbarabash
Copy link
Member Author

@edemaine thanks for testing it.

@kevinbarabash
Copy link
Member Author

I should probably do an 0.8.2 release now that this has been merged.

@edemaine
Copy link
Member

edemaine commented Aug 14, 2017

Yeah, makes sense, as this will affect all NPM users. (on Node 6)

@kevinbarabash
Copy link
Member Author

I was thinking that for future major release it might be good to do a couple of RC release to work out the kinks when there are big changes.

@edemaine
Copy link
Member

Given our experience with 0.8 and 0.7, that sounds like a good idea. 😄

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