Meteor packages -- how does it work? - meteor

I downloaded a Meteor Starter project called MeteorAdmin.
In the root of its directory tree, you find a packages directory that contains few packages (boostrap, comments, few others) and also, in the .meteor directory there's a file called packages that defines the dependencies of this project.
What is the difference between them? What I found interesting is that .meteor/packages contains bootstrap as well. In theory shouldn't that be enough so that bootstrap would get downloaded to the project?

The meteor packages file simply lists all of the apps dependencies as well as the load order of each (top to bottom). You can edit this file if you know what you are doing, but it's probably better to leave it alone until you are more familiar with Meteor.
The way you add packages is by typing meteor add <package-name> in your terminal and then it will be added to your project. Additionally, the name of the package will be added to the bottom of your packages file.
A meteor app can have local packages that are defined in the packages folder of the root directory. This project likely is implementing it's own bootstrap package and then added it with the meteor command I listed above. Once a local package is added to your project with the meteor add command it's package name will appear in the packages file just like packages from Atmosphere. I hope that answers your question... Let me know if you were looking for something more specific.

Related

How to Disable download missing package each time in meteor?

I tried to create meteor web application, but meteor download missing package each time when I change my code, and it was unnecessary.
So, can I config it only runs at the first time?
Thanks!
Could you add the actual message on the package it tries to download? Anyway, there are two potential locations where meteor looks for packages that need to be installed.
This is which each Meteor application and it's using Meteor Atmosphere packages. You can find these at .meteor folder in your project root file called packages path ./meteor/packages
Other potential place is packages.json in project root. It exists if you have used npm install or meteor npm install within the project.
Deleting unnecessary packages from these files should do the trick.

Customizing Meteor Package useraccounts:materialize

I'm currently trying to use the useraccounts:materialize package from Atmosphere; however, I do not know how to customize the HTML and CSS of it.
Is there any way of doing this?
Follow these steps :
Fork/Clone this repo
Make the required changes to the html and css files in the directory /lib
Publish your package to atmosphere and use that if you want to make it public OR use this as a local package.
Read about publishing to atmospherejs here and about using it as a local package by placing the package under packages folder in root and running the command meteor add usrname:packagename

How to re-use an already installed package in Meteor?

I installed couple of packages for 'Project A' (e.g bootstrap) assuming that it will be available for all subsequent projects. But when a new meteor project 'Project B' was created, meteor list showed only default packages. So my assumption that meteor packages are like ruby gems available globally is incorrect. As I work offline every now and then, Is there a way I can manually copy/re-use installed packages?
Yes they are similar to gems. Packages are installed in ~/.meteor/packages, in precompiled form. They can be installed globally this way.
When you add a package to your project it will essentially copy the package from there into your build-cache directory hidden in the .meteor directory of your project.
To install a package locally where you can easily re-use it you would have to clone the github repository of the package and place the output in the /packages directory of your Meteor app.
For example for bootstrap, twbs:bootstrap you would clone this reposistory: https://github.com/twbs/bootstrap, into a directory like /packages/twbs:bootstrap (name doesn't matter if its defined in the package.js file on the repository.
In general you can easily re-use a package without the hassle of adding it in manually like so. It's better to use the global packages which are kept up to date.
The trouble comes with being offline. If you use a local package its nearly guaranteed to always work. Whereas the global ones can give a bit of trouble once in a while when you try to add a package in as meteor tries to check the package is up to date, especially where npm packages are involved with the package.
To keep it short if you added a package in using meteor add twbs:bootstrap you should most likely be able to add it to another project using the same command. Only if you keep your packages & meteor up to date.

RStudio project and git repository in subdirectory

When developing packages in RStudio.
By default RStudio assume your package directory is the project directory and it looks like that:
But you are allowed to point the package location to a subdirectory of the project directory and it looks like that:
This way you can have some part of your project files, kept in the root project directory, not included in the package. You don't need to set git ignore etc.
But if you want to add RStudio git repo features, you are not allowed to point your git repo in subdirectory, even if you have already created git repo in your package dir (not project dir) you cannot set it in RStudio. I'm stuck at:
Is there any way to enable git repo features in RStudio having git repository in the subdirectory of the RStudio project? Maybe some .Rproj config tweaks?
Very good question. I've experienced the same trouble and it also does not go away with the latest pre-test release. So there's likely no super quick solution to this inside rstudio. Though it might be worth a feature request.
Personally I use the console / git bash with git and rstudio. That is I create a project inside R studio and manually run git init outside rstudio. Also I add, commit, merge, push and pull outside rstudio. If you don't like to manage git via console there's https://windows.github.com/ and https://mac.github.com/ also the folks at Atlassian provide some GUI tool called source tree: https://www.atlassian.com/software/sourcetree/overview
Plus there are many others, like Tortoise Git which I haven't tested, but I think R Studio's current git support is fine for simple things, but a git tool (console or gui) is definitely the way to go if you want to be more flexible.
That being said, sublime text edit is a powerful and easy to hack and customizable text editor which also has quite some packages to extend it. It's not entirely free but sometimes it's a nice supplement to rstudio. And it has a cool resolve conflict package etc.

Where does meteor stores its packages?

I have a meteor 1.0 app. I've added a bunch of packages, for example: meteor add kevohagan:ramda. But I cannot find it anywhere. I can't even find it on my system.
In my project:
$> meteor list
kevohagan:ramda 0.1.2 A practical functional library for Javascript programmers.
meteor-platform 1.2.0 Include a standard set of Meteor packages in your app
...
$> ls packages
ls: packages: No such file or directory
$> mdfind ramda.js # file added by the package
# no results
Where are they ?
If you add a package via meteor add author:pkg it will be added to the meteor installation (e.g. ~/.meteor/packages); here you can find different versions of the package. In your project home, the package name will be added to the .meteor/packages file.
Later, if run your project, the package will be added to the build directory (and of course only one version can be found here).
I think that they all are in
.meteor/local/build/programs/server/packages
but they are ninified, and the file names are changed, like "kevohagan_ramda.js" or "meteor-platform.js"
If you check out your project folder then you'll find two 'packages' folders. One at the root of your project and the other deep down inside .meteor. Below I've listed both of them.
.meteor/packages //this consist of the packages that you built yourself or other top-level packages like spinner & iron:router
.meteor/local/build/programs/server/packages //other packages

Resources