@stryke/fs 0.10.0 â 0.10.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/README.md +19 -17
- package/dist/write-file.cjs +3 -3
- package/dist/write-file.mjs +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -44,31 +44,33 @@ This package is part of Storm Software's **đŠī¸ Stryke** monorepo. Stryke pac
|
|
|
44
44
|
|
|
45
45
|
<!-- END header -->
|
|
46
46
|
|
|
47
|
-
# Stryke - File System
|
|
47
|
+
# Stryke - File System Helpers
|
|
48
48
|
|
|
49
49
|
A package containing various file system utilities that expand the functionality
|
|
50
|
-
of NodeJs's `fs` module. This package is intended to be used instead of
|
|
51
|
-
modern file system libraries such as `fs-extra` or `fs-jetpack` as it
|
|
52
|
-
more modern and functional approach to working with the file system.
|
|
50
|
+
of NodeJs's built-in `fs` module. This package is intended to be used instead of
|
|
51
|
+
other modern file system libraries such as `fs-extra` or `fs-jetpack` as it
|
|
52
|
+
provides a more modern and functional approach to working with the file system.
|
|
53
53
|
|
|
54
54
|
<!-- START doctoc -->
|
|
55
55
|
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
|
|
56
56
|
|
|
57
57
|
## Table of Contents
|
|
58
58
|
|
|
59
|
-
- [
|
|
60
|
-
- [
|
|
61
|
-
- [
|
|
62
|
-
- [
|
|
63
|
-
- [
|
|
64
|
-
|
|
65
|
-
- [
|
|
66
|
-
- [
|
|
67
|
-
- [
|
|
68
|
-
- [
|
|
69
|
-
- [
|
|
70
|
-
- [
|
|
71
|
-
- [
|
|
59
|
+
- [Stryke - File System Helpers](#stryke---file-system-helpers)
|
|
60
|
+
- [Table of Contents](#table-of-contents)
|
|
61
|
+
- [Installing](#installing)
|
|
62
|
+
- [Reduced Package Size](#reduced-package-size)
|
|
63
|
+
- [Development](#development)
|
|
64
|
+
- [Building](#building)
|
|
65
|
+
- [Running unit tests](#running-unit-tests)
|
|
66
|
+
- [Linting](#linting)
|
|
67
|
+
- [Storm Workspaces](#storm-workspaces)
|
|
68
|
+
- [Roadmap](#roadmap)
|
|
69
|
+
- [Support](#support)
|
|
70
|
+
- [License](#license)
|
|
71
|
+
- [Changelog](#changelog)
|
|
72
|
+
- [Contributing](#contributing)
|
|
73
|
+
- [Contributors](#contributors)
|
|
72
74
|
|
|
73
75
|
<!-- END doctoc -->
|
|
74
76
|
|
package/dist/write-file.cjs
CHANGED
|
@@ -7,21 +7,21 @@ exports.writeFileSync = exports.writeFile = void 0;
|
|
|
7
7
|
exports.writeJsonFile = writeJsonFile;
|
|
8
8
|
exports.writeJsonFileSync = writeJsonFileSync;
|
|
9
9
|
var _stormJson = require("@stryke/json/storm-json");
|
|
10
|
+
var _correctPath = require("@stryke/path/correct-path");
|
|
10
11
|
var _exists = require("@stryke/path/exists");
|
|
11
12
|
var _filePathFns = require("@stryke/path/file-path-fns");
|
|
12
|
-
var _normalizePath = require("@stryke/path/normalize-path");
|
|
13
13
|
var _nodeFs = require("node:fs");
|
|
14
14
|
var _promises = require("node:fs/promises");
|
|
15
15
|
var _helpers = require("./helpers.cjs");
|
|
16
16
|
const writeFileSync = (r, o, t) => {
|
|
17
17
|
if (!r) throw new Error("No file path provided to write data");
|
|
18
|
-
const e = (0, _filePathFns.findFilePath)((0,
|
|
18
|
+
const e = (0, _filePathFns.findFilePath)((0, _correctPath.correctPath)(r));
|
|
19
19
|
if (!(0, _exists.existsSync)(e)) if (t?.createDirectory !== !1) (0, _helpers.createDirectorySync)(e);else throw new Error(`Directory ${e} does not exist`);
|
|
20
20
|
(0, _nodeFs.writeFileSync)(r, o || "", t);
|
|
21
21
|
},
|
|
22
22
|
writeFile = async (r, o, t) => {
|
|
23
23
|
if (!r) throw new Error("No file path provided to read data");
|
|
24
|
-
const e = (0, _filePathFns.findFilePath)((0,
|
|
24
|
+
const e = (0, _filePathFns.findFilePath)((0, _correctPath.correctPath)(r));
|
|
25
25
|
if (!(0, _exists.existsSync)(e)) if (t?.createDirectory !== !1) await (0, _helpers.createDirectory)(e);else throw new Error(`Directory ${e} does not exist`);
|
|
26
26
|
return (0, _promises.writeFile)(r, o || "", t);
|
|
27
27
|
};
|
package/dist/write-file.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{StormJSON as i}from"@stryke/json/storm-json";import{
|
|
1
|
+
import{StormJSON as i}from"@stryke/json/storm-json";import{correctPath as n}from"@stryke/path/correct-path";import{existsSync as s}from"@stryke/path/exists";import{findFilePath as c}from"@stryke/path/file-path-fns";import{writeFileSync as p}from"node:fs";import{writeFile as d}from"node:fs/promises";import{createDirectory as a,createDirectorySync as f}from"./helpers";export const writeFileSync=(r,o,t)=>{if(!r)throw new Error("No file path provided to write data");const e=c(n(r));if(!s(e))if(t?.createDirectory!==!1)f(e);else throw new Error(`Directory ${e} does not exist`);p(r,o||"",t)},writeFile=async(r,o,t)=>{if(!r)throw new Error("No file path provided to read data");const e=c(n(r));if(!s(e))if(t?.createDirectory!==!1)await a(e);else throw new Error(`Directory ${e} does not exist`);return d(r,o||"",t)};export function writeJsonFileSync(r,o,t){const e=i.stringify(o,t);return writeFileSync(r,t?.appendNewLine?`${e}
|
|
2
2
|
`:e)}export async function writeJsonFile(r,o,t){const e=i.stringify(o);return writeFile(r,t?.appendNewLine?`${e}
|
|
3
3
|
`:e)}
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stryke/fs",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.1",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"description": "A package containing various file system utilities that expand the functionality of NodeJs's `fs` module.",
|
|
5
|
+
"description": "A package containing various file system utilities that expand the functionality of NodeJs's built-in `fs` module.",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "github",
|
|
8
8
|
"url": "https://github.com/storm-software/stryke.git",
|
|
@@ -19,9 +19,9 @@
|
|
|
19
19
|
"picomatch": "^4.0.2",
|
|
20
20
|
"semver": "7.7.1",
|
|
21
21
|
"@stryke/json": ">=0.5.0",
|
|
22
|
-
"@stryke/path": ">=0.4.
|
|
22
|
+
"@stryke/path": ">=0.4.2",
|
|
23
23
|
"@stryke/type-checks": ">=0.1.0",
|
|
24
|
-
"@stryke/types": ">=0.6.
|
|
24
|
+
"@stryke/types": ">=0.6.1"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"@types/node": "^22.13.1",
|