Try Install Learn Blog API Packages GitHub
Pages

Using the CLI

Once you install Mint you will have a mint binary at your disposal.

This is the help section (you can print this using the --help flag):

mint --help
Mint - Help
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Usage:
  mint [flags...] [arg...]

Mint

Flags:
  --env, -e (default: "")  # Loads the given .env file
  --help                   # Displays help for the current command.

Subcommands:
  build                    # Builds the project for production
  docs                     # Starts the documentation server
  format                   # Formats source files
  init                     # Initializes a new project
  install                  # Installs dependencies
  loc                      # Counts Lines of Code
  start                    # Starts the development server
  test                     # Runs the tests
  version                  # Shows version
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Initializing a new application

To initialize a new application, you invoke the binary with the init command:

mint init my-app

This will scaffold a new application in the my-app directory:

my-app
├── assets
│   └── head.html
├── source
│   └── Main.mint
├── tests
│   └── Main.mint
├── .gitignore
└── mint.json

After scaffolding a new project make sure to enter that directory and run commands from there.

Installing dependencies

You install dependencies by invoking the binary with the install command:

mint install

This builds a dependency tree of the packages and installs them by cloning their repositories from Git sources into the .mint directory.

Starting a development server

To start a development server for an application, just invoke the binary with the start command:

mint start

This will start the server at http://localhost:3000

Running tests

To run the test written for an application, just invoke the binary with the test command:

mint test

This will:

  • compile the application including the tests
  • open a browser in headless mode
  • run the tests in the browser printing the results along the way

The test command contains several flags you can set, such as which browser to use:

mint test --help
Usage:
  mint test [flags...] <test> [arg...]

Runs the tests

Flags:
  --browser, -b (default: "chrome")                                    # Which browser to run the tests in (chrome, firefox)
  --browser-host, -x (default: ENV["BROWSER_HOST"]? || "127.0.0.1")    # Target host, useful when hosted on another machine. (Default: 127.0.0.1)
  --browser-port, -c (default: (ENV["BROWSER_PORT"]? || "3001").to_i)  # Target port, useful when hosted on another machine. (Default: 3001)
  --env, -e (default: "")                                              # Loads the given .env file
  --help                                                               # Displays help for the current command.
  --host, -h (default: ENV["HOST"]? || "127.0.0.1")                    # Host to serve the tests on. (Default: 127.0.0.1)
  --manual, -m                                                         # Start the test server for manual testing
  --port, -p (default: (ENV["PORT"]? || "3001").to_i)                  # Port to serve the tests on. (Default: 3001)
  --reporter, -r (default: "dot")                                      # Which reporter to use (dot, documentation)

Arguments:
  test

Currently both chrome and firefox are supported.

Building for production

To build the application for production deployment, invoke the binary with the build command:

mint build

This will:

  • generate the index.html file
  • compile the application in production mode
  • if a base icon is provided, generate favicons in different sizes
  • copy all static files from the public directory
  • create a service worker and manifest file

Disabling the service worker

If you don't want a service worker for you application you can use the --skip-service-worker flag when building.

mint build --skip-service-worker

Browsing documentation of installed packages

To browse the documentation of the application and installed packages, invoke the binary with the docs command:

mint docs

It starts a documentation server which can be accessed at http://localhost:3002