Skip to content

Commit c7d6db0

Browse files
authored
🚀 update deps, add DSD options (#17)
1 parent cbe17de commit c7d6db0

25 files changed

+22257
-27192
lines changed

.github/workflows/chromatic.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
runs-on: ubuntu-latest
1212
# Job steps
1313
steps:
14-
- uses: actions/checkout@v1
14+
- uses: actions/checkout@v4
1515
- name: Install dependencies
1616
# 👇 Install dependencies with the same package manager used in the project (replace it as needed), e.g. yarn, npm, pnpm
1717
run: npm i

.github/workflows/gh-pages.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ jobs:
1313
concurrency:
1414
group: ${{ github.workflow }}-${{ github.ref }}
1515
steps:
16-
- uses: actions/checkout@v3
16+
- uses: actions/checkout@v4
1717

1818
- name: Setup Node
19-
uses: actions/setup-node@v3
19+
uses: actions/setup-node@v4
2020
with:
21-
node-version: '18'
21+
node-version: '20'
2222

2323
- name: Cache dependencies
2424
uses: actions/cache@v3

.github/workflows/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ jobs:
1919
id-token: write # to enable use of OIDC for npm provenance
2020
steps:
2121
- name: Checkout
22-
uses: actions/checkout@v3
22+
uses: actions/checkout@v4
2323
with:
2424
fetch-depth: 0
2525
- name: Setup Node.js
26-
uses: actions/setup-node@v3
26+
uses: actions/setup-node@v4
2727
with:
2828
node-version: "lts/*"
2929
- name: Install dependencies

.github/workflows/ui-tests.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ jobs:
88
interaction-and-accessibility:
99
runs-on: ubuntu-latest
1010
steps:
11-
- uses: actions/checkout@v3
12-
- uses: actions/setup-node@v3
11+
- uses: actions/checkout@v4
12+
- uses: actions/setup-node@v4
1313
with:
14-
node-version: '18.x'
14+
node-version: '20.x'
1515
- name: Install dependencies
1616
run: npm ci
1717
- name: Install Playwright

.github/workflows/unit-tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ jobs:
88
unit-tests:
99
runs-on: ubuntu-latest
1010
steps:
11-
- uses: actions/checkout@v3
12-
- uses: actions/setup-node@v3
11+
- uses: actions/checkout@v4
12+
- uses: actions/setup-node@v4
1313
with:
1414
node-version: '20.x'
1515
- name: Install dependencies

package-lock.json

Lines changed: 21968 additions & 27034 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"cem": "custom-elements-manifest analyze --config 'lib/custom-elements-manifest.config.js'",
88
"storybook": "storybook dev -p 6006",
99
"build-storybook": "storybook build",
10+
"preview-storybook": "storybook preview",
1011
"test-storybook": "test-storybook --coverage",
1112
"predist": "npm run cem && npm run build-storybook",
1213
"dist": "node lib/esbuild.config.js",
@@ -43,19 +44,19 @@
4344
},
4445
"license": "MIT",
4546
"devDependencies": {
46-
"@chromaui/addon-visual-tests": "^0.0.107",
47+
"@chromaui/addon-visual-tests": "^1.0.0",
4748
"@custom-elements-manifest/analyzer": "^0.9.0",
4849
"@custom-elements-manifest/to-markdown": "^0.1.0",
4950
"@primer/octicons": "^19.8.0",
50-
"@primer/primitives": "^7.15.0",
51-
"commander": "^11.1.0",
52-
"esbuild": "^0.19.5",
53-
"esbuild-plugin-inline-import": "^1.0.1",
54-
"fs-extra": "^11.1.1",
55-
"jsdoc-to-markdown": "^8.0.0",
56-
"storydocker-storybook": "^0.0.16",
57-
"storydocker-utilities": "^0.0.11",
58-
"yaml": "^2.3.3"
51+
"@primer/primitives": "^7.15.6",
52+
"commander": "^12.0.0",
53+
"esbuild": "^0.20.0",
54+
"esbuild-plugin-inline-import": "^1.0.4",
55+
"fs-extra": "^11.2.0",
56+
"jsdoc-to-markdown": "^8.0.1",
57+
"storydocker-storybook": "^0.0.22",
58+
"storydocker-utilities": "^0.0.16",
59+
"yaml": "^2.3.4"
5960
},
6061
"customElements": "custom-elements.json"
6162
}

src/devto/README.md

Lines changed: 49 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,46 @@ see README at root of repo for usage details
2323

2424
---
2525

