canonical-web-and-design / generator-canonical-webteam

Generator scripts for creating and maintaining Canonical webteam projects
Other
6 stars 11 forks source link
npm npm-package package

Project archived

We no longer use this project. It was mostly used for managing the ./run script, but that is barely updated any more (in favour of dotrun). Updates to ./run should now happen manually as needed.


The webteam's Yeoman generator

This is a collection of generator scripts for creating and maintaining Canonical webteam projects.

Usage

First, install Yeoman and generator-canonical-webteam using npm.

npm install -g yo generator-canonical-webteam

Then run the generator scripts from within a project directory to create or upgrade parts of the project:

cd {project-directory}
yo canonical-webteam:{script-name}

Scripts

Each of these scripts can either be used to create new files or to update existing ones:

run

yo canonical-webteam:run

This installs a ./run script which will use docker-yarn to automatically manage NPM dependencies and run standard NPM scripts defined in a package.json.

$ ./run --help

Usage
===

  $ ./run \
    [-m|--node-module PATH]  # A path to a local node module to use instead of the installed dependencies \
    [COMMAND]                # Optionally provide a command to run

If no COMMAND is provided, `serve` will be run.

Commands
---

- serve [-p|--port PORT] [-w|--watch] [-d|--detach]: Run `yarn run serve` (optionally running `watch` in the background) \
- watch: Run `yarn run watch`
- build: Run `yarn run build`
- test: Run `yarn run test`
- stop: Stop any running containers
- yarn <args>: Run yarn
- clean: Remove all images and containers, any installed dependencies and the .docker-project file
- clean-cache: Empty cache files, which are saved between projects (eg, yarn)

run-django

yo canonical-webteam:run-django

Install a version of the run script which will also use docker-django to run a Django application on ./run start.

run-django-db

yo canonical-webteam:run-django-db

Install a version of the run script similar to the run-django one, but which will also run a postgres container and attach it to the Django container with the hostname db, for use by the application.

License

This codebase is licensed with GNU Lesser General Public License version 3.