fix(core): update
This commit is contained in:
@ -33,7 +33,7 @@ export class GitlabAccount {
|
||||
});
|
||||
|
||||
// lets deal with pagination headers
|
||||
const findLinkName = (markup) => {
|
||||
const findLinkName = (markup: string) => {
|
||||
const pattern = /<([^\s>]+)(\s|>)+/;
|
||||
return markup.match(pattern)[1];
|
||||
};
|
||||
|
@ -148,4 +148,26 @@ export class GitlabProject {
|
||||
const readmeFile = await this.getFileFromProject('readme.md', refArg);
|
||||
return readmeFile.contents.toString('utf8');
|
||||
}
|
||||
|
||||
public async getNpmKeywords(refArg: string = 'master'): Promise<string[]> {
|
||||
const packageJsonFile = await this.getFileFromProject('package.json', refArg);
|
||||
const packageJsonObject: any = JSON.parse(packageJsonFile.contents.toString('utf8'));
|
||||
return packageJsonObject.keywords ? packageJsonObject.keywords : [];
|
||||
}
|
||||
|
||||
public async getProjectAsArticle(): Promise<plugins.tsclass.content.IArticle> {
|
||||
return {
|
||||
url: this.data.web_url,
|
||||
author: null,
|
||||
content: await this.getReadmeAsMarkdown().catch(err => null),
|
||||
tags: await this.getNpmKeywords().catch(err => null),
|
||||
title: this.data.name,
|
||||
timestamp: new Date(this.data.last_activity_at).getTime(),
|
||||
featuredImageUrl: null
|
||||
}
|
||||
}
|
||||
|
||||
public async syncNpmTagsToGitlabTopics() {
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -1,3 +1,10 @@
|
||||
// @tsclass scope
|
||||
import * as tsclass from '@tsclass/tsclass';
|
||||
|
||||
export {
|
||||
tsclass
|
||||
}
|
||||
|
||||
// pushrocks scope
|
||||
import * as smartfile from '@pushrocks/smartfile';
|
||||
import * as smartrequest from '@pushrocks/smartrequest';
|
||||
|
@ -1,2 +1,3 @@
|
||||
export * from './gitlab.classes.group';
|
||||
export * from './gitlab.classes.account';
|
||||
export * from './gitlab.classes.project';
|
Reference in New Issue
Block a user