sdc-build-wp 5.3.8 → 5.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -47,17 +47,22 @@ export default class CacheComponent extends BaseComponent {
47
47
 
48
48
  async ensureGitignore() {
49
49
  const gitignorePath = path.join(this.project.path, '.gitignore');
50
- const cacheIgnoreEntry = `${path.basename(this.project.sdcDir)}/${path.basename(this.cacheDir)}/`;
50
+ const cacheIgnoreEntry = `${path.basename(this.project.sdcDir)}/${path.basename(this.cacheDir)}`;
51
51
 
52
52
  try {
53
53
  let gitignoreContent = '';
54
54
  let gitignoreExists = false;
55
55
 
56
56
  try {
57
- gitignoreContent = await fs.readFile(gitignorePath, 'utf8');
57
+ gitignoreContent = await fs.readFile(gitignorePath, 'utf8'); // without trailing slash
58
58
  gitignoreExists = true;
59
59
  } catch (error) {
60
- // .gitignore doesn't exist, we'll create it
60
+ try {
61
+ gitignoreContent = await fs.readFile(`${gitignorePath}/`, 'utf8'); // with trailing slash
62
+ gitignoreExists = true;
63
+ } catch (error) {
64
+ // .gitignore doesn't exist, we'll create it
65
+ }
61
66
  }
62
67
 
63
68
  const lines = gitignoreContent.split('\n');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sdc-build-wp",
3
- "version": "5.3.8",
3
+ "version": "5.4.1",
4
4
  "description": "Custom WordPress build process.",
5
5
  "engines": {
6
6
  "node": ">=22"