@stacksjs/storage 0.58.28 → 0.58.43

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.
Files changed (2) hide show
  1. package/dist/index.js +29 -11
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -75,9 +75,15 @@ async function writeTextFile(file) {
75
75
  function isFile(path2) {
76
76
  return fs.existsSync(path2);
77
77
  }
78
+ function doesExist(path2) {
79
+ return !isFile(path2) || !isFolder(path2);
80
+ }
81
+ function doesNotExist(path2) {
82
+ return !isFile(path2) && !isFolder(path2);
83
+ }
78
84
  function hasFiles(folder) {
79
85
  try {
80
- return fs.default.readdirSync(folder).length > 0;
86
+ return fs.readdirSync(folder).length > 0;
81
87
  } catch (err) {
82
88
  return false;
83
89
  }
@@ -142,7 +148,7 @@ var files = {
142
148
  };
143
149
  // src/folders.ts
144
150
  import {join as join3} from "@stacksjs/path";
145
- function isFolder(path3) {
151
+ function isFolder2(path3) {
146
152
  try {
147
153
  return fs.statSync(path3).isDirectory();
148
154
  } catch {
@@ -150,10 +156,10 @@ function isFolder(path3) {
150
156
  }
151
157
  }
152
158
  function isDirectory(path3) {
153
- return isFolder(path3);
159
+ return isFolder2(path3);
154
160
  }
155
161
  function isDir(path3) {
156
- return isFolder(path3);
162
+ return isFolder2(path3);
157
163
  }
158
164
  function doesFolderExist(path3) {
159
165
  return fs.existsSync(path3);
@@ -174,7 +180,7 @@ function getFolders(dir) {
174
180
  });
175
181
  }
176
182
  var folders = {
177
- isFolder,
183
+ isFolder: isFolder2,
178
184
  doesFolderExist,
179
185
  createFolder: createFolder2,
180
186
  getFolders
@@ -226,7 +232,7 @@ function updateConfigFile(filePath, newConfig) {
226
232
  }
227
233
  });
228
234
  }
229
- var __dirname = "/home/runner/work/stacks/stacks/storage/framework/core/storage/src";
235
+ var __dirname = "/Users/chrisbreuer/Code/stacks/storage/framework/core/storage/src";
230
236
  var _dirname = typeof __dirname !== "undefined" ? __dirname : dirname2(fileURLToPath(import.meta.url));
231
237
  var helpers = {
232
238
  _dirname,
@@ -274,7 +280,7 @@ import {italic, log} from "@stacksjs/cli";
274
280
  function deleteFolder(path6) {
275
281
  return new Promise((resolve, reject) => {
276
282
  try {
277
- if (isFolder(path6)) {
283
+ if (isFolder2(path6)) {
278
284
  fs.rmSync(path6, { recursive: true, force: true });
279
285
  return resolve(ok(`Deleted ${path6}`));
280
286
  }
@@ -323,7 +329,7 @@ async function deleteEmptyFolders(dir) {
323
329
  const files3 = fs.readdirSync(dir);
324
330
  for (const file of files3) {
325
331
  const p3 = join(dir, file);
326
- if (isFolder(p3)) {
332
+ if (isFolder2(p3)) {
327
333
  if (fs.readdirSync(p3).length === 0)
328
334
  fs.rmSync(p3, { recursive: true, force: true });
329
335
  else
@@ -365,7 +371,7 @@ async function deleteGlob(path6) {
365
371
  async function del(path6) {
366
372
  if (isFile(path6))
367
373
  return await deleteFile(path6);
368
- if (isFolder(path6))
374
+ if (isFolder2(path6))
369
375
  return await deleteFolder(path6);
370
376
  if (path6.includes("*"))
371
377
  return await deleteGlob(path6);
@@ -494,7 +500,7 @@ __export(exports_storage, {
494
500
  },
495
501
  isFolder: () => {
496
502
  {
497
- return isFolder;
503
+ return isFolder2;
498
504
  }
499
505
  },
500
506
  isFile: () => {
@@ -592,11 +598,21 @@ __export(exports_storage, {
592
598
  return exists;
593
599
  }
594
600
  },
601
+ doesNotExist: () => {
602
+ {
603
+ return doesNotExist;
604
+ }
605
+ },
595
606
  doesFolderExist: () => {
596
607
  {
597
608
  return doesFolderExist;
598
609
  }
599
610
  },
611
+ doesExist: () => {
612
+ {
613
+ return doesExist;
614
+ }
615
+ },
600
616
  deleteGlob: () => {
601
617
  {
602
618
  return deleteGlob;
@@ -753,7 +769,7 @@ export {
753
769
  readJsonFile,
754
770
  put,
755
771
  mkdirSync,
756
- isFolder,
772
+ isFolder2 as isFolder,
757
773
  isFile,
758
774
  isDirectoryEmpty,
759
775
  isDirectory,
@@ -778,7 +794,9 @@ export {
778
794
  files,
779
795
  existsSync,
780
796
  exists,
797
+ doesNotExist,
781
798
  doesFolderExist,
799
+ doesExist,
782
800
  deleteGlob,
783
801
  deleteFolder,
784
802
  deleteFiles,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/storage",
3
3
  "type": "module",
4
- "version": "0.58.28",
4
+ "version": "0.58.43",
5
5
  "description": "The Stacks file system.",
6
6
  "author": "Chris Breuer",
7
7
  "license": "MIT",