-
Notifications
You must be signed in to change notification settings - Fork 303
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
Fix npm package #532
Fix npm package #532
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a somewhat breaking change, so should be highlighted in the release notes for the next release (for those who wouldn't use three, or meshline, in their apps)
Normally, they shouldn't have to do anything (three and three.meshline are still in |
Oops, missed it. |
My understanding (to be taken with a grain of salt) is that if a project A declares B as
On downstream projects yes. It only displays warnings when there's a mismatch though (they should really be errors with a -f flag imho, but nobody cares about my npm opinions it seems!). Long story short, as we still need three to be in itowns' node_modules, we need it in dependencies as well. Onto the version specifier question: in semver, all 0.x versions are considered major. Therefore, while ^1.0 would include every 1.x versions, ^0.77 would only include 0.77.x versions. From https://docs.npmjs.com/misc/semver on caret range:
And the npmjs.com semver calculator confirms that. Npm is fun! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks good to me but I'll leave the final word to you or @tbroyer on this topic :)
(nit: there's a typo to correct in one commit title: dependencie
-> dependency
)
jsdoc was failing on the newest node8 release, probably because some api change. see https://github.com/jsdoc3/jsdoc/releases/tag/3.5.5
dbe4478
to
7c27899
Compare
indeed, corrected :-) |
Wait before merging, there's actually a problem by doing so: in a project depending on itowns, three would get installed and imported 2 times: one in node_modules/three, and one in node_modules/three/itowns/node_modules/three, causing a lot of problem (Object3D's id being wrong, code using |
We completely fall in the use case of peerDependencies: we are a library using another one (three), and we also expect our user to use three independently (to add their own object for instance).
as advised in a console warning.
eslint-config-airbnb-base requires a peer dependency on eslint-plugin-import v2.7. We had it in version v2.2.
7c27899
to
19a5c97
Compare
Yes, that's because it's still a "normal" dependency. A "peer dependency" would fix this, at the expense of asking everyone to explicitly add a dependency on tree (a breaking change, but possibly not a big deal; I mean, everyone using React in the browser for instance knows they have to depend on both |
Actually broken; three needs to be removed from "dependencies"
Yep, but actually, I think I have now the good setup: having them both in peerDependencies and devDependencies (would get installed too on Yes, we actually don't want to hide THREE at all, and I don't think it's bad to require users to install it separately. That also means we should remove itowns.THREE someday. |
Isn't this PR a good time to get rid of |
I need to think of a way to keep being able to use three in examples then. |
Use another entrypoint script than The alternative would be to have the bundle depend on an "ambient" three (i.e. force users of the bundle to first include three in the page – like people are used to include jquery before they can use any jquery plugin). BTW, there seems to be a single use of |
Done.
Well, that's really not that simple actually. I need to persuade itowns.js to take THREE (and all our peerDependencies really) as an external. It's quite easy of course, but it also means |
I just pushed a commit that put proj4 in peerDependencies. @iTowns/reviewers please r? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, that's really not that simple actually.
How about my proposal to have the "drop-in bundle" ship with three and proj4 and provide them at itowns.THREE
and itowns.proj4
? (exactly like we do today; just that those properties wouldn't exist when using itowns as an npm dependency)
Worth a PR on its own, right?
I'm fine with this (though if you'd like to go with the –probably simpler– proposal above, then maybe do it in this PR)
I didn't want to bother exposing |
no strong opinion either way though. |
@tbroyer I ended up implementing your suggestion. I have been too greedy at first: I wanted a clean module use case and a full bundle and a bundle relying on ambiant peer dependencies, but that's apparently impossible to do with one webpack configuration. So let's be more reasonable here :-) WDYT now? I still might do an ambient build (without peerDependencies) one day if we feel the need (and I find the motivation) for it. Thanks for your suggestion anyway :-) @iTowns/reviewers updated. |
When people uses a bundler, they can directly import these no need to pollute our namespace with itowns.THREE, proj4 etc. However, for people using our bundle, we still expose those peerDependencies, are they are included in it anyway. In the future, we might provide 2 bundles: one full bundle like it is today, and a bundle relying on ambiant peerDependencies (attached to the windows object).
4573f88
to
4af3aa9
Compare
@@ -54,7 +54,7 @@ module.exports = { | |||
// .babelrc is used for transpiling src/ into lib/ in the prepublish | |||
// phase, see package.json | |||
options: { | |||
presets: ['es2015'], | |||
presets: [['es2015', { modules: false } ]], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Babel support for export * from 'foo'
seems broken, so I let webpack deals with that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Description
These are a collection of small fixes in our packaging system.