Skip to content

Commit

Permalink
refactor: remove server side rendering and prerendering
Browse files Browse the repository at this point in the history
  • Loading branch information
pascaliske committed Nov 27, 2024
1 parent 8a3a9cc commit 1ad3a1b
Show file tree
Hide file tree
Showing 12 changed files with 30 additions and 1,281 deletions.
9 changes: 1 addition & 8 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,7 @@
"tsConfig": "tsconfig.app.json",
"assets": ["src/favicon.ico", "src/assets"],
"styles": ["src/styles/common.css"],
"scripts": [],
"server": "src/main.server.ts",
"prerender": {
"routesFile": "routes.txt"
},
"ssr": {
"entry": "server.ts"
}
"scripts": []
},
"defaultConfiguration": "production",
"configurations": {
Expand Down
9 changes: 0 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@
},
"prettier": "@pascaliske/prettier-config",
"packageManager": "[email protected]",
"resolutions": {
"ts-node": "^10.9.1"
},
"dependencies": {
"@angular/animations": "^19.0.1",
"@angular/common": "^19.0.1",
Expand All @@ -38,10 +35,7 @@
"@angular/forms": "^19.0.1",
"@angular/platform-browser": "^19.0.1",
"@angular/platform-browser-dynamic": "^19.0.1",
"@angular/platform-server": "^19.0.1",
"@angular/router": "^19.0.1",
"@angular/ssr": "^19.0.2",
"express": "^4.21.1",
"http-status-codes": "^2.3.0",
"ngx-progressbar": "^13.0.0",
"rxjs": "~7.8.0",
Expand All @@ -61,16 +55,13 @@
"@pascaliske/eslint-config": "^3.0.1",
"@pascaliske/prettier-config": "^1.3.0",
"@rstacruz/bump-cli": "^2.0.1",
"@types/express": "^5.0.0",
"@types/node": "^22.10.0",
"@typescript-eslint/eslint-plugin": "^8.2.0",
"@typescript-eslint/parser": "^8.2.0",
"browser-sync": "^3.0.0",
"eslint": "^9.9.1",
"husky": "^9.1.5",
"prettier": "^3.3.3",
"standard-changelog": "^6.0.0",
"ts-node": "^10.9.2",
"typescript": "~5.5.4"
}
}
1 change: 0 additions & 1 deletion routes.txt

This file was deleted.

39 changes: 0 additions & 39 deletions server.ts

This file was deleted.

13 changes: 3 additions & 10 deletions src/app/app.component.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Component, OnInit } from '@angular/core'
import { Router, RouterOutlet } from '@angular/router'
import { Component } from '@angular/core'
import { RouterOutlet } from '@angular/router'
import { NgProgressbar } from 'ngx-progressbar'
import { NgProgressRouter } from 'ngx-progressbar/router'

Expand All @@ -8,11 +8,4 @@ import { NgProgressRouter } from 'ngx-progressbar/router'
templateUrl: './app.component.html',
imports: [RouterOutlet, NgProgressbar, NgProgressRouter],
})
export class AppComponent implements OnInit {
public constructor(private readonly router: Router) {}

public ngOnInit(): void {
// delayed initial navigation
setTimeout(() => this.router.initialNavigation())
}
}
export class AppComponent {}
7 changes: 0 additions & 7 deletions src/app/app.config.server.ts

This file was deleted.

2 changes: 0 additions & 2 deletions src/app/app.config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import type { ApplicationConfig, ValueProvider } from '@angular/core'
import { provideExperimentalZonelessChangeDetection, APP_ID } from '@angular/core'
import { provideClientHydration } from '@angular/platform-browser'
import { provideAnimationsAsync } from '@angular/platform-browser/animations/async'
import { provideRouter } from '@angular/router'
import { provideNgProgressOptions } from 'ngx-progressbar'
Expand All @@ -15,7 +14,6 @@ export const provideAppId: () => ValueProvider = (): ValueProvider => ({
export const appConfig: ApplicationConfig = {
providers: [
provideExperimentalZonelessChangeDetection(),
provideClientHydration(),
provideAnimationsAsync(),
provideRouter(routes, ...features),
provideNgProgressOptions({ spinner: true }),
Expand Down
3 changes: 1 addition & 2 deletions src/app/app.routing.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import type { RouterFeatures, Routes } from '@angular/router'
import { withDisabledInitialNavigation, withInMemoryScrolling } from '@angular/router'
import { withInMemoryScrolling } from '@angular/router'
import { ValidCodeGuard } from 'pages/error/valid-code.guard'

export const features: RouterFeatures[] = [
withDisabledInitialNavigation(),
withInMemoryScrolling({
anchorScrolling: 'enabled',
scrollPositionRestoration: 'enabled',
Expand Down
10 changes: 0 additions & 10 deletions src/main.server.ts

This file was deleted.

6 changes: 2 additions & 4 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ import { bootstrapApplication } from '@angular/platform-browser'
import { AppComponent } from './app/app.component'
import { appConfig } from './app/app.config'

setTimeout(() => {
bootstrapApplication(AppComponent, appConfig).catch(err => {
console.error(err)
})
bootstrapApplication(AppComponent, appConfig).catch(err => {
console.error(err)
})
2 changes: 1 addition & 1 deletion tsconfig.app.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
"outDir": "./out-tsc/app",
"types": ["node"]
},
"files": ["src/main.ts", "src/main.server.ts", "server.ts"],
"files": ["src/main.ts"],
"include": ["src/**/*.d.ts"]
}
Loading

0 comments on commit 1ad3a1b

Please sign in to comment.