Hi
It would be really nice to add some docs about how to deploy each app from the single repo.
I've tried to deploy on heroku but it looks like you have to push the whole repo and I didn't figure out how to setup the npm scripts to deploy only one app specifically with its own nodejs server.
Also tried with firebase hosting but it's also complicated since the dist folder is generated outside each app's folder, you cannot use firebase deploy
on each app.
Some insights would be much appreciated.
Thanks !
I think you can do ng build --app=[NAME APP] name of the app should be the same configured in the angular-cli.json. And then upload your dist folder per app to Heroku? For Firebase deploy I am also strruggling how that would be possible would be really nice if that could be possible.
Firebase deployment comes with a configuration file (firebase.json). In it, you can specify the public directory to publish your code from, to Firebase.
For example:
{
"database": {
"rules": "database.rules.json"
},
"hosting": {
"public": "dist/apps/academy",
"rewrites": [
{
"source": "**",
"destination": "/index.html"
}
]
}
}
Building from root will generate your apps distribution code inside dist/apps/{appName}
. This is the same as you would have done in any AngularCLI project.
When it comes to managing multiple apps inside this set-up, I would speculate that you can have the public
block, traverse up the file tree to root and create either helper scripts to navigate into an app directory and run firebase deploy
OR run the script directly from your directory yourself.
Yeah the config file that Firebase's CLI looks for only supports one app (not to be confused with a Firebase "project"), so you'd need to implement your own solution to have multiple apps that could be deployed to Firebase. You could include a firebase.json in each app directory, and include it in the app's static asset list in .angular-cli.json, and cd
into dist/app1/
and run firebase deploy
.
But to the original point, I agree it could be useful to have docs on deploying to different environments.