Releases: krzepah/mutaserv
0.0.4b
Developer tools
- new option : -r --reload Mutations are reloaded and database purged when mutations files are updated (default false)
- new option : -s --serve allow to serve a folder passed as parameter
- -s option is not bound to --skip command anymore
- loader is now compatible with stockroom way of writing reducers
-a --allow specifies which imports will be loaded
Logging
- better logging with winston
- new option -s --skip Skip any config file
- --env (-e) option becomes --log.env
- new option --log.args allow to log loaded args
- new option --log.config allow to log loaded configuration on start
- new option --log.nostdout allow to specify if logs should't be displayed in stdout (default false)
- new option --log.nocolor allow to specify if logs shouldn't use colors (default false)
- new option --log.path allow to change the default logging file (default ./mutaserver.log)
Dependency quick-fick
Fixes wrongly written dependency, moved @babel/parser&generator to dependency appropriately.
Command line tool
- It is no longer possible to run a mutation file by passing it as a first argument
- -m specifies which mutation file to run
- configuration can be done using package.json or a custom config.json
- -p --port to specify port
- database if configurable using --db.param (ex : --db.username)
- -e shows the configured env that's used
- -c specifies which config file should be used
- -h | command -h will give quick indication of how the cli is used
- command line tool retrieves parameters from package.json (or the config file) and overwrite them by any parameter sent by command-line and set all those in process.env before running the server.
- an example.json config file has been added to the repository
mutaserv -h
Usage
$ mutaserv <command> [options]
Available Commands
run Serves a mutation file.
For more info, run any command with the `--help` flag
$ mutaserv run --help
Options
-v, --version Displays current version
-h, --help Displays this message
mutaserv run -h
Description
Serves a mutation file.
Usage
$ mutaserv run [options]
Options
-p, --port Change the default port (default 9000)
-m, --muts Change the default muts (default example.js)
-c, --conf Provide path to custom package.json (default package.json)
-e, --env Display used environement before starting the server (default false)
--db.verbose Database query verbosity (default false)
--db.dialect Database dialect (default sqlite)
--db.host Database host (default localhost)
--db.path Sqlite database path (default ./mutaserv.db)
--db.username Database username (default mutaserv)
--db.password Database password (default mutaserv)
-h, --help Displays this message
Examples
$ mutaserv run
cat example.json
{
"mutaserv": {
"port": "9512",
"mutations": "./example.js",
"database": {
"verbose": false,
"dialect": "sqlite",
"path": "./mutaserv.db",
"name": "mutaserv",
"username": "mutaserv",
"password": "mutaserv",
"host": "host"
}
}
}
Use ES6 style mutations
Mutaserv it self is not written in ES6 but in plain node with polka. Therefor some new ES features are necessarily breaking when the server tries to import a custom mutation file.
I really wanted to directly use a mutation file written in the front-end, which usually use imports & such which the server cannot do.
This update allow to update given mutation file in the format expected by mutaserv. Under the hood it uses mutaserv-formater which uses babel AST parser & generator to strip out imports and change the expected two const "defaults" & "mutations" into a func which takes ramda as a parameter. Any import are translated into parameter deconstruction so everything can work as expected.
I'm still wondering if there are better choices and there could be much simpler ones. However I'd like to propose control over uploaded mutation files and their imports and this is a first step toward looking up what there is in the mutation file.
🎉 Initial release
Mutaserv is a state server for your front apps. It is designed a simple identify provider which you start with your mutation file. It then provides a couple of endpoints which allow mutasync to bind to.
Instalation
yarn add -g mutaserv
Usage
mutaserv ./mutation.js