Seek out Polymer team members and capture them as Polymon!
Polymon is a PWA, so most of the code runs in a browser. But, Polymon also uses Firebase for some business logic, persistance and web hosting.
First, ensure that you have the latest Node.js and NPM installed. Also, ensure the firebase CLI is available globally:
npm install -g firebase-tools
Next, from your project root, install Node.js dependencies:
npm install
Next, you will need at least one Firebase project to deploy to. If you don't already have one to target, go create one in the Firebase web control panel.
By default, the .firebaserc
is configured for the official Polymon
deployment environments. If you are creating a your own Firebase project to
deploy to, you will need to update the .firebaserc
file to reflect your
project's ID. For example, if your dev project's ID is polymon-foo
and your
production project's ID is polymon-prod
, your .firebaserc
should look something like:
{
"projects": {
"prod": "polymon-prod",
"dev": "polymon-foo"
}
}
Once you have access to the Firebase project(s), you will need to create two files for each project you want to work with:
These files should be named based on the alias that corresponds to each
Firebase project in .firebaserc
. So, for a project with alias dev
(as in
the example .firebaserc
above), the files should be named:
.dev.env.json
.dev.service-account.json
The .dev.env.json
file should describe a Firebase configuration, and
optionally a Google Analytics configuration; if you're copying these values from
firebase, ensure the keys match:
{
"firebase": {
"projectId": "polymon",
"apiKey": "AIzaSyDBzqU7s3b6hVu309lbYQABJr2xmioiIV0",
"authDomain": "polymon-foo.firebaseapp.com",
"databaseURL": "https://polymon-foo.firebaseio.com",
"storageBucket": "polymon-foo.appspot.com",
"messagingSenderId": "447537573236"
},
"googleAnalytics": {
"trackingId": "OPTIONAL_TRACKING_ID_HERE"
}
}
If you don't know how to generate a Service Account credential file, please consult the documentation here.
Assuming you have a .dev.env.json
and a .dev.service-account.json
from the previous step, you can quickly build, generate data, deploy, and serve using the following command:'
gulp
If you want to customize your environment, follow the next sections.
Once you have completed the above steps, and this is your first time building this project, then you must now generate seed data:
gulp gen-data:dev
# alternatively you can generate data for your prod environment with
gulp prod gen-data:prod
# you can also generate data for arbitrary .firebaserc alias (defaults to dev):
gulp generate-data --env myFirebasercAlias
Assuming you have already generated the seed data for the proper environment, you can deploy:
# deploys to dev
gulp deploy:all:dev
# deploys to prod
gulp deploy:all:prod
# deploys to arbitrary .firebaserc alias (defaults to dev):
gulp deploy:all --env myFirebasercAlias
Alternatively, you can deploy the uncompiled source:
# deploys to dev
gulp deploy:all:dev:debug
# deploys to prod
gulp deploy:all:prod:debug
# deploys to arbitrary .firebaserc alias (defaults to dev):
gulp deploy:all:debug --env myFirebasercAlias
If you want to do a rebuild without deploying you can simply just run:
# clean rebuild (env defaults to dev alias)
gulp clean build:dev
# dirty rebuild (env defaults to dev alias)
gulp build:dev
# alternatively you can build for different environments:
# prod
gulp build:prod
# arbirary (defaults to dev)
gulp build --env myFirebasercAlias
Assuming everything worked, you should be ready to hack on Polymon. Use the following command to serve:
# serves uncompiled source
gulp serve
# serves compiled source
gulp serve:compiled
And then open up a browser to http://localhost:5000 and check it out!
Note: The firebase.json
file is generated by the build tool. Edit `firebaseConfig.json instead
Finally, remember to: