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

Publish on npm #14

Closed
jefffriesen opened this issue May 18, 2014 · 13 comments
Closed

Publish on npm #14

jefffriesen opened this issue May 18, 2014 · 13 comments

Comments

@jefffriesen
Copy link
Contributor

We've completely moved our client-side dependencies from Bower to npm and use Browserify for dependency management. Browserify allows you to include npm modules on the client. It's great.

There are ways to include Bower modules within Browserify. Debowerify works sometimes but can cause conflicts depending on what other transforms you have.

For reference for others coming here, this is a way to get d4 workings within Browserify:

package.json:
  "browser": {
    "bootstrap": "./src/javascript/vendor/bootstrap.js",
    "d4": "./src/javascript/vendor/d4.js",
  },
  "browserify": {
    "transform": [
      "browserify-shim",
      "coffeeify",
    ]
  },
  "browserify-shim": {
    "bootstrap": {
      "exports": "bootstrap",
      "depends": [
        "jquery:$"
      ]
    },
    "d4": {
      "exports": "d4",
      "depends": [
        "d3:d3"
      ]
    },

Then you can require it in your modules:

d4 = require('d4')

But it's really nice to just be able to do this and be done:

npm install d4 --save
@heavysixer
Copy link
Owner

Feel free to submit a pull request and a means of testing and I am happy to merge this into the project.

@jefffriesen
Copy link
Contributor Author

PR:
#15

@heavysixer
Copy link
Owner

@jefffriesen
Copy link
Contributor Author

sweet. Testing things on my end now.

@tgriesser
Copy link

Was looking at this with @jefffriesen, looks like this won't quite do it, since each of the files in src refer to d4 as though it's a global... if you'd consider it, we could look at moving a few things around so it refers to the correct d4 object when built.

@heavysixer
Copy link
Owner

@tgriesser @jefffriesen that sounds great to me as long as the composabilty of the library remains. Honestly, I'd like to refactor base.js into a series of smaller modules at some point too so maybe this would be a good first step. So consider this +1 from me!

@nsonnad
Copy link
Contributor

nsonnad commented Jan 8, 2015

Any progress on this? I'm hoping to use d4 with browserify in a project.

@heavysixer
Copy link
Owner

@nsonnad happy to consider pull requests for this feature, but i've been working on other aspects of d4 at the moment.

@nsonnad
Copy link
Contributor

nsonnad commented Jan 8, 2015

Cool, I'm hoping to prepare a PR for this. Do you have some guidance as to how to refactor base.js (or modularize other parts of d4)? In trying to remove the dependency on d4 as a global I'm having to pull things apart quite a bit, but I want to make sure I'm following what you envisioned.

@heavysixer
Copy link
Owner

@nsonnad sorry for the late reply I wanted to think it over before responding. In general the only thing I'd like to ensure is that at some point we can pull the requisite parts away from base.js and make it a plugin style model. Right now d4 is a ball of features and parsers but as things grow i expect users will want to just choose the charts they are interested in. This was my main approach in claiming a global namespace early on. If you can continue to support this long term goal with the reorganization needed to make it work inside browserify I am all for it! Please let me know if you need any help, or have questions about the codebase I am more than happy to ride shotgun on this with you.

@heavysixer
Copy link
Owner

I've made a browserify branch now off of master https://github.com/heavysixer/d4/tree/browserify
I plan on working on this now. @nsonnad if you have anything you've been working on that you'd like to contribute let me know.

@nsonnad
Copy link
Contributor

nsonnad commented Jan 26, 2015

Thanks @heavysixer. I did plan on working on it at some point in the next couple of weeks. I've done some initial work but it was mainly just me orienting myself with the library, nothing too helpful.

I'll keep an eye on the progress in that branch and suggest ways I can help out as you go. How does that sound?

@heavysixer
Copy link
Owner

@nsonnad this sounds perfect, thanks for doing that.

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

No branches or pull requests

4 participants