Skip to content

Commit

Permalink
🎨 repo cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
scottnath committed Oct 11, 2023
1 parent 329822b commit 809c91d
Show file tree
Hide file tree
Showing 38 changed files with 317 additions and 693 deletions.
13 changes: 7 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ Web components which display profile information from various websites

## Components

## Modules

<dl>
<dt><a href="#module_GitHubUser">GitHubUser</a></dt>
<dd><p>GitHub user profile web component</p>
Expand Down Expand Up @@ -41,12 +39,13 @@ GitHub user profile web component
| login | <code>string</code> | User's GitHub login |
| avatar_url | <code>string</code> | URL to user's avatar |
| name | <code>string</code> | User's name |
| [fetch] | <code>boolean</code> | when true, fetches user from [GitHub api](https://docs.github.com/en/rest/users/users#get-a-user) |
| [fetch] | <code>boolean</code> | when true, fetches user from the [GitHub api](https://docs.github.com/en/rest/users/users#get-a-user) |
| [username] | <code>string</code> | alias for `login` |
| [bio] | <code>string</code> | User's biography content |
| [following] | <code>string</code> | number of people user is following |
| [followers] | <code>string</code> | number of followers |
| [repos] | <code>string</code> | JSON stringified array of repositories |
| [theme] | <code>string</code> | color theme for the component |

**Example**
```js
Expand All @@ -69,16 +68,17 @@ GitHub repository web component
| Name | Type | Description |
| --- | --- | --- |
| full_name | <code>string</code> | repository org and name, as in `scottnath/profile-components` |
| [fetch] | <code>boolean</code> | when true, fetches repo from the [GitHub api](https://docs.github.com/en/rest/repos/repos#get-a-repository) |
| [name] | <code>string</code> | repo name |
| [org] | <code>string</code> | repo owner organization's login, found at `<REST_RESPONSE>.organization.login` |
| [description] | <code>string</code> | repo description |
| [language] | <code>string</code> | programming language used in repo |
| [stargazers_count] | <code>string</code> | number of stars |
| [forks_count] | <code>string</code> | number of forks |
| [subscribers_count] | <code>string</code> | number of watchers |
| [fetch] | <code>boolean</code> | when true, fetches repo from [GitHub api](https://docs.github.com/en/rest/repos/repos#get-a-repository) |
| [itemprop] | <code>string</code> | Itemprop content to go with a containing component's itemscope |
| [no_org] | <code>string</code> | Do not include the repo owner or organization |
| [theme] | <code>string</code> | color theme for the component |

**Example**
```js
Expand All @@ -101,14 +101,15 @@ dev.to user profile web component
| Name | Type | Description |
| --- | --- | --- |
| username | <code>string</code> | User's dev.to username |
| [fetch] | <code>boolean</code> | when true, fetches user and posts from the [Forem API](https://developers.forem.com/api/v0#tag/users/operation/getUser) |
| [name] | <code>string</code> | The name of the user |
| [summary] | <code>string</code> | The user's bio |
| [joined_at] | <code>string</code> | The date the user joined |
| [profile_image] | <code>string</code> | The URL of the user's profile image |
| [fetch] | <code>boolean</code> | when true, fetches user and posts from api |
| [post_count] | <code>number</code> | The number of posts the user has published |
| [latest_post] | <code>string</code> | User's latest post content, JSON stringified |
| [popular_post] | <code>string</code> | User's most popular post content, JSON stringified |
| [theme] | <code>string</code> | color theme for the component |

**Example**
```js
Expand All @@ -135,7 +136,7 @@ dev.to post web component
| url | <code>string</code> | Post URL |
| cover_image | <code>string</code> | Post cover image URL |
| social_image | <code>string</code> | Post social image URL |
| [fetch] | <code>boolean</code> | when true, fetches post from api |
| [fetch] | <code>boolean</code> | when true, fetches post from the [Forem API](https://developers.forem.com/api/v0#tag/articles/operation/getArticleById) |

**Example**
```js
Expand Down
50 changes: 33 additions & 17 deletions custom-elements.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,14 @@
"name": "full_name",
"kind": "field"
},
{
"type": {
"text": "boolean"
},
"description": "when true, fetches repo from the [GitHub api](https://docs.github.com/en/rest/repos/repos#get-a-repository)",
"name": "fetch",
"kind": "field"
},
{
"type": {
"text": "string"
Expand Down Expand Up @@ -93,26 +101,26 @@
},
{
"type": {
"text": "boolean"
"text": "string"
},
"description": "when true, fetches repo from [GitHub api](https://docs.github.com/en/rest/repos/repos#get-a-repository)",
"name": "fetch",
"description": "Itemprop content to go with a containing component's itemscope",
"name": "itemprop",
"kind": "field"
},
{
"type": {
"text": "string"
},
"description": "Itemprop content to go with a containing component's itemscope",
"name": "itemprop",
"description": "Do not include the repo owner or organization",
"name": "no_org",
"kind": "field"
},
{
"type": {
"text": "string"
},
"description": "Do not include the repo owner or organization",
"name": "no_org",
"description": "color theme for the component",
"name": "theme",
"kind": "field"
}
],
Expand Down Expand Up @@ -196,7 +204,7 @@
"type": {
"text": "boolean"
},
"description": "when true, fetches user from [GitHub api](https://docs.github.com/en/rest/users/users#get-a-user)",
"description": "when true, fetches user from the [GitHub api](https://docs.github.com/en/rest/users/users#get-a-user)",
"name": "fetch",
"kind": "field"
},
Expand Down Expand Up @@ -301,6 +309,14 @@
"name": "username",
"kind": "field"
},
{
"type": {
"text": "boolean"
},
"description": "when true, fetches user and posts from the [Forem API](https://developers.forem.com/api/v0#tag/users/operation/getUser)",
"name": "fetch",
"kind": "field"
},
{
"type": {
"text": "string"
Expand Down Expand Up @@ -333,14 +349,6 @@
"name": "profile_image",
"kind": "field"
},
{
"type": {
"text": "boolean"
},
"description": "when true, fetches user and posts from api",
"name": "fetch",
"kind": "field"
},
{
"type": {
"text": "number"
Expand All @@ -364,6 +372,14 @@
"description": "User's most popular post content, JSON stringified",
"name": "popular_post",
"kind": "field"
},
{
"type": {
"text": "string"
},
"description": "color theme for the component",
"name": "theme",
"kind": "field"
}
],
"superclass": {
Expand Down Expand Up @@ -454,7 +470,7 @@
"type": {
"text": "boolean"
},
"description": "when true, fetches post from api",
"description": "when true, fetches post from the [Forem API](https://developers.forem.com/api/v0#tag/articles/operation/getArticleById)",
"name": "fetch",
"kind": "field"
}
Expand Down
6 changes: 3 additions & 3 deletions lib/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

import { Command } from 'commander';

import { writeDevCssFile } from '../src/devto/utils/forem.js';
import { writePrimerCssFile } from '../src/github/utils/primer.js';
import { generateFixtures as genFixGitHub } from '../src/github/utils/fixtures.js';
import { writeDevCssFile } from '../src/devto/helpers/forem.js';
import { writePrimerCssFile } from '../src/github/helpers/primer.js';
import { generateFixtures as genFixGitHub } from '../src/github/helpers/fixtures.js';
import { generateFixtures as genFixDevTo } from '../src/devto/fixtures/utils.js';
import { generateDocs } from './jsdoc.js';

Expand Down
7 changes: 0 additions & 7 deletions lib/custom-elements-manifest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,4 @@ export default {
dependencies: false,
dev: false,
packagejson: true,
plugins: [
readmePlugin({
from: getModulePaths().root,
to: 'custom-elements-readme.md',
omitSections: ['exports']
}),
],
}
42 changes: 7 additions & 35 deletions lib/jsdoc.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,12 @@ export const generateDocs = async () => {
pathFromRoot('src/devto/user/index.js'),
pathFromRoot('src/devto/post/index.js'),
],
// @todo automate changing `Modules` to `Components`
},
{
title: `GitHub profile components' utilities`,
dir: pathFromRoot('src/github/utils'),
files: pathFromRoot('src/github/utils/*.js'),
title: `GitHub profile components' helpers`,
dir: pathFromRoot('src/github/helpers'),
files: pathFromRoot('src/github/helpers/*.js'),
},
{
title: 'GitHub utilities',
Expand All @@ -56,39 +57,11 @@ export const generateDocs = async () => {
pathFromRoot('src/github/repository/content.js'),
pathFromRoot('src/github/index.js'),
],
filename: 'UTILITIES.md',
},
{
title: 'GitHub repository details component',
dir: pathFromRoot('src/github/repository'),
files: [
pathFromRoot('src/github/repository/index.js'),
pathFromRoot('src/github/repository/content.js'),
pathFromRoot('src/github/repository/html.js'),
],
},
{
title: `DEV profile components' utilities`,
dir: pathFromRoot('src/devto/utils'),
files: pathFromRoot('src/devto/utils/*.js'),
},
{
title: 'Dev user profile component',
dir: pathFromRoot('src/devto/user'),
files: [
pathFromRoot('src/devto/user/index.js'),
pathFromRoot('src/devto/user/content.js'),
pathFromRoot('src/devto/user/html.js'),
],
},
{
title: 'DEV post component',
dir: pathFromRoot('src/devto/post'),
files: [
pathFromRoot('src/devto/post/index.js'),
pathFromRoot('src/devto/post/content.js'),
pathFromRoot('src/devto/post/html.js'),
],
title: `DEV profile components' helpers`,
dir: pathFromRoot('src/devto/helpers'),
files: pathFromRoot('src/devto/helpers/*.js'),
},
{
title: 'DEV utilities',
Expand All @@ -101,7 +74,6 @@ export const generateDocs = async () => {
pathFromRoot('src/devto/post/content.js'),
pathFromRoot('src/devto/index.js'),
],
filename: 'UTILITIES.md',
},
]
for (const toDoc of toDocs) {
Expand Down
33 changes: 33 additions & 0 deletions src/devto/README.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<center><img src="./devto-unofficial-logo.png" alt="Unofficial DEV component" /></center>

# DEV profile components

Includes two web components:

* `<devto-user>` - displays information about a DEV user, includes `<devto-post>`
* `<devto-post>` - displays information about a DEV post

see README at root of repo for usage details

## api

* https://developers.forem.com/api/v0#tag/articles

## @todo

- [ ] re-do `parts`, removing parts that are just for style-sharing
- [ ] interaction tests
- [ ] a11y testing
- [ ] test in plain HTML page
- [ ] conform to https://dev.to/brand

---
{{>main}}
## Inspriation
- https://dev.to/asheeshh/devembed-embed-your-devto-profile-anywhere-using-widgets-linode-hacakathon-4659
- https://dev.to/saurabhdaware/i-made-dev-to-widget-for-websites-blogs-40p2
32 changes: 31 additions & 1 deletion src/devto/UTILITIES.md → src/devto/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,27 @@
# DEV utilities
<center><img src="./devto-unofficial-logo.png" alt="Unofficial DEV component" /></center>

# DEV profile components

Includes two web components:

* `<devto-user>` - displays information about a DEV user, includes `<devto-post>`
* `<devto-post>` - displays information about a DEV post

see README at root of repo for usage details

## api

* https://developers.forem.com/api/v0#tag/articles

## @todo

- [ ] re-do `parts`, removing parts that are just for style-sharing
- [ ] interaction tests
- [ ] a11y testing
- [ ] test in plain HTML page
- [ ] conform to https://dev.to/brand

---

<a name="DEVUtils"></a>

Expand Down Expand Up @@ -191,3 +214,10 @@ Only required properties from the api are defined.
| [latest_post] | <code>ForemPostHTML</code> | User's latest post |
| [popular_post] | <code>ForemPostHTML</code> | User's most popular post |




## Inspriation

- https://dev.to/asheeshh/devembed-embed-your-devto-profile-anywhere-using-widgets-linode-hacakathon-4659
- https://dev.to/saurabhdaware/i-made-dev-to-widget-for-websites-blogs-40p2
Binary file added src/devto/devto-unofficial-logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/devto/utils/README.md → src/devto/helpers/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# DEV profile components' utilities
# DEV profile components' helpers

## Modules

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 809c91d

Please sign in to comment.