Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit d4d8417

Browse files
Merge pull request #123 from Mathys-Gasnier/main
Adding scripts to check and consolidate snippets & fix the workflow failing if snippets were already consolidated.
2 parents 750abfe + 32d6a1f commit d4d8417

File tree

4 files changed

+30
-3
lines changed

4 files changed

+30
-3
lines changed

‎.github/workflows/consolidate-snippets.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,5 @@ jobs:
3535
git config --global user.email "action@github.com"
3636
git add public/consolidated/*
3737
git add public/icons/*
38-
git commit -m "Update consolidated snippets"
38+
git diff-index --quiet HEAD || git commit -m "Update consolidated snippets"
3939
git push

‎CONTRIBUTING.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,19 @@ console.log(formatDate(new Date())); // Output: '2024年12月10日'
7979
- Specify the language after the first set of backticks for syntax highlighting.
8080

8181
6. **Test your snippet:**
82-
- Ensure your code runs as expected.
82+
- Ensure your code runs as expected. \
83+
To test that your snippets are formatted correctly use the `snippets:check` script:
84+
```
85+
$ npm run snippets:check
86+
```
87+
It will return nothing if they are well formatted, otherwise it will tell you what the error is.
88+
89+
---
90+
To preview the snippets, you need to consolidate them, use the `snippets:consolidate` script:
91+
```
92+
$ npm run snippets:consolidate
93+
```
94+
It will update the snippets in the `/public` folder, making them available to the frontend.
8395
8496
Expected file structure:
8597

‎README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,19 @@ Expected file structure:
8080

8181
> Please do **NOT** add or edit anything in `/public` folder. It will be used for consolidating snippets.
8282
83+
To test that your snippets are formatted correctly use the `snippets:check` script:
84+
```
85+
$ npm run snippets:check
86+
```
87+
It will return nothing if they are well formatted, otherwise it will tell you what the error is.
88+
89+
---
90+
To preview the snippets, you need to consolidate them, use the `snippets:consolidate` script:
91+
```
92+
$ npm run snippets:consolidate
93+
```
94+
It will update the snippets in the `/public` folder, making them available to the frontend.
95+
8396
For more details about adding new categories or programming languages, check out the [CONTRIBUTING.md](/CONTRIBUTING.md) file.
8497

8598
## Guidelines for Contributions

‎package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
1010
"format": "prettier --write .",
1111
"format:check": "prettier --check .",
1212
"preview": "vite preview",
13-
"prepare": "husky"
13+
"prepare": "husky",
14+
"snippets:check": "node ./utils/checkSnippetFormatting.js",
15+
"snippets:consolidate": "node ./utils/consolidateSnippets.js"
1416
},
1517
"dependencies": {
1618
"framer-motion": "^11.15.0",

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /