cli
Stax CLI
Usage
$ npm install -g @staxjs/cli
$ stax COMMAND
running command...
$ stax (-v|--version|version)
@staxjs/cli/0.1.0 darwin-x64 node-v14.16.0
$ stax --help [COMMAND]
USAGE
$ stax COMMAND
...
Commands
- cli
- Usage
-
Commands
stax add WORKSPACE MODULE
stax altgen TYPE MODEL
stax build [WORKSPACE]
stax completion
stax completion:generate
stax completion:generate:alias ALIAS
stax dev WORKSPACE
stax generate RESOURCE [NAME]
stax hello [FILE]
stax help [COMMAND]
stax install RECIPE [RECIPE-FLAGS]
stax jest
stax list [TYPE]
stax remove WORKSPACE MODULE
stax run NAME
stax start WORKSPACES
stax update [CHANNEL]
stax add WORKSPACE MODULE
Add dependency to project
USAGE
$ stax add WORKSPACE MODULE
ARGUMENTS
WORKSPACE target workspace to install module
MODULE module name
OPTIONS
-D, --dev Install module as dev dependency
-E, --exact Install module with exact version
-P, --peer Install module as peer dependency
-h, --help show CLI help
ALIASES
$ stax a
See code: src/commands/add.ts
stax altgen TYPE MODEL
Generate new files for your Stax project
USAGE
$ stax altgen TYPE MODEL
ARGUMENTS
TYPE (all|crud|model|component|pages|queries|query|mutations|mutation|resource) What files to generate
MODEL The name of your model, like "user". Can be singular or plural - same result
OPTIONS
-c, --context=context Provide a context folder within which we'll place the generated files for better code
organization. You can also supply this in the name of the model to be generated (e.g. `stax
generate query admin/projects`). Combining the `--context` flags and supplying context via the
model name in the same command is not supported.
-d, --dry-run Show what files will be created without writing them to disk
-h, --help show CLI help
-p, --parent=parent Specify a parent model to be used for generating nested routes for dependent data when
generating pages, or to create hierarchical validation in queries and mutations. The code will
be generated with the nested data model in mind. Most often this should be used in conjunction
with 'stax generate all'
ALIASES
$ stax g
EXAMPLES
# The 'crud' type will generate all queries & mutations for a model
> stax generate crud productVariant
# The 'all' generator will scaffold out everything possible for a model
> stax generate all products
# The '--context' flag will allow you to generate files in a nested folder
> stax generate pages projects --admin
# Context can also be supplied in the model name directly
> stax generate pages admin/projects
# To generate nested routes for dependent models (e.g. Projects that contain
# Tasks), specify a parent model. For example, this command generates pages under
# app/tasks/pages/projects/[projectId]/tasks/
> stax generate all tasks --parent=projects
# Database models can also be generated directly from the CLI
# Model fields can be specified with any generator that generates
# a database model ("all", "model", "resource"). Both of the below
# will generate the proper database model for a Task.
> stax generate model task \
name:string \
completed:boolean:default=false \
belongsTo:project?
> stax generate all tasks \
name:string \
completed:boolean:default=false \
belongsTo:project?
# Sometimes you want just a single query with no generated
# logic. Generating "query" instead of "queries" will give you a more
# customizable template.
> stax generate query getUserSession
See code: src/commands/altgen.ts
stax build [WORKSPACE]
Creates a production build
USAGE
$ stax build [WORKSPACE]
ARGUMENTS
WORKSPACE (db|app|scripts|cli|codemod|components|config|display|functions|generator|installer|theme|transforms|graphq
l) target workspace to build
OPTIONS
-h, --help show CLI help
ALIASES
$ stax b
See code: src/commands/build.ts
stax completion
Generate shell completion script
USAGE
$ stax completion
OPTIONS
-s, --shell=bash|fish|zsh (required) Name of shell
DESCRIPTION
Run this command to see instructions for your shell.
EXAMPLE
$ stax completion --shell zsh
See code: oclif-plugin-completion
stax completion:generate
Generates completion script
USAGE
$ stax completion:generate
OPTIONS
-s, --shell=bash|fish|zsh (required) Name of shell
DESCRIPTION
Run the "completion" command to see instructions about how to use the script generated by this command.
EXAMPLE
$ stax completion:generate --shell zsh
See code: oclif-plugin-completion
stax completion:generate:alias ALIAS
Generates completion script for alias
USAGE
$ stax completion:generate:alias ALIAS
ARGUMENTS
ALIAS name of the alias
OPTIONS
-s, --shell=bash|fish (required) Name of shell
DESCRIPTION
This needs the completion script for the main command to be present.
Check the "completion:generate" command.
See code: oclif-plugin-completion
stax dev WORKSPACE
Start the production server
USAGE
$ stax dev WORKSPACE
ARGUMENTS
WORKSPACE (db|app|scripts|cli|codemod|components|config|display|functions|generator|installer|theme|transforms|graphq
l) target workspace in monorepo
OPTIONS
-h, --help show CLI help
-p, --port=port Set port number
--inspect Enable the Node.js inspector
ALIASES
$ stax d
See code: src/commands/dev.ts
stax generate RESOURCE [NAME]
Generate code from template
USAGE
$ stax generate RESOURCE [NAME]
ARGUMENTS
RESOURCE (component|page|function|model) resource type to generate
NAME name of resource to generate
OPTIONS
-h, --help show CLI help
Resource variant=variant
ALIASES
$ stax g
See code: src/commands/generate.ts
stax hello [FILE]
describe the command here
USAGE
$ stax hello [FILE]
OPTIONS
-f, --force
-h, --help show CLI help
-n, --name=name name to print
EXAMPLE
$ stax hello
hello world from ./src/hello.ts!
See code: src/commands/hello.ts
stax help [COMMAND]
display help for stax
USAGE
$ stax help [COMMAND]
ARGUMENTS
COMMAND command to show help for
OPTIONS
--all see all commands in CLI
See code: @oclif/plugin-help
stax install RECIPE [RECIPE-FLAGS]
Install a Recipe into your Stax app
USAGE
$ stax install RECIPE [RECIPE-FLAGS]
ARGUMENTS
RECIPE Name of a Stax recipe from @staxjs/stax/recipes, or a file path to a local recipe definition
RECIPE-FLAGS A list of flags to pass to the recipe. Stax will only parse these in the form key=value
OPTIONS
-h, --help show CLI help
ALIASES
$ stax i
See code: src/commands/install.ts
stax jest
Start the production server
USAGE
$ stax jest
OPTIONS
-h, --help show CLI help
--watch Enable watch mode for tests
ALIASES
$ stax j
See code: src/commands/jest.ts
stax list [TYPE]
Add dependency to project
USAGE
$ stax list [TYPE]
ARGUMENTS
TYPE type of workspaces to display
OPTIONS
-D, --dev Install module as dev dependency
-E, --exact Install module with exact version
-P, --peer Install module as peer dependency
-h, --help show CLI help
ALIASES
$ stax a
See code: src/commands/list.ts
stax remove WORKSPACE MODULE
Add dependency to project
USAGE
$ stax remove WORKSPACE MODULE
ARGUMENTS
WORKSPACE target workspace to install module
MODULE module name
OPTIONS
-W, --root Remove module from project root
-h, --help show CLI help
ALIASES
$ stax a
See code: src/commands/remove.ts
stax run NAME
Run script in scripts
directory using ts-node
USAGE
$ stax run NAME
ARGUMENTS
NAME Filename of script to run
OPTIONS
-h, --help show CLI help
-p, --port=port Set port number
--inspect Enable the Node.js inspector
ALIASES
$ stax r
See code: src/commands/run.ts
stax start WORKSPACES
Start the production server
USAGE
$ stax start WORKSPACES
ARGUMENTS
WORKSPACES (db|app|scripts|cli|codemod|components|config|display|functions|generator|installer|theme|transforms|graph
ql) target workspacs to start in monorepo
OPTIONS
-h, --help show CLI help
-p, --port=port Set port number
--inspect Enable the Node.js inspector
ALIASES
$ stax s
See code: src/commands/start.ts
stax update [CHANNEL]
update the stax CLI
USAGE
$ stax update [CHANNEL]
See code: @oclif/plugin-update