Skip to content

Commit 7e1f422

Browse files
committed
Add basic test script
1 parent 58ba601 commit 7e1f422

File tree

3 files changed

+47
-1
lines changed

3 files changed

+47
-1
lines changed

CONTRIBUTING.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Contributing
2+
3+
This project uses several helper scripts to keep the Markdown posts and front matter consistent. These scripts can modify many files across the repository.
4+
5+
Because these updates are often large-scale, test them on a separate branch before merging.
6+
7+
## Running automation scripts
8+
9+
1. Start from an up-to-date branch and create a new working branch:
10+
11+
```bash
12+
git checkout master
13+
git pull
14+
git checkout -b automation-update
15+
```
16+
17+
2. Run the automation scripts:
18+
19+
```bash
20+
./run_scripts.sh
21+
```
22+
23+
The scripts may rename files and update front matter, leading to many modified files.
24+
25+
3. Review the changes:
26+
27+
```bash
28+
git status
29+
git diff
30+
```
31+
32+
Look carefully over the diff before committing because the updates can be large.
33+
34+
4. Commit the desired changes and open a pull request.
35+
36+
Running the scripts on a clean branch helps keep your history tidy and makes code review easier.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
"uglify": "uglifyjs assets/js/vendor/jquery/jquery-3.6.0.js assets/js/plugins/jquery.fitvids.js assets/js/plugins/jquery.greedy-navigation.js assets/js/plugins/jquery.magnific-popup.js assets/js/plugins/jquery.ba-throttle-debounce.js assets/js/plugins/smooth-scroll.js assets/js/plugins/gumshoe.js assets/js/_main.js -c -m -o assets/js/main.min.js",
3131
"add-banner": "node banner.js",
3232
"watch:js": "onchange \"assets/js/**/*.js\" -e \"assets/js/main.min.js\" -- npm run build:js",
33-
"build:js": "npm run uglify && npm run add-banner"
33+
"build:js": "npm run uglify && npm run add-banner",
34+
"test": "node test.js"
3435
}
3536
}

test.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
const fs = require('fs');
2+
const assert = require('assert');
3+
4+
// Ensure README exists and is not empty
5+
assert(fs.existsSync('README.md'), 'README.md should exist');
6+
const readmeContent = fs.readFileSync('README.md', 'utf8');
7+
assert(readmeContent.trim().length > 0, 'README.md should not be empty');
8+
9+
console.log('All tests passed');

0 commit comments

Comments
 (0)