Skip to content

Commit

Permalink
fix hashnode url
Browse files Browse the repository at this point in the history
  • Loading branch information
codercatdev committed Dec 18, 2023
1 parent e8769da commit 778ecb4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
11 changes: 6 additions & 5 deletions apps/codingcatdev/scripts/podcast-hashnode.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,12 @@ for await (const file of g) {
fm?.cover &&
fm?.published === 'published' &&
new Date(fm?.start) < new Date() &&
!fm?.hasnode
!fm?.hashnode
) {
console.log('Adding', { slug: fm?.slug, hashnode: fm?.hasnode });
console.log('Adding', { slug: fm?.slug, hashnode: fm?.hashnode });

try {
console.log('addArticle to hasnode');
console.log('addArticle to hashnode');

// const response = await addArticle(

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

if (!hashnodeSlug) {
console.error('hasnode url missing');
console.error('hashnode url missing');
continue;
}

if (hashnodeSlug) {
console.log('Updating', file, { hashnode: json.url });
console.log('Updating', file, { hashnode: hashnodeSlug });
const newMdFile = matter.stringify(content, {
...data,
hashnode: hashnodeSlug
Expand Down
12 changes: 7 additions & 5 deletions apps/codingcatdev/scripts/post-hashnode.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,16 +56,17 @@ for await (const file of g) {
// TODO: We might need to add a check on cononical if this page is already in dev.to
if (
fm?.slug &&
fm.slug === 'angular-17-cypress-testing' &&
fm?.title &&
fm?.cover &&
fm?.published === 'published' &&
new Date(fm?.start) < new Date() &&
!fm?.hasnode
!fm?.hashnode
) {
console.log('Adding', { slug: fm?.slug, hashnode: fm?.hasnode });
console.log('Adding', { slug: fm?.slug, hashnode: fm?.hashnode });

try {
console.log('addArticle to hasnode');
console.log('addArticle to hashnode');

// const response = await addArticle(

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

if (!hashnodeSlug) {
console.error('hasnode url missing');
console.error('hashnode url missing');
continue;
}

if (hashnodeSlug) {
console.log('Updating', file, { hashnode: json.url });
console.log('Updating', file, { hashnode: hashnodeSlug });
const newMdFile = matter.stringify(content, {
...data,
hashnode: hashnodeSlug
Expand Down

1 comment on commit 778ecb4

@vercel
Copy link

@vercel vercel bot commented on 778ecb4 Dec 18, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

codingcat-dev – ./apps/codingcatdev

codingcat-dev-coding-cat-dev.vercel.app
codingcat-dev-git-main-coding-cat-dev.vercel.app
codingcat.dev

Please sign in to comment.