This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 244289 - Support for Bower
Summary: Support for Bower
Status: RESOLVED FIXED
Alias: None
Product: web
Classification: Unclassified
Component: HTML Project (show other bugs)
Version: 8.0
Hardware: All All
: P2 normal with 4 votes (vote)
Assignee: Jan Stola
URL:
Keywords:
Depends on:
Blocks: 229313
  Show dependency tree
 
Reported: 2014-05-05 05:24 UTC by Tomas Mysik
Modified: 2015-01-19 10:34 UTC (History)
5 users (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tomas Mysik 2014-05-05 05:24:42 UTC
Support for Bower could be very useful for NetBeans.

Petře, could you please create a Bugzilla component for it and assign there this task? However, I am not sure who will implement it (and should be its owner).

Thanks.
Comment 1 Jan Becicka 2014-05-12 10:18:31 UTC
Bower is javascript libraries manager, right? So we should extend a JavaScript Files panel, which is shown in wizard and project properties. For instance we can create a new tab in it:

+--------+-------+
|  CDNJS | Bower |
+---------------------------------------------------------------------+
| Choose a library                                                    | 
| Available: [                    ]  Selected:                        |
| +-------------------------------+ +-------------------------------+ |
| |                               | |                               | |
| |                               | |                               | |
| |                               | |                               | |
| |                               | |                               | |
| |                               | |                               | |
| +-------------------------------+ +-------------------------------+ |
| Libraries folder: bower_components                                  |
----------------------------------------------------------------------+

Does it make sense?
Anything else needs to be done?
Comment 2 Tomas Mysik 2014-05-12 13:22:07 UTC
(In reply to Jan Becicka from comment #1)
> Does it make sense?

I don't know Bower but I guess this could be fine.

> Anything else needs to be done?

IMHO a support for its command line tool so one can easily invoke any of Bower's actions (via context menu on project perhaps?).

Thanks.
Comment 3 Vladimir Riha 2014-05-12 13:29:42 UTC
(In reply to Tomas Mysik from comment #2)
> (via context menu on project perhaps?)

It could be nice to have it on bower.json file and make this file "important" (show it under Important files), just like Gruntfile.js
Comment 4 Petr Jiricka 2014-05-12 13:37:25 UTC
> IMHO a support for its command line tool so one can easily invoke 
> any of Bower's actions

Especially some actions are more important than others, e.g. if I import an existing project which has libraries managed by Bower, I will want to run "bower install" as the first step - there could be an action for that. And there could be a project-level warning on projects where 'bower install' was not done yet.

> Anything else needs to be done?

As for the 'bower init' command, this could be exposed in the UI as:
a/ The Bower panel under JavaScript Files could have a checkbox "Use Bower to manage JavaScript libraries", which would turn Bower on/off
b/ New HTML5 project wizard could have a similar checkbox
Comment 5 Jan Becicka 2014-05-12 14:16:30 UTC
> IMHO a support for its command line tool so one can easily invoke any of
> Bower's actions (via context menu on project perhaps?).

Bower have following commands:
 
    cache                   Manage bower cache
    help                    Display help information about Bower
    home                    Opens a package homepage into your favorite browser
    info                    Info of a particular package
    init                    Interactively create a bower.json file
    install                 Install a package locally
    link                    Symlink a package folder
    list                    List local packages
    lookup                  Look up a package URL by name
    prune                   Removes local extraneous packages
    register                Register a package
    search                  Search for a package by name
    update                  Update a local package
    uninstall               Remove a local package

I think, that we can ignore cache, help, home and link.
Init command should be "implemented" as New bower.json wizard.

Info, install, list, lookup, prune, search, update and uninstall is what can be done in the customizer.

And register command - will be simply unsupported.
Comment 6 Jan Becicka 2014-05-12 14:16:54 UTC
> It could be nice to have it on bower.json file and make this file
> "important" (show it under Important files), just like Gruntfile.js
sure
Comment 7 Jan Becicka 2014-05-12 14:28:07 UTC
(In reply to Petr Jiricka from comment #4)
> > IMHO a support for its command line tool so one can easily invoke 
> > any of Bower's actions
> 
> Especially some actions are more important than others, e.g. if I import an
> existing project which has libraries managed by Bower, I will want to run
> "bower install" as the first step - there could be an action for that. And
> there could be a project-level warning on projects where 'bower install' was
> not done yet.

Agreed.

> > Anything else needs to be done?
> 
> As for the 'bower init' command, this could be exposed in the UI as:
> a/ The Bower panel under JavaScript Files could have a checkbox "Use Bower
> to manage JavaScript libraries", which would turn Bower on/off
> b/ New HTML5 project wizard could have a similar checkbox

I'm not sure, what should "turn off bower" suppose to do.

Now we manage javascript libraries ourselves and we use CDNJS for that. If we now want to support bower, does it mean, that user can use our manager and bower together? Or user is required to choose just one manager and then use it and we will not support mixing?
Comment 8 Petr Jiricka 2014-05-12 14:47:21 UTC
You are right that turning off bower does not make much sense.

> If we now want to support bower, does it mean, that user can 
> use our manager and bower together?

Probably not, I guess it's one or the other, but not both at the same time.
Comment 9 Jan Becicka 2014-05-13 11:42:36 UTC
(In reply to Petr Jiricka from comment #8)
> You are right that turning off bower does not make much sense.
> 
> > If we now want to support bower, does it mean, that user can 
> > use our manager and bower together?
> 
> Probably not, I guess it's one or the other, but not both at the same time.

So once user choose to use bower, CDNJS approach should not be available?
Comment 10 Jan Becicka 2014-07-03 07:37:48 UTC
Basic support for bower implemented in 8.0.1:
+ bower.json and .bowerrc nodes under Important Files in Projects view
+ "bower install" action on HTML 5 Project
+ Project problem if HTML 5 Project contains bower.json, but bower modules not installed

Prototype of Bower libraries selection panel is available at http://deadlock.netbeans.org/job/bower_support/

will not be integrated in 8.0.1 since it requires deeper API changes not suitable for dot dot release.
Comment 11 mosca_morta 2014-08-19 16:47:44 UTC
Hello, I'm new in Bower too and a NetBeans enthusiastic!!! Use since I don't remember, lot of years ago.

Just a point, I don't know really if it helps.

To use bower (!!!) in NetBeans I do:

bower init // I use templates from other projects, so for me is not really necessary, but it's cool to another people

bower search "anything" // I need to find some components to install the right

bower install "anything" --save // The "--save" is necessary to add the dependency to bower.json

bower update // Install, update, reinstall dependencies

To remove any dependency I do it by hand, a dependency install lot of other dependencies so I just remove bower folder and update/reinstall again.

Another thing: A people can use a private repository adding the dependency "name" and "git path".

Examples:

{
    "name": "Olho no Campo",
    "version": "0.0.1",
    "authors": [
        "Francisco Ernesto Teixeira <fco.ernesto@gmail.com>"
    ],
    "description": "Cliente do Servidor Olho no Campo",
    "license": "MIT",
    "homepage": "https://s.olhonocampo.com.br",
    "private": true,
    "ignore": [
        "**/.*",
        "node_modules",
        "bower_components",
        "test",
        "tests"
    ],
    "dependencies": {
        "angular": "~1.2.21",
        "angular-cookies": "~1.2.21",
        "angular-loader": "~1.2.21",
        "angular-resource": "~1.2.21",
        "angular-route": "~1.2.21",
        "angular-i18n": "~1.2.21",
        "angular-http-auth": "~1.2.1",
        "requirejs": "~2.1.14",
        "leaflet": "~0.7.3",
        "fullcalendar": "~2.0.2",
        "open-sans-fontface": "~1.1.0",
        "components-font-awesome": "~4.1.0",
        "ace": "https://netinho@bitbucket.org/netinho/wb0b30dgr.git"
    }
}


Another example:
{
  "name": "Caixa Crescer",
  "version": "0.0.1",
  "authors": [
    "Francisco Ernesto Teixeira <fco.ernesto@gmail.com>"
  ],
  "description": "Força de Vendas",
  "license": "MIT",
  "homepage": "http://www.caixacrescer.com.br",
  "private": true,
  "ignore": [
    "**/.*",
    "node_modules",
    "bower_components",
    "test",
    "tests"
  ],
  "dependencies": {
    "jquery": "~2.1.1",
    "requirejs": ">= 2.1.*",
    "font-awesome": "~4.1.0",
    "jquery-meiomask": "~1.1.14",
    "leaflet": "~0.7.3",
    "ionic": "driftyco/ionic-bower#master",
    "raty-fa": "https://github.com/Jacob87/raty-fa.git",
    "Leaflet.awesome-markers": "~2.0.2"
  }
}
Comment 12 Tomas Mysik 2014-10-08 11:39:56 UTC
Reassigning to Honza, he is now the owner of this area.

Thanks.
Comment 13 seyfer 2014-12-26 05:22:55 UTC
If i'm create project with existing files not in my app folder, but in another folder where i'm place all my projects, then NetBeans doesn't found Important files like bower.js, package.js and not display it.
Comment 14 Tomas Mysik 2015-01-19 08:29:17 UTC
(In reply to seyfer from comment #13)
> If i'm create project with existing files not in my app folder, but in
> another folder where i'm place all my projects, then NetBeans doesn't found
> Important files like bower.js, package.js and not display it.

You need to place these files directly in the project directory.
Comment 15 Jan Stola 2015-01-19 10:34:44 UTC
There is Bower support (including library management) implemented in NetBeans development builds => I am closing this issue as fixed. If you miss some specific functionality, please, fill a separate enhancement. Thank you in advance.