Skip to content
This repository was archived by the owner on Sep 24, 2024. It is now read-only.

Commit b8318f0

Browse files
authored
Merge pull request #98 from selemondev/chore/readme-github-action
chore(app): update readme table
2 parents fd7c275 + a725af4 commit b8318f0

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import fs from 'node:fs'
2+
import path from 'node:path'
3+
import process from 'node:process'
4+
5+
const packageJsonPath = path.join(__dirname, '../../packages/nuxt-ui-vue/package.json') // Adjust the path based on your project structure
6+
const readmePath = path.join(__dirname, '../../README.md')
7+
8+
// Read the package.json file
9+
fs.readFile(packageJsonPath, 'utf8', (err, packageJsonData) => {
10+
if (err) {
11+
console.error(err)
12+
process.exit(1)
13+
}
14+
15+
const packageJson = JSON.parse(packageJsonData)
16+
const newNuxtUIVueVersion = packageJson.version
17+
18+
// Read the README file
19+
fs.readFile(readmePath, 'utf8', (readmeErr, data) => {
20+
if (readmeErr) {
21+
console.error(readmeErr)
22+
process.exit(1)
23+
}
24+
25+
// Regular expression to match the table row with nuxt-ui-vue version
26+
const regex = /\| nuxt-ui\s+\| nuxt-ui-vue\s+\|\s+\| [^|]*\s+\| [^|]*\s+\|/
27+
28+
// Create the replacement table row with updated nuxt-ui-vue version
29+
const newTableRow = `| nuxt-ui | nuxt-ui-vue |\n|------------------|------------------|\n| v2.7.0 | v${newNuxtUIVueVersion} |`
30+
31+
// Replace the old table row with the new one
32+
const updatedData = data.replace(regex, newTableRow)
33+
34+
// Write the updated content back to the README file
35+
fs.writeFile(readmePath, updatedData, 'utf8', (writeErr) => {
36+
if (writeErr) {
37+
console.error(writeErr)
38+
process.exit(1)
39+
}
40+
41+
// eslint-disable-next-line no-console
42+
console.log('README table updated successfully.')
43+
})
44+
})
45+
})

0 commit comments

Comments
 (0)