gbc tool syntax

The gbc tool is used for building, cleaning, and managing customizations in GBC projects, offering commands like build, info, clean, and theme-graph with various options for customization and debugging. It supports features such as creating zip files, setting compile modes, and generating JSON graphs for theme variable relationships.

Note:

If you are on Microsoft® Windows®, ensure you are using the legacy Command Prompt (cmd.exe) command-line utility to execute gbc instructions; do not use the Powershell command-line utility. If you are using a Genero Workplace Window, you are using the legacy Command Prompt (cmd.exe) command-line utility.

To run the gbc tool without commands:

gbc [ option [...] ]
Table 1. gbc options
-v, -V, --version Display the GBC version.
-h, --help Display help for the gbc command.
-d, --debug Output extra debugging.
The gbc tool supports the following commands:

gbc build

The gbc build command builds the GBC.

gbc build [ option [...] ]
Table 2. gbc build options
-A, --all Build GBC without customization and each customization in customization folder in their default build output folders. --build-dist has no effect.
-C, --configuration configuration Build configuration file
-c, --customization customization-id Build a specific customization. Supersedes the value set in file custom.json. Can take customization-id to explicitly build the given GBC customization in dist/customization-id, unless --build-dist is defined.
-nc, --no-customization Build ignoring specified customization (in config file); explicitly build GBC without customization in dist/web (unless --build-dist is defined).
-s, --customization-suffix customizationSuffix Set customization suffix.
-H, --html-cache Uses dated url suffix for resources (default: false).
-z, --create-zip Creates a runtime zip in the archive/ folder.
-m, --compile-mode compileMode
Set compile mode:
  • dev -- every file is provided separately.
  • cdev (default) -- files are packed.
  • prod -- files are packed and minified.
-d, --build-dist buildDist Set a build destination, a custom target build directory relative to dist/ folder.
-t, --themes List themes to build.
-w, --watch Keep rebuild when sources change (default: false).
-D, --debug Output extra debugging (default: false).
-h, --help Display help for the gbc build command.

Examples

To build the customization project specified in the custom.json file:

$ gbc build 

To build the customization named "sample":

$ gbc build --customization sample 

To create a zip file of the "sample" customization (the compilation mode is taken from the custom.json file):

$ gbc build --customization sample --create-zip 

To set the compilation mode to "prod", and create a zip file of the "sample" customization:

$ gbc build --customization sample --compile-mode prod --create-zip 

To build the GBC project without any customization, and place the results in the gbc-project-dir/dist/web directory:

$ gbc build --no-customization 

gbc info

The gbc info command retrieves information about customizations.

gbc info [ command ] [ option [...] ]
Table 3. gbc info options
-h, --help Display help for the gbc info command.
Table 4. gbc info commands
buildnumber Returns the current build number in format 'BUILD=<buildnumber>' on the console.
help [ command ] Display help for the named command.

Example

To return the build number (not the version number) of the GBC project:

$ gbc info 

gbc clean

The gbc clean command cleans files in the project.

gbc clean [ command ] [ option [...] ]
Table 5. gbc clean options
-D, --dry-run List only files that would be cleaned.
-h, --help Display help for the gbc clean command.
Table 6. gbc clean commands
tests Clean test binary files in the project.
orig Clean *.orig files in the project.
dependencies Clean node_modules/ folder in the project.
dist [ option [...] ] Clean a customization output or 'dist/web/' folder in the project. To view the available options, see Table 7.
default Clean .cache/, archive/, and dist/ folders in the project.
all Clean all dispensable files in the project.
help [ command ] Display help for the named command.
Table 7. gbc clean dist options
-c, --customization customization Clean a specific customization.
-a, --all Clean dist/ complete folder.
-h, --help Display help for the gbc clean dist command.

Examples

To remove all customization projects from the .cache/, archive/, and dist/ folders:

$ gbc clean

To remove all customization projects from the .cache/, archive/, dist/, and node_modules/ folders:

$ gbc clean all

To remove the "sample" project from the dist/ folder:

$ gbc clean dist --customization customization/sample 

To remove the dist/ folder and all its built projects:

$ gbc clean dist --all

gbc theme-graph

The gbc theme-graph command builds a tree-structured JSON file representing theme variable relationships, which will help you understand dependencies between theme variables and thereby better understand potential knock-on effects when customizing given variables. The JSON graph file that it outputs can be viewed using a JSON graph viewer.

gbc theme-graph [ option ] inputFile [ variableNames ... ]
Where:
  • option is described in Table 8.
  • inputFile is the theme json file containing the variables. You can use any json file in the gbc-project-dir/src/theme/definition path. If the inputFile does not exist, the algorithm will generate the JSON data directly from the GBC project. No JSON data file will be created, but the JSON graph data will be generated.
  • variableNames is a space-separated list of theme variable names or a part of variable names (for example, button, field, input, and so on) used to filter on when building the graph.
Table 8. theme-graph options
--valueType valueTypes ... Include only nodes in the graph with the specified value types (for example, size, color, and so on). The default is to include all nodes.
-d, --defaultValueFilter Use also the default value for filtering nodes.
-c, --noChildren When building a filtered graph, the child nodes are not queried
-p, --noParents When building a filtered graph, the parent nodes are not queried.
-s, --simple Remove all information in the nodes except the name and relationship.
-h, --help Display help for the theme-graph command.

Examples

Generate a JSON graph from the variables.json file, containing all the theme variables. This will output a large graph to variables.graph.json.

gbc theme-graph variables.json

Generate a JSON graph with all the variables having "button" in their names and include their relationships to ancestor and descendant nodes.

gbc theme-graph variables.json button

Generate a JSON graph with all the variables having "palette" in their names or with the default value filter and include their relationships to ancestor and descendant nodes.

gbc theme-graph variables.json palette --defaultValueFilter

Generate a JSON graph with all the variables having "mt" in their names and include their relationships to their child nodes only.

gbc theme-graph variables.json mt --noParents

Generate a JSON graph with all the variables having "mt" in their names and include their relationships to their parent nodes only.

gbc theme-graph variables.json mt --noChildren

Generate a JSON graph with all the variables having "mt" in their names and include their relationships to ancestor and descendant nodes with a valueType equal to "color".

gbc theme-graph variables.json mt --valueType color

Generate a JSON graph with all the variables having "mt" in their names and include their relationships to ancestor and descendant nodes, displaying only the name and relationship. This will output a simpler graph.

gbc theme-graph variables.json mt --simple