generator-jspm-lib

Yeoman generator

Usage no npm install needed!

<script type="module">
  import generatorJspmLib from 'https://cdn.skypack.dev/generator-jspm-lib';
</script>

README

Yeoman generator

Yeoman generator for creating ES6 javascript libraries with JSPM. Generated directory is configured to work with testing stack: karma-jspm, Mocha, Chai, Sinon, Travis, Sauce Labs

Instalation

Installing generator

npm install -g yo
npm install -g generator-jspm-lib

Scaffolding library

mkdir mylib & cd mylib
yo jspm-lib

Generator will ask you for your GitHub username which will be used for jspm configuration.

Set GitHub authentification to avoid GitHub rate limit:

jspm registry config github

Setup Travis with Github and Sauce Labs

  1. We assume you have registered GitHub, NPM, Travis and Sauce Labs accounts

  2. Install travis cli by:

gem install travis
  1. Enable you new lib repo for travis build by running comman:
travis enable
  1. Add travis environment variables by command line:
travis env set SAUCE_USERNAME my_sauce_user
travis env set SAUCE_ACCESS_KEY my_sauce_key
  1. Set GitHub authentification env variable to avoid GitHub rate limit in travis build:
travis env set JSPM_AUTH "$(node -pe 'JSON.parse(process.argv[1]).registries.github.auth' "$(cat ~/.jspm/config)")"
  1. Enable NPM deployment from travis build
travis setup npm

It is recommended by jspm to release your libraries to npm endpoint. For more details see travis documentation.

Development workflow

JSPM linking (with watching)

gulp link

Depoly new release to NPM

gulp deploy-master

Testing

karma start

Using your library

In any jspm project you can install your library with this command:

jspm install npm:REPO

or make a pull request to JSPM Reigistry