feat: backup old now stuff before clearing

This commit is contained in:
Ayo Ayco 2025-01-04 23:27:24 +01:00
parent 2a88744047
commit 44acb5bb78
6 changed files with 56 additions and 14 deletions

View file

@ -1,5 +1,5 @@
import { fileURLToPath } from 'node:url'
import { readFileSync, writeFileSync } from 'node:fs'
import { copyFileSync, readFileSync, writeFileSync } from 'node:fs'
import { consola } from 'consola'
import { colorize } from 'consola/utils'
import { dirname, resolve } from 'pathe'
@ -8,8 +8,7 @@ import now from '../src/constants/now.json'
export default async function newNow(): Promise<void> {
consola.box('Preparing for a new Now page!')
const datetime = now.publishDate
const postFileName = `${datetime}.astro`
const postFileName = `${now.publishDate}.astro`
consola.start(`Copying current now page to ${colorize('blue', postFileName)}`)
try {
@ -40,9 +39,15 @@ export default async function newNow(): Promise<void> {
/**
* clear now.md
*/
// consola.start('Clearing now.md file...')
// writeFileSync(nowMdPath, '')
// consola.success('now.md cleared')
consola.start('Clearing now.md file...')
const destinationMd = resolve(
__dirname,
'../src/constants/bkup',
`${now.publishDate}.md`
)
copyFileSync(nowMdPath, destinationMd)
writeFileSync(nowMdPath, '')
consola.success('now.md cleared')
/**
* clear now.ts
@ -54,6 +59,14 @@ export default async function newNow(): Promise<void> {
) // Object.assign({}, now)
newNowObj.publishDate = new Date().toISOString().split('T')[0] ?? ''
const nowJsonPath = resolve(__dirname, '../src/constants/now.json')
// backup file
const destinationJson = resolve(
__dirname,
'../src/constants/bkup',
`${now.publishDate}.json`
)
copyFileSync(nowJsonPath, destinationJson)
writeFileSync(nowJsonPath, JSON.stringify(newNowObj, null, '\t'))
consola.success('You may now update your Now content and props.\n')

View file

@ -0,0 +1,7 @@
{
"title": "Celebrating the year's end 🎉",
"description": "Wrapping up 2024 and preparing for the next year...",
"publishDate": "2024-12-25",
"publishedOn": "the Christmas Day of 2024",
"publishState": "while on the way home after a vacation in Germany; now onboard a train from Eindhoven to Amsterdam."
}

View file

@ -0,0 +1,16 @@
Christmas holidays as started for me.
I think I finished all needed stuff for work. Also messaged people online for a final happy holiday greetings of the year. Will go offline til January and figure out my rhythm for next year.
Reading Radical Candor by Kim Scott. Feels like a lot of these kind of books are a rehash of concepts in "The 7 Habits of Highly Effective People" and "How to Win Friends and Influence People" -- I recommend those first before this one! I like that “humility” was also given a spotlight; there's not enough attention to the effectivity/productivity of acknowledging you can be wrong and welcoming feedback (both praise & criticism). Hard to capture in a paragraph though -- ask me to elaborate if you want and when given the chance!
Also reinforced the idea that 'writing a story' in my head about people, with prejudice, is unproductive. Assumptions are never good; always verify before forming judgments and/or giving feedbacks.
Spent some time in Aachen, Germany with the fam. Walked around the Christmas Market there. Food trip galore, sat at cafes, read books, bought stuff. :)
But the highlight is going to Monschau on a day trip. Kahel buit a small snowman.
Also, realized down-time travel time is infinitely more productive when listening to Audio books. It is especially effective for me for books I have already finished and just need a review. So I am glad I have a copy of the 7-habits book ready -- I finished that one years ago, listening to the audio is mostly just a review.
Stopping now before this becomes a long blog about books; seems I need to write that separately...

View file

@ -1,7 +1,7 @@
{
"title": "Yes, New year!",
"description": "Oh what a feeling...",
"title": "",
"description": "",
"publishDate": "2025-01-04",
"publishedOn": "the fourth day of the first month of 2025",
"publishState": "after a weekend coding session"
"publishedOn": "",
"publishState": ""
}

View file

@ -1 +0,0 @@
something happened

View file

@ -2,12 +2,19 @@
import Layout from '../../../../layouts/Layout.astro'
import Footer from '../../../../components/Footer.astro'
const title = `Yessss`
const description = `Closing the year and planning for the next`
const title = `Celebrating the year's end 🎉`
const description = `Wrapping up 2024 and preparing for the next year...`
const publishedOn = `the Christmas Day of 2024`
const publishDate = `2024-12-25`
const publishState = `while on the way home after a vacation in Germany; now onboard a train from Eindhoven to Amsterdam.`
const content = `<p>something happened</p>`
const content = `<p>Christmas holidays as started for me.</p>
<p>I think I finished all needed stuff for work. Also messaged people online for a final happy holiday greetings of the year. Will go offline til January and figure out my rhythm for next year.</p>
<p>Reading Radical Candor by Kim Scott. Feels like a lot of these kind of books are a rehash of concepts in "The 7 Habits of Highly Effective People" and "How to Win Friends and Influence People" -- I recommend those first before this one! I like that “humility” was also given a spotlight; there's not enough attention to the effectivity/productivity of acknowledging you can be wrong and welcoming feedback (both praise &#x26; criticism). Hard to capture in a paragraph though -- ask me to elaborate if you want and when given the chance!</p>
<p>Also reinforced the idea that 'writing a story' in my head about people, with prejudice, is unproductive. Assumptions are never good; always verify before forming judgments and/or giving feedbacks.</p>
<p>Spent some time in Aachen, Germany with the fam. Walked around the Christmas Market there. Food trip galore, sat at cafes, read books, bought stuff. :)</p>
<p>But the highlight is going to Monschau on a day trip. Kahel buit a small snowman.</p>
<p>Also, realized down-time travel time is infinitely more productive when listening to Audio books. It is especially effective for me for books I have already finished and just need a review. So I am glad I have a copy of the 7-habits book ready -- I finished that one years ago, listening to the audio is mostly just a review.</p>
<p>Stopping now before this becomes a long blog about books; seems I need to write that separately...</p>`
---
<Layout title={title} description={description}>