To install the package with the atmosphere in meteor.js sufficient to use a single command. But let us assume that there is a need to edit a specific package for themselves. Now I needed to translate into another language package accounts-ui-bootstrap. Package code is in the appropriate folder in the directory .meteor. Everything works as it should, but after restarting the application server, all changes are rolled back to its original state. What should I do?
Just add a new JS or CSS file on your public/server folder depends the case, and overwrite it
Related
I have an external node package installed in my project. It does 90% of what I want but I'd like to make some changes to it. I don't want to submit a PR to developer since these changes are unique to my situation and would only be used by me. What would the best way to go about this? Inside my node_modules folder, the JS file of the library is minified so it's hard to make out anything or edit anything in a coherent manner.
You shouldn't be really messing about with the node_modules folder, as the code is usually minified (as you have stated).
However, the most reasonable approach to do is to follow the steps below.
Fork the repository on GitHub, and add whatever changes you need to add in the forked repository.
If you want, you can make a new npm module (if you have an account), and install that in your project.
Otherwise, you can just add it as a folder in your project, or something like that.
Make sure that this isn't overkill for your project!
In conclusion, you shouldn't make changes to the node_modules folder, but you can fork the repository as an alternative.
For a Meteor project I want to make changes to a Meteor Core library file.
Is this possible and if so, how?
So far I've tried just copying the files into my project directory hoping that the respective Objects are just overwritten from the originals but the problem herewith was that dependent functions or variables were only defined locally.
Then I tried to git clone them into the project's packages directory like you would do with a community package, but that didn't function either since the clone command failed (fatal: repository ... not found) and also the package is not explicitly called in the .meteor/packages file.
Any idea?
Meteor allows having local packages in a project, including ones that override existing (community or core) packages.
While overriding a community package locally often simply requires cloning (or extracting or adding as submodule) the GitHub repository into the /packages folder, core packages currently live inside sub-directories of the main meteor/meteor repository, which makes cloning them trickier.
Overriding a core package may require you to manually apply changes to the package as Meteor or the package update (as Meteor used to be dependent on specific package versions).
Therefore, before taking such step, make sure that you actually need to do it.
Make sure that you cannot you make your changes using local files or your own local package (e.g, by wrapping or replacing a function or monkey-patching it).
There are a few approaches that I used in order to override a core package.
Clone the entire repository and link the directories
This is useful if you want to contribute your changes to the project. You should probably fork the repository and clone your own fork.
Clone the meteor repository:
git clone https://github.com/meteor/meteor.git
or
git clone git#github.com:<username>/meteor.git if you forked it
Link the package directory (in your project's packages directory)
ln -s ../../(...)/meteor/packages/
You can checkout the desired branch/commit and copy them to the local packages directory instead, of course.
Statically download only the package directory
There is a neat trick that allows you to download a given directory from GitHub using svn.
This is obtained by issuing:
svn export https://github.com/meteor/meteor/[trunk|branches/]/packages/
for example:
cloning ddp-client from the devel branch:
svn export https://github.com/meteor/meteor/branches/devel/packages/ddp-client
or from the master branch:
svn export https://github.com/meteor/meteor/trunk/packages/ddp-client
Notes:
As mentioned earlier, you may need to manually apply changes if you update Meteor.
Don't forget to add the package to the project (meteor add <package>) if you haven't already.
Meteor is expected to switch to NPM at some point (possibly in Meteor v1.5), so make sure to use the methods specified in this answer only for meteor's own packaging system.
I am not that good at computers but am trying to use JSDoc for one of my projects,
The tutorial to get it up and running is here
http://usejsdoc.org/about-jsdoc3.html
I have downloaded the program from github, but now do not understand what I have to do. I have a bunch of files in a folder and dont know how to get it actually running for my project.
Could someone please give me a step by step instruction on how to actually get JSDoc working, how do I set it up, how do I use it etc.
I know this may be mundane to some of you, but hey we all gotta start somewhere right?
Well, are you using windows or GNU/Linux?
First, you have to follow the default tags to markup your source code, identifying your classes, methods, parameters, etc...
After that, you download the file here: https://github.com/jsdoc3/jsdoc
Extract it and then go to folder jsdoc-master.
Inside it, you have a script called jsdoc (with no extension). Only you have to do is execute it pointing the whole path to your .js file you want to create a documentation like this: ./jsdoc your_class.js
Then, in a couple minutes you'll have the output inside the 'out' folder. Open the .html file and bang! You have your documentation working pretty good.
Right here you can find some common tags to use in your code (as comments): http://usejsdoc.org/
This solution is for Unix based system. But, there is another one using nodejs (that you can run with windows, Linux, mac, etc...). First, download the nodejs here: http://nodejs.org/
Then go to this website to take a look at the package jsdoc: https://npmjs.org/
Then, go back to your terminal (in any operating system after installed node) and type: npm install -g jsdoc
The option -g means globally, so you have inside the main folder of your node packages and they are available for whatever project you have and you don't need to install it again and again...
Finally, you can just use this command: jsdoc path/to/your/file.js
And that's it! I hope it helps you.
Once you've extracted the file you downloaded off of github, navigate within the folder and run in a terminal:
./jsdoc
with the options you want.
If you want to display the help menu
./jsdoc --help
If you want to install the program on your system, assuming a mac or linux machine, use root user or sudo:
npm install --save -g [~/Downloads/jsdoc-3.2.2 or your path to the downloaded extracted files]
I have 2 projects. They use same js/img files. When I change js content in first project I should also change it in second project. I wanna make it as dependency. So I deploy changes to my local repository, then goto project1/project2, call update and changes are loaded.
I have tried to use bower but it doesn't satisfy me because of some strange behaviour (it copies whole folder content and ignores main section in component.json)
How can I implement normal dependency managment in my project? note: I need to manage my local dependencies
The main property in component.json is currently only used for other tools using Bower. There is currently a discussion going if Bower should have a .bowerignore file for ignoring files it doesn't need.
You might be better of just using a git submodule or symlinking the files.
Alternatively you could check out if any of the other JS package managers fills your need: npm, Ender, volo, component, jam
Another option (if you just want to fetch single files) might be: pulldown.
Configuration is extremely simple and you can easily add your own files/urls to the list.
I am in the process of converting an existing Rails 3.1 app I made for a client into a Backbone.js app with the Rails app only as a backend server extension. This is only a personal project of mine, to learn more about Backbone.js.
While setting up Backbone.js (using Backbone-on-Rails), I noticed I have some dependencies (like backbone-forms) that come from external sources and are frequently updated.
I've grown accustomed to using Bundler to manage my Ruby gems, but I haven't found anything similar for JavaScript files. I'm wondering if there is any way to do the same for Javascript (and possibly css) files.
Basically I can see three possibilities to solve this issue:
Simply write down all the sources for each JS file and check these sources from time to time to see what has changed.
Use some kind of existing "Bundler for Javascript" type of tool, I've been looking for something like this but have yet to find anything (good).
Since most of these JS files will be coming from Git anyway, use Git to get the files directly and use checkout to get the latest version from time to time.
I prefer the last option, but was hoping on some more input from other people who have gone this route or preferred some other way to tackle this issue (or is this even an issue?).
I figure the Git way seems easy, but I am not quite sure yet how I could make this work nicely with Rails 3.1 and Sprockets. I guess I'd try to checkout a single file using Git and have it be cloned in a directory that is accessible to Sprockets, but I haven't tried this yet.
Any thoughts?
You don't mention it in your alternatives, but ideally you should use something like Maven to manage your dependencies. Unfortunately, there are no public repositories for javascript files. This discussion lists some other options which might be of help to you: JQuery Availability on Maven Repositories
For now I've settled on using the Git solution combined with some guard-shell magic.
The steps I follow:
Create a dependencies directory somewhere on your local drive
Clone the repositories with javascript (or css) files you want to use in the app
Set up a custom guard-shell command to do the following:
group 'dependencies' do
guard 'shell' do
dependencies = '~/path/to/dependencies/'
watch(%r{backbone-forms/src/(backbone\-forms\.js)}) {|m| `cp #{dependencies + m[0]} vendor/assets/javascripts/#{m[1]}` }
end
end
Place the Guardfile at the root of the app directory
It takes some time to set things up, but after that, when you have the Guard running, and you pull changes into your dependencies, the required files are automatically copied to your application directory, which are then part of your repository.
It seems to work great, you need to do some work for each new file you want to include in the asset pipeline, but all that is required is cloning the repository in your dependencies directory and adding a single line to your Guardfile, for example for the backbone-form css:
watch(%r{backbone-forms/src/(backbone\-forms\.css)}) {|m| `cp #{dependencies + m[0]} vendor/assets/stylesheets/#{m[1]}` }
Also, the reason I added this Guard to a group is because I keep my dependencies outside the main application directory, which means guard normally doesn't check my dependencies directory. To make this work, I start up my main Guard processes using bundle exec guard -g main and use bundle exec guard -w ~/path/to/dependencies -g dependencies in a new terminal window/tab to specify the -w(atchdir).