Skip to content

Commit 8a5d741

Browse files
SanderEliasVillanuevand
authored andcommitted
fix(staticserve): make sure 404 is handled correctly at staticserve
* chore(update to latest cli and core): angular update t o latest * fix(staticserver): make sure 404 works as expected * fix(staticserve): make sure 404 is handled correctly at staticserve in some circumstances our server would serve the wrong files, this PR will fix that.
1 parent 67132de commit 8a5d741

15 files changed

Lines changed: 343 additions & 185 deletions

package-lock.json

Lines changed: 215 additions & 138 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"version": "0.0.2",
44
"scripts": {
55
"ng": "ng",
6+
"tsc": "tsc",
67
"start": "ng serve",
78
"build": "ng build",
89
"test": "ng test",
@@ -28,27 +29,26 @@
2829
},
2930
"private": true,
3031
"dependencies": {
31-
"@angular/animations": "~9.0.0-rc.6",
32-
"@angular/common": "~9.0.0-rc.6",
33-
"@angular/compiler": "~9.0.0-rc.6",
34-
"@angular/core": "~9.0.0-rc.6",
35-
"@angular/forms": "~9.0.0-rc.6",
36-
"@angular/platform-browser": "~9.0.0-rc.6",
37-
"@angular/platform-browser-dynamic": "~9.0.0-rc.6",
38-
"@angular/platform-server": "~9.0.0-rc.6",
39-
"@angular/router": "~9.0.0-rc.6",
40-
"request": "^2.88.0",
32+
"@angular/animations": "~9.0.0-rc.7",
33+
"@angular/common": "~9.0.0-rc.7",
34+
"@angular/compiler": "~9.0.0-rc.7",
35+
"@angular/core": "~9.0.0-rc.7",
36+
"@angular/forms": "~9.0.0-rc.7",
37+
"@angular/platform-browser": "~9.0.0-rc.7",
38+
"@angular/platform-browser-dynamic": "~9.0.0-rc.7",
39+
"@angular/platform-server": "~9.0.0-rc.7",
40+
"@angular/router": "~9.0.0-rc.7",
4141
"rxjs": "^6.5.3",
4242
"semver": "^6.3.0",
4343
"tslib": "^1.10.0",
4444
"zone.js": "~0.10.2"
4545
},
4646
"devDependencies": {
4747
"@angular-devkit/build-angular": "^0.900.0-rc.7",
48-
"@angular-devkit/build-ng-packagr": "~0.900.0-rc.5",
49-
"@angular/cli": "~9.0.0-rc.5",
50-
"@angular/compiler-cli": "~9.0.0-rc.6",
51-
"@angular/language-service": "~9.0.0-rc.6",
48+
"@angular-devkit/build-ng-packagr": "~0.900.0-rc.7",
49+
"@angular/cli": "~9.0.0-rc.7",
50+
"@angular/compiler-cli": "~9.0.0-rc.7",
51+
"@angular/language-service": "~9.0.0-rc.7",
5252
"@bazel/bazel": "^1.2.0",
5353
"@bazel/buildifier": "^0.29.0",
5454
"@bazel/ibazel": "^0.10.3",

projects/sampleBlog/src/app/app-routing.module.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,11 @@ const routes: Routes = [
2020
loadChildren: () => import('./user/user.module').then(m => m.UserModule),
2121
},
2222
{path: 'demo', loadChildren: () => import('./demo/demo.module').then(m => m.DemoModule)},
23-
// {path: '', redirectTo: '/home/', pathMatch: 'full'}
23+
{path: '', redirectTo: '/home', pathMatch: 'full'},
24+
{
25+
path: '**',
26+
loadChildren: () => import('./pagenotfound/pagenotfound.module').then(m => m.PagenotfoundModule),
27+
},
2428
];
2529

2630
@NgModule({
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { NgModule } from '@angular/core';
2+
import { Routes, RouterModule } from '@angular/router';
3+
4+
import { PagenotfoundComponent } from './pagenotfound.component';
5+
6+
const routes: Routes = [{ path: '', component: PagenotfoundComponent }];
7+
8+
@NgModule({
9+
imports: [RouterModule.forChild(routes)],
10+
exports: [RouterModule]
11+
})
12+
export class PagenotfoundRoutingModule { }

projects/sampleBlog/src/app/pagenotfound/pagenotfound.component.css

Whitespace-only changes.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<p>pagenotfound works!</p>
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
2+
3+
import { PagenotfoundComponent } from './pagenotfound.component';
4+
5+
describe('PagenotfoundComponent', () => {
6+
let component: PagenotfoundComponent;
7+
let fixture: ComponentFixture<PagenotfoundComponent>;
8+
9+
beforeEach(async(() => {
10+
TestBed.configureTestingModule({
11+
declarations: [ PagenotfoundComponent ]
12+
})
13+
.compileComponents();
14+
}));
15+
16+
beforeEach(() => {
17+
fixture = TestBed.createComponent(PagenotfoundComponent);
18+
component = fixture.componentInstance;
19+
fixture.detectChanges();
20+
});
21+
22+
it('should create', () => {
23+
expect(component).toBeTruthy();
24+
});
25+
});
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { Component, OnInit } from '@angular/core';
2+
3+
@Component({
4+
selector: 'app-pagenotfound',
5+
templateUrl: './pagenotfound.component.html',
6+
styleUrls: ['./pagenotfound.component.css']
7+
})
8+
export class PagenotfoundComponent implements OnInit {
9+
10+
constructor() { }
11+
12+
ngOnInit() {
13+
}
14+
15+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { NgModule } from '@angular/core';
2+
import { CommonModule } from '@angular/common';
3+
4+
import { PagenotfoundRoutingModule } from './pagenotfound-routing.module';
5+
import { PagenotfoundComponent } from './pagenotfound.component';
6+
7+
8+
@NgModule({
9+
declarations: [PagenotfoundComponent],
10+
imports: [
11+
CommonModule,
12+
PagenotfoundRoutingModule
13+
]
14+
})
15+
export class PagenotfoundModule { }
Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
import {parseAngularRoutes} from 'guess-parser';
22
import {scullyConfig} from '../utils/config';
33

4-
export const traverseAppRoutes = async (
5-
appRootFolder = scullyConfig.projectRoot
6-
) => {
4+
export const traverseAppRoutes = async (appRootFolder = scullyConfig.projectRoot) => {
75
try {
86
const routes = parseAngularRoutes(appRootFolder).map(r => r.path);
97

108
return routes;
119
} catch (e) {
12-
// console.log('e',e)
10+
console.log('e', e);
1311
throw new Error('Scully could not traverse routes');
1412
}
1513
};

0 commit comments

Comments
 (0)