bee-lab / bowerphp Goto Github PK
View Code? Open in Web Editor NEWA PHP implementation of bower :bird:
License: MIT License
A PHP implementation of bower :bird:
License: MIT License
Create a new command to check for updates of current installed packages, and eventually do needed updates
in bower, "list" shows a list of installed packages. In Symfony, "list" shows a list of commands.
bowerphp install modernizr
output:
Cannot open package git URL https://raw.github.com/Modernizr/Modernizr/master/bower.json nor https://raw.github.com/Modernizr/Modernizr/2.7.*/package.json (Client error response
[status code] 404
[reason phrase] Not Found
[url] https://raw.github.com/Modernizr/Modernizr/master/bower.json).
it should look for package.json in master
in src/Bowerphp/Config/Config.php, line 15
The class
Camspiers\JsonPretty\JsonPretty
is declared but never used. You should remove theuse
statement.
*/
namespace Bowerphp\Config;
use Bowerphp\Package\PackageInterface;
use Camspiers\JsonPretty\JsonPretty;
use Gaufrette\Filesystem;
use RuntimeException;
/**
Posted from SensioLabsInsight
We need to handle output, to be able to return partial information to user during process. E.g., progress of downloading, info about package installed (or not), etc.
This is an advanced issue (e.g. to implement later).
Handle versions of packages. In other words, consider also versions specified in bower.json file or in command arguments
Implement a command to show cached packages and to clear cache
My bower.json
"dependencies": {
"jquery": ">=2.1.1",
"bootstrap": ">=3.1.1",
"underscore": ">=1.6.0",
"backbone": ">=1.1.2",
"fancybox": ">=2.1.5",
"js-loader": "*",
"jquery-ui": ">=1.10.4",
"jqueryui-timepicker-addon": ">=1.4.4",
"highstock-release": "~2.0.1",
"highcharts-release": "~4.0.1"
}
bower jquery#>=2.1.1
bower jquery#2.1.1 install
bower bootstrap#>=3.1.1
bower bootstrap#v3.1.1 install
Failed to touch ".../components/jquery/test/qunit/".
I have a bower.json like:
...
"dependencies": {
"jquery": "2.1.0",
"datatables": "1.10.0"
}
datatables has a dependency for jquery: "jquery": ">=1.7.0"
, which should just be fine, because jquery was installed first.
But now bowerphp is going to look for https://raw.github.com/jquery/jquery/>=1.7.0/bower.json
which doesnt exist, because the tag is wrong, so it will try https://raw.github.com/jquery/jquery/master/bower.json
, and thus update jquery to dev-master.
somehow it finally exits with error Failed to touch "/vagrant/data/bowerComponents/jquery/test/qunit/"
.
I can't really wrap my head around it, but I suppose there should be a test to check if an installed component is already newer, before trying to update it.
While bower newer seems to be able to do this, here you could take advantage of several composer classes and get such a feature relatively easily up and running.
I had an issue getting bowerphp to work on openshift.
I get a 400 Bad Request for all urls like raw.github.com
according to 2014-04-25-user-content-security, we should use raw.githubusercontent.com
instead.
The link should redirect, but somehow this doesnt work for me on openshift.
should we str_replace
all the links?
Implement a command to uninstall packages
Now I can't do downgrade of package.
Steps:
bowerphp install jquery#2.1.0 --save
2.1.1
bowerphp update jquery
2.1.0
I thing good solution will be use for this command update
.
We need to implement other flags for commands.
E.g., install
has these flags:
-F, --force-latest Force latest version on conflict
-h, --help Show this help message
-p, --production Do not install project devDependencies
-S, --save Save installed packages into the project's bower.json dependencies
-D, --save-dev Save installed packages into the project's bower.json devDependencies
If a version of a package is not found, we must show available tags.
Example: try to install colorbox#3
Implement install of single package from terminal.
Example:
$ php bin/bowerphp install foo
This command should search package named "foo", install it if found, and update dependencies entry in bower.json file. If not bower.json file found, a new bower.json file should be created.
Implement "home" command.
The prune command uninstall all installed packages that are not in bower.json
Hi, thanks for nice tool!
I got NotFound error when install ace-builds.
ace-builds is compiled ace
that does not have package.json.
It looks like bowerphp is not support a package.json-less repository.
Will that support in future?
$ cat bower.json
{
"name": "test-ace-builds",
"dependencies": {
"ace-builds" : "*"
}
}
$ bower -v
1.3.4
$ bower install
bower ace-builds#* not-cached git://github.com/ajaxorg/ace-builds.git#*
bower ace-builds#* resolve git://github.com/ajaxorg/ace-builds.git#*
bower ace-builds#* download https://github.com/ajaxorg/ace-builds/archive/v1.1.3.tar.gz
bower ace-builds#* extract archive.tar.gz
bower ace-builds#* resolved git://github.com/ajaxorg/ace-builds.git#1.1.3
bower ace-builds#* install ace-builds#1.1.3
$ composer show|grep bowerphp
beelab/bowerphp dev-master 792e28b An implementation of bower in PHP
$ vendor/bin/bowerphp install
Client error response
[status code] 404
[reason phrase] Not Found
[url] https://raw.githubusercontent.com/ajaxorg/ace-builds/master/package.json
Hi there,
Thx for your package.
I got a problem on my package https://github.com/DrMabuse23/yii2-bower-asset-wood
thre was package dropzone but when i use install or update the package is empty maybe i do something wrong with single bower install it works with bowerphp is empty
thx for reply
Currently, there is a really basic implementation of package install, hard-coded in InstallCommand.php
We need to extract it in a separate class (maybe more than one class?), to be able to test it and to clean code
Implement command for lookup and search packages.
(Lookup is a search with exact match)
Please consider using the KnpLabs GitHub API so you can authenticate, create a token and not hit the API rate limit.
This is also done by Composer when the rate limit is hit.
When I try to install create.js package, bowerphp fails to resolve dependency on jquery:
$ bin/bowerphp install create --save
bower create#*
bower create#1.0.0alpha4 install
Version 1.9.x not found.
Available versions: 2.1.1-rc2, 2.1.1-rc1, 2.1.1-beta1, 2.1.1, 2.1.0-rc1, 2.1.0-beta3, 2.1.0-beta2, 2.1.0-beta1, 2.1.0, 2.0.3, 2.0.2, 2.0.1, 2.0.0-beta3, 2.0.0b2, 2.0.0b1, 2.0.0, 1.11.1-rc2, 1.11.1-rc1, 1.11.1-beta1, 1.11.1, 1.11.0-rc1, 1.11.0-beta3, 1.11.0-beta2, 1.11.0-beta1, 1.11.0, 1.10.2, 1.10.1, 1.10.0-beta1, 1.10.0, 1.9.1, 1.9.0rc1, 1.9.0b1, 1.9.0, 1.8rc1, 1.8b2, 1.8b1, 1.8.3+1, 1.8.3, 1.8.2, 1.8.1, 1.8.0, 1.7rc2, 1.7rc1, 1.7b2, 1.7b1, 1.7.2rc1, 1.7.2b1, 1.7.2, 1.7.1rc1, 1.7.1, 1.7.0, 1.7, 1.6rc1, 1.6b1, 1.6.4rc1, 1.6.4, 1.6.3rc1, 1.6.3, 1.6.2rc1, 1.6.2, 1.6.1rc1, 1.6.1, 1.6.0, 1.6, 1.5rc1, 1.5b1, 1.5.2rc1, 1.5.2, 1.5.1rc1, 1.5.1, 1.5.0, 1.5, 1.4rc1, 1.4a2, 1.4a1, 1.4.4rc3, 1.4.4rc2, 1.4.4rc1, 1.4.4, 1.4.3rc2, 1.4.3rc1, 1.4.3, 1.4.2, 1.4.1, 1.4.0, 1.4, 1.3rc1, 1.3b2, 1.3b1, 1.3.2, 1.3.1rc1, 1.3.1, 1.3.0, 1.3, 1.2.6, 1.2.5, 1.2.4b, 1.2.4a, 1.2.4, 1.2.3b
BowerPHP doesn't handle the case when a repo is renamed on GitHub
For example, the package "jquery-hammerjs" returns "git://github.com/EightMedia/jquery.hammer.js.git"
(Check out https://bower.herokuapp.com/packages/jquery-hammerjs)
However, "EightMedia" has been renamed to "hammerjs" so https://github.com/EightMedia/jquery.hammer.js redirects to https://github.com/hammerjs/jquery.hammer.js but the API call of https://api.github.com/repos/EightMedia/jquery.hammer.js returns a 404 instead.
I believe Bower.js doesn't use GitHub API so it was able to find the correct repo.
We currently establish if a package is installed by looking for its bower.json file.
This is ugly, and bower uses a different approach (some packages have bower.json in "ignore").
We must investigate how bower handles this and try to replicate it.
During package installation, if there is a conflict, we should prompt user with possible options to resolve.
E.g. try to install colorbox and then install jquery#1.2
After running bower register xxx xxx
I get the following error:
[InvalidArgumentException]
Command "register" is not defined.
This is a important functionality because bower does not have all packages from github!
When calling bowerphp list
, dependencies packages are detected like "extraneous".
Example: if in bower.json there is "jquery-ui": "1.10.*" as requirement, callingbowerphp list
produces this output:
jquery#1.9.1 extraneous
jquery-ui#1.10.4
The release tag is vv0.1.6
, note the extra 'v'
When installing (or updating) a package, we need to ignore every entry listed in ignore
key of package's bower.json
bowerphp install bootstrap
This is the bower.josn of bootstrap, the install command install also the "ignore" files/dirs
{
"name": "bootstrap",
"version": "3.0.3",
"main": [
"./dist/js/bootstrap.js",
"./dist/css/bootstrap.css",
"./dist/fonts/glyphicons-halflings-regular.eot",
"./dist/fonts/glyphicons-halflings-regular.svg",
"./dist/fonts/glyphicons-halflings-regular.ttf",
"./dist/fonts/glyphicons-halflings-regular.woff"
],
"ignore": [
"**/.*",
"_*",
"docs-assets",
"examples",
"/fonts",
"js/tests",
"CNAME",
"CONTRIBUTING.md",
"Gruntfile.js",
"browserstack.json",
"composer.json",
"package.json",
"*.html"
],
"dependencies": {
"jquery": ">= 1.9.0"
}
}
The Gaufrette version pointed on the composer file is wrong and it throws an error when trying to access listKeys
. The version installed (0.1.x-dev e8f59e6
) doesn't have that method:
https://github.com/KnpLabs/Gaufrette/blob/0.1/src/Gaufrette/Filesystem.php#L141
You need to update your version for:
https://github.com/Bee-Lab/Gaufrette/blob/master/src/Gaufrette/Filesystem.php#L180
Which has the right method.
Bowerphp seems not check package.json file.
Using >=
operator as a prefix to version results in message version x.y.* not found.
.
Example: use x-editable package as an dependency.
Create a "task" to compile this project into a bowerphp.phar file.
See https://github.com/composer/composer/blob/master/bin/compile
bowerphp info jquery
was produce wrong sorted versions.
- 2.1.1-rc2
- 2.1.1-rc1
- 2.1.1-beta1
- 2.1.1
- 2.1.0-rc1
- 2.1.0-beta3
- 2.1.0-beta2
- 2.1.0-beta1
- 2.1.0
should be replaced by
- 2.1.1
- 2.1.1-rc2
- 2.1.1-rc1
- 2.1.1-beta1
- 2.1.0
- 2.1.0-rc1
- 2.1.0-beta3
- 2.1.0-beta2
- 2.1.0-beta1
(I know this is currently marked as "advanced" in README, but we need it sooner).
The first and most important option we need to support is the "directory" option, since it's very important to know where install files.
So, given a .bowerrc file like this:
{
"directory": "app/Resources/bower",
"storage": { "packages": "/tmp/bower" }
}
We'll install libs under that directory.
Default directory, if not specified, should be "bower_components".
Default cache location, if not found in .bowerrc, is $HOME/.cache/bower
Implement "info" command
You should use code from composer and not inventing the wheel. I suggest to use VersionParser
, JsonFormatter
, DependencyResolver
, Downloader
etc.
Currently, we rely on Guzzle http cache.
We should implement a "real" cache layer: if a package is in cache, we should not hit the http layer, but instead installa package from cache.
Also, we need to implement "cache" command (list cached packages and clear cache).
Currently, when uncompressing a package file, we ignore file mtimes (e.g. files are extracted with current timestamp instead of their original mtime)
If a package is already installed and I try to reinstall it, the command do not execute any operation
Hi,
I am using BowerPHP on a portable disk and it would be great to give BowerPHP the path to the git.exe as a parameter since it is also portable and a manual path change on multiple devices is expensive.
If flag -S or --save is passed to install, package must be added to bower.json file (only if bower.json file already exists)
See #10
After running for example the command
bower install jquery
the following will appear:
bower jquery#*
bower jquery#2.1.1 install
Failed to touch "[myPath]/jquery/MIT-LICENSE.txt".
So BowerPHP will not download the whole package, instead it will only download the file "MIT-LICENSE.txt". Also the bower.json will not be appended with the new added jquery dependency.
I have also tested it with the normal NodeJS Bower and it works.
Output for other commands shows up fine, just the update
command is silent. v0.1.9-alpha.
>bowerphp update
Updating dependencies:
>
But dependencies are updated.
With debug option (-vvv) I've found out that I should enable extension but still output is empty.
e.g. bowerphp install -S git://github.com/someone/some-package.git
. See http://bower.io/#install-packages.
We need use a cache directory (instead of current directory)
bowerphp install scrollup
bowerphp info scrollup
[RuntimeException]
Version *.*.* not found.
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.