How to create a personally hosted package registry like bower - angularjs

I'm looking to create a package registry for components or add-ons for the Ionic Framework, where one would be able to:
View / search packages on a website
Upload new packages (components) to the registry
Download packages from the registry
It would almost be a replica of the Bower registry. There would be a nice front-end for viewing and searching the available components inside of the registry. And a CLI would be necessary for downloading and uploading the packages/components from and to the registry.The registry could link to git/github repos just like bower.
Basically I'm asking how does Bower work, how does it store all of the packages? how does the CLI download the package for the github repo? And how can I replicate it for my own personal use?
Ideally I would like to write the whole thing in NodeJS + MongoDB + AngularJs.

Bower uses your repo Git tags to manage module versioning, it doesn't store the code like npm does. Each time you push a new Tag to GitHub it becomes available as a version for your Bower module. Bower simply constructs the tar/zip/git (not 100% sure which it uses) download link for the Git tag.
Bower does have a DB of course to manage users and published modules.

Related

Angularjs project workflow steps

I am setting up am Angular.js project from scratch. And I would like to keep it on Github inside a repository.
I have a simple question but I couldn't find a comprehensive answer for it. After establishing the project basic scaffold, and installing some node modules with NPM, there are many libraries, node-modules and etc in project structure. Also there are files of the framework for example Sails framework. Since a developer can install them by running npm install, which files should I push into the repository? Which ones don't need to be pushed?
The problem is, Source tree shows all new files as not staged, and I am confused which one I should exclude, which I should commit.
From personal experience, 2 types of files can be ignored in git
3rd party libraries, which can be installed using npm/bower etc.
Generated files, like css generated from less, minified js files, etc.
which files should I push into the repository?
Any files related to your application that contain business logic, routing, or other files that you've added to the project that are required for your app to run.
Which ones don't need to be pushed?
You should add node_modules to your .gitignore file. In almost all scenarios it would be unnecessary to include installed packages because your package.json maintains a list of packages to install when calling npm install.
If you're not sure about where to start with a .gitignore file, this is the defacto Node.js .gitignore file that is generated by GitHub & many popular IDE's. Just add that file to your project folder and git will automatically detect it, you should include your .gitignore as part of your repository files.
Additionally, if you're using Bower for front-end package management, you should add your bower.json to your repository and add the bower_components directory to your .gitignore.

Angular2 with maven project

I have a question, I want to use angular 2 in maven project, and as you now the modules should download with ( npm install or ng new .. (cli) ).
The problem is if I generate the war file with all this modules, it will be very large because of the presence of all the nodejs modules.
In one of Github example they install this modules with ( npm install ) and finally goes to the home directory and run spring-boot:run
I want directly deploy my war file, so my question is : i should generate the war file with the all the modules and dependencies of nodejs or there is another solution ?
Three ways:
add all node_modules dependencies in to your version control, so source is always there, or copy necessary js libraries manually in specific source folder, like angular.min.js and so on (if your node.js is not available on your server, by security reason)
create execution goal inside pom.xml, something like
How to deploy a node.js app with maven?
use https://github.com/eirslett/frontend-maven-plugin and check existing examples, I am sure your case is straight forward

Is there an official nuget package for Angular 2?

I'm currently working in a work environment where I do not have access to npm / node. The npm download location is actually blocked so I can't get any packages.
I want to build an Angular 2 site. As I can't access npm, I want to use Nuget to get the files. Although I can see the Angular 1 packages, I cannot seem to see any Angular 2 packages. Is there one for Nuget?
Also, is populating the node_module folder and compiling the Typescript the only thing that npm does for Angular? If I can just get a copy of the node_module folder (from outside work) and get TypeScript working in my solution, can I basically bypass the need for npm?
In short; No.
You can see a list of all available NuGet package versions here, with the most recent being 1.5.3.
Even performing a generic search shows most recent versions as 1.5.3.
Sometimes they'll have beta versions of packages available that you can install with a command similar to: Install-Package EntityFramework -Version 6.1.3-beta1 -Pre, but it doesn't appear as if they have created any pre-release packages.
So, as #Michal Dymel mentioned, you could get it from a CDN or some other location.

Why do I need to install node.js and git to learn AngularJS?

I am presently reading Manning's AngularJS in Action by Lukas Ruebbelke
The introductory part suggests,
Because you’re pulling files from a CDN, you’ll need to run
Angello Lite(the application name) from a web server. There are a few ways to do this, but one of the easiest ways is to use the npm package serve.
The steps for installing Angello Lite are as follows:
■ Install Node.js. You can find all of the information to do that at http://
nodejs.org/.
■ Install the serve package by running npm install -g serve from the command
line.
■ Download Angello Lite from GitHub, using the URL given above, and place it
on your local machine in a directory named angello-lite.
■ Navigate to the angello-lite directory from the command line and run serve.
■ Go to http://localhost:3000 in your browser to see the application.
Does learning Angular JS require previous exposure to node and git?
If I have Apache Tomcat already configured on my local m/c, what is the procedure to start with it?
Furthermore, just to keep in sync with the author, I installed git and then cloned a dir onto my local m/c from github.
Then i install node.js and Install the serve package by runningnpm install -g servefrom the command line.
Unfortunately when i navigate to the angello-lite directory from the command line and run serve, it shows me
where angello-lite is the repository where the application resides?
Any suggestions on how to configure successfully?
I have no idea regarding node.js and git. Do i really need to learn
these to begin with AngularJS then.
No, that's not a requirement. You don't even need a web server. You can have your static HTML files locally or use some online service like plnkr. Obviously if you need to work with dynamic data then you will need a web server. At some point you might want to start making AJAX calls in order to fetch some dynamic data from your server backend.
If I have Apache Tomcat already configured on my local m/c, what is
the procedure to start with it?
Just add an HTML page to the root of your website, open your favorite browser and invoke this page.
You don't need those tools to learn Angular - you can download latest package from the AngularJS website (both for development and for production).
Node.js and Git may be necessary to pull and build packages from the NPM, run tasks and many more great features, but just to learn Angular all you need is its code.

Adding packages like moment.js & account.js to meteor Project

How do I add these JS packages to a meteor project? Do I simply place the JS files in the public folder so the client and server can access them? Or is there some specific steps that I need to follow?
These kind of standalone libraries can be directly placed in the /lib directory under your project.
For use on both the client and the server, place them into project/lib folder.
Or if you want to use them only at client-side, place them as usual in project/client/lib
In short, It depends.
I would recommend you check out http://atmosphere.meteor.com for a list of packages. If what you're looking for is there, install meteorite with npm install -g meteorite (https://github.com/oortcloud/meteorite)
Once you have metorite installed you can install these community packages quite easily using mrt add packagename
Most packages are on http://atmosphere.meteor.com.
But if for some reason the JS package you want isn't on atmosphere, depending on the package, if its a UI package (e.g datepicker, etc) put it in the /client/lib folder to avoid meteor crashing (only accessible by client).
If its a type of module abstractor (e.g backbone - backbone is included in meteor already btw: add using meteor add backbone) you could put it in the /lib directory of your package, it will be referenced automatically by both the server and client.
You have to add the packages via console.
Type "meteor add accounts-password" for example.
See here
Perhaps you should watch some of these videos here
to get an idea how meteor packages are added.

Resources