Skip to content
This repository has been archived by the owner on Aug 14, 2019. It is now read-only.

Install as a NPM module #24

Open
henrikbjorn opened this issue Apr 11, 2016 · 10 comments
Open

Install as a NPM module #24

henrikbjorn opened this issue Apr 11, 2016 · 10 comments
Labels
migrated The issue has been migrated

Comments

@henrikbjorn
Copy link

Hey. We are using Webpack to bundle our JS files in our React project. For that reason i am using analytics.js directly from npm, and would like to install each integration from npm as well.

So would you mind publishing the integrations to npm?

@hankim813
Copy link
Contributor

@henrikbjorn Right now our Analytics.js will load each client side JS library (if a given integration has one) at the time of a.js's initialization so I'm not sure this is something we'll do?

@f2prateek @sperand-io

@f2prateek
Copy link
Contributor

@henrikbjorn Our hosted version is the recommended way to use Segment, I'd recommend using your own fork hosted on NPM if the hosted version doesn't work for you.

@peterzen
Copy link

peterzen commented Jun 6, 2016

I am running into the same problem as @henrikbjorn – I too want to avoid using the hosted version in favor of the npm package.

@f2prateek Do I really have to fork the library just to add the (otherwise mandatory) version to package.json to get the package install? Does not sound sensible to me at all and creates maintenance overhead – it kind of defeats the purpose of using Segment altogether.

Please consider making the package installable using the standard npm method.

Thanks

Peter

@f2prateek
Copy link
Contributor

unfortunately b/w the 100+ analytics.js integrations (and some of which are being maintained by partners) we don't have the resources to publish all of them (outside of providing the segment hosted version).

I'm not as familiar with the fronted packaging ecosystem, so I'll let @ndhoule and @sperand-io chime in to confirm what our plan of action will be.

@peterzen
Copy link

peterzen commented Jun 7, 2016

This issue has not much to do with webpack - the issue is that the package.json file does not validate:

http://package-json-validator.com/

The below PR has a fix for the missing "version" field – and the missing dependencies which are another issue (though these aren't critical).

#29

Without having installable npm packages projects using webpack/browserify/etc won't be able to use your modules and using the hosted library is not an option for many.

@f2prateek
Copy link
Contributor

@peterzen could you explain why using the hosted version is not an option? I think that the hosted version should be easier to use, because instead of having to updated the version every time one of your integrations is updated, our hosted version can pull in the latest snippet of that integration without you needing to redeploy your app for updates.

@peterzen
Copy link

peterzen commented Jun 8, 2016

@f2prateek Performance considerations – I have many external libraries which I want to bundle into one single build, instead of loading them on demand from many third party services that I don't control the uptime of.

@f2prateek
Copy link
Contributor

@peterzen That sounds reasonable, but I'm not sure if using Segment integrations via a npm module helps with that. Most of our integrations are using dynamically loaded scripts. e.g. Just in the Google Analytics integrations, these are all the dynamically loaded scripts https://github.com/segment-integrations/analytics.js-integration-google-analytics/blob/master/lib/index.js#L58-L61 that might get updated/or be down at any time.

@hbrls
Copy link

hbrls commented Jun 16, 2016

@peterzen I just occupied the repo https://www.npmjs.com/package/analytics.js-integration-google-analytics in case.

As you've already found that, the package.json has problems and so does the deps. I'm working on a migration because I want it too. Any help official/non-official is welcomed.

And a bite-you I met yesterday. npm does not accept publish of the same version. I just published 1.4.3, and then found it did not work. After fixing the bug, I could not publish a 1.4.3 again. That means accidents will make the npm version not match the official version.

@SegmentDestinationsBot
Copy link
Contributor

Hi @henrikbjorn, as part of the monorepo migration, this issue has been moved to new issue. Our engineers have been notified and will prioritize and work on it ASAP. Thank you!

For more information, see README.md.

@SegmentDestinationsBot SegmentDestinationsBot added the migrated The issue has been migrated label Aug 13, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
migrated The issue has been migrated
Projects
None yet
Development

No branches or pull requests

6 participants