fix(core): update

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

20039
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -11,9 +11,9 @@
"build": "(tsbuild --web)"
},
"devDependencies": {
"@gitzone/tsbuild": "^2.1.25",
"@gitzone/tsrun": "^1.2.12",
"@gitzone/tstest": "^1.0.54",
"@gitzone/tsbuild": "^2.1.27",
"@gitzone/tsrun": "^1.2.17",
"@gitzone/tstest": "^1.0.57",
"@pushrocks/tapbundle": "^3.2.14",
"tslint": "^6.1.3",
"tslint-config-prettier": "^1.18.0"
@ -21,7 +21,8 @@
"dependencies": {
"@pushrocks/smartfile": "^8.0.10",
"@pushrocks/smartrequest": "^1.1.52",
"@pushrocks/smarturl": "^2.0.1"
"@pushrocks/smarturl": "^2.0.1",
"@tsclass/tsclass": "^3.0.33"
},
"private": false,
"browserslist": [

View File

@ -3,24 +3,24 @@ import * as gitlab from '../ts/index';
let testGitlabAccount: gitlab.GitlabAccount;
tap.test('should create an anonymous Gitlab Account', async () => {
const test1 = tap.test('should create an anonymous Gitlab Account', async () => {
testGitlabAccount = gitlab.GitlabAccount.createAnonymousAccount();
expect(testGitlabAccount).to.be.instanceOf(gitlab.GitlabAccount);
});
tap.test('should get the pushrocks group', async () => {
const test2 = tap.test('should get the pushrocks group', async () => {
const pushrocksGroup = await testGitlabAccount.getGroupByName('pushrocks');
expect(pushrocksGroup).to.be.instanceOf(gitlab.GitlabGroup);
console.log(pushrocksGroup);
});
tap.test('should get the pushrocks group', async () => {
const test3 = tap.test('should get the pushrocks group', async () => {
const pushrocksGroup = await testGitlabAccount.getGroupByName('pushrocks');
expect(pushrocksGroup).to.be.instanceOf(gitlab.GitlabGroup);
await pushrocksGroup.getProjects();
});
tap.test('should get the readme of a project', async () => {
const test4 = tap.test('should get the readme of a project', async () => {
const pushrocksGroup = await testGitlabAccount.getGroupByName('pushrocks');
expect(pushrocksGroup).to.be.instanceOf(gitlab.GitlabGroup);
const projects = await pushrocksGroup.getProjects();
@ -29,7 +29,15 @@ tap.test('should get the readme of a project', async () => {
});
expect(selectedProject.data.name).to.equal('smartfile');
const readme = await selectedProject.getReadmeAsMarkdown('master');
expect(readme).to.startWith('# @pushrocks/smartfile');
expect(readme.startsWith('# @pushrocks/smartfile')).to.be.true;
return projects;
});
const test5 = tap.test('should be able to create an article list', async () => {
const projects: gitlab.GitlabProject[] = (await test4.testResultPromise) as any;
for (const project of projects) {
console.log(await project.getProjectAsArticle());
}
})
tap.start();

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