Development

In this section we cover all aspects of Wails development and contribution guidelines.

Issue Driven Development

If there is something to add to the code, whether a bug or enhancement, a ticket should be opened so that it can be discussed. If the coding goes ahead, a new branch should be created from the develop branch with a reference to the ticket ID, eg: 64 - Support react

Commit messages should follow the conventional commits format:

  • tag[(scope)]: message
TagMeaning
fixBugfix
featNew Feature
docsDocumentation update
BREAKING CHANGEAPI Change

Examples:

  • fix: this is a fix for the project as a whole
  • fix(cli): this is a fix for the cli
  • docs: updated the contributors

Branch Workflow

  • Wails uses a gitflow-like approach to development
  • Feature/Bugfix branches are created from the develop branch
  • Once the work is complete, pull requests should be made against the develop branch
  • As features are added, the develop branch is tagged with pre-release tags
  • Releases are made weekly, so at the end of the weekly cycle, the latest features and bugfixes that were made will be merged to master and tagged with the next appropriate version.

Example:

  • After release v0.14.0, a ticket (#63) is opened requesting react support
  • This is worked on and a PR is made back to develop
  • Once merged, develop is tagged with v0.14.1-pre
  • A ticket (#64) is opened requesting ultralight support
  • This is worked on and a PR is made back to develop
  • Once merged, develop is tagged with v0.14.2-pre
  • We reach the end of our week and merge v0.14.2-pre to master, tagging it as v0.15.0
  • Work continues on the devel branch

Development - 图1

Tooling

The Wails cli has developer tooling built in, but needs activating. To create a developer version, do the following:

  1. cd cmd/wails
  2. go install --tags=dev

This unlocks a wails dev command that has subcommands for development.

Creating new project templates

With a developer enabled cli, you can run wails dev newtemplate to create a new project template. You will be asked a number of questions regarding your template and as a result, a new directory will be created in <project-root>/cmd/templates.

Here is an example run:

  1. Wails v0.14.4-pre - Generating new project template
  2. ? Please enter the name of your template (eg: React/Webpack Basic): Mithril Basic
  3. ? Please enter a short description for the template (eg: React with Webpack 4): Mithril with Webpack 3
  4. ? Please enter a long description: Mithril v2.0.0-rc.4 with Webpack 4
  5. ? Please enter the name of the directory the frontend code resides (eg: frontend): frontend
  6. ? Please enter the install command (eg: npm install): npm install
  7. ? Please enter the build command (eg: npm run build): npm run build
  8. ? Please enter the serve command (eg: npm run serve): npm run serve
  9. ? Please enter the name of the directory to copy the wails bridge runtime (eg: src): src
  10. ? Please enter a directory name for the template: mithril-basic
  11. Created new template 'Mithril Basic' in directory '/Users/lea/Projects/wails/cmd/templates/mithril-basic'

This generates the following template.json:

  1. {
  2. "name": "Mithril Basic",
  3. "version": "1.0.0",
  4. "shortdescription": "Mithril with Webpack 3",
  5. "description": "Mithril v2.0.0-rc.4 with Webpack 4",
  6. "install": "npm install",
  7. "build": "npm run build",
  8. "author": "Duncan Disorderly <frostyjack@sesh.com>",
  9. "created": "2019-05-20 20:16:30.394489 +1000 AEST m=+159.490635188",
  10. "frontenddir": "frontend",
  11. "serve": "npm run serve",
  12. "bridge": "src",
  13. "wailsdir": ""
  14. }

Note: The wailsdir key is currently unused but will be used in place of bridge in the near future