GlueStick comes with several commands to help you get started. You can full list of commands available on gluestick below:
Takes care of generating new project
If you use new
command from gluestick-cli
it will use latest gluestick
version available on npm
gluestick new <YOUR_APPLICATION_NAME>
Available options:
-d, --dev <path>
- Relative path from inside crated directory to development version of gluestick-n, --npm
- Use npm instead of yarn for install dependencies-s, --skip-main
- Gluestick will not generate main app
Generates a new entity from given template
gluestick generate <ENTITY_TYPE> <ENTITY_NAME>
Available options:
-A --app <appName>
- App in which to generate files (eg:main
,shared
)-F, --functional
- Generate stateless functional component-O, --gen-options <value>
- Options to pass to the generator (see generators)
Removes entity created by generate
command
destroy
command only removes files, meaning if entity generator modifies already existing file, you need to manually update that file, so this command works best withcomponent
andcontainer
, but forreducer
generator it will only remove reducer and test for it, so any reference to that reducer inreducers/index.js
must be removed manually
gluestick destroy <ENTITY_TYPE> <ENTITY_NAME>
Available options:
-A --app <appName>
- App from which entity should be removed (eg:main
,shared
)s
Starts a gluestick project
If you want to start your project in production mode, run this command with
NODE_ENV=production
.
gluestick start
Depending on NODE_ENV
value and presence of -P
/--skip-build
flag, start
command applies different behaviours:
NODE_ENV |
-P /--skip-build passed |
client build | server build |
---|---|---|---|
development / not specified |
no | no (start-client is spawned) |
yes |
development / not specified |
yes | no (start-client is spawned) |
yes |
production |
no | yes | yes |
production |
yes | no | no |
Available options:
-T, --run-tests
- Run test hook-L, --log-level <level>
- Set the logging level- Valid options:
fatal
,error
,warn
,info
,debug
,trace
,silent
- Valid options:
-A, --app <appName>
- Specify which app (or group of them) to build and run (see resolving apps to build and run)-D, --debug-server
- Debug server side rendering with built-in node inspector-p, --debug-port <number>
- Port on which to run node inspector-C --coverage
- Create test coverage report-P, --skip-build
- Skip build when running in production mode-S, --skip-dep-check
- Skips the check for version discrepancies between package.json and node_modules
Starts client separately (part of gluestick start
command)
gluestick start-client
Starts server separately (part of gluestick start
command)
gluestick start-server
Available options:
-D, --debug-server
- Debug server side rendering with built-in node inspector-p, --debug-port <number>
- Port on which to run node inspector
Create client and (default) / or server bundle
If you want to build in production mode, run this command with
NODE_ENV=production
.
gluestick build
Available options:
--client
- Build only client bundle--server
- Build only server bundle-Z, --static [url]
- Prepare static HTML for each entry (and use providedurl
(hostname
) to fetch HTML from renderer, by default it islocalhost
)-S, --stats
- Output webpack stats-A, --app
- Build only specific app or a group of them-D, --vendor
- Build Vendor DLL bundle-B, --skip-if-ok
- Skip vendor DLL recompilation if the bundle is valid--no-progress
- Disable progress indicator
Access dependencies bin directory
gluestick bin <DEPENDENCY_NAME> -- <DEPENDENCY_ARGS>
Create docker image (requires docker
installed on your machine)
gluestick dockerize
Run projects test suite
gluestick test
Available options:
-D, --debug-test
- Debug tests with built-in node inspector
This command supports all Jest CLI options
including <regexForTestFile>
argument.
Example:
gluestick test --watch Home
Reinstall gluestick dependency project
gluestick reinstall-dev
Watches and applies changes from gluestick package to current project
gluestick watch
Removes gluestick dependency project clean build, cache and reinstalls dependencies
gluestick reset-hard
You can check which commands are being called by gluestick
and gluestick-cli
here:
To pass enviroment variables when running command simply, add them at the beginning:
ENV_VAR_NAME=env_var_value gluestick <command>
for example to set NODE_ENV
to production use:
NODE_ENV=production gluestick <command>
Generators documentation is available here.
Caching & Hooks documentation is available here.
Styles documentation is available here.
By default GlueStick will use dark theme when logging messages. If you want to use the light one, either set GS_LOG_LIGHT
environment variable to true
or pass --light
(-l
) option when running a command.
For better CI/CD and other build tools support, GlueStick will switch to machine friendly output mode, thus instead of colorful header prefixing message, you will get log matching the following format:
[GleuStick][<command>][<headerTitle>] <message>
To switch to machine friendly mode, one of the folling condition must be met:
NODE_ENV
must be set toproduction
CI
must be set (to whatever value)CD
must be set (to whatever value)
However, if you want to overwrite this behaviour pass GS_LOG_PRETTY=true
when running a command.
When you run start
command you can specify which app or which group of apps to build and run. It's worth knowing how resolving algorithm works:
If passed value (appName
) starts with /
, it will build and run single app, which has name
property equal to passed value. If name
property is not defined, it will camelCase app key and check if it equals passed value.
To run app with /
key in src/entries.json
, you need to pass /main
.
If passed value doesn't start with /
it will check group
property to check if the app is assigned to any group then if it's assigned to passed group name. Please not that, all group names will be converted to camelCase.