Skip to content

Commit 778ecb4

Browse files
committed
fix hashnode url
1 parent e8769da commit 778ecb4

File tree

2 files changed

+13
-10
lines changed

2 files changed

+13
-10
lines changed

apps/codingcatdev/scripts/podcast-hashnode.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,12 @@ for await (const file of g) {
6060
fm?.cover &&
6161
fm?.published === 'published' &&
6262
new Date(fm?.start) < new Date() &&
63-
!fm?.hasnode
63+
!fm?.hashnode
6464
) {
65-
console.log('Adding', { slug: fm?.slug, hashnode: fm?.hasnode });
65+
console.log('Adding', { slug: fm?.slug, hashnode: fm?.hashnode });
6666

6767
try {
68-
console.log('addArticle to hasnode');
68+
console.log('addArticle to hashnode');
6969

7070
// const response = await addArticle(
7171

@@ -112,15 +112,16 @@ ${content}`;
112112
// Get new devto url and update
113113
if (response.status === 200) {
114114
const json = await response.json();
115+
console.log('hashnode url', json?.data?.createPublicationStory?.post?.slug);
115116
const hashnodeSlug = json?.data?.createPublicationStory?.post?.slug;
116117

117118
if (!hashnodeSlug) {
118-
console.error('hasnode url missing');
119+
console.error('hashnode url missing');
119120
continue;
120121
}
121122

122123
if (hashnodeSlug) {
123-
console.log('Updating', file, { hashnode: json.url });
124+
console.log('Updating', file, { hashnode: hashnodeSlug });
124125
const newMdFile = matter.stringify(content, {
125126
...data,
126127
hashnode: hashnodeSlug

apps/codingcatdev/scripts/post-hashnode.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,16 +56,17 @@ for await (const file of g) {
5656
// TODO: We might need to add a check on cononical if this page is already in dev.to
5757
if (
5858
fm?.slug &&
59+
fm.slug === 'angular-17-cypress-testing' &&
5960
fm?.title &&
6061
fm?.cover &&
6162
fm?.published === 'published' &&
6263
new Date(fm?.start) < new Date() &&
63-
!fm?.hasnode
64+
!fm?.hashnode
6465
) {
65-
console.log('Adding', { slug: fm?.slug, hashnode: fm?.hasnode });
66+
console.log('Adding', { slug: fm?.slug, hashnode: fm?.hashnode });
6667

6768
try {
68-
console.log('addArticle to hasnode');
69+
console.log('addArticle to hashnode');
6970

7071
// const response = await addArticle(
7172

@@ -107,15 +108,16 @@ ${content}`;
107108
// Get new devto url and update
108109
if (response.status === 200) {
109110
const json = await response.json();
111+
console.log('hashnode url', json?.data?.createPublicationStory?.post?.slug);
110112
const hashnodeSlug = json?.data?.createPublicationStory?.post?.slug;
111113

112114
if (!hashnodeSlug) {
113-
console.error('hasnode url missing');
115+
console.error('hashnode url missing');
114116
continue;
115117
}
116118

117119
if (hashnodeSlug) {
118-
console.log('Updating', file, { hashnode: json.url });
120+
console.log('Updating', file, { hashnode: hashnodeSlug });
119121
const newMdFile = matter.stringify(content, {
120122
...data,
121123
hashnode: hashnodeSlug

0 commit comments

Comments
 (0)