CLI to bootstrap React projects with TypeScript
A CLI to bootstrap React Applications ranging in complexity from the very simple to more complex setups with CI.
To install run
npm i -g @webnsurf/bootstrap
This will install the package globally and make wns-new
command available anywhere on your machine. You can also install it locally and then use it with NPX
To create a new project run
wns-new <project_name> [arguments]
If no project_name
is provided the current working directory is used. Each project can be configured with:
- Frontend setup
- Backend setup (optional)
- Docker setup (optional)
- Development & production setup with Docker Compose
- With Træfik proxy labels for routing to appropriate containers (front-end / back-end)
- For best implementation experience we suggest checking out Web'n'surF proxy based on Træfik
- Deployment setup (optional)
The CLI is interactive so specifying the below arguments when running the command is not required.
Arguments:
| Name | Alias | Action | Default value | Info |
| ---- | :---: | ------ | :-----------: | ---- |
| --yes
| -y
| Skip the propmpt and use default options | false
| Preferred default options to use here can be set and saved using the --set-defaults
flag (see below)
| --docker
| -d
| Create a Docker setup within the project | false
| This will create the following structure: Docker image build script /docker/build.sh
Docker container start script /docker/start.sh
front-end and back-end Dockerfile.prod
& Dockerfile.dev
in their corresponding foldersdocker-compose.prod.yml
& docker-compose.yml
files to easily spin up production and development containersThe default Docker setup uses Web'n'surF Docker network. It allows you to access the development server on https://dev.webnsurf.com and the local "staging" server on https://local.webnsurf.com (both resolve to 127.0.0.1
and are then proxied to the right containers using Web'n'surF proxy). Get the Web'n'surF proxy based on Træfik
| --pipeline
| -p
| Create a Jenkins pipeline | false
| This will create the following structure: Jenkinsfile
in the root directoryDeployment script /docker/deploy.sh
Remote start script /docker/start-remote.sh
This option automatically sets --docker
to true
.Specify --server-user
& --server-ip
options to replace variables in the files listed above.Get the Web'n'surF CI server based on Jenkins
| --install
| -i
| Install node modules | false
| Install node modules once the project is initialised
| --set-defaults
| -s
| Set default options | false
| Set default options to use next time --yes(-y)
is used
| --no-backend
| N/A
| Create a project without a back-end server | false
| By default the project is created with an Express JS backend server. This option disables that.
| --no-git
| N/A
| Create a project without Git | false
| By default a new Git project is initiated. This option disables that.
| --no-router
| N/A
| Create a project without React router | false
| By default React router is included and a few front-end routes are set up. This option disables that.This option can not be disabled if the project is created with Login functionality.
| --no-login
| N/A
| Create a project without login fuctionality | false
| By default the project is setup with a redux store and a user login functionality (both back-end and front-end logic). This option disables that
| --design
| N/A
| Specify a design library | null
| Sets up, istalls and uses a React design library in the project.Available options:antd
(Documentation)Material UI
(Documentation) - this option is currently disabled (WIP)
| --domain
| N/A
| Domain name for proxy | webnsurf.com
| Specify a domain name to use in the Web'n'surF proxy router setup.This option is only needed if --docker
is set to true
| --server-user
| N/A
| Remote server username | <SERVER_USERNAME>
| Specify a username on the remote server for the deployment (/docker/deploy.sh
) and start-remote (/docker/start-remote.sh
) scripts to use.This option is only needed if --pipeline
is set to true
| --server-ip
| N/A
| Remote server IP address | <SERVER_IP>
| Specify the remote server IP address for the deployment (/docker/deploy.sh
) and start-remote (/docker/start-remote.sh
) scripts to use.This option is only needed if --pipeline
is set to true