fabien-d / alertify.js

JavaScript Alert/Notification System
http://fabien-d.github.com/alertify.js/
4.26k stars 725 forks source link

Add support for Composer & publish to Packagist #150

Closed andrew-kzoo closed 10 years ago

andrew-kzoo commented 11 years ago

See #149

I have only recently started using Composer and before today I have not prepared a component for publishing on Packagist. However, the following composer.json does clone the alertify.js repository into components\alertify.js directory:

{
  "repositories": [
    {
      "type": "vcs",
      "url": "https://github.com/andrew-kzoo/alertify.js"
    }
  ],
  "require": {
    "components/alertify.js": "dev-master"
  }
}

Publishing to Packagist is straightforward. Few, if any, additional changes to composer.json should be necessary. http://getcomposer.org/doc/02-libraries.md#publishing-to-packagist

fabien-d commented 11 years ago

Thanks for the PR. I don't really know much about composer or Packagist - so I'm just going to do a bit of research on it before merging.

fabien-d commented 11 years ago

Do you have any arguments on why a JS plugin should be part of a PHP package manager? I'm hesitant on whether it makes sense...

andrew-kzoo commented 11 years ago

Composer is used for dependency management. Composer's composer.json is used in a manner similar to bower's bower.json and Node.js's package.json to define a package.

If you aren't using any of these tools there is no benefit for you. However, even so, by including any of these package definitions (composer.json, bower,json, or package.json) this project will get exposure to a wider audience.

Others can speak to using bower and Node.js, but I use Composer with the following composer.json to download dependencies (including alertify.js) for a small event scheduling application:

{
  "repositories": [
    {
      "type": "package",
      "package": {
        "name": "tinymce/tinymce",
        "version": "4.0.1",
        "dist": {
          "url": "http://download.moxiecode.com/tinymce/tinymce_4.0.1.zip",
          "type": "zip"
        }
      }
    },
    {
      "type": "package",
      "package": {
        "name": "arshaw/fullcalendar",
        "version": "1.6.1",
        "dist": {
          "url": "http://arshaw.com/fullcalendar/downloads/fullcalendar-1.6.1.zip",
          "type": "zip"
        }
      }
    },
    {
      "type": "package",
      "package": {
        "name": "fabien-d/alertify.js",
        "version": "0.3.10",
        "dist": {
          "url": "https://github.com/fabien-d/alertify.js/archive/0.3.10.zip",
          "type": "zip"
        }
      }
    }
  ],
  "require": {
    "components/jquery": "1.9.1",
    "components/jqueryui": "1.10.3",
    "tinymce/tinymce": "4.0.1",
    "arshaw/fullcalendar": "1.6.1",
    "fabien-d/alertify.js": "0.3.10",
    "timrwood/moment": "dev-master"
  }
}

As can be seen it isn't necessary for a project to have a composer.json for it to be used with Composer. I can't give any argument which would directly benefit any non-user of Composer (or similarly, bower or Node.js) for including a package definition (composer.json, bower.json, or package.json).

fabien-d commented 10 years ago

I'm going to pass on this for now. Since you can still use it with composer without the composer.json file. Also, 0.4 has been deprecated. Cheers,