Manage dependencies of ionic project - Github - github

I am working on an ionic project which needs to be shared with multiple developers using Github. We are not syncing the following folders to github, so they are part of the .gitignore file
plugins/
www/lib/
How would a new developer (who gets the app from github) would manage the dependencies that are part of these folders.
If I do 'ionic state restore' from the terminal then it fetches all the cordova plugins that are part of package.json. So, this takes care of the 'plugins/' folder.
However, www/lib folder is still empty. What do I need to do to get all the ionic/angular related javascript files that reside in the www/lib folder.

(Assuming the you have both bower and npm installed, if not follow these links to get your setup done: npm, bower)
Ionic uses bower as its library package manager. Run these commands after you clone the project from github:
npm install (refers package.json to install plugins)
bower install (referes bower.json to install libs)
Hope it was helpful, Happy coding. :)

Related

Install a github repository as a library through a script file

I am trying to remove the libraries folder in an Arduino project I am working on and install them through a script file. The issue with some of the libraries is that they seem to not be officially registered, so you can't use the arduino-cli lib install for them. Most of them are on github, so I am looking for a way to install them in a similar fashion as arduino-cli lib install, so they can all be neatly in one script file. I am slightly new to github and I am not sure if there is a way through which this is achievable.

Bower package not found - necessary to use npm as well?

I'm new to Bower, and I'm setting up a dummy project. I have initialised my project and installed jQuery and gulp just to get things started. This is fine, they have been added to my dependencies list in bower.json and are now present in my bower_modules folder. Great so far.
However, I want to install two plugins: main-bower-files and gulp-filter, but bower doesn't seem to have these libs.
When I run bower install --save main-bower-files, I get:
bower ENOTFOUND Package main-bower-files not found
So, it seems my only solution is use npm instead. But surely bower is supposed to be an alternative to npm, right?
Or is the only solution just to npm init as well as bower init at the start of the project, and then run two lists of separate dependencies?
Any help appreciated.
Actually, Bower and NPM have slightly different aims.
In my experience, Bower focuses mainly on frontend packages (jQuery, CreateJS, ...). See it as an alternative of using an external CDN for certain resources. NPM, however, has most of those packages on Bower, and then a large selection of packages for the backend, as well.
You would indeed need to keep two separate dependency lists, if you need packages from both repositories. Using those two managers in tandem is actually not that uncommon.
Be sure to install gulp and its modules through NPM, since they are definitely not frontend resources.
TLDR: Bower = frontend resources that you could have also hosted on a CDN, NPM = everything from frontend to backend and more.

Javascript Protractor - Is there any solution to run protractor test with remote node_modules?

I'm writing automation test for the angularjs web app. Using protractor and cucumber.
From beginning, I organized the test as a separate folder and actually it required different node packages from the root project(the project built up the web app).
Today there's a requirement that the node_modules of test project should be merged with the node_modules of root project.
As per my knowledge, when running the command protractor protractor_conf.js, the system looks for the node_modules in 1 level upstream folder.
I'm attaching the screenshot of my project folder to be clearer.
Appreciate all suggestions !
Thanks.
I will not recommend you not to save node_modules as the separate folder in the project directory. Instead, you can create a package.json file for your test project and list all the dependencies in the package.json file. so each time before you run protractor conf.js ,just run npm install command from the directory where your project is available. So by doing this way will help you to run the e2e scripts in different machines without depending on the node_modules folder.
Example package.json for protractor
Also, it is advisable to maintain separate node_modules for different project because it may avoid versions conflicts of any node_module that is used in both projects.

How to include leaflet-pip in ionic. Manually, bower or with browserify?

Right now in my ionic project I added manually the leaflet-pip.min.js file in www/lib/leaflet-pip/
I would like to do it with bower or with browserify. Documentation says:
npm install leaflet-pip
It is installed in node_modules/leaflet-pip directory but what else do I have to do, shouldn't those files be copied (automatically) to www/lib/leaflet-pip so thus I can add to my index.html the path to leaflet-pip.min.js

How to clone Ionic project to production

I have an Ionic Project, with all plugins, and libs and I am a little lost on how to manage so many plugins and libs.
Sometimes I install a plugin, test and after that install a couple of other plugins, and so on. After some time, I have so many plugins and I donĀ“t remember what are useful and what are not useful.
So, I would like to create another folder with a fresh version of my project, with only the necessary plugins and libs.
I am now using gulp to minify and uglyfy my code, and I will put all my minified files in this new folder.
So, my questions are:
Is there a simple way to verify what are the plugins and libs really necessary, without need to see it one by one ?
Is there a way to clone all my original project to another one, after I have already cleaned up the original folder ?
Thanks.
when you adding a plugin, you should call
ionic plugin "plugin-name" --save
it will save plugin information to your config.xml and package.json
next time, when your run ionic build, if plugins not install, it will auto install necessary plugins.
about npm module, you should call npm install "package-name" --save-dev to save your develop module, like gulp
in new project, you just copy the package.json and change project name and information, then call npm install, it will install the saved module.