26+
## Members
27+
28+
<dl>
29+
<dt><a href="#DEV-Post-Declarative-Shadow-DOM">DEV-Post-Declarative-Shadow-DOM</a> ⇒ <code>string</code></dt>
30+
<dd></dd>
31+
<dt><a href="#DEV-Declarative-Shadow-DOM">DEV-Declarative-Shadow-DOM</a> ⇒ <code>string</code></dt>
32+
<dd></dd>
33+
</dl>
34+
35+
## Objects
36+
37+
<dl>
38+
<dt><a href="#DEVUtils">DEVUtils</a> : <code>object</code></dt>
39+
<dd><p>Utility functions for fetching and parsing dev.to api data, getting
40+
styles and generating HTML for dev.to profile UIs</p>
41+
</dd>
42+
</dl>
43+
44+
<a name="DEV-Post-Declarative-Shadow-DOM"></a>
45+
46+
## DEV-Post-Declarative-Shadow-DOM ⇒ <code>string</code>
47+
**Kind**: global variable
48+
**Returns**: <code>string</code> - DEV post HTML wrapped in a `template`
49+
50+
| Param | Type | Description |
51+
| --- | --- | --- |
52+
| content | <code>ForemPostHTML</code> | Content about one post by dev.to (or Forem) user |
53+
| fetch | <code>boolean</code> | |
54+
55+
<a name="DEV-Declarative-Shadow-DOM"></a>
56+
57+
## DEV-Declarative-Shadow-DOM ⇒ <code>string</code>
58+
**Kind**: global variable
59+
**Returns**: <code>string</code> - DEV HTML wrapped in a `template`
60+
61+
| Param | Type | Description |
62+
| --- | --- | --- |
63+
| content | <code>ForemUserHTML</code> | a content object representing a DEV user |
64+
| fetch | <code>boolean</code> | |
65+
2666
<a name="DEVUtils"></a>
2767

2868
## DEVUtils : <code>object</code>
@@ -51,17 +91,14 @@ Utility functions for fetching and parsing dev.to api data, getting
5191
Utility functions for a post
5292

5393
**Kind**: static namespace of [<code>DEVUtils</code>](#DEVUtils)
54-
**Example** *(Server side rendering trick)*
94+
**Example** *(Server side rendering a post with Declarative Shadow Dom)*
5595
```js
56-
<devto-post>
57-
<template id="devto-post" shadowrootmode="open"></template>
58-
</devto-post>
96+
<devto-post></devto-post>
5997

6098
<script type="module">
6199
import {post} from 'profile-components/devto-utils';
62-
const content = post.generateContent({id: '12345'}, true);
63-
const html = post.html(content);
64-
document.querySelector('#devto-post').innerHTML = `<style>${post.style}</style>${html}`;
100+
const dsdHTML = post.dsd({id: '12345'}, true);
101+
document.querySelector('devto-post').innerHTML = dsdHTML;
65102
</script>
66103
```
67104

@@ -131,17 +168,14 @@ Forem post content, ready for HTML
131168
Utility functions for a user
132169

133170
**Kind**: static namespace of [<code>DEVUtils</code>](#DEVUtils)
134-
**Example** *(Server side rendering trick)*
171+
**Example** *(Server side rendering with Declarative Shadow Dom)*
135172
```js
136-
<devto-user>
137-
<template id="devto-user" shadowrootmode="open"></template>
138-
</devto-user>
173+
<devto-user></devto-user>
139174

140175
<script type="module">
141-
import {user} from 'profile-components/devto-utils';
142-
const content = user.generateContent({username: 'scottnath'}, true);
143-
const html = user.html(content);
144-
document.querySelector('#devto-user').innerHTML = `<style>${user.style}</style>${html}`;
176+
import {dsd} from 'profile-components/devto-utils';
177+
const dsdHTML = dsd({username: 'scottnath'}, true);
178+
document.querySelector('devto-user').innerHTML = dsdHTML;
145179
</script>
146180
```
147181

src/devto/fixtures/generated/post--bugfix-multi-vite.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"id": 1466138,
44
"title": "Bugfix: Multiple Vite Storybooks from Same node_modules",
55
"description": "tl;dr Encountering Failed to fetch dynamically imported module or ENOTEMPTY: directory not...",
6-
"readable_publish_date": "May 12",
6+
"readable_publish_date": "May 12 2023",
77
"slug": "bugfix-multiple-vite-storybooks-from-same-nodemodules-4mg1",
88
"path": "/scottnath/bugfix-multiple-vite-storybooks-from-same-nodemodules-4mg1",
99
"url": "https://dev.to/scottnath/bugfix-multiple-vite-storybooks-from-same-nodemodules-4mg1",
@@ -12,8 +12,8 @@
1212
"collection_id": null,
1313
"published_timestamp": "2023-05-12T17:02:05Z",
1414
"positive_reactions_count": 0,
15-
"cover_image": "https://res.cloudinary.com/practicaldev/image/fetch/s--AR_lGaEf--/c_imagga_scale,f_auto,fl_progressive,h_420,q_auto,w_1000/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/k026dc27vi3hv6n0apyp.png",
16-
"social_image": "https://res.cloudinary.com/practicaldev/image/fetch/s--v_uMw7cg--/c_imagga_scale,f_auto,fl_progressive,h_500,q_auto,w_1000/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/k026dc27vi3hv6n0apyp.png",
15+
"cover_image": "https://media.dev.to/cdn-cgi/image/width=1000,height=420,fit=cover,gravity=auto,format=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fk026dc27vi3hv6n0apyp.png",
16+
"social_image": "https://media.dev.to/cdn-cgi/image/width=1000,height=500,fit=cover,gravity=auto,format=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fk026dc27vi3hv6n0apyp.png",
1717
"canonical_url": "https://scottnath.com/blahg/bug-multiple-vite-storybooks/",
1818
"created_at": "2023-05-12T17:02:05Z",
1919
"edited_at": null,
@@ -37,7 +37,7 @@
3737
"github_username": "scottnath",
3838
"user_id": 1055555,
3939
"website_url": "https://scottnath.com",
40-
"profile_image": "https://res.cloudinary.com/practicaldev/image/fetch/s--k0ZYTR18--/c_fill,f_auto,fl_progressive,h_640,q_auto,w_640/https://dev-to-uploads.s3.amazonaws.com/uploads/user/profile_image/1055555/99c3a97d-b160-4d6d-96c1-1007d266c024.jpeg",
41-
"profile_image_90": "https://res.cloudinary.com/practicaldev/image/fetch/s--K8yLyVye--/c_fill,f_auto,fl_progressive,h_90,q_auto,w_90/https://dev-to-uploads.s3.amazonaws.com/uploads/user/profile_image/1055555/99c3a97d-b160-4d6d-96c1-1007d266c024.jpeg"
40+
"profile_image": "https://media.dev.to/cdn-cgi/image/width=640,height=640,fit=cover,gravity=auto,format=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1055555%2F4d0bf90a-bec7-4228-b1ca-d663fa40adeb.jpeg",
41+
"profile_image_90": "https://media.dev.to/cdn-cgi/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1055555%2F4d0bf90a-bec7-4228-b1ca-d663fa40adeb.jpeg"
4242
}
43-
}
43+
}

