How to get individual ui-utility module using bower.json - angular-ui

I'm trying to include the ui-mask utility in my projects bower.json file so other devs will be able to install it when running bower install.
I can install it manually with bower install angular-ui-utils#bower-mask,
but in my bower.json file I can't figure out the correct name/version. Should be mask-0.1.1
Angular UI-Utils
UI-Util Mask Module
What I want to work in bower.json:
{
"name": "project-name",
"dependencies": {
"jquery": "^2.1.x",
"angular": "~1.3.x",
"angular-route": "~1.3.x",
"angular-touch": "~1.3.x",
"angular-sanitize": "~1.3.x",
"at-table": "1.0.1",
"ngDialog": "0.2.13",
"angular-local-storage" : "0.0.7",
"angular-ui-utils#bower-mask" : "0.1.1" <- This should work
}
}

When using bower install angular-ui-utils#bower-mask you instruct bower to look for angular-ui-utils with a "bower-mask" version.
A version in this case is actually a git tag, branch or commit hash (when bower is using a git resolver).
Since the the angular-ui/ui-utils repository has a bower-mask branch it will be resolved.
If you would like to resolve bower-mask 0.1.1 you will need to find the correct tag in the Github repository. In this case this should be mask-0.1.1, so what you need in bower.json is:
{
"name": "project-name",
"dependencies": {
"angular-ui-utils" : "mask-0.1.1"
}
}
In the bower output you should see:
bower resolve git://github.com/angular-ui/ui-utils.git#mask-0.1.1
bower download https://github.com/angular-ui/ui-utils/archive/mask-0.1.1.tar.gz

Related

how do you get the latest version of Polymer elements using bower?

I am experimenting with an asp.net core MVC web app using Polymer, and largely things seem to be going well. I used the now built in bower.json file to specify required packages (eg paper-fab), and they were dutifully installed. Nearly every time I could just use the package name and version from the appropriate Polymer catalogue page (example). But with a couple of the pages (paper-ripple and paper-card) bower can't find the specified version, so I tried the wildcard approach which resolved to a much earlier version. For paper-ripple it didn't seem to cause any problems, but paper-card just doesn't seem to work for me.
Here is my bower.json file:
{
"name": "asp.net",
"private": true,
"dependencies": {
"jquery": "2.2.0",
"jquery-validation": "1.14.0",
"jquery-validation-unobtrusive": "3.2.6",
"polymer": "1.4.0",
"PolymerElements/paper-material": "1.0.6",
"PolymerElements/iron-icons": "1.1.3",
"PolymerElements/iron-image": "1.2.5",
"PolymerElements/paper-button": "1.0.13",
"PolymerElements/paper-icon-button": "1.1.3",
"PolymerElements/app-layout": "0.10.4",
"PolymerElements/paper-header-panel": "1.1.6",
"PolymerElements/paper-toolbar": "1.1.7",
"PolymerElements/paper-drawer-panel": "1.0.10",
"PolymerElements/paper-fab": "1.2.1",
"PolymerElements/paper-item": "1.2.1",
"PolymerElements/paper-listbox": "1.1.2",
"PolymerElements/paper-ripple": "*",
"PolymerElements/paper-card": "*",
"normalize-css": "4.1.1"
},
"resolutions": {
"polymer": "^1.2.1",
"paper-ripple": "^1.0.0",
"font-roboto": "^1.0.1"
}
}
I know I could just download the latest versions from the catalogue, but I'd rather continue using bower if I can.
Of course it's always possible I am doing the cards wrong!
<link rel="import" href="~/lib/bower/paper-card/paper-card.html" />
<paper-material main elevation="0">
#for (int i = 0; i < 10; i++)
{
<paper-card heading="Card #i">
<div class="card-content">Some content #i</div>
</paper-card>
}
</paper-material>
The cards are just being output into the DOM like this (usually when using chrome dev tools I can see all the local DOM inside Polymer elements, but not in this case):
<paper-card heading="Card 0">
<div class="card-content">Some content 0</div>
</paper-card>
EDIT: Potential Workaround
So I have found that rather than directly editing the bower.json file in Visual Studio (which updates all your packages when saving), if I open up cmd in the same directory as the bower.json file and run bower commands from there I can install the versions shown in the Polymer catalog. For example bower install --save PolymerElements/paper-ripple which then updates the bower.json file accordingly. Perhaps this is the best way of doing it rather than relying editing it manually and relying on VS to update the packages?
If you want to install latest version on every bower install command you can add caret(^) to all your bower dependencies. Currently you have hard coded all the versions that needs to be used.
You can check out this answer for more details on bower versions

Composer install wp-plugin to vendor dir

