blox-factory
v1.3.14
Published
A full-feature app development toolkit we use to churn out projects
Downloads
17
Readme
Blox Factory
Starting a new project
- Make sure you have the firebase CLI installed
npm install -g firebase-tools
- Create your project in Firebase (or CLI)
- Copy the firebase config and save it for later
npx create-react-app project-name
cd project-name
- Add
.firebase
to.gitignore
# firebase
.firebase
- Run the Firebase init process
firebase init
? What file should be used for Realtime Database Security Rules? database.rules.json
? What do you want to use as your public directory? build
? Configure as a single-page app (rewrite all urls to /index.html)? Yes
? Set up automatic builds and deploys with GitHub? (y/N) n
? File public/index.html already exists. Overwrite (y/N) n
npm install -S blox-factory
- Create database file to initialize your Blox Factory app
// @reference src/database/database.ts
import { setupApp, Database } from 'blox-factory'
const firebaseConfig = {
// download your firebase config and copy it here
}
const bloxFactoryApp = setupApp(firebaseConfig)
export const analytics = bloxFactoryApp.analytics
export const database = new Database(bloxFactoryApp.app, {
sources: [
// add datasources here later...
]
})
export const dataSources = database.sources
- Add deploy scripts
"scripts": {
// ...
"predeploy": "npm run build",
"deploy": "firebase deploy"
},
- Configure firebase hosting deploys
// firebase.json
{
"hosting": {
"public": "build"
// ...
}
}
Development
npm start
Deployment
npm run deploy
➜ blox-factory-dev git:(master) ✗ npm run deploy
> [email protected] deploy
> firebase deploy
=== Deploying to 'blox-factory-dev'...
i deploying database, hosting
i database: checking rules syntax...
✔ database: rules syntax for database blox-factory-dev-default-rtdb is valid
i hosting[blox-factory-dev]: beginning deploy...
i hosting[blox-factory-dev]: found 6 files in public
✔ hosting[blox-factory-dev]: file upload complete
i database: releasing rules...
✔ database: rules for database blox-factory-dev-default-rtdb released successfully
i hosting[blox-factory-dev]: finalizing version...
✔ hosting[blox-factory-dev]: version finalized
i hosting[blox-factory-dev]: releasing new version...
✔ hosting[blox-factory-dev]: release complete
✔ Deploy complete!
Project Console: https://console.firebase.google.com/project/blox-factory-dev/overview
Hosting URL: https://blox-factory-dev.web.app