Skip to content

jwayong/generator-tpa

 
 

Repository files navigation

Build Status

Yeoman generator for TPA projects

Introduction

Polymer is a library of polyfills and sugar which enable the use of Web Components in modern browsers. The project allows developers to build apps using the platform of tomorrow and inform the W3C of places where in-flight specifications can be further improved.

generator-tpa provides Polymer scaffolding using Yeoman (a scaffolding tool for the web), letting you easily create and customize Polymer (custom) elements via the command-line and import them using HTML Imports. This saves you time writing boilerplate code so you can start writing up the logic to your components straight away.

Features

  • A TPA Polymer element tpa-seed that was forked from Polymer's seed-element
  • Seed element contains examples such as unit testing, i18n, API mocking for a developer to contribute new functionality into the TPA Bootstrap application

Issues

This generator uses the tpa-seed template to create a new web component.

If you're having issues with the template files generated for this project, please raise them in that repository as they are the canonical source.

Installation

Install the generator

npm install -g generator-tpa

Generators

tpa:seed is the only available generator.

More can be [contributed](#Adding a new generator) to over time

Note: Generator is to be run from the root of your app

TPA

Generates a reusable polymer element based on the tpa-seed template.

To preview your new element you'll want to use the polyserve and Drakov tools that's executed via gulp

For further explanation of these tools, see the tpa-seed README

Example:

mkdir -p tpa-new-element && cd $_
yo tpa:seed tpa-new-element
npm install && bower install
gulp serve

Contribute

See the contributing docs

When submitting an issue, please follow the guidelines. Especially important is to make sure Yeoman is up-to-date, and providing the command or commands that cause the issue.

Install the generator from a local folder

First clone this project to a local folder, and from that folder execute the following command:

npm install -g .\

Updating submodules

This generator uses git submodules to generate the component. To update the submodules use the following command:

git submodule update --remote

Note: Push these updates back into source control

Updating generator to npm

When you update the generator to the npm generator-tpa, it will need to be published to npm

Ensure you update the package.json to a newer version following the semantic versioning pattern

npm version [patch|minor|major]
npm publish

Adding a generator

As new patterns emerge, new TPA generators can be added to the solution

  1. Create a new folder using the name that you want run. For example, host if you want a consumer to run tpa:host

  2. Add an index.js to the root of folder, which you can either reuse from seed folder or create a new one following the yeoman guidelines

  3. Add your generator name to the package.json under the "files" property

  4. Install the git submodule using the following convention if we were implementing a host generator from tpa-host.git

    git submodule add https://github.com/ING-Group/tpa-host.git host/templates/tpa-host

  5. Add tests to the test folder

  6. Update the version number in the package.json

  7. Update and manually test the generator locally

    npm install -g .\

  8. Push to source control after validating behaviour

  9. Publish to npm

Deleting a generator

Just as generators can be added, they can also be removed

  1. Delete the git submodule, and using the previous host example here

    git rm --cached host/templates/tpa-host

  2. Delete the relevant section from the .gitmodules file

[submodule "host/templates/tpa-host"]
	path = host/templates/tpa-host
	url = https://github.com/ING-Group/tpa-host.git
  1. Update the version number

  2. Push to source control

  3. Publish to npm

License

BSD license

About

yeoman scaffold for tpa custom elements

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%