Skip to content

Commit fcacf17

Browse files
authored
Merge pull request #58 from WebDevStudios/feature/WDSBT-241-Design-System-Cards
WDSBT-241 - Add cards pattern category and fixes to the version updat…
2 parents 9a32ab6 + 390b287 commit fcacf17

File tree

7 files changed

+47
-23
lines changed

7 files changed

+47
-23
lines changed

.nvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v22.16.0
1+
v22.17.1

inc/hooks/register-block-pattern-categories.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,13 @@ function register_custom_block_pattern_categories() {
4040
'description' => __( 'A collection of template patterns designed for WDS BT.', 'wdsbt' ),
4141
)
4242
);
43+
register_block_pattern_category(
44+
'cards',
45+
array(
46+
'label' => __( 'Cards', 'wdsbt' ),
47+
'description' => __( 'A collection of card patterns designed for WDS BT.', 'wdsbt' ),
48+
)
49+
);
4350

4451
// Remove default patterns.
4552
remove_theme_support( 'core-block-patterns' );

lefthook.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ pre-commit:
4848
echo "$CONFLICT_FILES"
4949
exit 1
5050
fi
51-
stage: false
5251
5352
exit-status:
5453
run: echo "✅ All pre-commit checks passed!"

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"url": "https://github.com/WebDevStudios/wds-bt/issues"
1919
},
2020
"engines": {
21-
"node": ">=20.0.0",
21+
"node": ">=22.0.0",
2222
"npm": ">=10"
2323
},
2424
"dependencies": {

readme.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Contributors: webdevstudios, khleomix, bgardner
33
Requires at least: 6.4
44
Tested up to: 6.4
55
Requires PHP: 8.2
6-
Stable tag: 0.1.0
6+
Stable tag: 1.1.0
77
License: GPLv3
88
License URI: https://www.gnu.org/licenses/gpl-3.0.html
99

updateVersion.js

Lines changed: 36 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ if (!version) {
88
process.exit(1);
99
}
1010

11-
const updateJsonFile = (filePath) => {
11+
const updateJsonFile = (filePath, label = filePath) => {
1212
if (!fs.existsSync(filePath)) {
1313
return;
1414
}
@@ -17,7 +17,7 @@ const updateJsonFile = (filePath) => {
1717

1818
if (jsonData.version === version) {
1919
console.log(
20-
`No update needed for ${filePath} (already version ${version}).`
20+
`No update needed for ${label} (already version ${version}).`
2121
);
2222
return;
2323
}
@@ -28,36 +28,54 @@ const updateJsonFile = (filePath) => {
2828
JSON.stringify(jsonData, null, 2) + '\n',
2929
'utf8'
3030
);
31-
console.log(`Updated version in ${filePath} to ${version}`);
31+
console.log(`Updated version in ${label} to ${version}`);
3232
};
3333

34-
const updateTextFile = (filePath, regex, replacement) => {
34+
const updateTextFile = (filePath, regex, replacement, label = filePath) => {
3535
if (!fs.existsSync(filePath)) {
3636
return;
3737
}
3838

3939
let fileContent = fs.readFileSync(filePath, 'utf8');
40+
const match = fileContent.match(regex);
41+
42+
if (match) {
43+
const currentVersion = match[2];
44+
if (currentVersion === version) {
45+
console.log(
46+
`No update needed for ${label} (already version ${version}).`
47+
);
48+
return;
49+
}
4050

41-
if (regex.test(fileContent)) {
4251
fileContent = fileContent.replace(regex, replacement);
4352
fs.writeFileSync(filePath, fileContent, 'utf8');
44-
console.log(`Updated version in ${filePath} to ${version}`);
53+
console.log(`Updated version in ${label} to ${version}`);
4554
} else {
46-
console.warn(
47-
`Version pattern not found in ${filePath}, skipping update.`
48-
);
55+
console.warn(`Version pattern not found in ${label}, skipping update.`);
4956
}
5057
};
5158

52-
// Update version in style.css
53-
updateTextFile('./style.css', /(Version:\s*)([^\n]+)/, `$1${version}`);
54-
55-
// Update version in README.md
56-
updateTextFile('./README.md', /(## Version:\s*)([^\n]+)/, `$1${version}`);
57-
58-
// Update JSON-based files
59-
updateJsonFile('./package.json');
60-
updateJsonFile('./composer.json');
59+
// Update all relevant files
60+
updateTextFile(
61+
'./style.css',
62+
/(Version:\s*)([^\n]+)/,
63+
`$1${version}`,
64+
'style.css'
65+
);
66+
updateTextFile(
67+
'./README.md',
68+
/(## Version:\s*)([^\n]+)/,
69+
`$1${version}`,
70+
'README.md'
71+
);
72+
updateTextFile(
73+
'./readme.txt',
74+
/(Stable tag:\s*)([^\n]+)/,
75+
`$1${version}`,
76+
'readme.txt'
77+
);
78+
updateJsonFile('./package.json', 'package.json');
6179

6280
console.log('Version update process completed.');
6381
/* eslint-enable no-console */

0 commit comments

Comments
 (0)