mirror of
https://github.com/NohamR/gitprofile.git
synced 2026-05-25 20:00:25 +00:00
Add definition for projects
This commit is contained in:
@@ -15,7 +15,6 @@ const config = {
|
|||||||
projects: [], // These projects will not be displayed. example: ['my-project1', 'my-project2']
|
projects: [], // These projects will not be displayed. example: ['my-project1', 'my-project2']
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
external: {
|
external: {
|
||||||
header: 'External Projects',
|
header: 'External Projects',
|
||||||
display: true, // Display external projects?
|
display: true, // Display external projects?
|
||||||
|
|||||||
@@ -77,15 +77,15 @@ const GitProfile = ({ config }) => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
sanitizedConfig.github.exclude.projects.forEach((project) => {
|
sanitizedConfig.projects.github.exclude.projects.forEach((project) => {
|
||||||
excludeRepo += `+-repo:${sanitizedConfig.github.username}/${project}`;
|
excludeRepo += `+-repo:${sanitizedConfig.github.username}/${project}`;
|
||||||
});
|
});
|
||||||
|
|
||||||
let query = `user:${
|
let query = `user:${
|
||||||
sanitizedConfig.github.username
|
sanitizedConfig.github.username
|
||||||
}+fork:${!sanitizedConfig.github.exclude.forks}${excludeRepo}`;
|
}+fork:${!sanitizedConfig.projects.github.exclude.forks}${excludeRepo}`;
|
||||||
|
|
||||||
let url = `https://api.github.com/search/repositories?q=${query}&sort=${sanitizedConfig.github.sortBy}&per_page=${sanitizedConfig.github.limit}&type=Repositories`;
|
let url = `https://api.github.com/search/repositories?q=${query}&sort=${sanitizedConfig.projects.github.sortBy}&per_page=${sanitizedConfig.projects.github.limit}&type=Repositories`;
|
||||||
|
|
||||||
axios
|
axios
|
||||||
.get(url, {
|
.get(url, {
|
||||||
@@ -236,13 +236,31 @@ GitProfile.propTypes = {
|
|||||||
config: PropTypes.shape({
|
config: PropTypes.shape({
|
||||||
github: PropTypes.shape({
|
github: PropTypes.shape({
|
||||||
username: PropTypes.string.isRequired,
|
username: PropTypes.string.isRequired,
|
||||||
|
}).isRequired,
|
||||||
|
projects: {
|
||||||
|
github: PropTypes.shape({
|
||||||
|
header: PropTypes.string,
|
||||||
|
display: PropTypes.bool,
|
||||||
sortBy: PropTypes.oneOf(['stars', 'updated']),
|
sortBy: PropTypes.oneOf(['stars', 'updated']),
|
||||||
limit: PropTypes.number,
|
limit: PropTypes.number,
|
||||||
exclude: PropTypes.shape({
|
exclude: PropTypes.shape({
|
||||||
forks: PropTypes.bool,
|
forks: PropTypes.bool,
|
||||||
projects: PropTypes.array,
|
projects: PropTypes.array,
|
||||||
}),
|
}),
|
||||||
}).isRequired,
|
}),
|
||||||
|
projects: PropTypes.shape({
|
||||||
|
header: PropTypes.string,
|
||||||
|
display: PropTypes.bool,
|
||||||
|
projects: PropTypes.arrayOf(
|
||||||
|
PropTypes.shape({
|
||||||
|
title: PropTypes.string.isRequired,
|
||||||
|
description: PropTypes.string.isRequired,
|
||||||
|
link: PropTypes.string.isRequired,
|
||||||
|
imageUrl: PropTypes.string,
|
||||||
|
})
|
||||||
|
),
|
||||||
|
}),
|
||||||
|
},
|
||||||
social: PropTypes.shape({
|
social: PropTypes.shape({
|
||||||
linkedin: PropTypes.string,
|
linkedin: PropTypes.string,
|
||||||
twitter: PropTypes.string,
|
twitter: PropTypes.string,
|
||||||
@@ -265,14 +283,6 @@ GitProfile.propTypes = {
|
|||||||
fileUrl: PropTypes.string,
|
fileUrl: PropTypes.string,
|
||||||
}),
|
}),
|
||||||
skills: PropTypes.array,
|
skills: PropTypes.array,
|
||||||
externalProjects: PropTypes.arrayOf(
|
|
||||||
PropTypes.shape({
|
|
||||||
title: PropTypes.string.isRequired,
|
|
||||||
description: PropTypes.string.isRequired,
|
|
||||||
link: PropTypes.string.isRequired,
|
|
||||||
imageUrl: PropTypes.string,
|
|
||||||
})
|
|
||||||
),
|
|
||||||
experiences: PropTypes.arrayOf(
|
experiences: PropTypes.arrayOf(
|
||||||
PropTypes.shape({
|
PropTypes.shape({
|
||||||
company: PropTypes.string,
|
company: PropTypes.string,
|
||||||
|
|||||||
@@ -137,11 +137,22 @@ export const sanitizeConfig = (config) => {
|
|||||||
return {
|
return {
|
||||||
github: {
|
github: {
|
||||||
username: config?.github?.username || '',
|
username: config?.github?.username || '',
|
||||||
sortBy: config?.github?.sortBy || 'stars',
|
},
|
||||||
limit: config?.github?.limit || 8,
|
projects: {
|
||||||
|
github: {
|
||||||
|
header: config?.projects?.github?.header || 'GitHub Projects',
|
||||||
|
display: config?.projects?.github?.display || true,
|
||||||
|
sortBy: config?.projects?.github?.sortBy || 'stars',
|
||||||
|
limit: config?.projects?.github?.limit || 8,
|
||||||
exclude: {
|
exclude: {
|
||||||
forks: config?.github?.exclude?.forks || false,
|
forks: config?.projects?.github?.exclude?.forks || false,
|
||||||
projects: config?.github?.exclude?.projects || [],
|
projects: config?.projects?.github?.exclude?.projects || [],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
external: {
|
||||||
|
header: config?.projects?.external?.header || 'External Projects',
|
||||||
|
display: config?.projects?.external?.display || true,
|
||||||
|
projects: config?.projects?.external?.projects || [],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
social: {
|
social: {
|
||||||
@@ -166,7 +177,6 @@ export const sanitizeConfig = (config) => {
|
|||||||
fileUrl: config?.resume?.fileUrl || '',
|
fileUrl: config?.resume?.fileUrl || '',
|
||||||
},
|
},
|
||||||
skills: config?.skills || [],
|
skills: config?.skills || [],
|
||||||
externalProjects: config?.externalProjects || [],
|
|
||||||
experiences: config?.experiences || [],
|
experiences: config?.experiences || [],
|
||||||
certifications: config?.certifications || [],
|
certifications: config?.certifications || [],
|
||||||
education: config?.education || [],
|
education: config?.education || [],
|
||||||
|
|||||||
41
types/index.d.ts
vendored
41
types/index.d.ts
vendored
@@ -9,6 +9,19 @@ export interface Github {
|
|||||||
* GitHub org/user name
|
* GitHub org/user name
|
||||||
*/
|
*/
|
||||||
username: string;
|
username: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Projects {
|
||||||
|
github: {
|
||||||
|
/**
|
||||||
|
* Header Title
|
||||||
|
*/
|
||||||
|
header?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display GitHub projects?
|
||||||
|
*/
|
||||||
|
display?: boolean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* stars | updated
|
* stars | updated
|
||||||
@@ -36,6 +49,24 @@ export interface Github {
|
|||||||
*/
|
*/
|
||||||
projects?: Array<string>;
|
projects?: Array<string>;
|
||||||
};
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
external: {
|
||||||
|
/**
|
||||||
|
* Header Title
|
||||||
|
*/
|
||||||
|
header?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display external projects?
|
||||||
|
*/
|
||||||
|
display?: boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* External Projects
|
||||||
|
*/
|
||||||
|
projects?: Array<ExternalProjects>;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Social {
|
export interface Social {
|
||||||
@@ -265,6 +296,11 @@ export interface Config {
|
|||||||
*/
|
*/
|
||||||
github: Github;
|
github: Github;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Projects
|
||||||
|
*/
|
||||||
|
projects?: Projects;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Social links
|
* Social links
|
||||||
*/
|
*/
|
||||||
@@ -285,11 +321,6 @@ export interface Config {
|
|||||||
*/
|
*/
|
||||||
experiences?: Array<Experience>;
|
experiences?: Array<Experience>;
|
||||||
|
|
||||||
/**
|
|
||||||
* External Projects
|
|
||||||
*/
|
|
||||||
externalProjects?: Array<ExternalProjects>;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Certifications list
|
* Certifications list
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user