mf-bootstrap
v1.3.0
Published
`mf-bootstrap` allows you to generate micro frontends to be used with [mf-maestro](https://github.com/calions-app/mf-maestro) and [mf-bundler](https://github.com/calions-app/mf-bundler)
Downloads
46
Readme
mf-bootstrap
mf-bootstrap
allows you to generate micro frontends to be used with mf-maestro and mf-bundler
Install
You should install this package globally to easily use it anywhere:
$ npm install -g mf-bootstrap
Quick start
We will start by creating a new project named blog
:
$ mf-generate init blog ../main-styles
Now we will go to the created project:
$ cd blog
And we will create a first micro frontend for the domain users, a creation of account:
$ mf-generate mf users accounts new
You can install all dependencies with npm install
(this will also install micro frontends' dependencies).
And now you can run the tests to be sure everything is working fine:
$ npm run test
This will run unit and end2end tests for all micro frontends.
You could also go to your micro frontend directory and start it to check everything is ok:
$ cd apps/users/accounts-new
$ npm start
If you don't have a webserver running, don't forget to run mocks with npm run mocks
at the root of your project.
If you have a webserver running, be sure to configure its host and port in the .env
file.
Everything is working and ready, you can adapt the base code for your needs and generate new micro frontends.
Usage
With mf-bootstrap
you can generate a new project that will host your micro frontends, and you can also add new micro frontends.
Generate a new project
$ mf-generate init [project] [mainStylesPath] [-d destPath] [-a author]
This command will generate a new project named <project>
in folder <destPath>/<project>
.
Arguments
project
: The project namemainStylesPath
: The relative path from your project's folder where you can find the main styles projects. This project is used to generate styles used by your instance of the maestro, so that your micro frontends can be run with these styles outside of the maestro.destPath
: The destination folder where your project will be created. Default to.
author
: The author name to use in thepackage.json
files. Default toCalions apps
Generate a new micro frontend
Go to your project's folder. Then execute:
$ mf-generate mf [domain] [entity] [type] [-l lang]
This will generate a new micro frontend in your apps
folder.
Arguments
domain
: The domain of your entityentity
: The name of the entity linked to this viewtype
: The UI type of the view. Possible values are:master
: List of entitiesdetail
: A detailed view of an entitynew
: A form to create a new entityedit
: A form to edit an existing entity
lang
: The language/framework to use for this micro frontend. Default toelm