Skip to content

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

Merged
edemaine merged 2 commits intomasterfrom
point_main_to_dist
Aug 14, 2017
Merged

Update package.json to point 'main' at dist/katex.js#791
edemaine merged 2 commits intomasterfrom
point_main_to_dist

Conversation

@k4b7
Copy link
Copy Markdown
Member

@k4b7 k4b7 commented Aug 13, 2017

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
Copy Markdown
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
Copy Markdown
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
},
"files": [
"katex.js",
"dist/katex.js",
Copy link
Copy Markdown
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
Copy Markdown
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
@k4b7 k4b7 force-pushed the point_main_to_dist branch from b73d4bc to 7d68707 Compare August 14, 2017 13:55
@edemaine edemaine merged commit e192be2 into master Aug 14, 2017
@edemaine
Copy link
Copy Markdown
Member

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

@k4b7
Copy link
Copy Markdown
Member Author

k4b7 commented Aug 14, 2017

@edemaine thanks for testing it.

@k4b7
Copy link
Copy Markdown
Member Author

k4b7 commented Aug 14, 2017

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

@edemaine
Copy link
Copy Markdown
Member

edemaine commented Aug 14, 2017

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

@k4b7
Copy link
Copy Markdown
Member Author

k4b7 commented Aug 14, 2017

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
Copy Markdown
Member

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

@k4b7 k4b7 deleted the point_main_to_dist branch August 23, 2017 01:47
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