I'm using Roots/Bedrock for my WordPress structure and I want to use WebDevStudios/CMB2 as a library and not as a plugin.
The Roots/Bedrock composer.json specifies that dependencies of type:wordpress-plugin be installed in app/plugins. The WebDevStudios/CMB2 composer.json declares that it is a wordpress-plugin type, so it gets installed into app/plugins which is not where I want it.
How can I get this dependency to be installed into vendor and not app/plugins?
I have a suspicion I might have to fork CMB2 and change it's type from wordpress-plugin to library, but I'm hoping there is a cleaner solution.
I'm not using Roots/Bedrock but I had a similar problem when adding CMB2 as a dependency to a plugin (rather than loading it as a separate plugin). It was installing the plugin in wp-content/plugins instead of vendor. The following worked for me.
{
"require": {
"webdevstudios/cmb2": "^2.2",
},
"autoload" : {
"files": [
"vendor/webdevstudios/cmb2/init.php"
]
},
"extra": {
"installer-paths": {
"vendor/webdevstudios/cmb2": ["webdevstudios/cmb2"]
}
}
}
The key was the installer-paths entry that tells Composer where we want to install webdevstudios/cmb2.
I wrote a blog post about this at https://salferrarello.com/cmb2-composer-dependency/

Dev dependency with dotnet core

My library (NetMQ) have a dependency on JetBrains.Annotations, however I want it to be only a dev dependency and don't want it to appear on the nuspec file generated with "dotnet pack".
How can I set a dependency a dev dependency with project.json?
it seems setting the type of the dependency to build does the trick, like so:
"dependencies": {
"JetBrains.Annotations": {
"version": "10.1.5",
"type" : "build"
}
}

Meteor require unpublished npm module

In node, it's easy to do
"dependencies": {
"express": "^4.13.3",
"node-uuid": "^1.4.3",
"PACKAGE_NAME": "git://github.com/USERNAME/REPO_NAME.git#COMMIT_SHA"
}
In meteor I can include an npm module using var uuid = Meteor.npmRequire('node-uuid'); for npm packages that are published, but when pointing my package at github (the same way I would in a node project) I get an error.
How does one doe this with Meteor? When trying to do the same thing in the package.json I get the following error
"must declare exact version of dependency:"
Any help on how to include a package that's not published to Npm?
You need to specify the commit and point to the archive. From https://atmospherejs.com/meteorhacks/npm:
If you need to install an npm module from a specific commit, use the
syntax:
{ "googleapis": "https://github.com/bradvogel/google-api-nodejs-client/archive/d945dabf416d58177b0c14da64e0d6038f0cc47b.tar.gz" }

Trouble updating packages using Bower in ASP .NET vNext

I have started ASP .NET vNext and I was going through several articles about using bower in Visual Studio 2015 for managing client side libraries, it's pretty simple to use but I am having problems in updating the packages...
I am following this
bower.json:
"dependencies": {
"bootstrap": "3.3.2",
"jquery": "1.4.1",
"jquery-validation": "1.11.1",
"jquery-validation-unobtrusive": "3.2.2",
"hammer.js": "2.0.4",
"bootstrap-touch-carousel": "0.8.0",
"jquery-migrate-official": "^1.2.1",
"bootstrap-hover-dropdown": "2.1.3",
"jquery-slimscroll": "1.3.3",
"jquery-cookie": "1.4.1",
"jquery.uniform": "4.3.0",
"blockui": "2.1.2",
"font-awesome": "4.3.0"
},
The intellisense says that the package blockui has the latest stable version 2.1.2 but package manager log says:
bower blockui#2.1.2 ENORESTARGET No tag found that was able to satisfy 2.1.2
bower blockui#2.1.2 not-cached git://github.com/malsup/blockui.git#2.1.2
bower blockui#2.1.2 resolve git://github.com/malsup/blockui.git#2.1.
Questions:
What does this mean? Is the intellisense picking up the wrong latest version?
Is there any better way to update all client side packages like I used to do using nuget package manager ?
update-package
I read that for server-side packages ASP .NET vNext will use nuget packages but when I write any command in my Package Manager Console nothing happens
update-package
install-package entityframework
You can right-click the 'Bower' node under the 'Dependencies' node and choose 'Restore Packages'. I often have to open the 'Task Runner Explorer' from 'View -> Other Windows' and run the 'bower' task from its context menu. This will trigger a bower installation.
gruntfile.js
module.exports = function (grunt) {
grunt.initConfig({
bower: {
install: {
options: {
targetDir: "wwwroot/lib",
layout: "byComponent",
cleanTargetDir: false
}
}
}
});
// This command registers the default task which will install bower packages into wwwroot/lib
grunt.registerTask("default", ["bower:install"]);
// The following line loads the grunt plugins.
// This line needs to be at the end of this this file.
grunt.loadNpmTasks("grunt-bower-task");
};
package.json
{
"version": "0.0.0",
"name": "",
"devDependencies": {
"grunt": "0.4.5",
"grunt-bower-task": "0.4.0"
}
}
The packages should then show up in your wwwroot -> lib directory.
Check out bower's website for more details: http://bower.io/
I just found that for (and for font-awesome package) IntelliSense advices non-existing version. That was 2.1.2, exactly like for your case, that is why I found your question.
I had re-checked real version, corrected it to existing one, and everything started to work.

Resources