@stacksjs/storage 0.51.0 → 0.52.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 +1 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.mjs +7 -2
- package/package.json +17 -17
package/README.md
CHANGED
|
@@ -53,7 +53,7 @@ pnpm test
|
|
|
53
53
|
|
|
54
54
|
Please see our [releases](https://github.com/stacksjs/stacks/releases) page for more information on what has changed recently.
|
|
55
55
|
|
|
56
|
-
##
|
|
56
|
+
## 🚜 Contributing
|
|
57
57
|
|
|
58
58
|
Please review the [Contributing Guide](https://github.com/stacksjs/contributing) for details.
|
|
59
59
|
|
package/dist/index.d.ts
CHANGED
|
@@ -4,6 +4,10 @@ export declare const _dirname: any;
|
|
|
4
4
|
* Reads a JSON file and returns the parsed data.
|
|
5
5
|
*/
|
|
6
6
|
export declare function readJsonFile(name: string, cwd?: string): Promise<JsonFile>;
|
|
7
|
+
/**
|
|
8
|
+
* Reads a package.json file and returns the parsed data.
|
|
9
|
+
*/
|
|
10
|
+
export declare function readPackageJson(name: string, cwd?: string): Promise<PackageJson>;
|
|
7
11
|
/**
|
|
8
12
|
* Writes the given data to the specified JSON file.
|
|
9
13
|
*/
|
|
@@ -36,7 +40,7 @@ export declare function deleteFiles(dir: string, exclude?: string[]): void;
|
|
|
36
40
|
export declare function deleteEmptyFolders(dir: string): void;
|
|
37
41
|
export declare function doesFolderExist(path: string): any;
|
|
38
42
|
export declare function createFolder(dir: string): Promise<void>;
|
|
39
|
-
export declare function updateConfigFile(filePath: string, newConfig:
|
|
43
|
+
export declare function updateConfigFile(filePath: string, newConfig: Record<string, unknown>): Promise<void>;
|
|
40
44
|
export declare const filesystem: {
|
|
41
45
|
_dirname: any;
|
|
42
46
|
readJsonFile: typeof readJsonFile;
|
package/dist/index.mjs
CHANGED
|
@@ -11,6 +11,11 @@ export async function readJsonFile(name, cwd) {
|
|
|
11
11
|
const newline = detectNewline(file.data);
|
|
12
12
|
return { ...file, data, indent, newline };
|
|
13
13
|
}
|
|
14
|
+
export async function readPackageJson(name, cwd) {
|
|
15
|
+
const file = await readJsonFile(name, cwd);
|
|
16
|
+
const data = file.data;
|
|
17
|
+
return data;
|
|
18
|
+
}
|
|
14
19
|
export async function writeJsonFile(file) {
|
|
15
20
|
let json = JSON.stringify(file.data, void 0, file.indent);
|
|
16
21
|
if (file.newline)
|
|
@@ -128,12 +133,12 @@ export function createFolder(dir) {
|
|
|
128
133
|
}
|
|
129
134
|
export function updateConfigFile(filePath, newConfig) {
|
|
130
135
|
return new Promise((resolve, reject) => {
|
|
131
|
-
|
|
136
|
+
const config = JSON.parse(fs.readFileSync(filePath, "utf8"));
|
|
132
137
|
for (const key in newConfig) {
|
|
133
138
|
config[key] = newConfig[key];
|
|
134
139
|
}
|
|
135
140
|
fs.writeFileSync(filePath, JSON.stringify(config, null, 2));
|
|
136
|
-
|
|
141
|
+
resolve();
|
|
137
142
|
});
|
|
138
143
|
}
|
|
139
144
|
export const filesystem = {
|
package/package.json
CHANGED
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stacksjs/storage",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
5
|
-
"packageManager": "pnpm@
|
|
4
|
+
"version": "0.52.1",
|
|
5
|
+
"packageManager": "pnpm@8.5.1",
|
|
6
6
|
"description": "The Stacks file system.",
|
|
7
7
|
"author": "Chris Breuer",
|
|
8
8
|
"license": "MIT",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"import": "./dist/index.mjs"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
9
15
|
"funding": "https://github.com/sponsors/chrisbbreuer",
|
|
10
16
|
"homepage": "https://github.com/stacksjs/stacks/tree/main/.stacks/core/storage#readme",
|
|
11
17
|
"repository": {
|
|
@@ -36,26 +42,20 @@
|
|
|
36
42
|
"dist",
|
|
37
43
|
"README.md"
|
|
38
44
|
],
|
|
39
|
-
"engines": {
|
|
40
|
-
"node": ">=v18.14.0",
|
|
41
|
-
"pnpm": ">=7.26.3"
|
|
42
|
-
},
|
|
43
45
|
"peerDependencies": {
|
|
44
|
-
"fs-extra": "^11.1.
|
|
45
|
-
"unstorage": "^1.0
|
|
46
|
-
"@stacksjs/arrays": "0.
|
|
47
|
-
"@stacksjs/
|
|
48
|
-
"@stacksjs/
|
|
46
|
+
"fs-extra": "^11.1.1",
|
|
47
|
+
"unstorage": "^1.6.0",
|
|
48
|
+
"@stacksjs/arrays": "0.52.1",
|
|
49
|
+
"@stacksjs/path": "0.52.1",
|
|
50
|
+
"@stacksjs/types": "0.52.1",
|
|
51
|
+
"@stacksjs/utils": "0.52.1"
|
|
49
52
|
},
|
|
50
53
|
"devDependencies": {
|
|
51
|
-
"
|
|
52
|
-
"typescript": "^4.9.5",
|
|
53
|
-
"@stacksjs/path": "0.51.0",
|
|
54
|
-
"@stacksjs/testing": "0.51.0"
|
|
54
|
+
"@stacksjs/development": "0.52.1"
|
|
55
55
|
},
|
|
56
56
|
"scripts": {
|
|
57
|
-
"build": "
|
|
58
|
-
"dev": "
|
|
57
|
+
"build": "unbuild",
|
|
58
|
+
"dev": "unbuild --stub",
|
|
59
59
|
"typecheck": "tsc --noEmit"
|
|
60
60
|
}
|
|
61
61
|
}
|