@jsenv/filesystem 4.13.0 → 4.13.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsenv/filesystem",
3
- "version": "4.13.0",
3
+ "version": "4.13.1",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -43,6 +43,7 @@ export const writeDirectorySync = (
43
43
  .slice(0, -1),
44
44
  ),
45
45
  );
46
+ destinationStats = null;
46
47
  } else {
47
48
  throw new Error(
48
49
  `cannot write directory at ${destinationPath} because there is a file at ${urlToFileSystemPath(
@@ -62,10 +63,14 @@ export const writeDirectorySync = (
62
63
  }
63
64
  throw new Error(`directory already exists at ${destinationPath}`);
64
65
  }
65
- const destinationType = statsToType(destinationStats);
66
- throw new Error(
67
- `cannot write directory at ${destinationPath} because there is a ${destinationType}`,
68
- );
66
+ if (force) {
67
+ unlinkSync(destinationPath);
68
+ } else {
69
+ const destinationType = statsToType(destinationStats);
70
+ throw new Error(
71
+ `cannot write directory at ${destinationPath} because there is a ${destinationType}`,
72
+ );
73
+ }
69
74
  }
70
75
 
71
76
  try {