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

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.

Related

How to create a babel plugin for internal use

How do we use a babel plugin that is not already accepted in a babel repository? I had trouble finding this answer reading through the babel plugin documentation.
We are interested in writing a babel plugin for for...in loops to address a bug in ios9 (ios9 Safari miscalculating sum). Although we would be happy to contribute it to the babel community, I was also wondering if it doesn't get accepted or isn't ready for general consumption, how to start using and testing it locally.
It's possible to make use of custom babel plugins that you can host on git.
You can refer to https://github.com/jamiebuilds/babel-handbook/blob/master/translations/en/plugin-handbook.md for learning how you can develop and test your babel plugin locally.
Once you have developed the plugin, you can add a dependency for it in your project's package.json file.
Note that if you plan to make the plugin repository private, you'd have to create a personal access token (for Github) to allow npm to fetch repository contents. In that case, the example entry in your package.json file would be as follows:
"babel-plugin-transform-for-of-loop": "git+https://{token}:x-oauth-basic#github.com/username/babel-plugin-transform-for-of-loop"
Whatever package name that you pick for your plugin, you will need to add a reference for it in the .babelrc file. For this example, it would be as follows:
{
...
"plugins": [
"babel-plugin-transform-for-of-loop"
]
}
With that done, you should simply run npm install and your plugin would become active for your project.

Manage dependencies of ionic project - 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. :)

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.

Use purescript-halogen (with pulp)

Following PureScript by Example, I'm using pulp for installing packages.
Halogen requires virtual-dom as extra dependency. From the documentation and the example packages, it seems to me that adding it involves a bunch of build tools that I haven't used before (gulp, webpack, bower, etc.). I downloaded the examples and tried to run them with npm install & npm run example but I got unknwon module errors.
So, I'd like to know a minimal viable way to install halogen into a new pulp project (which hopefully doesn't require me to delve into the slew of build tools, or at least not for small projects).
I think you should be able to build it with pulp browserify --to some-file.js - the Browserify option is there for situations like this, where you want to produce a single JS file from a collection of CommonJS modules that may include npm dependencies.

Why does the nuget command line tool not follow dependencies?

According to this question:
using nuget.exe commandline to install dependency
The command line NuGet tool does not follow dependencies intentionally. While I could understand this as the default behavior, it seems odd to me that there is no choice to have the tool follow the dependencies. Is anyone aware of the reasoning behind this?
That answer is specific to running nuget install packages.config.
When specifying packages.config, only explicitly listed packages are installed.
However, if you try installing a specific package: nuget install My.Package.Id then NuGet will install the package and any dependencies.
EDIT Additional info as to why there's a distinction.
nuget install should really be called nuget download. It doesn't really install in the traditional sense. That is, it doesn't add references to your project files, it doesn't run install.ps1, it doesn't update packages.config, etc. You need to either use the NuGet GUI or Package Manager console to get a true install.
Since the true install updates packages.config, this file already includes all the dependencies that were installed. So specifying the file means, I want to download these specific packages. NuGet doesn't need to think about it since it's basically pre-calculated.
If you want to install/download multiple packages and have NuGet follow dependencies, just create a batch file and issue multiple commands:
nuget install My.Package.Id
nuget install Another.Package.Id
This will cause NuGet to fetch the package an any dependencies it may have.
Hope this clarifies things.