fix(core): update

This commit is contained in:
2021-10-04 22:02:47 +02:00
parent 1fd2bb8e01
commit 098a9c64c6
7 changed files with 17256 additions and 2842 deletions

View File

@ -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];
};

View File

@ -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() {
}
}

View File

@ -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';

View File

@ -1,2 +1,3 @@
export * from './gitlab.classes.group';
export * from './gitlab.classes.account';
export * from './gitlab.classes.project';