Skip to content

Commit

Permalink
Wired admin and user libraries to main library in usersrole-nx-app an…
Browse files Browse the repository at this point in the history
…d setup hosting for usersrole-nx app
  • Loading branch information
jdwillmsen committed Nov 8, 2023
1 parent 25bf552 commit 23071e9
Show file tree
Hide file tree
Showing 10 changed files with 1,148 additions and 54 deletions.
15 changes: 14 additions & 1 deletion .firebaserc
Original file line number Diff line number Diff line change
@@ -1 +1,14 @@
{}
{
"targets": {
"users-role-nx": {
"hosting": {
"usersrole-nx": [
"users-role-nx"
]
}
}
},
"projects": {
"default": "users-role-nx"
}
}
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,8 @@ Thumbs.db

.angular

.nx/cache
.nx/cache
# Firebase
.firebase
*-debug.log
.runtimeconfig.json
25 changes: 20 additions & 5 deletions apps/usersrole-nx/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,16 @@
"targets": {
"build": {
"executor": "@angular-devkit/build-angular:browser",
"outputs": ["{options.outputPath}"],
"outputs": [
"{options.outputPath}"
],
"options": {
"outputPath": "dist/apps/usersrole-nx",
"index": "apps/usersrole-nx/src/index.html",
"main": "apps/usersrole-nx/src/main.ts",
"polyfills": ["zone.js"],
"polyfills": [
"zone.js"
],
"tsConfig": "apps/usersrole-nx/tsconfig.app.json",
"assets": [
"apps/usersrole-nx/src/favicon.ico",
Expand Down Expand Up @@ -111,7 +115,9 @@
},
"lint": {
"executor": "@nx/eslint:lint",
"outputs": ["{options.outputFile}"],
"outputs": [
"{options.outputFile}"
],
"options": {
"lintFilePatterns": [
"apps/usersrole-nx/**/*.ts",
Expand All @@ -121,7 +127,9 @@
},
"test": {
"executor": "@nx/jest:jest",
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
"outputs": [
"{workspaceRoot}/coverage/{projectRoot}"
],
"options": {
"jestConfig": "apps/usersrole-nx/jest.config.ts",
"passWithNoTests": true
Expand All @@ -147,6 +155,13 @@
"skipServe": true,
"devServerTarget": "usersrole-nx:build"
}
},
"deploy": {
"executor": "@angular/fire:deploy",
"options": {
"version": 2,
"browserTarget": "usersrole-nx:build:production"
}
}
}
}
}
22 changes: 21 additions & 1 deletion apps/usersrole-nx/src/app/app.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,32 @@ import { appRoutes } from './app.routes';
import { provideAnimations } from '@angular/platform-browser/animations';
import { MatSnackBarModule } from '@angular/material/snack-bar';
import { provideHttpClient } from '@angular/common/http';
import { initializeApp, provideFirebaseApp } from '@angular/fire/app';
import { getAuth, provideAuth } from '@angular/fire/auth';
import { getFunctions, provideFunctions } from '@angular/fire/functions';
import { getFirestore, provideFirestore } from '@angular/fire/firestore';

export const appConfig: ApplicationConfig = {
providers: [
provideRouter(appRoutes, withEnabledBlockingInitialNavigation()),
provideHttpClient(),
importProvidersFrom(MatSnackBarModule),
provideAnimations(),
importProvidersFrom(
MatSnackBarModule,
provideFirebaseApp(() =>
initializeApp({
projectId: 'users-role-nx',
appId: '1:267012633634:web:b1a938b1ab87883bd4c67b',
storageBucket: 'users-role-nx.appspot.com',
apiKey: 'AIzaSyBEaRY-pKlhpky-y20bKWsbuhFbjTv6WiE',
authDomain: 'users-role-nx.firebaseapp.com',
messagingSenderId: '267012633634',
measurementId: 'G-33YM05QL2M',
})
),
provideAuth(() => getAuth()),
provideFunctions(() => getFunctions()),
provideFirestore(() => getFirestore())
),
],
};
35 changes: 34 additions & 1 deletion firebase.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,38 @@
"npm --prefix \"$RESOURCE_DIR\" run build"
]
}
],
"hosting": [
{
"target": "usersrole-nx",
"public": "dist/apps/usersrole-nx",
"ignore": ["**/.*"],
"headers": [
{
"source": "*.[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f].+(css|js)",
"headers": [
{
"key": "Cache-Control",
"value": "public,max-age=31536000,immutable"
}
]
},
{
"source": "/@(ngsw-worker.js|ngsw.json)",
"headers": [
{
"key": "Cache-Control",
"value": "no-cache"
}
]
}
],
"rewrites": [
{
"source": "**",
"destination": "/index.html"
}
]
}
]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export class MainComponent {
title: 'Home',
},
{
path: '/profile',
path: '/user/profile',
icon: 'person',
title: 'Profile',
},
Expand Down
8 changes: 4 additions & 4 deletions libs/usersrole-nx-app/main/src/lib/lib.routes.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Route } from '@angular/router';
import { NavigationItemComponent } from '@usersrole-nx/shared-ui';
import { HomeComponent } from './components/home/home.component';

export const mainRoutes: Route[] = [
Expand All @@ -13,8 +12,8 @@ export const mainRoutes: Route[] = [
component: HomeComponent,
},
{
path: 'profile',
component: NavigationItemComponent,
path: 'user',
loadChildren: () => import('@usersrole-nx/user').then((m) => m.userRoutes),
},
{
path: '',
Expand All @@ -25,7 +24,8 @@ export const mainRoutes: Route[] = [
},
{
path: 'admin',
component: NavigationItemComponent,
loadChildren: () =>
import('@usersrole-nx/admin').then((m) => m.adminRoutes),
},
{
path: 'preview',
Expand Down
5 changes: 4 additions & 1 deletion libs/usersrole-nx-app/user/src/lib/lib.routes.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import { Route } from '@angular/router';
import { UserComponent } from './user/user.component';

export const userRoutes: Route[] = [{ path: '', component: UserComponent }];
export const userRoutes: Route[] = [
{ path: '', component: UserComponent },
{ path: '/profile', component: UserComponent },
];
Loading

0 comments on commit 23071e9

Please sign in to comment.