src/devto/fixtures/generated/post--dependabot.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"id": 1568661,
44
"title": "A crazy-simple way to bulk-update NPM dependencies with GitHub's Dependabot",
55
"description": "This is the simplest way I've found to keep your NPM dependencies up-to-date. This will update all...",
6-
"readable_publish_date": "Aug 15",
6+
"readable_publish_date": "Aug 15 2023",
77
"slug": "a-crazy-simple-way-to-bulk-update-npm-dependencies-with-githubs-dependabot-3e2o",
88
"path": "/scottnath/a-crazy-simple-way-to-bulk-update-npm-dependencies-with-githubs-dependabot-3e2o",
99
"url": "https://dev.to/scottnath/a-crazy-simple-way-to-bulk-update-npm-dependencies-with-githubs-dependabot-3e2o",
@@ -12,8 +12,8 @@
1212
"collection_id": null,
1313
"published_timestamp": "2023-08-15T18:00:37Z",
1414
"positive_reactions_count": 0,
15-
"cover_image": "https://res.cloudinary.com/practicaldev/image/fetch/s--DfcEJZWu--/c_imagga_scale,f_auto,fl_progressive,h_420,q_auto,w_1000/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/d9sds37k57qzn6j5nbxp.png",
16-
"social_image": "https://res.cloudinary.com/practicaldev/image/fetch/s--XDW1Jh5r--/c_imagga_scale,f_auto,fl_progressive,h_500,q_auto,w_1000/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/d9sds37k57qzn6j5nbxp.png",
15+
"cover_image": "https://media.dev.to/cdn-cgi/image/width=1000,height=420,fit=cover,gravity=auto,format=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fd9sds37k57qzn6j5nbxp.png",
16+
"social_image": "https://media.dev.to/cdn-cgi/image/width=1000,height=500,fit=cover,gravity=auto,format=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fd9sds37k57qzn6j5nbxp.png",
1717
"canonical_url": "https://dev.to/scottnath/a-crazy-simple-way-to-bulk-update-npm-dependencies-with-githubs-dependabot-3e2o",
1818
"created_at": "2023-08-15T00:55:09Z",
1919
"edited_at": null,
@@ -37,7 +37,7 @@
3737
"github_username": "scottnath",
3838
"user_id": 1055555,
3939
"website_url": "https://scottnath.com",
40-
"profile_image": "https://res.cloudinary.com/practicaldev/image/fetch/s--k0ZYTR18--/c_fill,f_auto,fl_progressive,h_640,q_auto,w_640/https://dev-to-uploads.s3.amazonaws.com/uploads/user/profile_image/1055555/99c3a97d-b160-4d6d-96c1-1007d266c024.jpeg",
41-
"profile_image_90": "https://res.cloudinary.com/practicaldev/image/fetch/s--K8yLyVye--/c_fill,f_auto,fl_progressive,h_90,q_auto,w_90/https://dev-to-uploads.s3.amazonaws.com/uploads/user/profile_image/1055555/99c3a97d-b160-4d6d-96c1-1007d266c024.jpeg"
40+
"profile_image": "https://media.dev.to/cdn-cgi/image/width=640,height=640,fit=cover,gravity=auto,format=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1055555%2F4d0bf90a-bec7-4228-b1ca-d663fa40adeb.jpeg",
41+
"profile_image_90": "https://media.dev.to/cdn-cgi/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1055555%2F4d0bf90a-bec7-4228-b1ca-d663fa40adeb.jpeg"
4242
}
43-
}
43+
}

0 commit comments

Comments
 (0)