evolross
evolross

Reputation: 533

How do I edit a Meteor package from Atmosphere that's not on GitHub?

I have some Twitter functionality I'm working on and I want to use "Application-Only Authentication" which only needs my Twitter application credentials to just perform GETS in my app (e.g. random tweet searches based on user inputted tags, etc. - no actual user posting.)

Twitter supports this but most of the Twitter packages on Atmosphere and NPM do not. They force you to pass both application credentials and OAuth tokens, if you don't, your requests come back invalid. The most popular Meteor Twitter API package called mrt:twit actually wraps the NPM package ttezel/twit which actually implements Application-Only Authentication correctly, however the wrapper package for Meteor mrt:twit forces you to use Full Authentication requiring the user's OAuth tokens which I don't want or need to use. So I'd like to edit mrt:twit to properly follow ttezel/twit's interface.

However, the mrt:twit package is not on GitHub. How do I figure out where this lives and/or if I can access it locally and modify it and/or find some repository online for where it lives? Atmosphere doesn't offer much help providing no links from where this package is actually downloading?

Link for mrt:twit: https://atmospherejs.com/mrt/twit

Link for ttezel/twit: https://github.com/ttezel/twit

EDIT: I'm using Meteor 1.1.0.2. I was able to find where mrt:twit is locally. It's at:

.../.meteor/local/build/programs/server/packages/

After investigating, it's not that mrt:twit doesn't "implement" ttezel/twit's interface correctly, it's that mrt:twit is using/requiring an old version of ttezel/twit, version 1.1.9 instead of the current 2.1.0. That old version of ttezel/twit doesn't support the "application-only" authorization - I can see it in the code. Hence my above original issue. ttezel/twit downloads to the following folder:

.../.meteor/local/build/programs/server/npm/mrt_twit/node_modules/twit

Inside the above folder I see the full .git package for ttezel/twit but it's version 1.1.9. So I assume I could just replace this folder with the latest 2.1.0 version of ttezel/twit but I don't think you're supposed to have to mess with anything inside of an node_modules folder right? Shouldn't there be a config file somewhere to edit?

For the life of me I can't find where mrt:twit is declaring to use version 1.1.9. In all the code it just calls Npm.require('twit'). There's no config file I can find that sets the version to 1.1.9. The only thing I found is a file at the second path above sitting next to the twit folder called .node_version and all it has in it is v0.10.20 which is a version of Node to use I assume. That wouldn't "force" whatever package versions were out at that time would it? If so, then that's probably what is setting ttezel/twit to use 1.1.9.

My original post question still exists though, where can I find mrt:twit on a server so I can fork it/edit it and not have to edit the code locally?

Upvotes: 1

Views: 1108

Answers (2)

evolross
evolross

Reputation: 533

I emailed the creators of Atmosphere (percolatestudio.com) and Tom was really helpful and pointed me to where mrt:twit lives on GitHub. It's on the old 1.0 atmosphere:

https://old-atmosphere.meteor.com/package/twit

And that page points to the actual GitHub location which is:

https://github.com/subhog/meteor-twit

So the above link is from where the current mrt:twit package downloads into your Meteor app if you add it to your app (as of this writing). Once I found that I could easily see in the package.js file it declares Npm.depends({twit: "1.1.9"}). On a side note: It would be nice if the current version of Atmosphere pointed you to the GitHub location of older/legacy packages how it does the new packages.

So I was able to fork this and update the package to use version 2.1.0 of ttezel/twit. I made a pull request for mrt:twit so hopefully the author updates it - as this is the number one Twitter API package for Meteor with 1,200 downloads. Seemed better to update it than to publish my own version.

Until then, I made a local package following the below link and everything is working great - including application-only authentication. Thanks for the comments - they were helpful. I'm still pretty new at Meteor and how the packaging system works.

http://www.webtempest.com/meteor-js-packages-tutorial

If you want to access the updated package I made it's at the below link but it's not a published meteor package - so you'll have to download it and use it locally:

https://github.com/evolross/meteor-twit

Upvotes: 1

Dmitry
Dmitry

Reputation: 167

You should check .meteor/local/* folders.

I have a lot of packages files in .meteor/local/build/programs/server/packages

I'm afraid it's all compiled but you can grab some code you need and make your own package.

Upvotes: 0

Related Questions