2017 © Pedro Peláez
 

library js-demo-welcomer

Example javascript package

image

programster/js-demo-welcomer

Example javascript package

  • JavaScript
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

This is a demonstration package of how one can use composer for building and distributing Javascript packages. The implementation demo is here., (*1)

Installation / Usage

In order to use this packages, one will need to use composer require/install the package as usual:, (*2)

composer require programster/js-demo-welcomer

However, yout then probably want to add the following scripts section to your composer.json file in order to have the package automatically install the source code to the public_html/js folder. Obviously if you want the sourceelsewhere, you would just update the paths accordingly., (*3)

One has to manually add the scripts section themselves because the scripts of the packages themselves are not automatically executed (probably for security). Only the scripts in the root composer.json file are executed., (*4)

{
    "require": {
        "programster/js-demo-welcomer": "0.1.*"
    },
    "scripts": {
        "post-install-cmd": [
            "rm -f public_html/js/js-demo-welcomer && ln -s ../../vendor/programster/js-demo-welcomer/src public_html/js/js-demo-welcomer"
        ],
        "post-update-cmd": [
            "rm -f public_html/js/js-demo-welcomer && ln -s ../../vendor/programster/js-demo-welcomer/src public_html/js/js-demo-welcomer"
        ]
    }
}

For this package, a full example composer.json file would be as follows:, (*5)

{
    "require": {
        "programster/js-demo-welcomer": "0.1.*"
    },
    "scripts": {
        "post-install-cmd": [
            "rm -f public_html/js/js-demo-welcomer && ln -s ../../vendor/programster/js-demo-welcomer/src public_html/js/js-demo-welcomer"
        ],
        "post-update-cmd": [
            "rm -f public_html/js/js-demo-welcomer && ln -s ../../vendor/programster/js-demo-welcomer/src public_html/js/js-demo-welcomer"
        ]
    }
}

Then you would use this package like so in your source code:, (*6)

...
<body>
<script src="js/js-demo-welcomer/Welcomer.js"></script>
<script type="text/javascript">
    var welcomer = new Welcomer("James");
    welcomer.run();
</script>
...

The Versions

17/06 2018

dev-master

9999999-dev https://blog.programster.org

Example javascript package

  Sources   Download

MIT

demo js hello-world

17/06 2018

0.1.2

0.1.2.0 https://blog.programster.org

Example javascript package

  Sources   Download

MIT

demo js hello-world

17/06 2018

0.1.1

0.1.1.0 https://blog.programster.org

Example javascript package

  Sources   Download

MIT

demo js hello-world

17/06 2018

0.1.0

0.1.0.0 https://blog.programster.org

Example javascript package

  Sources   Download

MIT

demo js hello-world