craigburke / client-dependencies-gradle Goto Github PK
View Code? Open in Web Editor NEWInstall client dependencies from NPM, Bower or Git
License: Other
Install client dependencies from NPM, Bower or Git
License: Other
Angular 2 RC uses a new NPM org @angular
with dependencies in it (https://www.npmjs.com/~angular). When attempting to install with this plugin, it puts the dependencies in folders like this:
grails-app/assets/npm/angular-common
grails-app/assets/npm/angular-compiler
grails-app/assets/npm/angular-core
grails-app/assets/npm/angular-http
grails-app/assets/npm/angular-platform-browser
grails-app/assets/npm/angular-platform-browser-dynamic
grails-app/assets/npm/angular-router
grails-app/assets/npm/angular-router-deprecated
grails-app/assets/npm/angular-upgrade
When instead, I think they should all be under a common @angular
folder like this:
grails-app/assets/npm/@angular/common
grails-app/assets/npm/@angular/compiler
grails-app/assets/npm/@angular/core
grails-app/assets/npm/@angular/http
grails-app/assets/npm/@angular/platform-browser
grails-app/assets/npm/@angular/platform-browser-dynamic
grails-app/assets/npm/@angular/router
grails-app/assets/npm/@angular/router-deprecated
grails-app/assets/npm/@angular/upgrade
Similar to craigburke/karma-gradle#7, I need your written permission to use this plugin, and this is best achieved through a publicly stated LICENSE file.
Jeff Atwood has some interesting thoughts on this that may be worth a read.
I'm very interested in this so I hope you'll consider it.
I'm sure you don't need any more explanation here ;)
See: https://developer.github.com/v3/repos/contents/#get-archive-link
Currently causing issues resolving certain bower dependencies.
When running gradle in daemon mode, some git object files are left open/locked, preventing a subsequent run of clientClean
. An example on Windows7 + Git Bash (with org.gradle.daemon = true
defined in .gradle/gradle.properties):
$ gradlew clientInstall :clientInstall BUILD SUCCESSFUL Total time: 4.588 secs $ gradlew clientClean :clientClean FAILED FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':clientClean'. > Unable to delete file: C:\Users\me\git\projectx\build\client-cache\bower\some-js-lib\1.2.3\.git\objects\pack\pack-df66b80a9b56f748396e2aa74daad6124db34c23.pack * Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. BUILD FAILED Total time: 3.744 secs
This can be worked around by disabling the gradle daemon with the --no-daemon
switch. The issue remains for some IDE integrations where the daemon is always used. See e.g. https://discuss.gradle.org/t/disable-gradle-daemon-in-eclipse/11503. The tool is currently broken on these platforms.
A likely fix would be to close() the Grgit instance in GitResolver.groovy after use.
This build script
plugins {
id "com.craigburke.client-dependencies" version "1.1.4"
}
clientDependencies {
installDir = 'src/main/resources/static/vendor'
npm {
'react' ('15.x.x')
'react-dom' ('15.x.x')
'babelify' ('7.3.0')
'babel-preset-react' ('6.x.x')
}
}
throws the following exception:
* What went wrong:
Execution failed for task ':web-frontend:clientReport'.
> com.craigburke.gradle.client.registry.core.CircularDependencyException: com.craigburke.gradle.client.registry.core.CircularDependencyException: com.craigburke.gradle.client.registry.core.CircularDependencyException: com.craigburke.gradle.client.registry.core.CircularDependencyException: com.craigburke.gradle.client.registry.core.CircularDependencyException: com.craigburke.gradle.client.registry.core.CircularDependencyException: com.craigburke.gradle.client.registry.core.CircularDependencyException: Circular dependency created by dependency babel-types@^6.9.0
It seems like circular dependencies are supported by npm, so they should also be supported by the client dependencies plugin.
Hi is there any way i could use this plugin in java servlet instead of gradle task??
Hi there.
Can you make an example how to download typings with this plugin ? Or should I just stick with this and another plugin of yours https://github.com/craigburke/bower-installer-gradle ?
Seems to be also related to #53.
Thank your for your time.
2.0.0-beta.11
should resolve for ^2.0.0-beta.8
Hi!
I'm running clientInstall
with the following configuration
clientDependencies {
bower {
'polymer'('1.4.0') { source '*' }
'app-route'('0.9.1', url: 'PolymerElements/app-route') { source '*' }
'paper-input'('1.0.0', url: 'PolymerElements/paper-input') { source '*' }
}
}
and get the following response after successfully downloading 15 dependencies
{
"message": "API rate limit exceeded for 10.101.110.11. (But here's the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.)",
"documentation_url": "https://developer.github.com/v3/#rate-limiting"
}
Is there a way to supply user credentials to prevent rate limiting?
For requests using Basic Authentication or OAuth, you can make up to 5,000 requests per hour. For unauthenticated requests, the rate limit allows you to make up to 60 requests per hour. Unauthenticated requests are associated with your IP address, and not the user making requests.
Follow-up question which might (not) be a separate issue:
Does the plugin support conditional requests?
Most responses return an ETag header. Many responses also return a Last-Modified header. You can use the values of these headers to make subsequent requests to those resources using the If-None-Match and If-Modified-Since headers, respectively. If the resource has not changed, the server will return a 304 Not Modified. Also note: making a conditional request and receiving a 304 response does not count against your Rate Limit, so we encourage you to use it whenever possible.
Thanks again.
/Johannes
NPE is thrown with the following:
clientDependencies {
bower {
'angular-material'('1.0.6')
}
}
angular-material has the following 4 dependencies:
"angular": "^1.4.8",
"angular-animate": "^1.4.8",
"angular-aria": "^1.4.8",
"angular-messages": "^1.4.8"
Those resolve fine. But those last three have an additional dependency on [email protected] So they're colliding as they all try to resolve those at the same time. I'll fix that.
Looks like the release folders (dist
, release
) aren't set as a default for the from property.
somehow i am seeing NullPointerException
s for bower dependencies that used to resolve with bower-installer-gradle
. while this one works:
clientDependencies {
bower {
jquery "2.0.0"
}
}
this one gives a npe:
clientDependencies {
bower {
angular "1.5.0"
}
}
stacktrace:
Caused by: java.lang.NullPointerException: Cannot get property 'fullVersion' on null object
at com.craigburke.gradle.client.registry.BowerRegistry.loadDependency(BowerRegistry.groovy:125)
at com.craigburke.gradle.client.plugin.ClientDependenciesPlugin$_installDependencies_closure4$_closure10.doCall(ClientDependenciesPlugin.groovy:75)
at groovyx.gpars.pa.CallClosure.call(CallClosure.java:47)
from a quick look at the repositories, i can just offer a wild guess: maybe a mismatch of the bower.json
version
and the actual tag name has something to do with it? they seem to be the same for jquery
but not for a lot of other packages (v
prefix)..
Check local caches first to resolve bower and npm dependencies.
Should issue up a warning when npm peer dependencies aren't installed.
Root dependencies override children but there should be a warning (or error) if the same dependency is declared with a different major version. Example: [email protected]
declared as a root dependency and [email protected]
declared as a child dependency of another dependency.
Try to limit HTTP requests when getting version list.
Maybe something like this:
clientDependencies {
defaultCopy = {
include '**/*.js', '**/*.css'
exclude '**/*.less'
}
}
Allow url to reference a single file not just a git repo.
Because reasons.
If I fully understand the NPM conventions here, it resolves the "latest" version of a given dependency. Often module authors will tag "beta" versions with "dist-tag" that shouldn't be resolved unless that version is explicitly specified.
foo('1.0.0', url: 'foo/foo')
should be equivilant to
'foo'('1.0.0', url:'https://github.com/foo/foo')
New dependency should be installed by clientInstall
task without explicitly calling clientRefresh
I have a bower package that is using the github resolver. it has no tags and is bombing out
clientDependencies {
bower {
'elusive-icons'('2.0.0')
}
}
Execution failed for task ':clientInstall'.
> groovy.json.JsonException: Unable to process url: https://api.github.com/repos/reduxframework/Elusive-Icons/git/refs/tags
That repo has no tags so it 404's
Using version '1.1.4'
Should throw an error if there are circular dependencies.
Hi Craig,
Thanks for working on this! Once you get it finished it should go in the Grails angular-profile.
I'm trying to install angular2 in a Grails 3.1.4 app using the snippet below along with version 0.5.0 of your plugin. Unfortunately, it also installs the transitive dependencies, and I need to do those individually. Am I doing something wrong, or will this work in a newer release? I see you're up to 1.0.0-SNAPSHOT.
clientDependencies {
installDir = 'grails-app/assets/npm'
npm {
'angular2'('2.0.0-beta.14') {
include 'src/**/*.js'
exclude '**/*.ts'
transitive false
into 'javascripts/'
}
}
}
Also, I couldn't get into
or the eachFile
closure to work. For example, I wanted to have the angular files in grails-app/assets/npm/javascripts/angular2
, but they end up in grails-app/assets/npm/angular2/javascripts/angular2
.
I suspect I'm misusing the closure technique, but I assumed it would accept the same properties as the simpler method.
Thanks again,
Ken
Please create a readme and make sure the code works.
In other words, you might have a project that has javascript and java. Our JS folks tend to use javascript tools (npm, etc) and java folks don't want to know anything about it. The idea is that they could both be used and have it work together.
Some things that would need to change is where it looks for package.json and the sections of package.json that is looks at (devDependencies for instance).
Might need to put things in node_modules or have the ability to copy certain sub directories in the package to certain places in the file system (or both).
Hi Craig, thanks for an awesome plugin.
I'm trying to include PolymerElements/paper-input
from GitHub as a bower module but the clientInstall
task fails on a dependency.
My build.gradle contains:
clientDependencies {
bower {
'PolymerElements/paper-input'('1.0.0') { source '*' }
}
}
Upon running clientInstall
I get the following error:
Execution failed for task ':clientInstall'.
> com.craigburke.gradle.client.registry.core.DependencyResolveException: Couldn't resolve iron-autogrow-textarea@PolymerElements/iron-autogrow-textarea#^1.0.0
The bower.json
for PolymerElements/paper-input
contains:
"dependencies": {
"polymer": "Polymer/polymer#^1.2.0",
"iron-autogrow-textarea": "PolymerElements/iron-autogrow-textarea#^1.0.0", // <--
"iron-behaviors": "PolymerElements/iron-behaviors#^1.0.0",
"iron-form-element-behavior": "PolymerElements/iron-form-element-behavior#^1.0.0",
"iron-input": "PolymerElements/iron-input#^1.0.0",
"paper-styles": "PolymerElements/paper-styles#^1.1.4",
"iron-a11y-keys-behavior": "PolymerElements/iron-a11y-keys-behavior#^1.0.0"
}
Thankful for any help on this issue!
/Johannes
Hi,
The 'clientReport' task on version 0.3.1 always fails because Groovy complains about a missing method.
See gradle-output.txt for the output I get when I run ./gradlew clientReport --stacktrace
.
I also attached a test project that can be used to reproduce the issue: client-dependencies-test-project.zip
Some bower packages uses .bower.json instead bower.json. Plugin trying to search bower.json and fails with error
for example:
lodash 4.15.0 uses .bower.json
jade 1.11.0 โ .bower.json too
The following build script
plugins {
id "com.craigburke.client-dependencies" version "1.1.4"
}
clientDependencies {
installDir = 'src/main/resources/static/vendor'
npm {
'react' ('15.x.x')
'react-dom' ('15.x.x')
'babelify' ('7.3.0', exclude: 'babel-types')
'babel-preset-react' ('6.x.x')
}
}
Does not exclude "babel-types" from "babelify" - I guess because it is a transitive dependency. The script produces the following exception:
* What went wrong:
Execution failed for task ':web-frontend:clientReport'.
> com.craigburke.gradle.client.registry.core.CircularDependencyException: com.craigburke.gradle.client.registry.core.CircularDependencyException: com.craigburke.gradle.client.registry.core.CircularDependencyException: com.craigburke.gradle.client.registry.core.CircularDependencyException: Circular dependency created by dependency babel-types@^6.9.0
Excluding a dependency should also work when the library does not directly depend on the excluded dependency.
it seems that currently, scoped packages are not supported.
for example, the angular2-material alpha packages are published under the angular2-material
scope, e.g.: npm install --save @angular2-material/core
. see
:clientInstall FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':clientInstall'.
> groovy.json.JsonException: groovy.json.JsonException: Unable to process url: https://registry.npmjs.org/@angular2-material/core
support for scoped packages would be great :)
Delete client cache folder after clientInstall
successfully runs.
Pull some of the common logic of the two registries into RegistryBase.
Need an easier way to override the copy destination.
Be able to register custom bower or npm repos.
clientDependencies {
registry name: 'npmLocal', type:'npm', url:'http://www.example.com/npm/'
registry name: 'bowerLocal', type:'bower', url:'http://www.example.com/bower/'
}
Based on comments in #17 @zyro23 I decided to look at why there was such a big difference in terms of size vs. bower. Apparently they use a custom resolver for github:
https://github.com/bower/bower/blob/master/lib/core/resolvers/GitHubResolver.js
This causes the dependencies to be re-downloaded constantly.
To pull from a specific subfolder
'foo'('1.0.0', from:'dist')
I defined a custom registry, cradle doesn't seem to complain about it, but the custom registry doesn't look like it is searched for dependency. Also, it would be nice to be able to override the default registry and be able to tell the plugin to just use a particular registry in the case of you using an npm proxy cache. Or am I missing something.
Add gradle task to list client dependencies (clientReport
). Should be similar to the gradle dependencies
task.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.