Startup from Bitf boilerplate
Last updated
Was this helpful?
Last updated
Was this helpful?
To create a boilerplate clone, connect to devOps at the link: and copy the SSH link.
When you start with a new project, you have to follow some steps to keep both the code for the app you are developing clean, removing the packages that you will not use, and to keep the git history clean.
Clone bitf-angular-boilerplate
Remove .git folder (rm -rf .git)
Remove the bitforce folder from src/common/libs
in the package.json in the serve:base command change the default port to a random number
git init
git add .
git commit -m 'Init'
git remote add origin ‘the repo of the new project’
Run bitf-core:init command to install the bitforce lib.
you've to add your certificates in the /ssl folder to run https in the tom folder there are tom's certificates you can use those
Now you have cleaned the part about git. Now we have to remove the parts related to the packages that we will not use for the project.
Remove all ion and capacitor references.
package.json (scripts and dependencies)
app property from angular.json
ion-tsconfig.json file
ion folder into src/apps
android, ios folder from root
cap-environments folder
Install Prettier
Update configuration in .prettierrc.json
3. Add your custom prefix for components and directives in .eslintrc.json "prefix": ["mpa", "app", "bitf"])
Create your env
Add ssl keys. You can copy the files inside the ssl/tom folder inside ssl and install the certificate on your pc. Or you can create new certificates by following the readme.
angular.json: update schematics (bottom file) "prefix" with project prefix ex: prada
package.json
Update project name
Reset project semver
remove not used dependencies
ngsw-config.json (PWA)
update it based on project requirements
ionic.config.json
update the project name (if we have ion app)
config.xml
Check ion app cordova libs dependencies
Clean changelog
update readme with project details
Update manifest.js
clean (or delete) resources folder if is not ion app
Import "app-parser" in common/core/parsers and configure it into common-bitf.config.ts
Set the DefaultApiCallStateMapper
Set material-theme-settings, with colors
Set the correct font into index.html and delete favicon or manifest if not used
CSS / Styles
Check css folder structure
Material
If material is used check to import all needed components in material module
Set up the correct theme
Bootstap
Import what is needed (probably only grid utils functions variables ..)
set 24 columns
If used with material be sure to override breakpoints
Project setup
Be sure that all components are using the proper name space prefix ex prada-header
Common folder
We are using src/common folder to store all common const / enums / configs / services / models / components etc... that are reused between multiple apps both web or ion
common.constants.ts
This file will be extended by apps (web / ion etc...) add / remove what is needed
core
components/
If we have ion app this we can add only abstract super component classes
if we don't have ion we can add here common components like loaders, not found page etc... this make sense only if we have multiple apps like (web / admin) otherwise we can add core component inside the web/ folder
models/
Add all project models
Add them to the index.ts,
Add them in the model src/common/services/api/model-mappers/model-mappers.strategy.ts
services/
Create all project services
Export them in the barrel
Configure AuthService to extend the correct bitf-core service
api/
Create all project services extending superApiService
Export them in the barrel
parsers/
Import "app-parser" in common/core/parsers and configure it into common-bitf.config.ts
Create all project parsers (extending what is needed from bitf-core) the default one will be called app-parser
AuthService: create the proper auth services based on project requirements
enums/
Add common enums
interfaces/
Add common interfaces
Customize ITokenMetaData based on project Auth
shared/
components/
Add here common shared components (valid id we don't have ion app) this make sense only if we have multiple apps like (web / admin) otherwise we can add core component inside the web/ folder
if we have ion app we can add here only super abstract components which will be imported by the web app and not by ion app, this files will not be added in the bundle if not imported.
translations/
common.translations.ts: this file contains bitfToTranslate('COMMON.STATUSES.IN_BUS'); that are dynamically computed in the markup ex:
Responsive setup
For config the boilerplate has 1 app mobile 1 app desktop and the app adds add a /m as mobile prefix. If the double management is not needed we can remove the /m path from the app routing and In the In the AppSession service we have to comment the observer initDynamicLayoutUrl - initBreakpointObserver
If double UI responsive support is not needed in the AppSession we can avoid to Import the ResponsiveService if we have to do some ui / services operations when switching from mobile to desktop (ex close the dialogs)