Skip to content

Commit

Permalink
ci(cli): add images path in new learn content
Browse files Browse the repository at this point in the history
  • Loading branch information
Barbapapazes committed Feb 25, 2024
1 parent 52e3027 commit 175c89a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
10 changes: 5 additions & 5 deletions bin/commands/generate/content.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,15 @@ export const content = defineCommand({
const learnTemplatePath = getLearnTemplatePath()
const template = readFileSync(learnTemplatePath, 'utf-8')

const content = template.replace('learn_title', title).replaceAll('learn_date', date).replace('learn_category', category)

const path = join(learnPath, filename)
writeContent(content, path)

const learnImages = getLearnImagesPath()
const imagesPath = join(learnImages, filename.replace('.md', ''))
generateImageFolder(imagesPath)

const content = template.replace('learn_title', title).replaceAll('learn_date', date).replace('learn_category', category).replace('images_path', imagesPath.split('/public').pop() || '')

const path = join(learnPath, filename)
writeContent(content, path)

consola.success(`Successfully generated at:\nContent: ${path}\nImages: ${imagesPath}`)
}
},
Expand Down
6 changes: 3 additions & 3 deletions content/learn/articles/.template.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ publishedAt: learn_date
modifiedAt: learn_date
---

Checklist:

- [ ] Packages must match the package filename
<!--
Images Path: images_path
-->

0 comments on commit 175c89a

Please sign in to comment.