Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(lint): fix lint process #35

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 34 additions & 26 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,34 +1,42 @@
name: Deploy to GitHub Pages

on:
push:
branches:
- master
on: [push, pull_request]

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2 # If you're using actions/checkout@v2 you must set persist-credentials to false in most cases for the deployment to work correctly.
with:
persist-credentials: false
- name: Use Node.js 10.x
uses: actions/setup-node@v1
with:
node-version: '10.x'
- name: Build
run: |
npm install -g @angular/cli
npm install
node ./.github/workflows/ng-env-replace.js
ng build --prod --base-href="/redis-patterns-console/"
env:
- name: Checkout
uses: actions/checkout@v2 # If you're using actions/checkout@v2 you must set persist-credentials to false in most cases for the deployment to work correctly.
with:
persist-credentials: false
- name: Use Node.js 10.x
uses: actions/setup-node@v1
with:
node-version: "10.x"

- name: Install Deps
run: |
npm install -g @angular/cli
npm install

- name: Lint
run: npm run lint

- name: Build
run: |
npm install -g @angular/cli
npm install
node ./.github/workflows/ng-env-replace.js
ng build --prod --base-href="/redis-patterns-console/"
env:
REDIS_SERVER_API_WS: ${{ secrets.REDIS_SERVER_API_WS }}
- name: Deploy
uses: JamesIves/github-pages-deploy-action@releases/v2
env:
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
BASE_BRANCH: master
BRANCH: gh-pages
FOLDER: dist

- name: Deploy
if: github.ref == 'refs/heads/master'
uses: JamesIves/github-pages-deploy-action@releases/v2
env:
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
BASE_BRANCH: master
BRANCH: gh-pages
FOLDER: dist
18 changes: 9 additions & 9 deletions src/app/core/interceptors/cache-interceptor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,32 +8,32 @@ import {
} from '@angular/common/http';
import { Observable, of } from 'rxjs';
import { tap } from 'rxjs/operators';

import { environment } from '@app/../environments/environment';
import { CachingService } from '@app/core/services/caching.service';
import { GithubDataService } from '@app/core/services/github-data.service';

@Injectable({
providedIn: 'root'
})
export class CacheInterceptor implements HttpInterceptor {

constructor(private cachingService: CachingService, private githubDataService: GithubDataService) { }
intercept(request: HttpRequest<any>, next: HttpHandler ): Observable<HttpEvent<any>> {

intercept(request: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
if (this.githubDataService.accessToken && this.githubDataService.accessToken.length) {
request = request.clone({ setHeaders: { Authorization: `token ${this.githubDataService.accessToken}` } });
}
if (!request.headers.has(environment.cacheableHeaderKey)) {

if (!request.headers.has(environment.cacheableHeaderKey)) {
return next.handle(request);
}
/** remove cacheable headers form original request */
request = request.clone({ headers: request.headers.delete(environment.cacheableHeaderKey) });
const cachedResponse = this.cachingService.get(request.url);
return cachedResponse ? of(cachedResponse) : this.sendRequest(request, next);
}

sendRequest(req: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
return next.handle(req).pipe(
tap((event) => {
Expand All @@ -43,4 +43,4 @@ export class CacheInterceptor implements HttpInterceptor {
})
);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { Component, Input, ChangeDetectionStrategy, ViewChild, ElementRef } from

export class CommandDocumentationComponent {
public documentation = '';
@ViewChild('scrollBox', {static: true}) scrollBox: ElementRef;
@ViewChild('scrollBox', { static: true }) scrollBox: ElementRef;
@Input('documentation') set resetScroll(document: string) {
this.documentation = document;
this.scrollBox.nativeElement.scrollTop = 0;
Expand Down
2 changes: 1 addition & 1 deletion src/app/shared/models/github-content.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ export interface ITokenResponse {
token_type?: string;
scope?: string;
};
}
}
10 changes: 5 additions & 5 deletions src/app/shared/pipes/search-filter.pipe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ import { Pipe, PipeTransform } from '@angular/core';
})
export class SearchFilterPipe implements PipeTransform {
transform(items: any[], field: string, value: string): any[] {
if(!value) { return items; }
if(!items) { return []; }
if (!value) { return items; }
if (!items) { return []; }

return items.filter(it => {
if (typeof(it[field]) !== 'boolean') {
return it[field].toLowerCase().includes((<string>value).toLowerCase());
if (typeof (it[field]) !== 'boolean') {
return it[field].toLowerCase().includes((value as string).toLowerCase());
} else {
return (it[field]) === (value === 'true');
}
});
}
}
}
7 changes: 4 additions & 3 deletions src/environments/environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// The list of file replacements can be found in `angular.json`.

import { version } from 'package.json';

export const environment = {
production: false,
redisServer: 'ws://127.0.0.1:8080',
Expand All @@ -23,12 +23,13 @@ export const environment = {
cacheableHeaderKey: 'cacheable-request',
version
};

/*
* For easier debugging in development mode, you can import the following file
* to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`.
*
* This import should be commented out in production mode because it will have a negative impact
* on performance if an error is thrown.
*/
// import 'zone.js/dist/zone-error'; // Included with Angular CLI.
// import 'zone.js/dist/zone-error'; // Included with Angular CLI.