Skip to content

Make package.json compatible for npm frontend use #3627

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

Merged
merged 3 commits into from
Oct 31, 2015

Conversation

ThomasG77
Copy link
Contributor

This PR augments package.json to ease OpenLayers 3 frontend development through NPM.
See this post on NPM blog to get more informations and evaluate if it's worth to accept.
If you use Browserify and/or Parcelify, you can use this informations out of the box.
browser part is in this spec

It's up to you to decide if providing paths to js and css is good.
In fact, it's quite similar to Bower but we don't create a new file, we only use existing package.json.

This PR augments package.json to ease OpenLayers 3 frontend development through NPM.
See this post on NPM blog http://blog.npmjs.org/post/112712169830/making-your-jquery-plugin-work-better-with-npm to understand my viewpoint and evaluate if it's worth to accept.
@tschaub
Copy link
Member

tschaub commented Apr 24, 2015

Can you provide an example of something you can do after this change (but not before)?

See PR comments for an update
@ThomasG77
Copy link
Contributor Author

I've updated my PR. A bit ashamed...
You will see what the additional variables can do for you, looking at this small demo project
The README should be clear. Feel free to ask more.
I can also submit a new PR with only one change.

When pushing previous content to npm, it complains that it only accepts `"browser": "dist/ol.js"` hence the correction again
@elemoine
Copy link
Member

I have no problem with that change. @tschaub?

@elemoine elemoine added this to the v3.10.0 milestone Sep 10, 2015
@ahocevar
Copy link
Member

ahocevar commented Oct 8, 2015

https://www.npmjs.com/package/parcelify does not seem to be that popular. What do you think @tschaub?

@ahocevar ahocevar modified the milestones: v3.11.0, v3.10.0 Oct 8, 2015
@tschaub
Copy link
Member

tschaub commented Oct 31, 2015

This looks ok by me. Thanks @ThomasG77.

tschaub added a commit that referenced this pull request Oct 31, 2015
Make package.json compatible for npm frontend use.
@tschaub tschaub merged commit 363ef8f into openlayers:master Oct 31, 2015
@bartvde
Copy link
Member

bartvde commented Nov 12, 2015

this breaks tools like dr-frankenstyle (https://www.npmjs.com/package/dr-frankenstyle used by Pivotal UI React) where style needs to be a string not an array:

> dr-frankenstyle css

TypeError: Arguments to path.resolve must be strings
    at Object.posix.resolve (path.js:439:13)
    at Object.callee$1$0$ (/Users/bartvandeneijnden/opengeo/git/sdk/node_modules/dr-frankenstyle-win/css-dependencies.js:81:39)
    at tryCatch (/Users/bartvandeneijnden/opengeo/git/sdk/node_modules/dr-frankenstyle-win/node_modules/babel-runtime/regenerator/runtime.js:67:40)
    at GeneratorFunctionPrototype.invoke [as _invoke] (/Users/bartvandeneijnden/opengeo/git/sdk/node_modules/dr-frankenstyle-win/node_modules/babel-runtime/regenerator/runtime.js:294:22)
    at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (/Users/bartvandeneijnden/opengeo/git/sdk/node_modules/dr-frankenstyle-win/node_modules/babel-runtime/regenerator/runtime.js:100:21)
    at GeneratorFunctionPrototype.invoke (/Users/bartvandeneijnden/opengeo/git/sdk/node_modules/dr-frankenstyle-win/node_modules/babel-runtime/regenerator/runtime.js:136:37)
    at lib$es6$promise$$internal$$tryCatch (/Users/bartvandeneijnden/opengeo/git/sdk/node_modules/es6-promise/dist/es6-promise.js:326:16)
    at lib$es6$promise$$internal$$invokeCallback (/Users/bartvandeneijnden/opengeo/git/sdk/node_modules/es6-promise/dist/es6-promise.js:338:17)
    at lib$es6$promise$$internal$$publish (/Users/bartvandeneijnden/opengeo/git/sdk/node_modules/es6-promise/dist/es6-promise.js:309:11)
    at lib$es6$promise$asap$$flush (/Users/bartvandeneijnden/opengeo/git/sdk/node_modules/es6-promise/dist/es6-promise.js:120:9)

@bartvde
Copy link
Member

bartvde commented Nov 12, 2015

I guess I can whitelist the directories though to have it ignore the openlayers directory

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.

5 participants