Is there a Javascript implementation of Git?
I'm wanting to use HTML5 to create a rich Javascript application and have the idea that I could use git to track changes to the data. So, I'm wondering if there is a javascript implementation of a git client, or maybe some way of controlling a git repository by making POST requests.
Check out: https://github.com/danlucraft/git.js
A pure js implementation of git in javascript.
This https://github.com/creationix/js-git is and will be the future!
It is backed by a kickstarter campaign and has a very sound software design.
Many of the client use-cases such as git clone have been implemented
According the answer to my question on the issue tracker [1]. The author also plans to implement parts of the server side stuff to allow you to build a server with it.
https://github.com/creationix/js-git/issues/33
You can use https://github.com/isomorphic-git/isomorphic-git
isomorphic-git is a pure JavaScript reimplementation of git that works in both Node.js and browser JavaScript environments. It can read and write to git repositories, fetch from and push to git remotes (such as GitHub), all without any native C++ module
isomorphic-git is a continuation of https://github.com/creationix/js-git
isomorphic-git would not have been possible without the pioneering work by
#creationix and #chrisdickinson. Git is a tricky binary mess, and without
their examples (and their modules!) I would not have been able to come even
close to finishing this. They are geniuses ahead of their time.
Related questions:
Run git push from javascript hosted in static site
How to implement Git in pure Javascript to create a GUI?
I guess it depends on what you need, but there's a few related projects out there.
The most "robust" implementation I can think of is this one by the 280North crew (of Cappuccino fame).
There's also some server-side JavaScript projects underway (e.g., http://github.com/ajaxorg/node-github), but that won't run entirely within a browser client.
Update (for anyone else who comes across this):
Please be sure to check out vanthome's answer. Tim Caswell's js-git project is well funded and undoubtedly the best answer here at this time.
I just recently wrote a Git client called Nougit. Maybe this resembles something you are looking for?
$ npm install nougit
https://github.com/gordonwritescode/nougit
This is a full GUI, but the module inside named "git.js" is an API I wrote specifically to do what you are describing. Yank out the file, and you can use express to handle the http routes.
Related
I want to validate branch names when someone on my team does: git checkout -b [branch-name and then do some validation and give them feedback if they don't hit the criteria
I don't seem to be able to create custom hooks and im not sure how to create a script that runs when someone types git checkout -b. can someone give me a clue how to do this?
also once I commit this PR into master I would like the command git checkout -b to work on other peoples machines as soon as they pull this new code down
What you've described is that you want to commit something into a repo, so that if someone pulls from that repo, the behavior of a common git command is changed so as to run arbitrary code of your choosing. This is not something git supports, and hopefully it never will (as doing so would be a huge security hole).
I don't seem to be able to create custom hooks
Why is that?
I ask because hooks are the closest thing you're going to get to what you want. In particular, you should enforce branch naming (or any other conventions) on the remote using a pre-receive hook (and give up on caring what branch names might be used locally by the devs).
If your developers want something client-side so that they can "fail fast" when they make errors with respect to this naming convention - and once you have server-side enforcement, they probably will - then you can offer them the same underlying script to run as needed. They can then set it up locally in whatever way they see fit - perhaps as an alias, for example.
If you can't use a pre-receive hook - e.g. if the software that hosts your remote doesn't provide for custom hooks - then git has no direct support that's likely to help. In the case that server software is getting in the way, consult that software's docs to see what functionality it might offer in lieu of hooks.
In the end, you may not be able to rely on the software to enforce your naming policy. Not everything is best solved as a technical problem.
Should Node.js be the basis of a website or be used only when certain functionality (eg. a chat room) is needed?
For example, in certain project, I'm using npm and have a node_modules folder and a package.json file in the main directory where all my code is.
However, the question I'm asking is whether or not this is good practice? Should Node.js only be used in, for example a chat-room/ folder? Or is it OK to use the same Node.js installation across an entire website, using when needed?
Many companies recently are having a hard job to detach their front end code from their server, hence, if you are starting a project from scratch, this is something you want to avoid.
Having low coupling applications will give you the flexibility to change your whole Front End stack without changing a single code in your API. Moreover, you will be able to use your API from different applications. They will now work independently.
The routing is how you define the URL, verb and opt parameters.
I hope that is what you have been struggling with.
I have a little question here. Is there any way to build a server side JS without any use of external software. The reason for this is I am not able to install any software on the webspace but I wanted to experiment with realtime communication with the server and another user for a game or something like this.
If someone knows a way to establish something like this I would be quite happy to hear about it.
EDIT: Guys NOT NodeJS I AM NOT ALLOWED TO INSTALL ANY OTHER SOFTWARE!
https://cloud.google.com/nodejs/
or
https://devcenter.heroku.com/articles/getting-started-with-nodejs#introduction
Those $15 a year webhosts typically don't allow you advanced customization. You need a better web hosting service that allows you CLI access to the server back end.
Running JavaScript on backend requires NodeJS runtime environment. Download it here https://nodejs.org/en/
Alternatively you can can configure an instance on Heroku and run your application there. But I would suggest to try the first one.
No. Javascript is a scripting language that was designed to work within the browser. There's no out of the box solution for you, as Javascript doesn't do server-side out of the box
However, Node.Js (and others) use Chrome's V8 engine to create an event-driven runtime environment which can allow writing server-side code with Javascript. That's your best option
I'm trying to grasp a bit of an idea here. And hoping someone can help clarify the best practice.
How do teams or pairs approach using a build system for javascript like grunt.js ?
I really want to break our large javascript files into smaller pieces and converting to AMD/Require isn't an option right now.
It seems the easiest way is to concatenate and minify to a master file. And we are using version control (SVN).
So I'm wondering what the best practice is here?
Are we asking for constant conflicts with the production file? How do other teams approach this?
Hope i made my question clear enough.
thanks in advance...
We recently faced a similar dilemma at my organization. Using AMD or RequireJS wasn't an option due the the sheer amount of legacy JavaScript code we have.
We ultimately went with grunt and came up with a "build" task that concatenates and minifies. Then, there's a completely separate "deploy" task that gzip's the files and uploads to Amazon S3.
We don't check in our concatenated/minified code to source control. In general, it's a good operational practice to have separate build and deploy tasks for your source code. For larger development teams, the deploy/build process would traditionally be done in a CI tool that runs whenever someone commits to SVN/git.
In your case, a simpler arrangement would be if you just manually deployed code from your development machine instead of have it automated from a CI tool. The problem with this setup is it's easy to run into conflicts with other team members.
That said, there is a growing number of open-source (Jenkins) or cloud-hosted (CircleCI) tools that might be worthwhile for you to look into.
Do not commit the output. Use a ci tool like teamcity to build and deploy. Only commit source files to source control.
I'm developing a public e-commerce site in NodeJS and MongoDB, and I'm using forever instead of nginx or anything like that. (please let me know if I'm totally insane for doing this and why before I get too far along :)
As part of this site I need to calculate shipping, but I need to know that the numbers are spot on because I want to charge customers at checkout.
How could I set this up with Node.js?
I kind of have one solution, but I have no guarantee that it's accurate. Has anyone dealt with the UPS APIs using Node?
Thanks in advance for your help
Someone named Jesse D. Pate has developed a native UPS API. I have no idea if it's worthwhile, but the github repo is here, and it can be installed and toyed around with via
npm install ups_node
I think I've got it figured out ...now to start a Github project
This is a universal way to do it:
I modified the ./RatingPackage/PACKAGEXMLTools/Rate_Tool_SampleRequest.xml to include my information then I saved it as testRequest.xml then I posted it to https://wwwcie.ups.com/ups.app/xml/Rate (their test server) using the command
curl -X POST -d "`less testRequest.xml`" https://wwwcie.ups.com/ups.app/xml/Rate
and it returns an XML document that can then be converted to the (superior) json format and used in a web app.
I developed a node module with support for more functionality (and will continue improving) of the UPS API. With this module you can provide rating information, create a shipment, produce a label, void a shipment, track shipments, and perform address validation.
Check it out:
npm install shipping-ups
Read docs here: https://github.com/typefoo/node-shipping-ups