Giter VIP home page Giter VIP logo

bowerphp's Introduction

Bowerphp

An implementation of bower in PHP.

https://bowerphp.github.io/

travis build Code Climate Scrutinizer Code Quality insight Join the chat at https://gitter.im/Bee-Lab/bowerphp

Installation

$ composer require beelab/bowerphp

Configuration

Currently, you can configure your bower directory in .bowerrc file, just like the original Bower.

If you need many dependencies, you'll likely hit the Github API limit (currently 60 requests per hour). To increase your limit to 5000 requests per hour, you can use a token. See Github help. Once you created your token, just store it in the BOWERPHP_TOKEN environment variable.

Status

This project is in stable version (no beta suffix), but still in 0 major version (BC not assured).

See currently open issues.

Contributing

All contribution are welcome, just take a look at our issues tracker if you want to start somewhere.

If you make a PR make sure that it follow the PSR2 standard. To make sure that your code comply with the standard, you can use a git hook with php-cs-fixer. There is one here that you only need to copy to your .git/hooks folder under the name of pre-commit and you are set.

Building the phar

You can build the phar by simply running:

$ php bin/compile

Or you can use the box command line utility. If you add the following content in a box.json file, you only just need to run box build command to get a phar. Don't forget to give execution permission to your phar, using chmod +x bowerphp.phar.

{
    "directories": ["src"],
    "files": ["LICENSE"],
    "finder": [
        {
            "name": "*.php",
            "exclude": ["Tests", "phpunit", "mockery"],
            "in": "vendor"
        }
    ],
    "main": "bin/bowerphp",
    "output": "bowerphp.phar",
    "stub": true
}

bowerphp's People

Contributors

antontyutin avatar bauerj avatar bayne avatar garak avatar injitools avatar jalandis avatar lexxorlov avatar lordvlad avatar maurodalatri avatar maxakawizard avatar maxnuf avatar mikesimonson avatar peter279k avatar piotrooo avatar shine-neko avatar varoot avatar xemlock avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bowerphp's Issues

API rate limit with GitHub

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.

file mtimes

Currently, when uncompressing a package file, we ignore file mtimes (e.g. files are extracted with current timestamp instead of their original mtime)

Wrong sort versions

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

cannot install modernizr

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

enhance handling of installed packages

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.

Handle updates

Create a new command to check for updates of current installed packages, and eventually do needed updates

Handling renamed git repo

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.

lookup and search

Implement command for lookup and search packages.
(Lookup is a search with exact match)

Bug dependecies

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/".

implement other flags

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

bowerphp.lock?

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.

handle conflicts

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

Handle .bowerrc options

(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

Package downgrade

Now I can't do downgrade of package.

Steps:

  1. bowerphp install jquery#2.1.0 --save
  2. Change in bower.json file to 2.1.1
  3. bowerphp update jquery
  4. Change in bower.json file to 2.1.0
  5. And now doesn't work either update or install

I thing good solution will be use for this command update.

info

Implement "info" command

Implement install with argument

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.

list command

in bower, "list" shows a list of installed packages. In Symfony, "list" shows a list of commands.

handle ignores

When installing (or updating) a package, we need to ignore every entry listed in ignore key of package's bower.json

Parameter for git.exe

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.

Not Found error, package.json less repository

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?

  • sample bower.json
$ cat bower.json
{
    "name": "test-ace-builds",
    "dependencies": {
        "ace-builds" : "*"
    }
}
  • node.js bower
$ 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
  • bowerphp
$ 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

Refactor package install

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

No CLI output on bowerphp update

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.

Build on top of composer

You should use code from composer and not inventing the wheel. I suggest to use VersionParser, JsonFormatter, DependencyResolver, Downloader etc.

home

Implement "home" command.

Bug parsing jquery version

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

uninstall

Implement a command to uninstall packages

implement install --save

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

cache command

Implement a command to show cached packages and to clear cache

handle output

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.

"real" cache

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).

handle cache

We need use a cache directory (instead of current directory)

install does not work properly

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.

older versions overwrite newer installed versions

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.

Handle versions

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

list command doesn't detect dependecies

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

Add argument "register"

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!

Install command: ignore problem

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"
  }
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.