GioJSdocs
On this page

gio build

Explains that a normal GioJS deploy has no build step; gio build standalone packages a self-contained deploy directory.

bash
gio build
gio build standalone [--out <dir>] [--target <platform>]

Reference

ParameterTypeDefaultDescription
standalonesubcommand-Package the app into one directory that runs anywhere Node is installed. See gio build standalone for its options.
-h, --helpboolean-Print the help and exit with 0.

Behavior

Without a subcommand, gio build prints this and exits with 0:

text
GioJS has no build step for normal deploys: `gio start` starts the server,
renders on demand, and caches in Rust. To package a self-contained
deploy directory (one folder, runs anywhere Node is installed), use:

  gio build standalone [--out <dir>] [--target <platform>]

Any other argument is a usage error (exit code 2), with a suggestion for a near miss:

text
$ gio build stndalone
gio: unknown build target "stndalone" - did you mean `gio build standalone`?
Run `gio build --help` for usage.

Examples

A build script for a server app

A server app has nothing to compile ahead of time, so the starter's build script only typechecks:

package.json
{
  "scripts": {
    "build": "tsc --noEmit",
    "start": "cross-env NODE_ENV=production giojs-server"
  }
}

A build script for a static site

A site created with --static builds with gio export:

package.json
{
  "scripts": {
    "build": "tsc --noEmit && gio export"
  }
}

Good to know

  • Unlike frameworks with a next build-style step, GioJS bundles the client code when the server starts (into .gio/build) and renders pages on demand. A deploy is npm ci followed by gio start.
  • Use gio build standalone when the target machine should not run npm install, and gio export for a static host.

Version history

VersionChanges
v0.1.0-beta.8A mistyped subcommand is a usage error with a suggestion; gio build --help.
v0.1.0-beta.7Introduced: prints an explanation; gio build standalone.