Wrappid
App Boilerplate _ _
__ ___ __ __ _ _ __ _ __ (_) __| |
\ \ /\ / / '__/ _` | '_ \| '_ \| |/ _` |
\ V V /| | | (_| | |_) | |_) | | (_| |
\_/\_/ |_| \__,_| .__/| .__/|_|\__,_|
|_| |_|
This is a template documentation, @wrappid/toolkit uses this template to create frontend boilerplate.
Table of Contents
Wrappid
App Boilerplate
This is a frontend boilerplate template application built using the Wrappid
framework, which enables simultaneous development of web and mobile application.
This guide will help us setup and run application using Wrappid
framework.
This getting started section will help you setup a basic application built using the Wrappid
framework. Follow the below steps to get going.
2.1. What are my Pre-requisites? 2.2. How to Create? 2.3. How to Setup? 2.4. How to Start?
It is expected that you have successfully installed @wrappid/toolkit(wrappid framework's CLI tool) and initialised it. Run the below command to create Frontend Wrappid Project
wrappid init app <wrappid>
Output:
Frontend Wrappid-App
has two runtime-environments:
We will talk about these environments in upcomming sections.
Note: If you want to setup a wrappid-app project that is already in your github, you need to clone it. After clonning, run
npm i
at the root of the project
Run the below command to setup a Frontend Wrappid Project in web and mobile runtime-environments.
cd <wrappid>-<app>
wrappid setup
Run the below command to setup a wrappid-app
in web runtime-environment.
cd <wrappid>-<app>
wrappid setup web
Run the below command to setup a wrappid-app
in mobile runtime-environment.
cd <wrappid>-<app>
wrappid setup mobile
You can start a frontend app in two modes:
[Static (Without Backend Service)]()
[Dynamic (With Backend Service)]()
Static (Without Backend Service) Run the below command to start the development frontend server for web:
cd wrappid-app
wrappid start web
This should launch your default browser with a URL http://localhost:3000
Run the below command to start the development server for mobile:
cd wrappid-app
wrappid start mobile
This should launch your emulated device (provided a proper setup is done on the Android Device Manager)
To start Dynamic Fontend Wrappid project, you'll first need your Wrappid Backend up and running. [steps for backend]().
wrappid.conf.json
file located at the root of wrappid-app
project. Wrappid App can be runned in 3 environments:
By default, Wrappid App project setups and starts in dev
environment.
These environments are to be configured in wrappid.conf.json located at the root of wrappid-app
project
To run a Wrappid App project in a different environment, run the below command:
cd wrappid-app
wrappid start [web|mobile] --env=[dev|stage|prod]
Frontend Wrappid-App
has two runtime-environments:
./src/components
You'll write your code in components.
Write your code in a function, then export default your function
For example, if name of your file is helloWrappider.js It should have a function that is exported,
export default function helloWrappider(){
}
Then put an import of your code's function in ComponentRegistry.js
import helloWrappider from "./components/helloWrappider"
export default function ComponentRegistry
{
HelloWrappiders: {comp: helloWrappider}
}
Now we need to see what we wrote in the browser.
Go to the RoutesRegistry,
create an route object in RoutesRegistrys
{
defaultAppRoute : {
Page : {AppComponent: "HelloWrappiders" },
entityRef : 'defaultAppRoute',
URL : 'defaultAppRoute'
}
}
Now run the below commad
wrappid copy --src
Then run
wrappid start [web|mobile] --env=[dev|stage|prod]
Voila! Now after sometime(depending system specs) your browser will open and you'll be able to see your page rendered at localhost:3000
Now let's make another page,
Write your code in src/components directory
For example: secondPage.js
Then put an import of your code's function in ComponentRegistry.js
import secondPage from "./components/secondPage"
Add another object for your new page,
export default function ComponentRegistry
{
HelloWrappiders: {comp: helloWrappider},
SecondPage: {comp: secondPage}
}
And again to see what we wrote in the browser, we will put another entry for our new component
Go to the RoutesRegistry,
{
defaultAppRoute:{
Page: {AppComponent: "HelloWrappiders" },
entityRef: 'defaultAppRoute',
URL:'defaultAppRoute'
},
secondPageRoute:{
Page: {AppComponent: "SecondPage" },
entityRef: 'uniqueSecondPage',
URL:'secondPage'
}
}
Run below command in terminal
wrappid copy [web|mobile] --src
You need to start again if you stopped your web sever.
You should be able to see your page at localhost:3000/secondPage
Before building it is recommended to do a fresh setup of your project
```bash
wrappid setup [web|mobile] --env=[dev|stage|prod]
Run the below commands to build your wrappid app for web or mobile
wrappid build [web|android|ios]
Note: For android builds, you need to create build.gradle file with a keystore file in res/android/app IOS builds are not supported yet.
Used for appilcations
Used to link components
Used for functions
Used for generation of menu
Used for Reducers
Used for Resources
Used to route components
Used for validation
There are 4 wrappid packages that are used by wrappid-app
.
3.1. @wrappid/core
3.2. @wrappid/styles
3.3. @wrappid/native-web
3.4. @wrappid/native-mobile