Skip to content

Commit

Permalink
Updated handling of readme & version data
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelbromley committed May 25, 2022
1 parent 57459e0 commit e8c28ce
Show file tree
Hide file tree
Showing 11 changed files with 52 additions and 22 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 6.0.0

* Update to new Ivy package format for Angular v13+.

## 5.1.1 (2020-06-07)

#### Fixes
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -337,8 +337,9 @@ npm run test
npm run build
```

After running `npm run build`, the final output of the lib (which gets published to npm) is in the `/distngx-pagination` folder.
After running `npm run build`, the final output of the lib (which gets published to npm) is in the `/dist/ngx-pagination` folder.

To build the docs, run `npm run build:docs`, or serve them in dev mode with `npm run start`.

## License

Expand Down
1 change: 1 addition & 0 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
"inlineStyleLanguage": "scss",
"assets": [
"projects/docs/src/favicon.ico",
"projects/docs/src/assets",
"projects/docs/src/assets"
],
"styles": [
Expand Down
18 changes: 9 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
{
"name": "ngx-pagination",
"version": "5.1.1",
"version": "0.0.0",
"description": "Pagination for Angular",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"build:docs": "ng build docs",
"watch": "ng build --watch --configuration development",
"test": "ng test"
},
Expand Down Expand Up @@ -34,7 +35,7 @@
"@angular/platform-browser-dynamic": "~13.3.0",
"@angular/router": "~13.3.0",
"bulma": "0.2.3",
"marked": "^0.3.6",
"marked": "^4.0.16",
"ngx-highlightjs": "^6.1.2",
"rxjs": "~7.5.0",
"tslib": "^2.3.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<div [innerHTML]="readmeContent" class="readme"></div>
<div [innerHTML]="readmeContent$ | async" class="readme"></div>
Original file line number Diff line number Diff line change
@@ -1,15 +1,26 @@
import { Component } from '@angular/core';
import { Component, OnInit } from '@angular/core';
import { DomSanitizer, SafeHtml } from '@angular/platform-browser';
import { HttpClient } from '@angular/common/http';
import { Observable } from 'rxjs';
import { map } from 'rxjs/operators';
import { marked } from 'marked';

@Component({
selector: 'documentation-page',
templateUrl: './documentation-page.component.html'
})
export class DocumentationPageComponent {
export class DocumentationPageComponent implements OnInit {

readmeContent: SafeHtml;
readmeContent$: Observable<SafeHtml>;

constructor(private sanitizer: DomSanitizer) {
this.readmeContent = sanitizer.bypassSecurityTrustHtml('parsedReadme');
constructor(private sanitizer: DomSanitizer, private httpClient: HttpClient) {
}

ngOnInit() {

this.readmeContent$ = this.httpClient.get(`https://raw.githubusercontent.com/michaelbromley/ngx-pagination/master/README.md`, { responseType: 'text' }).pipe(
map(text => marked.parse(text)),
map(res => this.sanitizer.bypassSecurityTrustHtml(res)),
)
}
}
5 changes: 3 additions & 2 deletions projects/docs/src/app/demo-app.component.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import {Component} from "@angular/core";
//const version = require('../../package.json').version;
import versionInfo from "./version.json";

@Component({
selector: 'demo-app',
templateUrl: './demo-app.component.html'
})
export class DemoAppComponent {
version: string = '???';
version = versionInfo.version;
}

8 changes: 7 additions & 1 deletion projects/docs/src/app/demo.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { ServerPageComponent } from './components/server-example/server-page.com
import { MealsService } from './providers/meals.service';
import { DocumentationPageComponent } from './components/documentation/documentation-page.component';
import { HighlightModule, HIGHLIGHT_OPTIONS } from 'ngx-highlightjs';
import { HttpClientModule } from '@angular/common/http';

const ConfiguredRouterModule = RouterModule.forRoot([
{path: '', pathMatch: 'full', component: DocumentationPageComponent},
Expand All @@ -32,6 +33,7 @@ const ConfiguredRouterModule = RouterModule.forRoot([
ConfiguredRouterModule,
NgxPaginationModule,
HighlightModule,
HttpClientModule,
],
declarations: [
DocumentationPageComponent,
Expand All @@ -51,7 +53,11 @@ const ConfiguredRouterModule = RouterModule.forRoot([
{
provide: HIGHLIGHT_OPTIONS,
useValue: {
fullLibraryLoader: () => import('highlight.js'),
coreLibraryLoader: () => import('highlight.js/lib/core'),
languages: {
typescript: () => import('highlight.js/lib/languages/typescript'),
xml: () => import('highlight.js/lib/languages/xml')
},
}
}
],
Expand Down
3 changes: 3 additions & 0 deletions projects/docs/src/app/version.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"version": "6.0.0"
}
4 changes: 3 additions & 1 deletion projects/docs/tsconfig.app.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "../../out-tsc/app",
"types": []
"types": [],
"resolveJsonModule": true,
"allowSyntheticDefaultImports": true
},
"files": [
"src/main.ts",
Expand Down

0 comments on commit e8c28ce

Please sign in to comment.