Skip to content

Commit

Permalink
Merge pull request #243 from jaredwray/updating-readme-file-to-move-t…
Browse files Browse the repository at this point in the history
…o-site-with-onPrepare

updating readme file to move to site with onPrepare
  • Loading branch information
jaredwray committed Feb 4, 2024
2 parents 59cf5a9 + 906ab95 commit 28b2c37
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 4 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ blog_output
blog_public
dist
test_output
site/README.md

# IDEs
.idea/
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
![Writr](site/logo.png)
![Writr](site/logo.svg)

---

Expand Down
Binary file removed logo.png
Binary file not shown.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@
"handlebars"
],
"scripts": {
"clean": "rimraf ./dist ./coverage ./node_modules ./package-lock.json ./yarn.lock",
"clean": "rimraf ./dist ./coverage ./node_modules ./package-lock.json ./yarn.lock ./site/README.md",
"build": "rimraf ./dist && tsc",
"test": "xo --fix && vitest run --coverage",
"serve": "node bin/writr.mjs serve -s ./site -o ./dist/site-output",
"serve": "rimraf ./site/README.md && node bin/writr.mjs serve -s ./site -o ./dist/site-output",
"prepare": "yarn run build"
},
"bin": {
Expand Down
15 changes: 14 additions & 1 deletion site/writr.config.cjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,20 @@
const fs = require('fs-extra');
const path = require('path');
const process = require('node:process');

module.exports.options = {
templatePath: './template',
githubPath: 'jaredwray/writr',
siteTitle: 'Writr',
siteDescription: 'Beautiful Website for Your Projects',
siteUrl: 'https://writr.org',
};
};

module.exports.onPrepare = async (config) => {
const readmePath = path.join(process.cwd(), './README.md');
const readmeSitePath = path.join(config.sitePath, 'README.md');
const readme = await fs.readFile(readmePath, 'utf8');
const updatedReadme = readme.replace('![Writr](site/logo.svg)','');
console.log('writing updated readme to ', readmeSitePath);
await fs.writeFile(readmeSitePath, updatedReadme);
}

0 comments on commit 28b2c37

Please sign in to comment.