CLI
The gnim command line tool ships with the gnim npm package as a prebuilt binary, so it is available as npx gnim or through node_modules/.bin in package.json scripts.
NOTE
Currently only Linux x86_64 binaries are published.
Global flags:
| Flag | Description |
|---|---|
-k, --keep-tmp | Keep temporary and runtime files on exit |
gnim run
gnim run <SCRIPT> [ARGS]...Bundles a script into a temporary file and executes it with gjs -m, forwarding any additional arguments.
| Flag | Description |
|---|---|
-d, --define <KEY=VALUE> | Replace global identifiers with constant expressions |
gnim run src/main.ts
gnim run -d DEBUG=true -d ENV="DEV" src/main.ts -- --some-flag-for-the-scriptgnim types
gnim typesGenerates TypeScript annotations from installed .gir files.
| Flag | Description |
|---|---|
-o, --outdir <PATH> | Target directory to generate to |
-d, --dirs <PATHS> | Look in these directories for .gir files |
-i, --ignore <NAMESPACE> | Skip rendering by name and version, e.g. Gtk-4.0 |
--alias | Generate non-versioned import aliases |
-v, --verbose | Log debugging statements |
# skip Gtk3 to avoid conflicts with Gtk4
gnim types --alias -i Gtk-3.0 -i Gdk-3.0
# include gir files shipped by @gnim-js/gnome-shell
gnim types -d node_modules/@gnim-js/gnome-shell/gir-1.0/gnome50 --aliasgnim schemas
gnim schemas <DIRECTORY>Compiles *.gschema.ts and *.gschema.js files found in the directory into GSettings XML files. Each file's default export is expected to be a schema list created with defineSchemaList.
| Flag | Description |
|---|---|
-c, --compile | Compile into a gschemas.compiled binary |
-o, --outdir <PATH> | Where to store generated xml and compiled files |
-d, --define <KEY=VALUE> | Replace global identifiers with constant expressions |
gnim schemas ./src -o ./data --compilegnim dev
gnim dev <ENTRY>Starts the development server: bundles the entry file, runs it with gjs -m and watches the project for changes, hot-reloading components over a Unix socket. See the Dev server article for how hot reloading works and its limitations.
| Flag | Description |
|---|---|
-i, --id <ID> | Application ID in reverse DNS format |
-d, --define <KEY=VALUE> | Replace global identifiers with constant expressions |
-v, --verbose | Verbose logging |
gnim bundle
gnim bundle <ENTRY>Bundles the entry file and every asset it references (?file imports, CSS) into a gresource bundle.
| Flag | Description |
|---|---|
-o, --outfile <PATH> | Output target (default: gresource) |
--id <ID> | Application ID in reverse DNS format; used as the resource prefix |
-i, --include <PATH> | Extra directories to include in the bundle recursively |
-d, --define <KEY=VALUE> | Replace global identifiers with constant expressions |
gnim bundle --id com.example.MyApp -i data/icons src/main.tsxgnim exe
gnim exe <GRESOURCE>Generates an executable launcher script for a gresource bundle produced by gnim bundle. The script registers the gresource, sets up gettext and library paths based on the installation layout, and imports the bundled entry point. It is meant to be installed into bindir; see the Packaging tutorial for a complete example.
IMPORTANT
The script generated by this command is not relocatable or portable.
| Flag | Description |
|---|---|
-o, --outfile <PATH> | Output target, if omitted stdout is used |
-i, --id <ID> | Application ID in reverse DNS format |
-p, --prefix <PATH> | Installation prefix (default: /usr/local) |
-d, --datadir <PATH> | Data directory (default: share) |
-l, --libdir <PATH> | Library directory (default: lib) |
gnim bundle --id com.example.MyApp -o build/gresource src/main.tsx
gnim exe build/gresource --id com.example.MyApp -o build/my-app